Skip to content

Commit

Permalink
update fetchAssetMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jinglescode committed Oct 4, 2024
1 parent 733e52d commit 48d6251
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/mesh-provider/src/blockfrost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ export class BlockfrostProvider
if (status === 200 || status == 202)
return <AssetMetadata>{
...data.onchain_metadata,
fingerprint: data.fingerprint,
totalSupply: data.quantity,
mintingTxHash: data.initial_mint_tx_hash, // todo: request for `initial_mint_tx_hash`
mintCount: data.mint_or_burn_count,
};

throw parseHttpError(data);
Expand Down
5 changes: 4 additions & 1 deletion packages/mesh-provider/src/koios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ export class KoiosProvider implements IFetcher, IListener, ISubmitter {
const { data, status } = await this._axiosInstance.get(
`asset_info?_asset_policy=${policyId}&_asset_name=${assetName}`,
);

if (status === 200)
return <AssetMetadata>{
...data[0].minting_tx_metadata[721][policyId][toUTF8(assetName)],
fingerprint: data[0].fingerprint,
totalSupply: data[0].total_supply,
mintingTxHash: data[0].minting_tx_hash,
mintCount: data[0].mint_cnt,
};

throw parseHttpError(data);
Expand Down
5 changes: 5 additions & 0 deletions packages/mesh-provider/src/maestro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,15 @@ export class MaestroProvider
`assets/${policyId}${assetName}`,
);
if (status === 200) {

const data = timestampedData.data;
return <AssetMetadata>{
...data.asset_standards.cip25_metadata,
...data.asset_standards.cip68_metadata,
fingerprint: data.fingerprint,
totalSupply: data.total_supply,
mintingTxHash: data.latest_mint_tx.tx_hash,
mintCount: data.mint_tx_count,
};
}

Expand Down

0 comments on commit 48d6251

Please sign in to comment.