ContractCall
Smart contract call block for ABI-backed read or write interactions, with optional interactive execution in supported contexts.
For isolated previews, theme switching, and sandbox editing, open the ContractCall playground on holydocs.com .
When to use
Use this component when blockchain context, addresses, chains, token math, or wallet onboarding must stay precise and scannable.
Live Examples
Every example below renders the real component directly inside HolyDocs, followed by the exact MDX you can paste into a page.
Read Call
Document a view call without interactive execution.
balanceOf
mdx<ContractCall address="0x1234567890abcdef1234567890abcdef12345678" function="balanceOf" chain="ethereum" abi='[{"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]'/>
Interactive Write
Flag real transactions clearly when the component can trigger wallet confirmation.
mint
⚠️ Warning: This sends a real transaction on-chain. Review carefully before confirming.
mdx<ContractCall address="0x1234567890abcdef1234567890abcdef12345678" function="mint" chain="base" abi='[{"inputs":[{"name":"to","type":"address"},{"name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"}]' interactive requiresWallet/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
address | string | -- | Contract address to target. |
function | string | -- | Function name to show and execute. |
chain | string | ethereum | Chain key used for wallet and explorer context. |
abi | string | -- | Optional ABI JSON string used to build input controls. |
interactive | boolean | false | Turns on inline inputs and execution controls. |
requiresWallet | boolean | false | Marks the call as a write interaction that requires wallet confirmation. |
Usage
Start from this baseline shape and then tailor the copy, data, or nesting to the page you are writing.
mdx<ContractCall address="0x1234567890abcdef1234567890abcdef12345678" function="balanceOf" chain="ethereum" abi='[{"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]'/>
Tips
- Be explicit about whether the call is read-only, interactive, testnet-only, or a real transaction that can move value.
- Assume readers are one copy action away from using the value in production. Precision matters more than flair on web3 surfaces.
- Always make the target chain explicit when a component can imply a wallet, explorer, or transaction context.
Related Components
Readable wallet or contract address with truncation, copy-to-clipboard, and optional block-explorer deep link.
More
- Interactive playground: ContractCall on holydocs.com
- Component library index: /components