Skip to content

Commit

Permalink
docs: fix getMintedAssetId example (#2840)
Browse files Browse the repository at this point in the history
* docs: updated correct usage of `getMintedAssetId`

* chore: use `launchTestNode` in test

* chore: changeset

---------

Co-authored-by: Daniel Bate <[email protected]>
  • Loading branch information
petertonysmith94 and danielbate authored Jul 26, 2024
1 parent c99f56b commit 34de0c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .changeset/pink-walls-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

docs: fix `getMintedAssetId` example
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import type { Contract } from 'fuels';
import { bn, getMintedAssetId } from 'fuels';
import { launchTestNode } from 'fuels/test-utils';

import { DocSnippetProjectsEnum } from '../../../test/fixtures/forc-projects';
import { createAndDeployContractFromProject } from '../../utils';
import { TokenAbi__factory } from '../../../test/typegen';
import TokenAbiHex from '../../../test/typegen/contracts/TokenAbi.hex';

/**
* @group node
*/
describe(__filename, () => {
let contract: Contract;
it('should successfully execute contract call with forwarded amount', async () => {
using launched = await launchTestNode({
contractsConfigs: [{ deployer: TokenAbi__factory, bytecode: TokenAbiHex }],
});

beforeAll(async () => {
contract = await createAndDeployContractFromProject(DocSnippetProjectsEnum.TOKEN);
});
const {
contracts: [contract],
} = launched;

it('should successfully execute contract call with forwarded amount', async () => {
// #region minted-token-asset-id-2
// #import { bn, getMintedAssetId };

Expand All @@ -25,7 +27,7 @@ describe(__filename, () => {
const { waitForResult } = await contract.functions.mint_coins(subID, mintAmount).call();
const txResult = await waitForResult();

const mintedAssetId = getMintedAssetId(subID, contract.id.toB256());
const mintedAssetId = getMintedAssetId(contract.id.toB256(), subID);
// #endregion minted-token-asset-id-2

expect(mintedAssetId).toBeDefined();
Expand Down

0 comments on commit 34de0c7

Please sign in to comment.