Skip to main content

Overview

This guide covers how to interact with smart contracts on EVM chains, including reading contract state and executing contract functions.

Prerequisites

Write to Contract

Execute state-changing functions on a smart contract:

Read Contract Data

Query contract state without sending a transaction:

Complete Contract Interaction Example

Working with Contract ABIs

Defining ABIs

ABIs (Application Binary Interfaces) define how to interact with smart contracts:

Built-in ABIs

The SDK includes common contract ABIs. Note that you need to parse the ABI string to a JSON array:

Advanced Contract Interactions

NFT Minting

Approve Token Spending

Before a contract can spend your tokens, you need to approve it:

Check Token Allowance

Best Practices

1. Validate Contract Addresses

2. Handle Contract Errors

3. Estimate Gas for Complex Operations

Common Use Cases

DeFi: Swap Tokens

NFT: Check Ownership

Next Steps

Last modified on February 2, 2026