File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -30,22 +30,33 @@ void Start()
3030 }
3131 }
3232
33+ /// <summary>
34+ /// Gets the balance of the account for the specified address.
35+ /// The balance is obtained in hexadecimal format and then converted to decimal for display.
36+ /// </summary>
3337 public async void GetBalance ( )
3438 {
35- ShowOutput ( $ "Called GetBalance() ...") ;
39+ ShowOutput ( "Getting account balance ...") ;
3640
3741 try
3842 {
39- string balance = await Passport . ZkEvmGetBalance ( AddressInput . text ) ;
40- var balanceBI = BigInteger . Parse ( balance . Replace ( "0x" , "0" ) , NumberStyles . HexNumber ) ;
41- ShowOutput ( $ "Hex: { balance } \n Dec: { balanceBI } ") ;
43+ // Retrieve the balance in hexadecimal format
44+ string balanceHex = await Passport . ZkEvmGetBalance ( AddressInput . text ) ;
45+
46+ // Convert the hexadecimal balance to a BigInteger for decimal representation
47+ var balanceDec = BigInteger . Parse ( balanceHex . Replace ( "0x" , "" ) , NumberStyles . HexNumber ) ;
48+
49+ // Display both hexadecimal and decimal representations of the balance
50+ ShowOutput ( $ "Balance:\n Hex: { balanceHex } \n Dec: { balanceDec } ") ;
4251 }
4352 catch ( Exception ex )
4453 {
4554 ShowOutput ( $ "Failed to get balance: { ex . Message } ") ;
4655 }
4756 }
4857
58+
59+
4960 /// <summary>
5061 /// Navigates back to the authenticated scene.
5162 /// </summary>
You can’t perform that action at this time.
0 commit comments