Skip to content

Commit

Permalink
feature: sol mint aligned to backend service updates
Browse files Browse the repository at this point in the history
  • Loading branch information
newbreedofgeek committed Nov 22, 2024
1 parent 4141cc6 commit 0521f53
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 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.15",
"version": "3.8.0-alpha.16",
"description": "SDK for Itheum's Data NFT Technology on MultiversX Blockchain",
"main": "out/index.js",
"types": "out/index.d.js",
Expand Down
9 changes: 7 additions & 2 deletions src/cnft-sol-minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ErrArgumentNotSet } from './errors';
import { MinterSol } from './minter-sol';
import { StringValidator, validateResults } from './common/validator';
import { CNftSolPostMintMetaType } from './interfaces';
import { SolEnvChainIDEnum } from './config';

export class CNftSolMinter extends MinterSol {
/**
Expand Down Expand Up @@ -220,7 +221,11 @@ export class CNftSolMinter extends MinterSol {
tokenName,
mintForSolAddr: creatorAddress,
solSignature: solSignature || '',
signatureNonce: signatureNonce || ''
signatureNonce: signatureNonce || '',
chainId:
this.env === 'devnet'
? SolEnvChainIDEnum.devnet
: SolEnvChainIDEnum.mainnet
});

const requestOptions = {
Expand All @@ -233,7 +238,7 @@ export class CNftSolMinter extends MinterSol {
let dataMintCall: any = '';

resMintCall = await fetch(
this.solCNftMinterServiceUrl,
this.solCNftNfMeIdMinterServiceUrl,
requestOptions
);

Expand Down
21 changes: 18 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export enum SolEnvChainIDEnum {
devnet = 'SD',
mainnet = 'S1'
}

export enum EnvironmentsEnum {
devnet = 'devnet',
testnet = 'testnet',
Expand Down Expand Up @@ -82,9 +87,19 @@ export const imageService: { [key in EnvironmentsEnum]: string } = {
testnet: ''
};

export const solCNftMinterService: { [key in EnvironmentsEnum]: string } = {
devnet: 'https://api.itheumcloud-stg.com/datadexapi/solNftUtils/mintNft',
mainnet: 'https://api.itheumcloud.com/datadexapi/solNftUtils/mintNft',
export const solCNftNfMeIdMinterService: { [key in EnvironmentsEnum]: string } =
{
devnet:
'https://api.itheumcloud-stg.com/datadexapi/solNftUtils/mintNfMeIdDataNft',
mainnet:
'https://api.itheumcloud.com/datadexapi/solNftUtils/mintNfMeIdDataNft',
testnet: ''
};

export const solCNftMiscMinterService: { [key in EnvironmentsEnum]: string } = {
devnet:
'https://api.itheumcloud-stg.com/datadexapi/solNftUtils/mintMiscDataNft',
mainnet: 'https://api.itheumcloud.com/datadexapi/solNftUtils/mintMiscDataNft',
testnet: ''
};

Expand Down
16 changes: 12 additions & 4 deletions src/minter-sol.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import { EnvironmentsEnum, imageService, solCNftMinterService } from './config';
import {
EnvironmentsEnum,
imageService,
solCNftNfMeIdMinterService,
solCNftMiscMinterService
} from './config';
import { ContractSol } from './contract-sol';

export abstract class MinterSol extends ContractSol {
readonly imageServiceUrl: string;
readonly solCNftMinterServiceUrl: string;
readonly solCNftNfMeIdMinterServiceUrl: string;
readonly solCNftMiscMinterServiceUrl: string;

protected constructor(env: string) {
super(env);
this.imageServiceUrl = imageService[env as EnvironmentsEnum];
this.solCNftMinterServiceUrl =
solCNftMinterService[env as EnvironmentsEnum];
this.solCNftNfMeIdMinterServiceUrl =
solCNftNfMeIdMinterService[env as EnvironmentsEnum];
this.solCNftMiscMinterServiceUrl =
solCNftMiscMinterService[env as EnvironmentsEnum];
}
}

0 comments on commit 0521f53

Please sign in to comment.