2 years ago
#54173
codename
What is the "mint" key referring to in Metaplex SDK JS's token burning function parameters?
I am trying to burn a token (that is definitely minted and exists) on the Solana network using the javascript Metaplex SDK.
Their token burning function (written at the bottom) takes in an object of this interface for a parameter:
interface IBurnTokenParams {
connection: Connection;
wallet: Wallet;
token: PublicKey;
mint: PublicKey;
amount: number | u64;
owner?: PublicKey;
// close token account after
close?: boolean;
}
But nowhere in their docs do they explain exactly what the "mint" field represents. I have tried the Token's Public Address (which I think is what the 'token' field is for), the Mint Authority Address, and the Update Address, and none of them seem to work.
Here is the function:
export const burnToken = async ({
connection,
wallet,
token,
mint,
amount,
owner,
close = true,
}: IBurnTokenParams): Promise<IBurnTokenResponse> => {
const tx = new Transaction({ feePayer: wallet.publicKey }).add(
Token.createBurnInstruction(
TOKEN_PROGRAM_ID,
mint,
token,
owner ?? wallet.publicKey,
[],
amount,
),
);
if (close) {
tx.add(
Token.createCloseAccountInstruction(
TOKEN_PROGRAM_ID,
token,
wallet.publicKey,
owner ?? wallet.publicKey,
[],
),
);
}
const txId = await sendTransaction({ connection, wallet, txs: [tx] });
return { txId };
};
javascript
solana
nft
metaplex
solana-web3js
0 Answers
Your Answer