Comments (1)
@stskeeps this feature is on the way #12 and will become available in @fuel-js/[email protected]
. We can experiment a bit with API's but this is the general format.
// Get the transaction Id for this transfer.
const txTokenId = 1;
const txAddress = '0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e';
const txAmount = utils.parseEther('1');
// Generate the transactionId for this transfer.
const transactionId = await wallet.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.
let commitTx = await wallet.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 = await commitTx.wait(12);
// Transfer using Caller witness.
await wallet.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.
from fuel-js.
Related Issues (16)
- `Error: getaddrinfo EAI_AGAIN` when connecting to Infura with `--infura` flag set HOT 3
- [feature request] @fuel-js/wallet list withdrawls HOT 1
- [feature request] separate wallet from client
- Can't deposit ether into fuel HOT 5
- [feature request] return data logging plugin HOT 1
- Not possible to load wallet with short password HOT 1
- The link to your discord is invalid. HOT 2
- Package only supports Node 12 HOT 2
- Question about passing tokenId in the retrieve method HOT 5
- Typescript error due to spelling mistake HOT 2
- Better Features for Contract Signing [Feature Request]
- RaidGuild Request: indexed.wtf doc edits and additions HOT 3
- "Working on rues" link is broken HOT 1
- `Error: socket hang` when connecting to `geth` HOT 13
- Node should halt on password error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fuel-js.