getContract fetches a contract’s verified name and ABI from BOTScan, and tells you whether it’s a proxy and which implementation it points to.
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
get-contract.ts
Output
Parameters
Address
required
The contract address. Invalid input throws
InvalidAddressError without a request.Returns
Promise<ContractInfo>
string
required
The verified contract name, such as
"TransparentUpgradeableProxy". An empty string if the contract isn’t verified.Abi
required
The verified ABI. An empty array if the contract isn’t verified.
boolean
required
true if BOTScan has verified source for this contract.string | null
required
The proxy pattern BOTScan detected, such as
"eip1967", or null if it’s not a proxy.Address[]
required
For proxies, the implementation addresses BOTScan found. Empty for other contracts.
Errors
An unverified contract doesn’t throw. Check
isVerified before you use abi.
not-a-contract.ts
Output
Related
ABIs
Typed ABIs included in the SDK.
Verify a contract
Get your own contract verified on BOTScan.