Skip to content

Commit

Permalink
address suggestions from the code review
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Dec 24, 2024
1 parent 7a81589 commit 70ea311
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
13 changes: 9 additions & 4 deletions docs/src/content/docs/cookbook/jettons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ fun composeJettonMetadata(
description: String, // text description of the Jetton
symbol: String, // "stock ticker" symbol without the $ prefix, like USDT or SCALE
image: String, // link to the image
// There could be other attributes, see:
// There could be other data, see:
// https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md#jetton-metadata-attributes
): Cell {
let dict: map<Int as uint256, Cell> = emptyMap();
Expand All @@ -379,9 +379,8 @@ fun composeJettonMetadata(
dict.set(sha256("image"), image.asMetadataCell());
return beginCell()
.storeUint(0, 8)
.storeBit(true)
.storeRef(dict.asCell()!!)
.storeUint(0, 8) // a null byte prefix
.storeMaybeRef(dict.asCell()!!) // 1 as a single bit, then a reference
.endCell();
}
Expand All @@ -402,6 +401,12 @@ inline extends fun asMetadataCell(self: String): Cell {
}
```

:::note[Useful links:]

[Token Data Standard in TEPs](https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md#jetton-metadata-attributes)

:::

:::tip[Hey there!]

Didn't find your favorite example of Jetton usage? Have cool implementations in mind? [Contributions are welcome!](https://github.com/tact-lang/tact/issues)
Expand Down
28 changes: 20 additions & 8 deletions docs/src/content/docs/cookbook/nfts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ fun composeCollectionMetadata(
name: String, // full name
description: String, // text description of the NFT
image: String, // link to the image
// There could be other attributes, see:
// There could be other data, see:
// https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md#nft-metadata-attributes
): Cell {
let dict: map<Int as uint256, Cell> = emptyMap();
Expand All @@ -342,9 +342,8 @@ fun composeCollectionMetadata(
dict.set(sha256("image"), image.asMetadataCell());
return beginCell()
.storeUint(0, 8)
.storeBit(true)
.storeRef(dict.asCell()!!)
.storeUint(0, 8) // a null byte prefix
.storeMaybeRef(dict.asCell()!!) // 1 as a single bit, then a reference
.endCell();
}
Expand All @@ -364,6 +363,13 @@ inline extends fun asMetadataCell(self: String): Cell {
}
```

:::note[Useful links:]

[Token Data Standard in TEPs](https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md#nft-metadata-attributes)\
[Off-chain NFT metadata by GetGems](https://github.com/getgems-io/nft-contracts/blob/main/docs/metadata.md)

:::

### NFT Item {#onchain-metadata-nft-item}

```tact
Expand All @@ -372,7 +378,7 @@ fun composeItemMetadata(
name: String, // full name
description: String, // text description of the NFT
image: String, // link to the image
// There could be other attributes, see:
// There could be other data, see:
// https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md#nft-metadata-attributes
): Cell {
let dict: map<Int as uint256, Cell> = emptyMap();
Expand All @@ -381,9 +387,8 @@ fun composeItemMetadata(
dict.set(sha256("image"), image.asMetadataCell());
return beginCell()
.storeUint(0, 8)
.storeBit(true)
.storeRef(dict.asCell()!!)
.storeUint(0, 8) // a null byte prefix
.storeMaybeRef(dict.asCell()!!) // 1 as a single bit, then a reference
.endCell();
}
Expand All @@ -403,6 +408,13 @@ inline extends fun asMetadataCell(self: String): Cell {
}
```

:::note[Useful links:]

[Token Data Standard in TEPs](https://github.com/ton-blockchain/TEPs/blob/master/text/0064-token-data-standard.md#nft-metadata-attributes)\
[Off-chain NFT metadata by GetGems](https://github.com/getgems-io/nft-contracts/blob/main/docs/metadata.md)

:::

:::tip[Hey there!]

Didn't find your favorite example of a NFT communication? Have cool implementations in mind? [Contributions are welcome!](https://github.com/tact-lang/tact/issues)
Expand Down

0 comments on commit 70ea311

Please sign in to comment.