File tree Expand file tree Collapse file tree
apps/hub/src/components/terminal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,9 +229,11 @@ class CommandExecutor {
229229 }
230230
231231 try {
232- const balance = await this . client . getBalance ( address ) ;
233- const cgtBalance = ( Number ( balance ) / 1e18 ) . toFixed ( 6 ) ;
234- const sparks = ( Number ( balance ) / 1e16 ) . toFixed ( 2 ) ;
232+ const balanceResult = await this . client . getBalance ( address ) ;
233+ const balance = balanceResult ?. free ?? balanceResult ?? '0' ;
234+ const balanceNum = Number ( balance ) || 0 ;
235+ const cgtBalance = ( balanceNum / 1e18 ) . toFixed ( 6 ) ;
236+ const sparks = ( balanceNum / 1e16 ) . toFixed ( 2 ) ;
235237
236238 if ( isJson ) {
237239 return [ {
@@ -259,7 +261,8 @@ class CommandExecutor {
259261 }
260262
261263 try {
262- const energy = await this . client . getEnergy ( address ) ;
264+ const energyResult = await this . client . getEnergy ( address ) ;
265+ const energy = Number ( energyResult ) || 100 ;
263266 const filled = Math . floor ( energy / 5 ) ;
264267 const empty = 20 - filled ;
265268 const bar = '█' . repeat ( filled ) + '░' . repeat ( empty ) ;
You can’t perform that action at this time.
0 commit comments