Skip to content

Commit

Permalink
remove note + apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fhildeb committed Feb 22, 2024
1 parent 38016c0 commit 426cc13
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions digital-assets/fetch-tokenid-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ const RPC_URL = 'https://rpc.testnet.lukso.gateway.fm';
const provider = new ethers.JsonRpcProvider(RPC_URL);

// Create contract instance
const myAssetContract = new ethers.Contract(SAMPLE_LSP8_ASSET, lsp8Artifact.abi, provider);
const myAssetContract = new ethers.Contract(
SAMPLE_LSP8_ASSET,
lsp8Artifact.abi,
provider,
);

// Token ID as Bytes32 value (1)
// https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformat
const byte32TokenId = '0x0000000000000000000000000000000000000000000000000000000000000001';
const byte32TokenId =
'0x0000000000000000000000000000000000000000000000000000000000000001';

async function fetchTokenIdMetadata(tokenID: string) {
// https://docs.lukso.tech/contracts/contracts/ERC725/#supportsinterface
Expand All @@ -33,9 +38,6 @@ async function fetchTokenIdMetadata(tokenID: string) {

/**
* Get the encoded asset metadata
* Note: assets created with LSP versions below @lukso/lsp-smart-contracts@0.14.0
* lack support for retrieving token ID metadata.
*
* https://docs.lukso.tech/contracts/contracts/LSP8IdentifiableDigitalAsset/#getdatafortokenid
*/
const tokenIdMetadata = await myAssetContract.getDataForTokenId(
Expand All @@ -56,7 +58,10 @@ async function fetchTokenIdMetadata(tokenID: string) {
},
]);

console.log('Decoded Metadata: ', JSON.stringify(decodedMetadata, undefined, 2));
console.log(
'Decoded Metadata: ',
JSON.stringify(decodedMetadata, undefined, 2),
);
}

fetchTokenIdMetadata(byte32TokenId);

0 comments on commit 426cc13

Please sign in to comment.