Skip to content

Commit

Permalink
Restructure generated clients to be tree-shakable
Browse files Browse the repository at this point in the history
  • Loading branch information
limemloh committed Sep 11, 2023
1 parent 5ae5323 commit b6b56b2
Show file tree
Hide file tree
Showing 16 changed files with 830 additions and 444 deletions.
16 changes: 11 additions & 5 deletions examples/ccd-js-gen/wCCD/client-tokenMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,26 @@ const contractAddress: SDK.ContractAddress = {
/* eslint-disable import/no-unresolved */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const wCCDModule = await import('./lib/wCCD').catch((e) => {
const wCCDContractClient = await import('./lib/cis2_wCCD').catch((e) => {
/* eslint-enable import/no-unresolved */
console.error(
'\nFailed to load the generated wCCD module, did you run the `generate` script?\n'
);
throw e;
});

const parameter = '010000'; // First 2 bytes for number of tokens to query, 1 byte for the token ID.
const contract = await wCCDModule.Cis2WCCD.create(
const parameter = SDK.Parameter.fromHexString('010000'); // First 2 bytes for number of tokens to query, 1 byte for the token ID.
const contract = await wCCDContractClient.create(
grpcClient,
contractAddress
);

const responseHex = await contract.dryRun.tokenMetadata(parameter);
console.log({ responseHex });
const result = await wCCDContractClient.dryRunTokenMetadata(
contract,
new SDK.AccountAddress(
'357EYHqrmMiJBmUZTVG5FuaMq4soAhgtgz6XNEAJaXHW3NHaUf'
),
parameter
);
console.log({ result });
})();
Loading

0 comments on commit b6b56b2

Please sign in to comment.