Get Asset Proof

Get a merkle proof for a compressed asset by its ID.

Overview

This is an essential method for transactions involving a compressed asset. For instance, when you need to transfer a compressed NFT you need to return the proof and tree id for the transaction to be successful.

There is additional preparation needed on the root for a transaction, you can check out transferAsset in our examples repository here to see how this is used.

Example

const url = `https://mainnet.helius-rpc.com/?api-key=<api_key>`

const getAssetProof = async () => {
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 'my-id',
      method: 'getAssetProof',
      params: {
        id: 'Bu1DEKeawy7txbnCEJE4BU3BKLXaNAKCYcHR4XhndGss'
      },
    }),
  });
  const { result } = await response.json();
  console.log("Assets Proof: ", result);
};
getAssetProof(); 

Last updated