Skip to content

Commit

Permalink
refactor: abi file import in subclass and use in subclass constructor
Browse files Browse the repository at this point in the history
Refs: #37
  • Loading branch information
bucurdavid committed Sep 13, 2023
1 parent 71b69cf commit 01b2a56
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"short": "rustc 1.71.0-nightly (7f94b314c 2023-04-23)"
},
"contractCrate": {
"name": "nftenterprise",
"name": "data-nft-lease",
"version": "1.0.0"
},
"framework": {
Expand Down
5 changes: 2 additions & 3 deletions src/minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import {
itheumTokenIdentifier,
networkConfiguration
} from './config';
import dataNftMintAbi from './abis/datanftmint.abi.json';
import { MinterRequirements } from './interfaces';
import { NFTStorage, File } from 'nft.storage';
import {
checkTraitsUrl,
Expand Down Expand Up @@ -51,6 +49,7 @@ export class Minter {
protected constructor(
env: string,
contractAddress: string,
abiFile: any,
timeout: number = 10000
) {
this.env = env;
Expand All @@ -65,7 +64,7 @@ export class Minter {
);
this.contract = new SmartContract({
address: new Address(contractAddress),
abi: AbiRegistry.create(dataNftMintAbi)
abi: AbiRegistry.create(abiFile)
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/nft-minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {
U64Value
} from '@multiversx/sdk-core/out';
import { Minter } from './minter';
import dataNftLeaseAbi from './abis/data-nft-lease.abi.json';

export class NftMinter extends Minter {
constructor(env: string, contractAddress: string, timeout: number = 10000) {
super(env, contractAddress, timeout);
super(env, contractAddress, dataNftLeaseAbi, timeout);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/sft-minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ import {
minterContractAddress
} from './config';
import { MinterRequirements } from './interfaces';
import dataNftMinterAbi from './abis/datanftmint.abi.json';

export class SftMinter extends Minter {
constructor(env: string, timeout: number = 10000) {
super(env, minterContractAddress[env as EnvironmentsEnum], timeout);
super(
env,
minterContractAddress[env as EnvironmentsEnum],
dataNftMinterAbi,
timeout
);
}

/**
Expand Down

0 comments on commit 01b2a56

Please sign in to comment.