Skip to content

Commit e6fadf1

Browse files
committed
add mint/burn commands
1 parent f8b3351 commit e6fadf1

File tree

11 files changed

+740
-631
lines changed

11 files changed

+740
-631
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### [1.23.0](https://github.com/ElvenTools/elven-tools-cli/releases/tag/v1.23.0) (2023-09-16)
2+
- add mint and burn endpoints for SFT minter
3+
- update dependencies
4+
15
### [1.22.3](https://github.com/ElvenTools/elven-tools-cli/releases/tag/v1.22.3) (2023-08-09)
26
- bump NFT minter smart contract version
37
- update dependencies

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Please post issues and ideas [here](https://github.com/ElvenTools/elven-tools-cl
7777

7878
### Contact
7979

80-
- [Twitter](https://twitter.com/JulianCwirko)
80+
- [Twitter](https://twitter.com/theJulianIo)
8181

8282
### License
8383

package-lock.json

Lines changed: 512 additions & 516 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"engines": {
44
"node": "^14.13.1 || >=16.0.0"
55
},
6-
"version": "1.22.3",
6+
"version": "1.23.0",
77
"elvenTools": {
88
"nftSmartContractVersionTagName": "v1.13.0",
9-
"sftSmartContractVersionTagName": "v0.3.0",
9+
"sftSmartContractVersionTagName": "v0.4.0",
1010
"minterDappVersionTagName": "v7.3.0"
1111
},
1212
"description": "Interacting with custom NFT/SFT-related smart contracts on the MultiversX blockchain",
@@ -48,27 +48,27 @@
4848
"elrond"
4949
],
5050
"devDependencies": {
51-
"@types/cross-spawn": "6.0.2",
51+
"@types/cross-spawn": "6.0.3",
5252
"@types/decompress": "4.2.4",
53-
"@types/node": "20.4.9",
53+
"@types/node": "20.6.2",
5454
"@types/prompts": "2.4.4",
55-
"@typescript-eslint/eslint-plugin": "6.3.0",
56-
"@typescript-eslint/parser": "6.3.0",
57-
"esbuild": "0.19.0",
58-
"eslint": "8.46.0",
55+
"@typescript-eslint/eslint-plugin": "6.7.0",
56+
"@typescript-eslint/parser": "6.7.0",
57+
"esbuild": "0.19.3",
58+
"eslint": "8.49.0",
5959
"eslint-config-prettier": "9.0.0",
6060
"eslint-plugin-prettier": "5.0.0",
61-
"prettier": "3.0.1",
61+
"prettier": "3.0.3",
6262
"rimraf": "5.0.1",
63-
"typescript": "5.1.6"
63+
"typescript": "5.2.2"
6464
},
6565
"dependencies": {
66-
"@multiversx/sdk-core": "12.6.1",
67-
"@multiversx/sdk-network-providers": "1.5.0",
66+
"@multiversx/sdk-core": "12.8.0",
67+
"@multiversx/sdk-network-providers": "2.0.0",
6868
"@multiversx/sdk-wallet": "4.2.0",
69-
"axios": "1.4.0",
70-
"bignumber.js": "9.1.1",
71-
"cosmiconfig": "8.2.0",
69+
"axios": "1.5.0",
70+
"bignumber.js": "9.1.2",
71+
"cosmiconfig": "8.3.6",
7272
"cross-fetch": "4.0.0",
7373
"cross-spawn": "7.0.3",
7474
"decompress": "4.2.1",

src/collection-nft-owners.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ export const collectionNftOwners = async () => {
8282
];
8383

8484
try {
85-
const { collectionTicker, noSmartContracts, fileNamesList } = await prompts(
86-
promptsQuestions
87-
);
85+
const { collectionTicker, noSmartContracts, fileNamesList } =
86+
await prompts(promptsQuestions);
8887

8988
if (!collectionTicker) {
9089
console.log('You have to provide a collection ticker!');

src/config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,22 @@ export const getSftAmountPerAddressTotalFunctionName =
346346
customConfig?.config?.sftMinterSc?.getAmountPerAddressTotalFnName ||
347347
'getAmountPerAddressTotal';
348348

349+
// Increase the initial supply
350+
export const getSftMintFunctionName =
351+
customConfig?.config?.sftMinterSc?.getSftMintFnName || 'mint';
352+
353+
// Gas limit required for mint transaction
354+
export const sftMintGasLimit =
355+
customConfig?.config?.sftMinterSc?.mintGasLimit || 3000000;
356+
357+
// Decrease the initial supply
358+
export const getSftBurnFunctionName =
359+
customConfig?.config?.sftMinterSc?.getSftBurnFnName || 'burn';
360+
361+
// Gas limit required for mint transaction
362+
export const sftBurnGasLimit =
363+
customConfig?.config?.sftMinterSc?.burnGasLimit || 3000000;
364+
349365
// ⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡
350366
// Collection NFT owners
351367
// ⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡⚡
@@ -470,6 +486,10 @@ export const removeAllowlistAddressLabel = 'Provide address to remove.\n';
470486
export const provideAnAddressLabel = 'Please provide an address.\n';
471487
export const newLimitPerAddressLabel =
472488
'Please provide new limit of tokens per address.\n';
489+
export const newAmountOfTokensLabel =
490+
'Please provide the new amount of tokens to add to the initial supply.\n';
491+
export const amountOfTokensToBurnLabel =
492+
'Please provide the amount to burn to decrease the initial supply.\n';
473493

474494
// Pem file name - generated by this tool
475495
export const pemKeyFileName = 'walletKey.pem';

src/deploy.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,8 @@ const deployNftMinter = async () => {
248248
await provider.sendTransaction(deployTransaction);
249249

250250
const watcher = new TransactionWatcher(provider);
251-
const transactionOnNetwork = await watcher.awaitCompleted(
252-
deployTransaction
253-
);
251+
const transactionOnNetwork =
252+
await watcher.awaitCompleted(deployTransaction);
254253

255254
const txStatus = transactionOnNetwork.status;
256255
const txHash = transactionOnNetwork.hash;
@@ -321,9 +320,8 @@ export const deploySftMinter = async () => {
321320
await provider.sendTransaction(deployTransaction);
322321

323322
const watcher = new TransactionWatcher(provider);
324-
const transactionOnNetwork = await watcher.awaitCompleted(
325-
deployTransaction
326-
);
323+
const transactionOnNetwork =
324+
await watcher.awaitCompleted(deployTransaction);
327325

328326
const txStatus = transactionOnNetwork.status;
329327
const txHash = transactionOnNetwork.hash;

src/distribute-to-owners.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ const promptQuestions: PromptObject[] = [
102102

103103
export const distributeToOwners = async () => {
104104
try {
105-
const { amount, tokenType, token, multiply } = await prompts(
106-
promptQuestions
107-
);
105+
const { amount, tokenType, token, multiply } =
106+
await prompts(promptQuestions);
108107

109108
if (!amount) {
110109
console.log('You have to provide the amount per address!');

src/nft-minter-fns.ts

Lines changed: 38 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ const issueCollectionToken = async () => {
153153
exit(9);
154154
}
155155

156-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
157-
smartContractAddress
158-
);
156+
const { smartContract, userAccount, signer, provider } =
157+
await setupNftSc(smartContractAddress);
159158

160159
const issueCollectionTokenTx = getNftIssueTransaction(
161160
signer.getAddress(),
@@ -192,9 +191,8 @@ const setLocalRoles = async () => {
192191
try {
193192
await areYouSureAnswer();
194193

195-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
196-
smartContractAddress
197-
);
194+
const { smartContract, userAccount, signer, provider } =
195+
await setupNftSc(smartContractAddress);
198196

199197
const assignRolesTx = getNftAssignRolesTransaction(
200198
signer.getAddress(),
@@ -270,9 +268,8 @@ const giveaway = async () => {
270268
];
271269

272270
try {
273-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
274-
smartContractAddress
275-
);
271+
const { smartContract, userAccount, signer, provider } =
272+
await setupNftSc(smartContractAddress);
276273

277274
const giveawayFile = getFileContents(giveawayFileRelativePath, {
278275
noExitOnError: true,
@@ -295,9 +292,8 @@ const giveaway = async () => {
295292
console.log('You will be providing addresses by hand.');
296293
console.log(' ');
297294
await areYouSureAnswer();
298-
const { giveawayAddressList, giveawayTokensAmount } = await prompts(
299-
promptQuestions
300-
);
295+
const { giveawayAddressList, giveawayTokensAmount } =
296+
await prompts(promptQuestions);
301297
addresses = giveawayAddressList;
302298
amount = giveawayTokensAmount;
303299
}
@@ -343,9 +339,8 @@ const setDrop = async () => {
343339
const { dropTokensAmount, dropTokensLimitPerAddressPerDrop } =
344340
await prompts(promptQuestions);
345341

346-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
347-
smartContractAddress
348-
);
342+
const { smartContract, userAccount, signer, provider } =
343+
await setupNftSc(smartContractAddress);
349344

350345
const setDropTx = getSetDropTransaction(
351346
signer.getAddress(),
@@ -364,9 +359,8 @@ const setDrop = async () => {
364359
const unsetDrop = async () => {
365360
const smartContractAddress = getNftSCAddressFromOutputOrConfig();
366361
try {
367-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
368-
smartContractAddress
369-
);
362+
const { smartContract, userAccount, signer, provider } =
363+
await setupNftSc(smartContractAddress);
370364

371365
const unsetDropTx = getUnsetDropTransaction(
372366
signer.getAddress(),
@@ -385,9 +379,8 @@ const pauseMinting = async () => {
385379
try {
386380
await areYouSureAnswer();
387381

388-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
389-
smartContractAddress
390-
);
382+
const { smartContract, userAccount, signer, provider } =
383+
await setupNftSc(smartContractAddress);
391384

392385
const pauseMintingTx = getPauseMintingTransaction(
393386
signer.getAddress(),
@@ -406,9 +399,8 @@ const startMinting = async () => {
406399
try {
407400
await areYouSureAnswer();
408401

409-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
410-
smartContractAddress
411-
);
402+
const { smartContract, userAccount, signer, provider } =
403+
await setupNftSc(smartContractAddress);
412404

413405
const startMintingTx = getUnpauseMintingTransaction(
414406
signer.getAddress(),
@@ -441,9 +433,8 @@ const setNewPrice = async () => {
441433

442434
await areYouSureAnswer();
443435

444-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
445-
smartContractAddress
446-
);
436+
const { smartContract, userAccount, signer, provider } =
437+
await setupNftSc(smartContractAddress);
447438

448439
const changePriceTx = getSetNewPriceTransaction(
449440
signer.getAddress(),
@@ -463,9 +454,8 @@ const setNewPrice = async () => {
463454
const claimDevRewards = async () => {
464455
const smartContractAddress = getNftSCAddressFromOutputOrConfig();
465456
try {
466-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
467-
smartContractAddress
468-
);
457+
const { smartContract, userAccount, signer, provider } =
458+
await setupNftSc(smartContractAddress);
469459

470460
const claimDevRewardsTx = getClaimDevRewardsTransaction(
471461
smartContract,
@@ -513,15 +503,13 @@ const changeBaseCids = async () => {
513503

514504
const smartContractAddress = getNftSCAddressFromOutputOrConfig();
515505
try {
516-
const { nftMinterImgCid, nftMinterMetaCid } = await prompts(
517-
promptQuestions
518-
);
506+
const { nftMinterImgCid, nftMinterMetaCid } =
507+
await prompts(promptQuestions);
519508

520509
await areYouSureAnswer();
521510

522-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
523-
smartContractAddress
524-
);
511+
const { smartContract, userAccount, signer, provider } =
512+
await setupNftSc(smartContractAddress);
525513

526514
const changeBaseCidsTx = getChangeBaseCidsTransaction(
527515
signer.getAddress(),
@@ -553,9 +541,8 @@ const setNewTokensLimitPerAddress = async () => {
553541

554542
await areYouSureAnswer();
555543

556-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
557-
smartContractAddress
558-
);
544+
const { smartContract, userAccount, signer, provider } =
545+
await setupNftSc(smartContractAddress);
559546

560547
const setNewTokensLimitPerAddressTx =
561548
getSetNewTokensLimitPerAddressTransaction(
@@ -581,9 +568,8 @@ const enableAllowlist = async () => {
581568
try {
582569
await areYouSureAnswer();
583570

584-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
585-
smartContractAddress
586-
);
571+
const { smartContract, userAccount, signer, provider } =
572+
await setupNftSc(smartContractAddress);
587573

588574
const enableAllowlistTx = getEnableAllowlistTransaction(
589575
signer.getAddress(),
@@ -602,9 +588,8 @@ const disableAllowlist = async () => {
602588
try {
603589
await areYouSureAnswer();
604590

605-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
606-
smartContractAddress
607-
);
591+
const { smartContract, userAccount, signer, provider } =
592+
await setupNftSc(smartContractAddress);
608593

609594
const disableAllowlistTx = getDisableAllowlistTransaction(
610595
signer.getAddress(),
@@ -657,9 +642,8 @@ const getMintedPerAddressPerDrop = async () => {
657642
const claimScFunds = async () => {
658643
const smartContractAddress = getNftSCAddressFromOutputOrConfig();
659644
try {
660-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
661-
smartContractAddress
662-
);
645+
const { smartContract, userAccount, signer, provider } =
646+
await setupNftSc(smartContractAddress);
663647

664648
const claimScFundsTx = getClaimScFundsTransaction(
665649
signer.getAddress(),
@@ -689,9 +673,8 @@ const populateAllowlist = async () => {
689673
];
690674

691675
try {
692-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
693-
smartContractAddress
694-
);
676+
const { smartContract, userAccount, signer, provider } =
677+
await setupNftSc(smartContractAddress);
695678

696679
const allowlistFile = getFileContents(allowlistFileRelativePath, {
697680
noExitOnError: true,
@@ -743,9 +726,8 @@ const clearAllowlist = async () => {
743726
try {
744727
await areYouSureAnswer();
745728

746-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
747-
smartContractAddress
748-
);
729+
const { smartContract, userAccount, signer, provider } =
730+
await setupNftSc(smartContractAddress);
749731

750732
const itemsInAllowlistResponse = await scQuery(
751733
getAllowlistFunctionName,
@@ -783,9 +765,8 @@ const removeAllowlistAddress = async () => {
783765

784766
await areYouSureAnswer();
785767

786-
const { smartContract, userAccount, signer, provider } = await setupNftSc(
787-
smartContractAddress
788-
);
768+
const { smartContract, userAccount, signer, provider } =
769+
await setupNftSc(smartContractAddress);
789770

790771
const removeAllowlistAddressTx = getRemoveAllowlistAddressTx(
791772
signer.getAddress(),

0 commit comments

Comments
 (0)