@metaplex-foundation/mpl-bubblegum
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -18,4 +18,8 @@ import { Context, PublicKey } from '@metaplex-foundation/umi'; | ||
}; | ||
declare type GetAssetWithProofOptions = { | ||
truncateCanopy?: boolean; | ||
}; | ||
export declare const getAssetWithProof: (context: Pick<Context, 'rpc'> & { | ||
rpc: DasApiInterface; | ||
}, assetId: PublicKey) => Promise<AssetWithProof>; | ||
}, assetId: PublicKey, options?: GetAssetWithProofOptions | undefined) => Promise<AssetWithProof>; | ||
export {}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const generated_1 = require("./generated"); | ||
const getAssetWithProof = async (context, assetId) => { | ||
const getAssetWithProof = async (context, assetId, options) => { | ||
const [rpcAsset, rpcAssetProof] = await Promise.all([ | ||
@@ -12,2 +12,8 @@ context.rpc.getAsset(assetId), | ||
]); | ||
let { proof } = rpcAssetProof; | ||
if (options?.truncateCanopy) { | ||
const merkleTreeAccount = await (0, generated_1.fetchMerkleTree)(context, rpcAssetProof.tree_id); | ||
const canopyDepth = Math.log2(merkleTreeAccount.canopy.length + 2) - 1; | ||
proof = rpcAssetProof.proof.slice(0, canopyDepth === 0 ? undefined : -canopyDepth); | ||
} | ||
const collectionString = (rpcAsset.grouping ?? []).find((group) => group.group_key === 'collection')?.group_value; | ||
@@ -41,3 +47,3 @@ const metadata = { | ||
index: rpcAssetProof.node_index - 2 ** rpcAssetProof.proof.length, | ||
proof: rpcAssetProof.proof, | ||
proof, | ||
metadata, | ||
@@ -44,0 +50,0 @@ rpcAsset, |
{ | ||
"name": "@metaplex-foundation/mpl-bubblegum", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Create and interact with compressed Metaplex NFTs", | ||
@@ -20,3 +20,3 @@ "main": "dist/src/index.js", | ||
"@metaplex-foundation/mpl-token-metadata": "3.0.0-alpha.27", | ||
"@metaplex-foundation/digital-asset-standard-api": "^1.0.0-alpha.0", | ||
"@metaplex-foundation/digital-asset-standard-api": "^1.0.4", | ||
"@metaplex-foundation/mpl-toolbox": "^0.9.0", | ||
@@ -23,0 +23,0 @@ "@noble/hashes": "^1.3.1", |
Sorry, the diff of this file is not supported yet
406339
6226