vechain / vechain-sdk-js

The official JavaScript SDK for VeChain.
19 stars 6 forks source link

💡 Get Account :: Utility functions #998

Open darrenvechain opened 1 week ago

darrenvechain commented 1 week ago

Summary

It would be nice if getAccount returned a class or an object with some utility functions built in so it is easier to debug and read account balances etc.

Current code:

// Returns {balance, energy, hasCode}
const account = await client.accounts.getAccount(account)

Basic Example

It would be nice to have some extra functions such as:

const account = await client.accounts.getAccount(account)
console.log(account.parsedVet()) //if my VET balance is `0x43c33c1937564800000`, then it prints `20000`
claytonneal commented 1 week ago

Its unclear to me why we return hex strings for getAccount for the VET & VTHO balance perhaps to consider to change the AccountDetail interface so that balance and energy are of type BigNumber thanks