简体   繁体   中英

How to use from keyword : in ethers.js

In web3.js we will use from keyword as below, in the same way, how can we use from keyword in ether.js

eg: web3.js ==>>aggregator.methods.withdraw( ).send( { from: this.state.account } )

ethers.js ==>> How to use from keyword??

In ethers, after creating a contract instance, you can send an options object as last atribute of a function call.

let contract =  new ethers.Contract(address, abi, signer);

// waits until transaction is submitted.
let transaction = await contract.withdraw({ from: this.state.account });

// waits until transaction is finished.
await transaction.wait();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM