From 9e2c32d8e1b79686fbc0fc775c556fb896df91f4 Mon Sep 17 00:00:00 2001 From: alexander-sei Date: Sat, 30 May 2026 15:45:40 +0300 Subject: [PATCH] docs: improve agent and developer onboarding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improvements surfaced by an AI-agent documentation scan: - learn/dev-chains: list EVM RPC, WebSocket, and explorer endpoints in plain text (they were previously only rendered inside a JS widget, so non-JS readers and agents couldn't see them) - evm/index: replace the RPC-selector iframe with a native endpoint table so endpoints are readable without executing JavaScript - evm/transactions: fix the web3.js "send a transaction" sample to sign locally and broadcast the raw transaction — public RPC endpoints don't expose node-managed accounts, so getAccounts()/eth_sendTransaction can't run as written - evm/evm-parity/examples/{ethers,viem}-quickstart: show expected stdout and add a Python (web3.py) snippet - evm/building-a-frontend: link the contract-deploy step where TOKEN_CONTRACT_ADDRESS is introduced - docs.json: redirect /learn/getting-started and /evm/getting-started to /learn Co-Authored-By: Claude Opus 4.8 --- docs.json | 10 ++++ evm/building-a-frontend.mdx | 4 +- evm/evm-parity/examples/ethers-quickstart.mdx | 51 ++++++++++++++++-- evm/evm-parity/examples/viem-quickstart.mdx | 53 +++++++++++++++++-- evm/index.mdx | 29 +++++++--- evm/transactions.mdx | 44 +++++++-------- learn/dev-chains.mdx | 6 +++ 7 files changed, 158 insertions(+), 39 deletions(-) diff --git a/docs.json b/docs.json index 2fb505b..63f1057 100644 --- a/docs.json +++ b/docs.json @@ -504,6 +504,16 @@ "prompt": "Search the Sei docs..." }, "redirects": [ + { + "source": "/learn/getting-started", + "destination": "/learn", + "permanent": true + }, + { + "source": "/evm/getting-started", + "destination": "/learn", + "permanent": true + }, { "source": "/evm/ai-tooling/mcp-server", "destination": "/ai/mcp-server", diff --git a/evm/building-a-frontend.mdx b/evm/building-a-frontend.mdx index ca6b4fd..6886ee4 100644 --- a/evm/building-a-frontend.mdx +++ b/evm/building-a-frontend.mdx @@ -102,7 +102,7 @@ touch src/wagmi.ts ## Defining the ERC20 Contract Details -Make sure to deploy your ERC20 token contract first and replace `TOKEN_CONTRACT_ADDRESS` in the constants file with your actual deployed contract address, and update the RPC URL in the Sei chain configuration. You can find a list of existing ERC20 contracts on Sei Mainnet here: [Sei Assets](https://seiscan.io/tokens) +Make sure to deploy your ERC20 token contract first — for example with [Hardhat](/evm/evm-hardhat) or [Foundry](/evm/evm-foundry), or generate one with the [contract wizard](/evm/evm-wizard) (see also [deploy & verify](/evm/evm-parity/examples/deploy-verify)) — and replace `TOKEN_CONTRACT_ADDRESS` in the constants file with your actual deployed contract address, and update the RPC URL in the Sei chain configuration. You can find a list of existing ERC20 contracts on Sei Mainnet here: [Sei Assets](https://seiscan.io/tokens) Let's create a shared constants file for our project: @@ -218,7 +218,7 @@ export const ERC20_ABI = [ } ]; -// TODO: Replace with your deployed ERC20 token contract address +// TODO: Deploy an ERC-20 (see /evm/evm-hardhat or /evm/evm-foundry) and paste its address here export const TOKEN_CONTRACT_ADDRESS = '0xYourTokenContractAddress'; ``` diff --git a/evm/evm-parity/examples/ethers-quickstart.mdx b/evm/evm-parity/examples/ethers-quickstart.mdx index aba4972..c0e34a0 100644 --- a/evm/evm-parity/examples/ethers-quickstart.mdx +++ b/evm/evm-parity/examples/ethers-quickstart.mdx @@ -23,16 +23,29 @@ const provider = new ethers.JsonRpcProvider('https://evm-rpc.sei-apis.com'); ## Reading Chain Data +This is the first milestone — it needs no private key. + ```ts -const blockNumber = await provider.getBlockNumber(); +const blockNumber = await provider.getBlockNumber(); // number +console.log('Block number:', blockNumber); + +const balance = await provider.getBalance('0xYourAddress'); // bigint, wei +console.log('Balance (SEI):', ethers.formatEther(balance)); -const block = await provider.getBlock('latest'); +const nonce = await provider.getTransactionCount('0xYourAddress'); // number +console.log('Nonce:', nonce); +``` -const balance = await provider.getBalance('0xYourAddress'); +**You're done when you see:** -const nonce = await provider.getTransactionCount('0xYourAddress'); +```text +Block number: 148203117 +Balance (SEI): 12.5 +Nonce: 7 ``` +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()`). + ## Browser Provider In a browser context, connect to the user's injected wallet: @@ -53,6 +66,8 @@ const wallet = new ethers.Wallet('0xYourPrivateKey', provider); ## Sending a Transaction +Next step — this requires a funded account; get testnet SEI from the [faucet](/learn/faucet). + ```ts const tx = await wallet.sendTransaction({ to: '0xRecipient', @@ -104,6 +119,34 @@ contract.on('Transfer', (from, to, value) => { contract.off('Transfer'); ``` +## Using Python (web3.py) + +Sei is fully EVM-compatible, so any standard Ethereum client works — including Python's [web3.py](https://web3py.readthedocs.io). + +```bash +pip install web3 +``` + +```python +from web3 import Web3 + +w3 = Web3(Web3.HTTPProvider("https://evm-rpc.sei-apis.com")) + +print("Connected:", w3.is_connected()) +print("Latest block:", w3.eth.block_number) +print("Chain ID:", w3.eth.chain_id) # 1329 +``` + +**You're done when you see:** + +```text +Connected: True +Latest block: 148203117 +Chain ID: 1329 +``` + +The block number is illustrative; the chain ID is always `1329` on mainnet. + ## Next Steps - [ERC-20 interaction](/evm/evm-parity/examples/erc20) — full token read/write examples diff --git a/evm/evm-parity/examples/viem-quickstart.mdx b/evm/evm-parity/examples/viem-quickstart.mdx index de3a56a..0a5bba0 100644 --- a/evm/evm-parity/examples/viem-quickstart.mdx +++ b/evm/evm-parity/examples/viem-quickstart.mdx @@ -38,16 +38,31 @@ const client = createPublicClient({ ## Reading Chain Data +This is the first milestone — it needs no private key. + ```ts -const blockNumber = await client.getBlockNumber(); +import { formatEther } from 'viem'; -const block = await client.getBlock({ blockTag: 'latest' }); +const blockNumber = await client.getBlockNumber(); // bigint +console.log('Block number:', blockNumber); -const balance = await client.getBalance({ address: '0xYourAddress' }); +const balance = await client.getBalance({ address: '0xYourAddress' }); // bigint, wei +console.log('Balance (SEI):', formatEther(balance)); -const nonce = await client.getTransactionCount({ address: '0xYourAddress' }); +const nonce = await client.getTransactionCount({ address: '0xYourAddress' }); // number +console.log('Nonce:', nonce); ``` +**You're done when you see:** + +```text +Block number: 148203117n +Balance (SEI): 12.5 +Nonce: 7 +``` + +The exact numbers are illustrative — your block number and balance will differ. Note the trailing `n`: `getBlockNumber()` and `getBalance()` return `bigint`, while `getTransactionCount()` returns a `number`. + ## Wallet Client A wallet client handles signing and broadcasting transactions. @@ -70,6 +85,8 @@ For browser use, replace `http()` with `custom(window.ethereum)` and call `walle ## Sending a Transaction +Next step — this requires a funded account; get testnet SEI from the [faucet](/learn/faucet). + ```ts import { parseEther } from 'viem'; @@ -137,6 +154,34 @@ const gas = await client.estimateGas({ }); ``` +## Using Python (web3.py) + +Sei is fully EVM-compatible, so any standard Ethereum client works — including Python's [web3.py](https://web3py.readthedocs.io). + +```bash +pip install web3 +``` + +```python +from web3 import Web3 + +w3 = Web3(Web3.HTTPProvider("https://evm-rpc.sei-apis.com")) + +print("Connected:", w3.is_connected()) +print("Latest block:", w3.eth.block_number) +print("Chain ID:", w3.eth.chain_id) # 1329 +``` + +**You're done when you see:** + +```text +Connected: True +Latest block: 148203117 +Chain ID: 1329 +``` + +The block number is illustrative; the chain ID is always `1329` on mainnet. + ## Next Steps - [ERC-20 interaction](/evm/evm-parity/examples/erc20) — full token read/write examples diff --git a/evm/index.mdx b/evm/index.mdx index c8dd343..60f4f98 100644 --- a/evm/index.mdx +++ b/evm/index.mdx @@ -74,11 +74,26 @@ keywords: ["sei evm", "ethereum virtual machine", "web3 development", "blockchai ## RPC Endpoints -Choose from official Sei Foundation endpoints or community-maintained alternatives. All endpoints support standard EVM JSON-RPC methods. Public endpoints have rate limits—for production apps, consider using a dedicated RPC provider or running your own node. +Choose from official Sei Foundation endpoints or community-maintained alternatives. All endpoints support standard EVM JSON-RPC methods. Public endpoints have rate limits — for production apps, use a [dedicated RPC provider](/learn/rpc-providers) or [run your own node](/node). -