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
Address
required
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>
boolean
required
true if the address has contract code.boolean
required
true if the contract’s source is verified on BOTScan. Always false for wallets.string | null
required
The contract or token name BOTScan shows, or
null if it has none.{ symbol: string; decimals: number }
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.