From 3736df388c4ac7805c775fe3f27e490f6b644031 Mon Sep 17 00:00:00 2001 From: Mark Paul Date: Wed, 11 Dec 2024 23:22:44 +1100 Subject: [PATCH] feature: allow the solana nft mint to support skipGettingMintMeta flag --- package.json | 2 +- src/cnft-sol-minter.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c685d10..471d1d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@itheum/sdk-mx-data-nft", - "version": "3.8.0-alpha.17", + "version": "3.8.0-alpha.18", "description": "SDK for Itheum's Data NFT Technology on MultiversX Blockchain", "main": "out/index.js", "types": "out/index.d.js", diff --git a/src/cnft-sol-minter.ts b/src/cnft-sol-minter.ts index 4b75b62..bba27bf 100644 --- a/src/cnft-sol-minter.ts +++ b/src/cnft-sol-minter.ts @@ -44,6 +44,7 @@ export class CNftSolMinter extends MinterSol { * - signatureNonce: [optional] a recent nonce from the marshal network that will be signed to produce solSignature * - solSignature: [optional] a solana signature of signatureNonce to prove creatorAddress ownership * - useThisCustomIPFSGateway: [optional] a custom ipfs gateway to use for the img and json. where the CID goes in a {insertCIDHere} placeholder e.g. https://gateway.pinata.cloud/ipfs/{insertCIDHere}. + * - skipGettingMintMeta: [optional] if we send "1", then the minting service only mints and does not return any mint meta from the cNFT leaf etc * */ async mint( @@ -64,6 +65,7 @@ export class CNftSolMinter extends MinterSol { signatureNonce?: string; solSignature?: string; useThisCustomIPFSGateway?: string; + skipGettingMintMeta?: string; } ): Promise<{ imageUrl: string; @@ -84,7 +86,8 @@ export class CNftSolMinter extends MinterSol { imgGenSet, signatureNonce, solSignature, - useThisCustomIPFSGateway + useThisCustomIPFSGateway, + skipGettingMintMeta } = options ?? {}; const tokenNameValidator = new StringValidator() @@ -221,7 +224,7 @@ export class CNftSolMinter extends MinterSol { const postHeaders = new Headers(); postHeaders.append('Content-Type', 'application/json'); - const raw = JSON.stringify({ + const payload: Record = { metadataOnIpfsUrl, tokenName, mintForSolAddr: creatorAddress, @@ -231,7 +234,13 @@ export class CNftSolMinter extends MinterSol { this.env === 'devnet' ? SolEnvChainIDEnum.devnet : SolEnvChainIDEnum.mainnet - }); + }; + + if (skipGettingMintMeta && skipGettingMintMeta === '1') { + payload['skipGettingMintMeta'] = '1'; + } + + const raw = JSON.stringify(payload); const requestOptions = { method: 'POST',