Skip to content

Commit

Permalink
docs: improved documentation for obtaining and minting new asset
Browse files Browse the repository at this point in the history
  • Loading branch information
bolajahmad committed Jul 3, 2024
1 parent 075ef73 commit 9a24fdc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/docs/src/guide/contracts/minted-token-asset-id.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Imagine that this contract is already deployed and we are about to mint some coi

<<< @/../../docs-snippets/src/guide/contracts/minted-token-asset-id.test.ts#minted-token-asset-id-2{ts:line-numbers}

Since the asset ID depends on the contract ID, which is always dynamic (unlike the sub ID, which can be set to a fixed value), the helper `getMintedAssetId` can be used to easily obtain the asset ID for a given contract ID and sub ID.
## Obtaining the Asset ID

## `Create Asset Id`
Since the asset ID depends on the contract ID, which is always dynamic (unlike the sub ID, which can be set to a fixed value), the helper `getMintedAssetId` can be used to easily obtain the asset ID for a given contract ID and sub ID.

This is an extension of the Minted Token Asset ID, but it returns an [AssetId](https://github.com/FuelLabs/fuels-ts/blob/1fb529bf03e5751e61afac69bfbd488e05577d10/packages/interfaces/src/index.ts#L33). Under the hood, the `createAssetId` calls the `getMintedAssetId`
## Create Asset Id

A sample usage is as shown below:
The SDK provides a helper named `createAssetId` which takes the contract ID and sub ID as parameters. This helper internally calls `getMintedAssetId` and returns the Sway native parameter [AssetId](https://github.com/FuelLabs/fuels-ts/blob/1fb529bf03e5751e61afac69bfbd488e05577d10/packages/interfaces/src/index.ts#L33), ready to be used in a Sway program invocation:

<<< @/../../docs-snippets/src/guide/contracts/minted-token-asset-id.test.ts#create-asset-id-1{ts:line-numbers}

0 comments on commit 9a24fdc

Please sign in to comment.