getAddressInfo tells you whether an address on BOT Chain is a contract, whether it’s verified on BOTScan, and, for tokens, the symbol and decimals.
Early release. This is published in
@uzolabs/sdk 0.2.0 on npm and you can use it today. The API may change before 1.0, so pin the version.Usage
address-info.ts
Output
Parameters
A 0x-prefixed, 20-byte hex address. Any letter case is accepted. The client checksums it before calling BOTScan. Anything else throws
InvalidAddressError without making a request.Returns
Promise<AddressInfo>
Present only when BOTScan recognizes the address as a token with a symbol and whole-number decimals.
{ isContract: false, isVerified: false, name: null }, the same as an unused wallet.
Errors
Common use: check a token before using it
check-token.ts
Output
decimals() from the contract itself.
Related
getContract
Fetch the verified ABI.
Errors
Every error class.