Skip to content

Commit

Permalink
Elrond: add wipe NFT (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 authored Aug 18, 2021
1 parent 8733605 commit 1278e4e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "1.21.5",
"version": "1.21.6",
"description": "Tatum API client allows browsers and Node.js clients to interact with Tatum API.",
"main": "dist/src/index.js",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
1 change: 1 addition & 0 deletions src/model/request/egld/EsdtToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export enum EgldServiceType {
ESDTNFTAddQuantity = 'ESDTNFTAddQuantity',
ESDTNFTBurn = 'ESDTNFTBurn',
freezeSingleNFT = 'freezeSingleNFT',
wipeSingleNFT = 'wipeSingleNFT',
unFreezeSingleNFT = 'unFreezeSingleNFT',
ESDTNFTTransfer = 'ESDTNFTTransfer',
}
Expand Down
33 changes: 33 additions & 0 deletions src/transaction/egld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,39 @@ export const prepareEgldFreezeNftSignedTransaction = async (body: EgldEsdtTransa
return await prepareSignedTransactionAbstraction(client, tx, signatureId, fromPrivateKey, { gasLimit, gasPrice: fee?.gasPrice as string } as Fee)
}

/**
* Sign ESDT freeze NFT transaction with private keys locally. Nothing is broadcast to the blockchain.
* @param body content of the transaction to broadcast
* @param provider url of the EGLD Server to connect to. If not set, default public server will be used.
* @returns transaction data to be broadcast to blockchain.
*/
export const prepareEgldWipeNftSignedTransaction = async (body: EgldEsdtTransaction, provider?: string) => {
await validateBody(body, EgldEsdtTransaction)
const {
fromPrivateKey,
amount,
fee,
data,
nonce,
signatureId,
} = body

const client = getEgldClient(provider)

const value = amount ? new BigNumber(amount).toNumber() : 0
const gasLimit = fee?.gasLimit ? fee.gasLimit : '60000000'

const tx: TransactionConfig = {
from: 0,
to: ESDT_SYSTEM_SMART_CONTRACT_ADDRESS,
value,
nonce,
data: await prepareEgldFreezeOrWipeNftData(data),
}

return await prepareSignedTransactionAbstraction(client, tx, signatureId, fromPrivateKey, { gasLimit, gasPrice: fee?.gasPrice as string } as Fee)
}

/**
* Sign ESDT transfer NFT transaction with private keys locally. Nothing is broadcast to the blockchain.
* @param body content of the transaction to broadcast
Expand Down

0 comments on commit 1278e4e

Please sign in to comment.