Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions evm/debugging-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
description: 'Advanced debugging techniques for EVM transactions on Sei. Learn transaction template generation and analysis using seid and Foundry cast tools.'
keywords: ['EVM debugging', 'transaction templates', 'foundry cast', 'evm analysis', 'transaction debugging']
---

import { RunSnippet } from '/snippets/run-snippet.jsx';

## Overview

Debugging EVM transactions on Sei requires understanding both the transaction creation process and how to analyze transaction behavior. This guide covers advanced debugging techniques using transaction template generation, analysis tools, and comprehensive transaction inspection methods to help developers identify and resolve issues in their EVM interactions.

## Transaction Template Generation

Check warning on line 13 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L13

Use sentence case for headings: 'Transaction Template Generation'.

The `--generate-only` flag transforms any Sei CLI transaction command into a template generator, creating complete transaction structures without broadcasting them. Through the `--generate-only` flag and Foundry's `cast` tool, developers can craft, analyze, and debug transactions across the EVM environment.

### Basic Command Pattern

Check warning on line 17 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L17

Use sentence case for headings: 'Basic Command Pattern'.

The general pattern follows this structure:

Expand All @@ -19,7 +22,7 @@
seid tx <module> <action> <parameters> --from <key> --evm-rpc http://url-to-sei-evm-rpc --generate-only
```

### Generating EVM Transaction Templates

Check warning on line 25 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L25

Use sentence case for headings: 'Generating EVM Transaction Templates'.

To generate an EVM transaction template, use the `evm` module with `--generate-only`. Here's an example sending SEI to another EVM address:

Expand All @@ -36,7 +39,7 @@

---

## Analyzing EVM Transactions with Cast

Check warning on line 42 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L42

Use sentence case for headings: 'Analyzing EVM Transactions with Cast'.

Once you have a transaction hash, you can use Foundry's `cast` command to inspect the transaction details:

Expand Down Expand Up @@ -66,7 +69,7 @@
value 0
```

### Additional Analysis Commands

Check warning on line 72 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L72

Use sentence case for headings: 'Additional Analysis Commands'.

**Get transaction receipt:**

Expand All @@ -85,13 +88,13 @@

---

## RPC Consistency

Check warning on line 91 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L91

Use sentence case for headings: 'RPC Consistency'.

<Warning>Always point `cast` commands to an EVM RPC endpoint (for example, `$EVM_RPC_URL`), not a Cosmos RPC URL.</Warning>

---

## Tracing and Revert Reasons

Check warning on line 97 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L97

Use sentence case for headings: 'Tracing and Revert Reasons'.

If your endpoint supports debug RPC methods, you can retrieve full execution traces and revert reasons:

Expand All @@ -112,7 +115,7 @@

---

## Reproduce with a Local Fork

Check warning on line 118 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L118

Use sentence case for headings: 'Reproduce with a Local Fork'.

Fork the network locally to reproduce issues deterministically and run traces even if remote debug RPC is disabled:

Expand All @@ -130,7 +133,7 @@

---

## Event Logs and Decoding

Check warning on line 136 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L136

Use sentence case for headings: 'Event Logs and Decoding'.

Use the receipt to inspect logs and decode with the contract ABI:

Expand All @@ -146,7 +149,7 @@

---

## Nonce, Balance, and Gas Diagnostics

Check warning on line 152 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L152

Use sentence case for headings: 'Nonce, Balance, and Gas Diagnostics'.

Check common failure points quickly:

Expand All @@ -165,9 +168,33 @@
- Underpriced `maxFeePerGas`/`maxPriorityFeePerGas`
- Chain ID mismatch

### Try it live

Each `cast` diagnostic above is a plain read-only JSON-RPC call. Run the same four against Sei mainnet right here — the example address (`0xAa55…3d96`) is the sender from the `cast tx` output earlier on this page.

<RunSnippet method="eth_chainId" network="mainnet" title="cast chain-id" description="eth_chainId — decodes to 1329. A mismatch here is the most common cause of a rejected transaction." />

<RunSnippet method="eth_gasPrice" network="mainnet" title="cast gas-price" description="eth_gasPrice — the current gas price in wei. Compare it against your maxFeePerGas when a transaction is stuck as underpriced." />

<RunSnippet
method="eth_getTransactionCount"
params={['0xAa55a16dD4E73c48C968928983c2bcC98d913d96', 'latest']}
network="mainnet"
title="cast nonce 0xAa55…3d96"
description="eth_getTransactionCount at the latest block — the account's next nonce. Swap in your own address."
/>

<RunSnippet
method="eth_getBalance"
params={['0xAa55a16dD4E73c48C968928983c2bcC98d913d96', 'latest']}
network="mainnet"
title="cast balance 0xAa55…3d96"
description="eth_getBalance in wei — confirm the account can cover gas before you dig into a failed send."
/>

---

## Offline Workflow with --generate-only

Check warning on line 197 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L197

Use sentence case for headings: 'Offline Workflow with --generate-only'.

Generate, inspect, sign, and broadcast safely:

Expand All @@ -187,7 +214,7 @@

---

## Precompile Awareness

Check warning on line 217 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L217

Use sentence case for headings: 'Precompile Awareness'.

Calls to system precompiles (for example, addresses like `0x...100b`) may have specific input/output formats and error behavior.

Expand All @@ -206,7 +233,7 @@

---

## Transaction Analysis

