Skip to content

Commit

Permalink
feature: allow the solana nft mint to support skipGettingMintMeta flag
Browse files Browse the repository at this point in the history
  • Loading branch information
newbreedofgeek committed Dec 11, 2024
1 parent 8c2d150 commit 3736df3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 12 additions & 3 deletions src/cnft-sol-minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -64,6 +65,7 @@ export class CNftSolMinter extends MinterSol {
signatureNonce?: string;
solSignature?: string;
useThisCustomIPFSGateway?: string;
skipGettingMintMeta?: string;
}
): Promise<{
imageUrl: string;
Expand All @@ -84,7 +86,8 @@ export class CNftSolMinter extends MinterSol {
imgGenSet,
signatureNonce,
solSignature,
useThisCustomIPFSGateway
useThisCustomIPFSGateway,
skipGettingMintMeta
} = options ?? {};

const tokenNameValidator = new StringValidator()
Expand Down Expand Up @@ -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<any, any> = {
metadataOnIpfsUrl,
tokenName,
mintForSolAddr: creatorAddress,
Expand All @@ -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',
Expand Down

0 comments on commit 3736df3

Please sign in to comment.