API ReferenceSetup and configurationFunction
getContractAddress()
function getContractAddress(ctx, contract): Promise<`0x${string}`>;Gets the contract address of the contract associated with the provided AnvilContract.
The address comes from the required profile’s atomic address-and-ABI binding. The first address resolution on an SDK context performs a live chain consistency check; concurrent first resolutions share that check and later resolutions reuse its successful verdict.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | SDKContext | The SDK context. |
contract | AnvilContract | The enum value specifying the contract in question. |
Returns
Promise<`0x${string}`>
The address.
Remarks
A context therefore assumes its client stays on the profile’s chain for the context’s lifetime. If the underlying transport can change networks (for example an injected wallet provider), construct a new SDK instance per chain rather than reusing one across a switch; reads do not re-verify the live chain after the first successful check, though transaction sends always verify the wallet’s live chain.
Throws
If the provided contract is not found.
Throws
If the required profile disagrees with the connected chain.