Check warning on line 236 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L236

Use sentence case for headings: 'Transaction Analysis'.

When analyzing transactions, follow these essential practices:

Expand Down Expand Up @@ -236,7 +263,7 @@

---

## Error Handling

Check warning on line 266 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L266

Use sentence case for headings: 'Error Handling'.

Handle potential EVM transaction issues with proper monitoring:

Expand All @@ -262,7 +289,7 @@

---

## Security Guidelines

Check warning on line 292 in evm/debugging-contracts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/debugging-contracts.mdx#L292

Use sentence case for headings: 'Security Guidelines'.

<Warning>
<strong>Critical Security Requirements:</strong> Keep private keys secure and never include them in templates. Use an `.env` file or other environment variables when working with wallet keys or mnemonics. Never commit sensitive information to version control. Always verify transaction details before signing.
Expand Down
26 changes: 26 additions & 0 deletions evm/evm-foundry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
description: 'Learn how to develop, test, and deploy smart contracts on Sei EVM using Foundry, with step-by-step examples of contract creation, testing, deployment, and interaction using both CLI and ethers.js.'
keywords: ['sei evm', 'foundry', 'forge', 'smart contract', 'web3 development', 'nft', 'erc721', 'erc20']
---

import { RunSnippet } from '/snippets/run-snippet.jsx';
import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

This tutorial will guide you through setting up Foundry for Sei EVM development and using OpenZeppelin contracts to build secure, standardized smart contracts. We'll cover environment setup, contract creation, deployment, and show how to leverage OpenZeppelin's pre-built components with the powerful Foundry toolkit.

<Info>Watch the video walkthrough for this topic in the [Video Tutorials](/evm/videos) section.</Info>
Expand All @@ -16,7 +21,28 @@

</Tip>

## Try it before you install

Installing Foundry and scaffolding a project takes a few minutes. If you just want to see a contract deploy to Sei, you can do both of these right now in the browser.

First, confirm the RPC endpoints you'll put in `foundry.toml` respond:

<RunSnippet method="eth_chainId" network="testnet" title="eth_chainId · atlantic-2" description="Testnet RPC — decodes to 1328." />

<RunSnippet method="eth_chainId" network="mainnet" title="eth_chainId · pacific-1" description="Mainnet RPC — decodes to 1329." />

Then add Sei testnet to your wallet and deploy a minimal `Counter.sol` from Remix — no `forge`, no install. In Remix: compile under **Solidity Compiler**, then **Deploy & Run** with **Environment** set to **Injected Provider — MetaMask**.

<AddSeiButton network="testnet" label="Add Sei testnet" />

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCi8vLyBAdGl0bGUgQ291bnRlciDigJQgbWluaW1hbCBjb250cmFjdCB0byBjb21waWxlICYgZGVwbG95IHRvIFNlaSB0ZXN0bmV0Lgpjb250cmFjdCBDb3VudGVyIHsKICAgIHVpbnQyNTYgcHVibGljIGNvdW50OwogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWwgeyBjb3VudCsrOyB9CiAgICBmdW5jdGlvbiBkZWNyZW1lbnQoKSBleHRlcm5hbCB7IGNvdW50LS07IH0KfQ"
title="Counter.sol · deploy to Sei testnet"
description="Remix IDE with a minimal Counter contract preloaded. Compile in-browser, then deploy to Sei testnet."
/>

## Table of Contents

Check warning on line 45 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L45

Use sentence case for headings: 'Table of Contents'.

