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
The contract address. Invalid input throws
InvalidAddressError without a request.Returns
Promise<ContractInfo>
The verified contract name, such as
"TransparentUpgradeableProxy". An empty string if the contract isn’t verified.The proxy pattern BOTScan detected, such as
"eip1967", or null if it’s not a proxy.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.