You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@stskeeps this feature is on the way #12 and will become available in @fuel-js/wallet@0.5.2. We can experiment a bit with API's but this is the general format.
// Get the transaction Id for this transfer.consttxTokenId=1;consttxAddress='0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e';consttxAmount=utils.parseEther('1');// Generate the transactionId for this transfer.consttransactionId=awaitwallet.transfer(txTokenId,txAddress,txAmount,{transactionId: true,});// Commit the witness, note the contract object can be used by any provider (web3/ethers)// it just has to contact the `fuel` contract directly and use the `commitWitness(bytes32 transactionId)` ABI.letcommitTx=awaitwallet.contract.commitWitness(transactionId,{gasLimit: 200000,});// Here we wait for the transaction to process, but I also increased the number of blocks to let the Fuel aggregator pickup the log.// We will likely want to add a checking step here (on a loop) to ensure the Fuel sequencer has picked up the witness commitment.// For now just attempt to do the transfer until it goes through, but wait a few blocks to ensure the sequencer can pick it up, I selected 12 Ethereum blocks here, in ethers.js notation below.commitTx=awaitcommitTx.wait(12);// Transfer using Caller witness.awaitwallet.transfer(txTokenId,txAddress,txAmount,{// Here we provide the necessary event data to build the Caller witness (i.e. `{ blockNumber, address }`)caller: commitTx.events[0].args,});
Anyway, should be in once the PR is reviewed / merged.
Document how to do a transfer w/ caller witness (smart contract)
The text was updated successfully, but these errors were encountered: