File tree 3 files changed +16
-0
lines changed
3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ Commands:
42
42
meridian set-next-round-length < blocks> Set the next round length
43
43
meridian set-round-reward < reward> Set the round reward
44
44
meridian tick Trigger a tick
45
+ meridian available-balance Get the balance available
45
46
46
47
Options:
47
48
-a, --address Contract address (or $MERIDIAN_ADDRESS ) [string] [required]
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
21
21
import { setNextRoundLength } from '../commands/set-next-round-length.js'
22
22
import { setRoundReward } from '../commands/set-round-reward.js'
23
23
import { tick } from '../commands/tick.js'
24
+ import { availableBalance } from '../commands/available-balance.js'
24
25
25
26
const pkg = JSON . parse (
26
27
await fs . readFile (
@@ -119,6 +120,12 @@ yargs(hideBin(process.argv))
119
120
yargs => yargs ,
120
121
tick
121
122
)
123
+ . command (
124
+ 'available-balance' ,
125
+ 'Get the balance available' ,
126
+ yargs => yargs ,
127
+ availableBalance
128
+ )
122
129
. demandCommand ( )
123
130
. version ( `${ pkg . name } : ${ pkg . version } ` )
124
131
. alias ( 'v' , 'version' )
Original file line number Diff line number Diff line change
1
+ import { createContract } from '../index.js'
2
+ import { formatEther } from 'ethers'
3
+
4
+ export const availableBalance = async opts => {
5
+ const { contract } = createContract ( opts )
6
+ console . log ( formatEther ( await contract . availableBalance ( ) ) , 'FIL' )
7
+ process . exit ( 0 )
8
+ }
You can’t perform that action at this time.
0 commit comments