mirror of
https://github.com/vacp2p/swap-contracts-module.git
synced 2025-02-27 18:30:33 +00:00
Add example task for balance with arg to STDOUT
This commit is contained in:
parent
bbd31b7b10
commit
c0d448a932
@ -42,3 +42,7 @@ npx hardhat run scripts/redeem-cheque.js --network localhost
|
|||||||
```
|
```
|
||||||
|
|
||||||
Now Alice has send a cheque to Bob, and Bob has received it from the Swap contract. Cheques can be sent and received off-chain, and only settled once Bob wants to.
|
Now Alice has send a cheque to Bob, and Bob has received it from the Swap contract. Cheques can be sent and received off-chain, and only settled once Bob wants to.
|
||||||
|
|
||||||
|
## Example task
|
||||||
|
|
||||||
|
`npx hardhat balance --account 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require("@nomiclabs/hardhat-web3");
|
||||||
|
|
||||||
require("@nomiclabs/hardhat-waffle");
|
require("@nomiclabs/hardhat-waffle");
|
||||||
|
|
||||||
// This is a sample Hardhat task. To learn how to create your own go to
|
// This is a sample Hardhat task. To learn how to create your own go to
|
||||||
@ -10,6 +12,15 @@ task("accounts", "Prints the list of accounts", async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
task("balance", "Prints an account's balance")
|
||||||
|
.addParam("account", "The account's address")
|
||||||
|
.setAction(async taskArgs => {
|
||||||
|
const account = web3.utils.toChecksumAddress(taskArgs.account);
|
||||||
|
const balance = await web3.eth.getBalance(account);
|
||||||
|
|
||||||
|
console.log(web3.utils.fromWei(balance, "ether"), "ETH");
|
||||||
|
});
|
||||||
|
|
||||||
// You need to export an object to set up your config
|
// You need to export an object to set up your config
|
||||||
// Go to https://hardhat.org/config/ to learn more
|
// Go to https://hardhat.org/config/ to learn more
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user