- [Prerequisites](#prerequisites)
- [Setting Up Your Development Environment](#setting-up-your-development-environment)
Expand All @@ -36,7 +62,7 @@
- A wallet with SEI tokens for gas
- [Node.js](https://nodejs.org/) (v18.0.0 or later) for ethers.js interactions

## Setting Up Your Development Environment

Check warning on line 65 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L65

Use sentence case for headings: 'Setting Up Your Development Environment'.

First, let's install Foundry if you haven't already. Follow the [installation guide](https://book.getfoundry.sh/getting-started/installation) or use the quick install command:

Expand Down Expand Up @@ -90,7 +116,7 @@

<Warning>Add `.env` to your `.gitignore` file to prevent committing sensitive information such as your `PRIVATE_KEY` and potentially lose funds.</Warning>

## Using OpenZeppelin Contracts

Check warning on line 119 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L119

Use sentence case for headings: 'Using OpenZeppelin Contracts'.

OpenZeppelin provides a library of secure, tested smart contract components. Let's install OpenZeppelin contracts:

Expand All @@ -104,7 +130,7 @@
forge remappings > remappings.txt
```

## Creating and Deploying Smart Contracts

Check warning on line 133 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L133

Use sentence case for headings: 'Creating and Deploying Smart Contracts'.

Let's create different types of smart contracts. Choose from the tabs below based on what you want to build:

Expand Down Expand Up @@ -349,7 +375,7 @@
</Tab>
</Tabs>

## Testing Your Smart Contracts

Check warning on line 378 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L378

Use sentence case for headings: 'Testing Your Smart Contracts'.

Foundry provides excellent testing capabilities. Let's create comprehensive tests for our contracts.

Expand Down Expand Up @@ -552,11 +578,11 @@
forge test -vvv
```

## Deploying to Sei Testnet and Mainnet

Check warning on line 581 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L581

Use sentence case for headings: 'Deploying to Sei Testnet and Mainnet'.

Now let's deploy our contracts to the Sei networks. You can use either Forge scripts or direct deployment commands.

### Using Forge Scripts (Recommended)

Check warning on line 585 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L585

Use sentence case for headings: 'Using Forge Scripts (Recommended)'.

Deploy to Sei testnet:

Expand All @@ -570,7 +596,7 @@
forge script script/DeployCounter.s.sol --rpc-url $SEI_MAINNET_RPC --private-key $PRIVATE_KEY --broadcast
```

### Using Direct Forge Create Commands

Check warning on line 599 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L599

Use sentence case for headings: 'Using Direct Forge Create Commands'.

Alternatively, you can deploy directly:

Expand All @@ -595,11 +621,11 @@
Transaction hash: 0xYOUR_TX_HASH
```

## Interacting with Deployed Contracts

Check warning on line 624 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L624

Use sentence case for headings: 'Interacting with Deployed Contracts'.

Once deployed, you can interact with your contracts using Foundry's `cast` tool or ethers.js.

### Using Cast Commands

Check warning on line 628 in evm/evm-foundry.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-foundry.mdx#L628

Use sentence case for headings: 'Using Cast Commands'.

```bash
# Query the counter value
Expand Down
24 changes: 24 additions & 0 deletions evm/evm-general.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
description: "Comprehensive guide on Ethereum Virtual Machine (EVM) on Sei blockchain. Learn about smart contract languages, development tools, and best practices for building on Sei's parallelized EVM."
keywords: ['sei evm', 'ethereum virtual machine', 'smart contracts', 'solidity', 'vyper']
---

import { RunSnippet } from '/snippets/run-snippet.jsx';
import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

## Overview

The Ethereum Virtual Machine (EVM) is the runtime environment for smart
Expand All @@ -26,6 +31,25 @@
machine-readable instructions) and deployed to the EVM compatible network.
The EVM executes this bytecode.

## Try it: deploy without any setup

You don't need a local toolchain to ship a contract to Sei. First confirm the network is live, then compile and deploy a minimal `Counter.sol` to testnet straight from the browser.

<RunSnippet method="eth_chainId" network="testnet" title="eth_chainId · atlantic-2" description="Confirms the testnet RPC responds — decodes to 1328, the chain ID your tooling needs." />

<RunSnippet method="eth_chainId" network="mainnet" title="eth_chainId · pacific-1" description="Confirms the mainnet RPC responds — decodes to 1329." />

Add Sei testnet to your wallet, then deploy from Remix below — compile under **Solidity Compiler**, then **Deploy & Run** with **Environment** set to **Injected Provider — MetaMask**:

<AddSeiButton network="testnet" label="Add Sei testnet" />

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCi8vLyBAdGl0bGUgQ291bnRlciDigJQgbWluaW1hbCBjb250cmFjdCB0byBjb21waWxlICYgZGVwbG95IHRvIFNlaSB0ZXN0bmV0Lgpjb250cmFjdCBDb3VudGVyIHsKICAgIHVpbnQyNTYgcHVibGljIGNvdW50OwogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWwgeyBjb3VudCsrOyB9CiAgICBmdW5jdGlvbiBkZWNyZW1lbnQoKSBleHRlcm5hbCB7IGNvdW50LS07IH0KfQ"
title="Counter.sol · deploy to Sei testnet"
description="Remix IDE with a minimal Counter contract preloaded. Compile in-browser, then deploy to Sei testnet."
/>

## Smart contract languages

The two most popular languages for developing smart contracts on the EVM are
Expand All @@ -43,7 +67,7 @@
programming languages).
- Complex user-defined types.

#### Example solidity contract

Check warning on line 70 in evm/evm-general.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-general.mdx#L70

Use sentence case for headings: 'Example solidity contract'.

```solidity
// SPDX-License-Identifier: GPL-3.0
Expand Down Expand Up @@ -101,7 +125,7 @@
- Infinite-length loops
- Binary fixed points

#### Example Vyper contract

Check warning on line 128 in evm/evm-general.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-general.mdx#L128

Use sentence case for headings: 'Example Vyper contract'.

```python
# Open Auction
Expand Down
26 changes: 26 additions & 0 deletions evm/evm-hardhat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
description: 'Learn how to set up Hardhat for Sei EVM development, create and deploy smart contracts, and leverage OpenZeppelin components for secure, standardized implementations.'
keywords: ['hardhat', 'smart contracts', 'sei development', 'evm deployment', 'openzeppelin']
---

import { RunSnippet } from '/snippets/run-snippet.jsx';
import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

This tutorial will guide you through setting up Hardhat for Sei EVM development and using OpenZeppelin contracts to build secure, standardized smart contracts. We'll cover environment setup, contract creation, deployment, and show how to leverage OpenZeppelin's pre-built components.

<Info>Watch the video walkthrough for this topic in the [Video Tutorials](/evm/videos) section.</Info>
Expand All @@ -16,7 +21,28 @@

</Tip>

## Try it before you install

Setting up the full toolchain takes a few minutes. If you just want to see a contract deploy to Sei, you can do both of these right now in the browser.

First, confirm the RPC endpoints you'll put in `hardhat.config` respond:

<RunSnippet method="eth_chainId" network="testnet" title="eth_chainId · atlantic-2" description="Testnet RPC — decodes to 1328." />

<RunSnippet method="eth_chainId" network="mainnet" title="eth_chainId · pacific-1" description="Mainnet RPC — decodes to 1329." />

Then add Sei testnet to your wallet and deploy a minimal `Counter.sol` from Remix — no Node, no install. In Remix: compile under **Solidity Compiler**, then **Deploy & Run** with **Environment** set to **Injected Provider — MetaMask**.

<AddSeiButton network="testnet" label="Add Sei testnet" />

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCi8vLyBAdGl0bGUgQ291bnRlciDigJQgbWluaW1hbCBjb250cmFjdCB0byBjb21waWxlICYgZGVwbG95IHRvIFNlaSB0ZXN0bmV0Lgpjb250cmFjdCBDb3VudGVyIHsKICAgIHVpbnQyNTYgcHVibGljIGNvdW50OwogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWwgeyBjb3VudCsrOyB9CiAgICBmdW5jdGlvbiBkZWNyZW1lbnQoKSBleHRlcm5hbCB7IGNvdW50LS07IH0KfQ"
title="Counter.sol · deploy to Sei testnet"
description="Remix IDE with a minimal Counter contract preloaded. Compile in-browser, then deploy to Sei testnet."
/>

## Table of Contents

Check warning on line 45 in evm/evm-hardhat.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-hardhat.mdx#L45

Use sentence case for headings: 'Table of Contents'.

- [Prerequisites](#prerequisites)
- [Setting Up Your Development Environment](#setting-up-your-development-environment)
Expand All @@ -34,7 +60,7 @@
- [npm](https://www.npmjs.com/) (v7.0.0 or later) or [yarn](https://yarnpkg.com/)
- A code editor (VS Code recommended)

## Setting Up Your Development Environment

Check warning on line 63 in evm/evm-hardhat.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-hardhat.mdx#L63

Use sentence case for headings: 'Setting Up Your Development Environment'.

Let's create a new project and set up Hardhat:

Expand Down Expand Up @@ -123,11 +149,11 @@

<Warning>Use a dedicated, throwaway deploy key funded with only what you need — never a personal wallet holding real funds.</Warning>

## Using OpenZeppelin Contracts

Check warning on line 152 in evm/evm-hardhat.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-hardhat.mdx#L152

Use sentence case for headings: 'Using OpenZeppelin Contracts'.

OpenZeppelin provides a library of secure, tested smart contract components that you can use to build your applications. The `@openzeppelin/contracts` package was already installed during setup, so you're ready to import its contracts directly.

## Creating and Deploying an ERC20 Token, ERC721 NFT or an Upgradeable UUPS Token

Check warning on line 156 in evm/evm-hardhat.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-hardhat.mdx#L156

Use sentence case for headings: 'Creating and Deploying an ERC20 Token, ERC721 NFT or an Upgradeable UUPS Token'.

<Tabs>
<Tab title="ERC20">
Expand Down Expand Up @@ -492,7 +518,7 @@
</Tab>
</Tabs>

## Testing Your Smart Contracts

Check warning on line 521 in evm/evm-hardhat.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-hardhat.mdx#L521

Use sentence case for headings: 'Testing Your Smart Contracts'.

Hardhat makes it easy to test your contracts before deploying them. Create a test file `test/sei-token-test.ts`:

Expand Down Expand Up @@ -576,7 +602,7 @@
npx hardhat test
```

## Deploying to Sei Testnet and Mainnet

Check warning on line 605 in evm/evm-hardhat.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-hardhat.mdx#L605

Use sentence case for headings: 'Deploying to Sei Testnet and Mainnet'.

Once you've tested your contracts, you can deploy them to the Sei testnet or mainnet. To deploy, you'll need:

Expand Down
20 changes: 20 additions & 0 deletions evm/evm-parity/examples/deploy-verify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,30 @@
description: 'Deploying and verifying smart contracts on Sei with viem, ethers, Foundry, and Hardhat'
---

import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

Sei is EVM-compatible — standard deployment tooling works without modification. This page covers deploying a contract and verifying its source on the Sei block explorer.

For a deeper look at verification options (Remix, Sourcify UI, batch verification), see the [Verify Contracts](/evm/evm-verify-contracts) page.

## Deploy from your browser (Remix)

No local toolchain required — compile and deploy a contract to Sei testnet straight from the browser. The Remix sandbox below preloads a minimal `Counter.sol`.

First, add Sei testnet to your wallet:

<AddSeiButton network="testnet" label="Add Sei testnet" />

Then in Remix: compile under the **Solidity Compiler** tab, open **Deploy & Run**, set **Environment** to **Injected Provider — MetaMask** (or **External HTTP Provider** pointed at `https://evm-rpc-testnet.sei-apis.com`), and click **Deploy**. Sei has instant finality, so the deployment confirms in well under a second.

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCi8vLyBAdGl0bGUgQ291bnRlciDigJQgbWluaW1hbCBjb250cmFjdCB0byBjb21waWxlICYgZGVwbG95IHRvIFNlaSB0ZXN0bmV0Lgpjb250cmFjdCBDb3VudGVyIHsKICAgIHVpbnQyNTYgcHVibGljIGNvdW50OwogICAgZnVuY3Rpb24gaW5jcmVtZW50KCkgZXh0ZXJuYWwgeyBjb3VudCsrOyB9CiAgICBmdW5jdGlvbiBkZWNyZW1lbnQoKSBleHRlcm5hbCB7IGNvdW50LS07IH0KfQ"
title="Counter.sol · deploy to Sei testnet"
description="Remix IDE with a minimal Counter contract preloaded. Compile in-browser, then deploy to Sei testnet."
/>

## Deploying with viem or ethers

<CodeGroup>
Expand Down Expand Up @@ -115,7 +135,7 @@
npx hardhat ignition deploy ignition/modules/MyContract.ts --network sei
```

## Verifying Contracts

Check warning on line 138 in evm/evm-parity/examples/deploy-verify.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/deploy-verify.mdx#L138

Use sentence case for headings: 'Verifying Contracts'.

Sei's block explorer is [Seiscan](https://seiscan.io). The recommended verification method is [Sourcify](https://sourcify.dev/) — no API key required.

Expand Down Expand Up @@ -192,7 +212,7 @@

Running `npx hardhat verify` without the `sourcify` subtask attempts verification on all enabled providers (Etherscan, Blockscout, and Sourcify) in a single run.

## Network Reference

Check warning on line 215 in evm/evm-parity/examples/deploy-verify.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/deploy-verify.mdx#L215

Use sentence case for headings: 'Network Reference'.

| Network | Chain ID | RPC | Explorer |
| --- | --- | --- | --- |
Expand Down
20 changes: 20 additions & 0 deletions evm/evm-parity/examples/erc1155.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,30 @@
description: 'Reading and writing ERC-1155 multi-token contracts on Sei with viem and ethers'
---

import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

# ERC-1155 Interaction

Check warning on line 9 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L9

Use sentence case for headings: 'ERC-1155 Interaction'.

ERC-1155 is the multi-token standard — a single contract can hold both fungible tokens (like gold coins in a game) and non-fungible tokens (like unique items), with efficient batch operations built in. Standard ERC-1155 contracts work on Sei without modification.

## Try it: deploy an ERC-1155

Compile and deploy a real ERC-1155 to Sei testnet from the browser — the Remix sandbox preloads an OpenZeppelin-based `DemoMultiToken` with a public `mint(id, amount)`. Then point the read/write patterns below at your deployed address.

First, add Sei testnet to your wallet:

<AddSeiButton network="testnet" label="Add Sei testnet" />

In Remix, compile under **Solidity Compiler**, then **Deploy & Run** with **Environment** set to **Injected Provider — MetaMask** (or **External HTTP Provider** at `https://evm-rpc-testnet.sei-apis.com`).

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCmltcG9ydCAiQG9wZW56ZXBwZWxpbi9jb250cmFjdHMvdG9rZW4vRVJDMTE1NS9FUkMxMTU1LnNvbCI7Cgpjb250cmFjdCBEZW1vTXVsdGlUb2tlbiBpcyBFUkMxMTU1IHsKICAgIHVpbnQyNTYgcHVibGljIGNvbnN0YW50IEdPTEQgPSAwOwogICAgdWludDI1NiBwdWJsaWMgY29uc3RhbnQgU0lMVkVSID0gMTsKICAgIGNvbnN0cnVjdG9yKCkgRVJDMTE1NSgiaHR0cHM6Ly9leGFtcGxlLmNvbS9hcGkvaXRlbS97aWR9Lmpzb24iKSB7fQogICAgZnVuY3Rpb24gbWludCh1aW50MjU2IGlkLCB1aW50MjU2IGFtb3VudCkgZXh0ZXJuYWwgeyBfbWludChtc2cuc2VuZGVyLCBpZCwgYW1vdW50LCAiIik7IH0KfQo"
title="DemoMultiToken (ERC-1155) · deploy to Sei testnet"
description="Remix IDE with an OpenZeppelin ERC-1155 preloaded. Compile in-browser and deploy to Sei testnet."
/>

## Setup

<CodeGroup>
Expand Down Expand Up @@ -60,7 +80,7 @@

</CodeGroup>

## Reading a Single Balance

Check warning on line 83 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L83

Use sentence case for headings: 'Reading a Single Balance'.

<CodeGroup>

Expand All @@ -79,7 +99,7 @@

</CodeGroup>

## Batch Balance Query

Check warning on line 102 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L102

Use sentence case for headings: 'Batch Balance Query'.

`balanceOfBatch` retrieves multiple owner/ID pairs in one call — the most efficient way to load a user's inventory:

Expand Down Expand Up @@ -107,7 +127,7 @@

</CodeGroup>

## Reading Token Metadata URI

Check warning on line 130 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L130

Use sentence case for headings: 'Reading Token Metadata URI'.

```ts viem
const uri = await client.readContract({
Expand All @@ -120,7 +140,7 @@
const resolvedUri = uri.replace('{id}', (1n).toString(16).padStart(64, '0'));
```

## Transferring a Single Token

Check warning on line 143 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L143

Use sentence case for headings: 'Transferring a Single Token'.

<CodeGroup>

Expand All @@ -142,7 +162,7 @@

</CodeGroup>

## Batch Transfer

Check warning on line 165 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L165

Use sentence case for headings: 'Batch Transfer'.

Send multiple token IDs in a single transaction:

Expand Down Expand Up @@ -175,7 +195,7 @@

</CodeGroup>

## Operator Approval

Check warning on line 198 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L198

Use sentence case for headings: 'Operator Approval'.

<CodeGroup>

Expand Down Expand Up @@ -205,7 +225,7 @@

</CodeGroup>

## Watching Transfer Events

Check warning on line 228 in evm/evm-parity/examples/erc1155.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc1155.mdx#L228

Use sentence case for headings: 'Watching Transfer Events'.

<CodeGroup>

Expand Down
20 changes: 20 additions & 0 deletions evm/evm-parity/examples/erc20.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,30 @@
description: 'Reading and writing ERC-20 tokens on Sei with viem and ethers'
---

import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

# ERC-20 Interaction

Check warning on line 9 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L9

Use sentence case for headings: 'ERC-20 Interaction'.

Standard ERC-20 contracts work on Sei without modification. This page covers the common read and write operations using viem and ethers.

## Try it: deploy an ERC-20

Compile and deploy a real ERC-20 to Sei testnet from the browser — the Remix sandbox preloads an OpenZeppelin-based `DemoToken`. Then point the read/write patterns below at your deployed address.

First, add Sei testnet to your wallet:

<AddSeiButton network="testnet" label="Add Sei testnet" />

In Remix, compile under **Solidity Compiler**, then **Deploy & Run** with **Environment** set to **Injected Provider — MetaMask** (or **External HTTP Provider** at `https://evm-rpc-testnet.sei-apis.com`).

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCmltcG9ydCAiQG9wZW56ZXBwZWxpbi9jb250cmFjdHMvdG9rZW4vRVJDMjAvRVJDMjAuc29sIjsKCmNvbnRyYWN0IERlbW9Ub2tlbiBpcyBFUkMyMCB7CiAgICBjb25zdHJ1Y3RvcigpIEVSQzIwKCJEZW1vIFRva2VuIiwgIkRFTU8iKSB7CiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgMV8wMDBfMDAwICogMTAgKiogZGVjaW1hbHMoKSk7CiAgICB9Cn0"
title="DemoToken (ERC-20) · deploy to Sei testnet"
description="Remix IDE with an OpenZeppelin ERC-20 preloaded. Compile in-browser and deploy to Sei testnet."
/>

## Setup

<CodeGroup>
Expand Down Expand Up @@ -64,7 +84,7 @@

</CodeGroup>

## Reading Token Metadata

Check warning on line 87 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L87

Use sentence case for headings: 'Reading Token Metadata'.

<CodeGroup>

Expand All @@ -88,7 +108,7 @@

</CodeGroup>

## Reading Balances and Allowances

Check warning on line 111 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L111

Use sentence case for headings: 'Reading Balances and Allowances'.

<CodeGroup>

Expand All @@ -115,7 +135,7 @@

</CodeGroup>

## Transferring Tokens

Check warning on line 138 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L138

Use sentence case for headings: 'Transferring Tokens'.

<CodeGroup>

Expand All @@ -139,7 +159,7 @@

</CodeGroup>

## Approving a Spender

Check warning on line 162 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L162

Use sentence case for headings: 'Approving a Spender'.

<CodeGroup>

Expand Down Expand Up @@ -173,7 +193,7 @@

</CodeGroup>

## Watching Transfer Events

Check warning on line 196 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L196

Use sentence case for headings: 'Watching Transfer Events'.

<CodeGroup>

Expand Down Expand Up @@ -204,7 +224,7 @@

</CodeGroup>

## Fetching Historical Transfers

Check warning on line 227 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L227

Use sentence case for headings: 'Fetching Historical Transfers'.

<CodeGroup>

Expand All @@ -225,6 +245,6 @@

</CodeGroup>

## CosmWasm Token Compatibility

Check warning on line 248 in evm/evm-parity/examples/erc20.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc20.mdx#L248

Use sentence case for headings: 'CosmWasm Token Compatibility'.

CW20 tokens on Sei have ERC-20 pointer contracts that expose the standard ERC-20 interface. You can use all of the patterns above against a CW20 pointer address. See [Pointer Contracts](/evm/evm-parity/examples/pointer-contracts) for how to look up the pointer address.
20 changes: 20 additions & 0 deletions evm/evm-parity/examples/erc721.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,30 @@
description: 'Reading and writing ERC-721 NFTs on Sei with viem and ethers'
---

import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';
import { AddSeiButton } from '/snippets/add-sei-button.jsx';

# ERC-721 Interaction

Check warning on line 9 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L9

Use sentence case for headings: 'ERC-721 Interaction'.

Standard ERC-721 contracts work on Sei without modification. This page covers reading token ownership, transferring NFTs, and managing approvals.

## Try it: deploy an ERC-721

Compile and deploy a real ERC-721 to Sei testnet from the browser — the Remix sandbox preloads an OpenZeppelin-based `DemoNFT` with a public `mint()`. Then point the patterns below at your deployed address.

First, add Sei testnet to your wallet:

<AddSeiButton network="testnet" label="Add Sei testnet" />

In Remix, compile under **Solidity Compiler**, then **Deploy & Run** with **Environment** set to **Injected Provider — MetaMask** (or **External HTTP Provider** at `https://evm-rpc-testnet.sei-apis.com`).

<SandboxEmbed
kind="remix"
src="https://remix.ethereum.org/?#activate=solidity,fileManager&code=Ly8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IE1JVApwcmFnbWEgc29saWRpdHkgXjAuOC4yNDsKCmltcG9ydCAiQG9wZW56ZXBwZWxpbi9jb250cmFjdHMvdG9rZW4vRVJDNzIxL0VSQzcyMS5zb2wiOwoKY29udHJhY3QgRGVtb05GVCBpcyBFUkM3MjEgewogICAgdWludDI1NiBwdWJsaWMgbmV4dElkOwogICAgY29uc3RydWN0b3IoKSBFUkM3MjEoIkRlbW8gTkZUIiwgIkRORlQiKSB7fQogICAgZnVuY3Rpb24gbWludCgpIGV4dGVybmFsIHsgX3NhZmVNaW50KG1zZy5zZW5kZXIsIG5leHRJZCsrKTsgfQp9"
title="DemoNFT (ERC-721) · deploy to Sei testnet"
description="Remix IDE with an OpenZeppelin ERC-721 preloaded. Compile in-browser and deploy to Sei testnet."
/>

## Setup

<CodeGroup>
Expand Down Expand Up @@ -70,7 +90,7 @@

</CodeGroup>

## Reading Token Data

Check warning on line 93 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L93

Use sentence case for headings: 'Reading Token Data'.

<CodeGroup>

Expand All @@ -96,7 +116,7 @@

</CodeGroup>

## Checking Ownership Count

Check warning on line 119 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L119

Use sentence case for headings: 'Checking Ownership Count'.

<CodeGroup>

Expand Down Expand Up @@ -137,7 +157,7 @@

</CodeGroup>

## Approving a Single Token

Check warning on line 160 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L160

Use sentence case for headings: 'Approving a Single Token'.

<CodeGroup>

Expand All @@ -156,7 +176,7 @@

</CodeGroup>

## Approving All Tokens (Operator)

Check warning on line 179 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L179

Use sentence case for headings: 'Approving All Tokens (Operator)'.

<CodeGroup>

Expand Down Expand Up @@ -188,7 +208,7 @@

</CodeGroup>

## Watching Transfer Events

Check warning on line 211 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L211

Use sentence case for headings: 'Watching Transfer Events'.

<CodeGroup>

Expand Down Expand Up @@ -219,6 +239,6 @@

</CodeGroup>

## CosmWasm NFT Compatibility

Check warning on line 242 in evm/evm-parity/examples/erc721.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/erc721.mdx#L242

Use sentence case for headings: 'CosmWasm NFT Compatibility'.

CW721 tokens on Sei have ERC-721 pointer contracts that expose the standard ERC-721 interface. You can use all of the patterns above against a CW721 pointer address. See [Pointer Contracts](/evm/evm-parity/examples/pointer-contracts) for how to look up the pointer address.
22 changes: 22 additions & 0 deletions evm/evm-parity/examples/error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,33 @@
description: 'Decode contract reverts, handle wallet rejections, and recover from RPC errors in Sei apps'
---

import { RunSnippet } from '/snippets/run-snippet.jsx';

# Error Handling

Check warning on line 8 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L8

Use sentence case for headings: 'Error Handling'.

Most transaction failures fall into three categories: contract reverts, wallet rejections, and RPC errors. This page shows how to decode each type and respond correctly.

## Try it: see real errors

The `RunSnippet` widget surfaces whatever the RPC returns — including failures. These two calls fail on purpose so you can see the exact error shape your code has to handle, live against Sei mainnet.

<RunSnippet
method="eth_call"
params={[{ to: '0xcA11bde05977b3631167028862bE2a173976CA11', data: '0xdeadbeef' }, 'latest']}
network="mainnet"
title="A contract revert"
description="Calls an unknown selector (0xdeadbeef) on Multicall3. The node rejects it with execution reverted — the same class of failure as the Contract Reverts section below."
/>

<RunSnippet
method="eth_getBalance"
params={['0x123', 'latest']}
network="mainnet"
title="An RPC argument error"
description="A malformed address (0x123) triggers a JSON-RPC -32602 invalid argument error — distinct from a revert, and the kind of failure the RPC Errors and Retries section below handles."
/>

## Contract Reverts

Check warning on line 32 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L32

Use sentence case for headings: 'Contract Reverts'.

When a transaction reverts, the error contains the revert reason if the contract provides one.

Expand Down Expand Up @@ -55,7 +77,7 @@

</CodeGroup>

## Simulating Before Sending

Check warning on line 80 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L80

Use sentence case for headings: 'Simulating Before Sending'.

Always simulate write calls before submitting them. Simulation runs the call against current chain state and surfaces reverts before you spend gas:

Expand All @@ -70,7 +92,7 @@
}
```

## Wallet Rejections

Check warning on line 95 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L95

Use sentence case for headings: 'Wallet Rejections'.

Users can reject signature and transaction requests. These rejections have a predictable error code:

Expand Down Expand Up @@ -101,7 +123,7 @@

</CodeGroup>

## Insufficient Funds

Check warning on line 126 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L126

Use sentence case for headings: 'Insufficient Funds'.

<CodeGroup>

Expand Down Expand Up @@ -129,7 +151,7 @@

</CodeGroup>

## Classifying Any Error

Check warning on line 154 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L154

Use sentence case for headings: 'Classifying Any Error'.

A utility to handle the most common cases in one place:

Expand All @@ -156,7 +178,7 @@
}
```

## RPC Errors and Retries

Check warning on line 181 in evm/evm-parity/examples/error-handling.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/error-handling.mdx#L181

Use sentence case for headings: 'RPC Errors and Retries'.

Transient RPC failures (network timeouts, rate limits) can be retried. Don't retry on contract reverts or user rejections — those are deterministic.

Expand Down
28 changes: 28 additions & 0 deletions evm/evm-parity/examples/ethers-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
description: 'Using ethers v6 with Sei in a Node.js script or browser context'
---

import { RunSnippet } from '/snippets/run-snippet.jsx';
import { SandboxEmbed } from '/snippets/sandbox-embed.jsx';

# ethers v6 Quickstart

Check warning on line 9 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L9

Use sentence case for headings: 'ethers v6 Quickstart'.

This example covers ethers v6 with Sei. The patterns apply whether you are writing a Node.js script, a CLI tool, or a browser app.

Expand All @@ -19,7 +22,7 @@
npx tsx script.ts
```

## Read-Only Provider

Check warning on line 25 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L25

Use sentence case for headings: 'Read-Only Provider'.

```ts
import { ethers } from 'ethers';
Expand All @@ -27,7 +30,7 @@
const provider = new ethers.JsonRpcProvider('https://evm-rpc.sei-apis.com');
```

## Reading Chain Data

Check warning on line 33 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L33

Use sentence case for headings: 'Reading Chain Data'.

This is the first milestone — it needs no private key.

Expand Down Expand Up @@ -55,7 +58,32 @@

The exact numbers are illustrative — your block number and balance will differ. `getBlockNumber()` and `getTransactionCount()` return a `number`, while `getBalance()` returns a `bigint` in wei (format it with `ethers.formatEther()`).

## Try It Live

Check warning on line 61 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L61

Use sentence case for headings: 'Try It Live'.

Check warning on line 61 in evm/evm-parity/examples/ethers-quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] evm/evm-parity/examples/ethers-quickstart.mdx#L61

[Sei.Headings] Use sentence case for headings: 'Try It Live'.
Raw output
{"message": "[Sei.Headings] Use sentence case for headings: 'Try It Live'.", "location": {"path": "evm/evm-parity/examples/ethers-quickstart.mdx", "range": {"start": {"line": 61, "column": 4}}}, "severity": "WARNING"}

Run these read-only calls against Sei mainnet right now — no install, no private key. They're plain JSON-RPC, the same reads the script above performs.

<RunSnippet method="eth_blockNumber" network="mainnet" title="eth_blockNumber" />

<RunSnippet
method="eth_getBalance"
params={["0x0000000000000000000000000000000000000000", "latest"]}
network="mainnet"
title="eth_getBalance"
description="Balance in wei of the example address at the latest block — swap in any address."
/>

## Edit and run

Edit and re-run the full ethers code from this page live in the browser — a real ethers v6 `JsonRpcProvider` reading Sei testnet:

<SandboxEmbed
kind="codesandbox"
src="https://codesandbox.io/embed/qs82lw?view=split&hidenavigation=1&theme=dark"
title="ethers · read Sei testnet"
description="A real ethers v6 provider reading Sei testnet (atlantic-2). Edit index.js and the preview re-runs."
/>

## Browser Provider

Check warning on line 86 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L86

Use sentence case for headings: 'Browser Provider'.

In a browser context, connect to the user's injected wallet:

Expand All @@ -65,7 +93,7 @@
const address = await signer.getAddress();
```

## Wallet from Private Key

Check warning on line 96 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L96

Use sentence case for headings: 'Wallet from Private Key'.

For scripts and backend services:

Expand All @@ -73,7 +101,7 @@
const wallet = new ethers.Wallet('0xYourPrivateKey', provider);
```

## Sending a Transaction

Check warning on line 104 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L104

Use sentence case for headings: 'Sending a Transaction'.

Next step — this requires a funded account; get testnet SEI from the [faucet](/learn/faucet).

Expand All @@ -87,7 +115,7 @@
// receipt is final immediately — Sei has instant finality
```

## Reading a Contract

Check warning on line 118 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L118

Use sentence case for headings: 'Reading a Contract'.

```ts
const abi = ['function balanceOf(address owner) view returns (uint256)'];
Expand All @@ -96,7 +124,7 @@
const balance = await contract.balanceOf('0xYourAddress');
```

## Writing to a Contract

Check warning on line 127 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L127

Use sentence case for headings: 'Writing to a Contract'.

Pass a signer (wallet or browser signer) to the contract constructor for write operations:

Expand All @@ -107,7 +135,7 @@
const receipt = await tx.wait();
```

## Estimating Gas

Check warning on line 138 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L138

Use sentence case for headings: 'Estimating Gas'.

```ts
const gas = await provider.estimateGas({
Expand All @@ -117,7 +145,7 @@
});
```

## Listening for Events

Check warning on line 148 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L148

Use sentence case for headings: 'Listening for Events'.

```ts
contract.on('Transfer', (from, to, value) => {
Expand All @@ -128,7 +156,7 @@
contract.off('Transfer');
```

## Next Steps

Check warning on line 159 in evm/evm-parity/examples/ethers-quickstart.mdx

View check run for this annotation

Mintlify / Mintlify Validation (seilabs) - vale-spellcheck

evm/evm-parity/examples/ethers-quickstart.mdx#L159

Use sentence case for headings: 'Next Steps'.

- [Python quickstart (web3.py)](/evm/python-quickstart) — the same first steps in Python
- [ERC-20 interaction](/evm/evm-parity/examples/erc20) — full token read/write examples
Expand Down
Loading
Loading