prepareTransaction
Prepare transaction that need to be executed through meta transaction.
Param | Default value | Description |
---|---|---|
contractObj | Array with Bcode NFT Contract | Array of interested contract addresses |
functionName | Current user address | Wallet address of NFT owner |
params | Array | Array of original prams for contract function |
optionals | Object | Optionals element, like nonce |
⚠️
It's important to set name and version as the one setted in the deployed smart contract.
If they are not setted correctly an error will be visible in polygonscan explorer. The error will be:
Error: Signer and signature do not match
Usage
const tx = await sdk.prepareTransaction(
{
address: config[`TEST_META_TX_${env}`],
abi: testMetaTxAbi,
name: "TestMetaTransaction",
version: "0.0.1",
},
"increment",
[],
optionals
));
The variable optionals includes the nonce that can be used for implementing concurrent transaction logic.
Basically, if the wallet is going to execute more transaction in sequence, is suggested to keep track of the blockchain's nonce and the current pending transactions, in this way you can use the nonce and add the number of current pending transaction to prepare transaction without using duplicate nonce.