@renec-foundation/mpl-token-metadata
Version:
MPL Token Metadata JavaScript API.
70 lines • 2.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BurnNft = exports.BurnNftArgs = void 0;
const mpl_core_1 = require("@renec-foundation/mpl-core");
const spl_token_1 = require("@solana/spl-token");
const web3_js_1 = require("@solana/web3.js");
const MetadataProgram_1 = require("../MetadataProgram");
class BurnNftArgs extends mpl_core_1.Borsh.Data {
constructor() {
super(...arguments);
this.instruction = 29;
}
}
exports.BurnNftArgs = BurnNftArgs;
BurnNftArgs.SCHEMA = BurnNftArgs.struct([
['instruction', 'u8'],
]);
class BurnNft extends mpl_core_1.Transaction {
constructor(options, params) {
super(options);
const { metadata, owner, mint, tokenAccount, masterEdition, collectionMetadata } = params;
const data = BurnNftArgs.serialize();
const keys = [
{
pubkey: metadata,
isSigner: false,
isWritable: true,
},
{
pubkey: owner,
isSigner: true,
isWritable: true,
},
{
pubkey: mint,
isSigner: false,
isWritable: true,
},
{
pubkey: tokenAccount,
isSigner: false,
isWritable: true,
},
{
pubkey: masterEdition,
isSigner: false,
isWritable: true,
},
{
pubkey: spl_token_1.TOKEN_PROGRAM_ID,
isSigner: false,
isWritable: false,
},
];
if (collectionMetadata != null) {
keys.push({
pubkey: collectionMetadata,
isSigner: false,
isWritable: true,
});
}
this.add(new web3_js_1.TransactionInstruction({
keys,
programId: MetadataProgram_1.MetadataProgram.PUBKEY,
data,
}));
}
}
exports.BurnNft = BurnNft;
//# sourceMappingURL=BurnNft.js.map