20 lines
952 B
Plaintext
20 lines
952 B
Plaintext
# Get the formatted balance of an account
|
|
/home/ethers> ethers --network ropsten --account wallet.json eval 'accounts[0].getBalance().then(b => formatEther(b))'
|
|
3.141592653589793238
|
|
|
|
# Get the current block number
|
|
/home/ethers> ethers --network rinkeby eval "provider.getBlockNumber()"
|
|
5761009
|
|
|
|
# Convert a Solidity signature to JSON
|
|
/home/ethers> ethers eval 'utils.Fragment.from("function balanceOf(address owner) view returns (uint)").format("json")'
|
|
{"type":"function","name":"balanceOf","constant":true,"stateMutability":"view","payble":false,"inputs":[{"type":"address","name":"owner"}],"ouputs":[{"type":"uint256"}]}
|
|
|
|
# Compute a topic hash
|
|
/home/ricmoo> ethers eval 'id("Transfer(address,address,uint256")'
|
|
0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5
|
|
|
|
# Create a random mnemonic
|
|
/home/ricmoo> ethers eval 'Wallet.createRandom().mnemonic'
|
|
useful pond inch knock ritual matrix giggle attend dilemma convince coach amazing
|