Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elrond: add wipe NFT #121

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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