Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Is there an example of snake using the latest ton-core libraries?

I am trying to test and work with an updated version of getgems.io-snake example.

I got my flattensnake working, however for the makeSnakeCell function I run into the following trouble -

export function makeSnakeCell(data: Buffer) {
    let chunks = bufferToChunks(data, 127)
    let rootCell = beginCell()
    let curCell = rootCell

    curCell.bits.writeBuffer(chunks[0])
    for (let i = 0; i < chunks.length-1; i++) {
        let chunk = chunks[i]


        if (chunks[i+1]) {
            let nextCell = beginCell().storeBuffer(chunks[i+1])
						curCell.storeRef(nextCell)
            curCell = nextCell
        }
    }

    return rootCell.endCell()
}

The rootCell has only the first ref. I think the issue is the assignment of nextCell to curCell as builder and not as a cell. However, if I try to endCell for both curCell and nextCell and then assign it throws an error.

If someone already has an updated version that would be great!

1
1
Posted 2 years ago
Votes Newest

Answers


Yes, from my understanding, you were trying to store and put your content metadata into the NTTs.

Here is the example that you can take a reference from Tact community


export function buildOnchainMetadata(data: {
    name: string;
    description: string;
    image: string;
}): Cell {
    let dict = Dictionary.empty(
        Dictionary.Keys.BigUint(256),
        Dictionary.Values.Cell()
    );
    Object.entries(data).forEach(([key, value]) => {
        dict.set(toKey(key), makeSnakeCell(Buffer.from(value, "utf8")));
    });

    return beginCell()
        .storeInt(ONCHAIN_CONTENT_PREFIX, 8)
.storeDict(dict)
        .endCell();
}

*but I don't get why don't use let rootCell = new Cell() by the way.

  
  
Posted 2 years ago