From 71fab4ed61f8418058a42300e0589d238d1dd65b Mon Sep 17 00:00:00 2001 From: monty-sei Date: Thu, 14 May 2026 10:16:27 +1000 Subject: [PATCH 1/5] Add EVM parity planning docs --- docs/docs.json | 11 +++++ docs/evm-parity/issue-sla.mdx | 54 ++++++++++++++++++++ docs/evm-parity/matrix.json | 68 +++++++++++++++++++++++++ docs/evm-parity/matrix.mdx | 57 +++++++++++++++++++++ docs/evm-parity/plan.mdx | 77 +++++++++++++++++++++++++++++ docs/evm-parity/rpc-conformance.mdx | 65 ++++++++++++++++++++++++ 6 files changed, 332 insertions(+) create mode 100644 docs/evm-parity/issue-sla.mdx create mode 100644 docs/evm-parity/matrix.json create mode 100644 docs/evm-parity/matrix.mdx create mode 100644 docs/evm-parity/plan.mdx create mode 100644 docs/evm-parity/rpc-conformance.mdx diff --git a/docs/docs.json b/docs/docs.json index 4463fc077..ae41cfdc0 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -81,6 +81,17 @@ } ] }, + { + "dropdown": "EVM Parity", + "description": "Compatibility matrix and execution plan", + "icon": "check-double", + "pages": [ + { + "group": "Program", + "pages": ["evm-parity/plan", "evm-parity/matrix", "evm-parity/rpc-conformance", "evm-parity/issue-sla"] + } + ] + }, { "dropdown": "@sei-js/sei-global-wallet", "description": "User friendly wallet connect", diff --git a/docs/evm-parity/issue-sla.mdx b/docs/evm-parity/issue-sla.mdx new file mode 100644 index 000000000..aad597d10 --- /dev/null +++ b/docs/evm-parity/issue-sla.mdx @@ -0,0 +1,54 @@ +--- +title: 'Issue SLA' +description: 'Compatibility issue triage and aging rules for EVM parity work' +icon: 'stopwatch' +--- + +# Issue SLA + +The operational target is simple: no open GitHub issue tagged `evm-compat` should be older than 14 days. + +## Label + +Use `evm-compat` for reports where a developer expected standard EVM behavior through viem, wagmi, ethers, wallet connectors, JSON-RPC, or common ERC/token flows. + +## Required Triage Fields + +Each issue should include: + +- Library or tool: viem, wagmi, ethers, wallet connector, RPC, template, docs, or other +- Network: mainnet, testnet, devnet, local, or unknown +- Expected EVM behavior +- Observed Sei behavior +- Minimal reproduction +- Error output or transaction hash when available +- Classification: SDK gap, network issue, upstream issue, docs issue, or intentional divergence + +## Aging Rules + +| Age | Required action | +| --- | --- | +| 0-2 days | Confirm scope, request missing reproduction details, and add classification. | +| 3-7 days | Assign owner and link to a matrix row or create one. | +| 8-13 days | Post status, define next action, and split network/upstream work if needed. | +| 14 days | Escalate until the issue is closed, transferred, or converted into tracked implementation work. | + +## Closure Rules + +Close an `evm-compat` issue when one of these is true: + +- A fix has landed and a release path is identified. +- The behavior is documented as an intentional Sei divergence. +- The issue belongs to network infrastructure and has been transferred to the right tracker. +- The issue belongs upstream and a linked upstream report or workaround exists. +- The reporter cannot provide enough detail to reproduce after follow-up. + +## Weekly Review + +Run a weekly review with: + +- Count of open `evm-compat` issues. +- Count older than 14 days. +- New matrix rows added from reports. +- SDK, docs, network, and upstream classifications. +- Release notes needed for resolved issues. diff --git a/docs/evm-parity/matrix.json b/docs/evm-parity/matrix.json new file mode 100644 index 000000000..b8985310f --- /dev/null +++ b/docs/evm-parity/matrix.json @@ -0,0 +1,68 @@ +{ + "targetCoverage": 0.95, + "scoreStartsWhen": "conformance-tests-land", + "statusLegend": { + "verified": "Covered by docs or code and ready for conformance tests.", + "covered": "Supported through standard tooling or existing sei-js helpers, but not yet backed by a dedicated parity test.", + "partial": "A path exists, but examples, helpers, typing, or tests are incomplete.", + "planned": "Needed for the target and not yet represented clearly.", + "not-core": "Useful in some ecosystems, but excluded from the core parity score.", + "network-limited": "The SDK can expose the behavior, but the chain intentionally differs from Ethereum." + }, + "rows": [ + { + "capability": "Chain metadata and HTTP transport", + "status": "covered", + "scoreScope": "core", + "nextGap": "Centralize mainnet, testnet, devnet, and local chain exports from one sei-js surface." + }, + { + "capability": "WebSocket subscriptions and watchers", + "status": "partial", + "scoreScope": "core", + "nextGap": "Add subscription examples and conformance checks for block, log, and pending transaction watchers." + }, + { + "capability": "Wallet discovery", + "status": "covered", + "scoreScope": "core", + "nextGap": "Add browser-level compatibility checks with common connector libraries." + }, + { + "capability": "Switch and add chain", + "status": "partial", + "scoreScope": "core", + "nextGap": "Add explicit Sei mainnet, testnet, devnet payload examples and error handling notes." + }, + { + "capability": "Contract deploy", + "status": "partial", + "scoreScope": "core", + "nextGap": "Add template and docs coverage for deploy, receipt, and verification next steps." + }, + { + "capability": "Message signing", + "status": "planned", + "scoreScope": "core", + "nextGap": "Add examples and wallet compatibility checks." + }, + { + "capability": "Typed-data signing", + "status": "planned", + "scoreScope": "core", + "nextGap": "Add EIP-712 examples and conformance fixtures." + }, + { + "capability": "Blob transactions", + "status": "network-limited", + "scoreScope": "excluded", + "nextGap": "Document unsupported status and exclude from core score." + }, + { + "capability": "ENS", + "status": "not-core", + "scoreScope": "excluded", + "nextGap": "Keep outside score unless Sei adopts a first-party name-service path." + } + ] +} diff --git a/docs/evm-parity/matrix.mdx b/docs/evm-parity/matrix.mdx new file mode 100644 index 000000000..1054cfd5c --- /dev/null +++ b/docs/evm-parity/matrix.mdx @@ -0,0 +1,57 @@ +--- +title: 'Parity Matrix' +description: 'Baseline EVM feature coverage matrix for sei-js against viem, wagmi, and ethers' +icon: 'table' +--- + +# Parity Matrix + +This matrix tracks EVM developer workflows rather than package export counts. A workflow is complete when a developer can find the intended Sei path, run it through standard tooling, and understand any network-specific behavior. + +## Status Legend + +| Status | Meaning | +| --- | --- | +| Verified | Covered by docs or code and ready for conformance tests. | +| Covered | Supported through standard tooling or existing `sei-js` helpers, but not yet backed by a dedicated parity test. | +| Partial | A path exists, but examples, helpers, typing, or tests are incomplete. | +| Planned | Needed for the >=95% target and not yet represented clearly. | +| Not core | Useful in some ecosystems, but excluded from the core parity score. | +| Network-limited | The SDK can expose the behavior, but the chain intentionally differs from Ethereum. | + +## Core Feature Matrix + +| Capability | viem | wagmi | ethers | Current `sei-js` status | Evidence | Next gap | +| --- | --- | --- | --- | --- | --- | --- | +| Chain metadata and HTTP transport | Public client + chains | `createConfig` transports | JSON-RPC provider | Covered | `viem/chains` is used in `mcp-server` and templates; `@sei-js/precompiles` exports `seiLocal` | Centralize mainnet, testnet, devnet, and local chain exports from one `sei-js` surface. | +| WebSocket subscriptions and watchers | WebSocket transport + watch actions | watch hooks | provider event APIs | Partial | Registry includes `evm_ws` endpoint shape | Add subscription examples and conformance checks for block, log, and pending transaction watchers. | +| Wallet discovery | Custom EIP-1193 transport | connectors | `BrowserProvider` | Covered | `@sei-js/sei-global-wallet/eip6963` registers discovery | Add browser-level compatibility checks with common connector libraries. | +| Connect and disconnect | Wallet client actions | `useConnect`, `useDisconnect` | provider request flow | Covered | Sei Global Wallet docs cover RainbowKit, ConnectKit, Web3-React, and wagmi + Dynamic | Add a single comparison page that maps connector behavior across libraries. | +| Switch and add chain | `switchChain`, `addChain` | `useSwitchChain` | EIP-1193 requests | Partial | Existing docs use wagmi chain config | Add explicit Sei mainnet, testnet, devnet payload examples and error handling notes. | +| Native SEI balance | `getBalance` | `useBalance` | `provider.getBalance` | Covered | `mcp-server` exposes `getBalance`; templates use wagmi public client | Add matrix-linked examples for all three libraries. | +| Blocks | `getBlock`, `getBlockNumber` | `useBlock`, `useBlockNumber` | provider block APIs | Covered | `mcp-server` exposes block helpers | Add tests that assert Sei finality tag behavior. | +| Transactions and receipts | transaction actions | transaction hooks | provider transaction APIs | Covered | `mcp-server` exposes transaction helpers | Add library-level smoke tests for submitted and historical transactions. | +| Logs and events | `getLogs`, `watchEvent` | event hooks | filters and listeners | Partial | `mcp-server` exposes `getLogs` | Add examples for ERC events and precompile event reads. | +| Contract reads | `readContract` | `useReadContract` | contract view calls | Covered | `@sei-js/precompiles` exports viem ABIs and ethers factories | Add parity tests for one ERC and one precompile read. | +| Contract writes | `writeContract` | `useWriteContract` | signer contract calls | Covered | `mcp-server` exposes write helpers; precompile docs show viem simulation patterns | Add complete write examples for viem, wagmi, and ethers. | +| Contract deploy | `deployContract` | `useDeployContract` | `ContractFactory` | Partial | `mcp-server` exposes `deployContract` | Add template and docs coverage for deploy + receipt + verification next steps. | +| Simulation and gas estimate | `simulateContract`, `estimateGas` | `useSimulateContract`, `useEstimateGas` | `estimateGas`, static calls | Partial | Precompile docs show `simulateContract`; `mcp-server` exposes `estimateGas` | Add examples for reverted calls, gas buffers, and Sei gas-limit guidance. | +| Message signing | `signMessage` | `useSignMessage` | signer message APIs | Planned | Standard library support exists | Add examples and wallet compatibility checks. | +| Typed-data signing | `signTypedData` | `useSignTypedData` | signer typed-data APIs | Planned | Standard library support exists | Add EIP-712 examples and conformance fixtures. | +| Transaction signing | `signTransaction` | `useSignTransaction` | signer transaction APIs | Planned | Standard library support exists | Add coverage for supported transaction types and legacy gas guidance. | +| ERC-20 reads and transfers | ERC ABI + actions | read/write hooks | contract calls | Partial | `mcp-server` includes ERC-20 balance, transfer, and approve helpers | Add reusable examples and tests against a fixture contract. | +| ERC-721 reads and transfers | ERC ABI + actions | read/write hooks | contract calls | Partial | `mcp-server` includes ERC-721 balance, ownership, and transfer helpers | Add metadata and event examples. | +| ERC-1155 reads and transfers | ERC ABI + actions | read/write hooks | contract calls | Partial | `mcp-server` includes ERC-1155 balance and transfer helpers | Add batch transfer and event examples. | +| Sei precompiles | Contract actions | contract hooks | contract factories | Covered | `@sei-js/precompiles` exports viem ABIs and ethers v6 factories | Add generated docs coverage table for every precompile ABI and method. | +| Pointer and address helper flows | Custom RPC + precompiles | custom hook wrapper | provider send + contracts | Partial | Precompile docs cover pointer and address workflows | Add high-level helpers only where they reduce repeated integration code. | +| `eth_getProof` | Public action/custom request | `useProof` | provider send | Network-limited | Sei returns IAVL proof data rather than Ethereum MPT proof data | Add warning in matrix and conformance tests that assert documented shape. | +| Blob transactions | Blob transaction actions | fee/blob hooks | transaction request fields | Network-limited | Sei runs Pectra without blob transactions | Exclude from core score and document unsupported status. | +| ENS | ENS actions | ENS hooks | name resolver | Not core | Sei does not provide Ethereum mainnet ENS behavior | Keep outside score; link to app-specific name service guidance if needed. | + +## Scoring Rule + +The public coverage score will start once conformance tests land. Only core rows count toward the >=95% target. `Not core` and `Network-limited` rows remain visible so developers understand the boundary, but they do not lower the SDK score when the behavior is intentional and documented. + +## Source Data + +The editable matrix source is stored at `/docs/evm-parity/matrix.json`. diff --git a/docs/evm-parity/plan.mdx b/docs/evm-parity/plan.mdx new file mode 100644 index 000000000..5840899d7 --- /dev/null +++ b/docs/evm-parity/plan.mdx @@ -0,0 +1,77 @@ +--- +title: 'EVM Standard Parity Plan' +description: 'Work plan for bringing sei-js EVM workflows to industry-standard compatibility' +icon: 'check-double' +--- + +# EVM Standard Parity Plan + +This work raises `sei-js` to the level developers expect when they arrive with viem, wagmi, ethers, and modern EVM assumptions. + +## Success Criteria + +- Publish a parity matrix against viem, wagmi, and ethers with >=95% core feature coverage. +- Keep zero open GitHub issues tagged `evm-compat` older than 14 days. +- Separate SDK gaps from Sei network behavior so product decisions are explicit and easy to track. + +## Operating Principles + +- **Standard tooling first:** Sei should work through viem, wagmi, ethers, Foundry, Hardhat, and wallet standards without custom ceremony. +- **Sei extensions second:** `@sei-js` should fill Sei-specific gaps through chain metadata, wallet discovery, precompile helpers, templates, and clear docs. +- **Runnable evidence over claims:** Matrix rows should link to docs, examples, tests, or conformance checks. +- **Network behavior is documented:** Known Sei differences should be tested and explained instead of hidden behind SDK wrappers. + +## Feature Groups + +The matrix scores practical developer workflows: + +- Chain metadata and transports +- Wallet discovery, connect, disconnect, switch, and add-chain flows +- Account, balance, block, transaction, receipt, and log reads +- Contract read, write, deploy, simulate, estimate gas, and event flows +- Native SEI, ERC-20, ERC-721, and ERC-1155 token flows +- Message, typed-data, and transaction signing +- WebSocket subscriptions and watcher flows +- Sei precompiles, pointer contracts, and address helper flows +- Templates, examples, and migration documentation + +## Phases + +### Phase 1: Baseline Matrix + +- Inventory current `sei-js` packages, templates, and docs. +- Classify each capability as verified, covered, partial, planned, not core, or network-limited. +- Publish the first matrix in docs. + +### Phase 2: Conformance Harness + +- Add repeatable checks for standard Ethereum JSON-RPC families on Sei mainnet, testnet, devnet, and local networks. +- Run viem and ethers smoke tests for core flows. +- Add browser-oriented wallet checks where the dependency can be mocked reliably. + +### Phase 3: SDK Improvements + +- Fill gaps with focused helpers only where standard libraries do not already solve the workflow. +- Strengthen templates for common EVM flows: read, write, deploy, logs, signing, and precompiles. +- Expand docs for Sei-specific differences that affect app behavior. + +### Phase 4: Maintenance SLA + +- Label compatibility issues with `evm-compat`. +- Triage new reports into SDK, docs, network, or upstream-tool categories. +- Review the aging queue weekly until no `evm-compat` issue exceeds 14 days. + +## Initial Focus + +1. Make the parity matrix public and source-backed. +2. Build a conformance checklist around Sei's supported `eth_*` and `debug_*` methods. +3. Prioritize gaps that create "Sei is weird" friction during the first hour of integration. + +## References + +- [Sei RPC Reference](https://docs.sei.io/evm/reference) +- [Sei EVM Differences](https://docs.sei.io/evm/differences-with-ethereum) +- [viem Clients](https://viem.sh/docs/clients/intro) +- [wagmi Getting Started](https://wagmi.sh/react/getting-started) +- [ethers v6 Getting Started](https://docs.ethers.org/v6/getting-started/) +- [Solana JavaScript SDKs](https://solana.com/docs/clients/official/javascript) diff --git a/docs/evm-parity/rpc-conformance.mdx b/docs/evm-parity/rpc-conformance.mdx new file mode 100644 index 000000000..0c3798ee1 --- /dev/null +++ b/docs/evm-parity/rpc-conformance.mdx @@ -0,0 +1,65 @@ +--- +title: 'RPC Conformance' +description: 'Conformance checklist for Sei EVM JSON-RPC behavior used by SDK parity tests' +icon: 'network-wired' +--- + +# RPC Conformance + +The SDK parity target depends on the Sei network supporting standard Ethereum JSON-RPC behavior where EVM tooling expects it. This checklist separates network checks from package-level helpers. + +## Method Families + +| Family | Representative methods | SDK workflows | Conformance expectation | +| --- | --- | --- | --- | +| Send transactions | `eth_sendRawTransaction` | viem `sendRawTransaction`, ethers provider send | Signed transaction returns a transaction hash or a standard JSON-RPC error. | +| Transaction lookup | `eth_getTransactionByHash`, `eth_getTransactionReceipt`, block index lookups | transaction views, receipt polling, wait helpers | Hash and receipt shapes are compatible with standard EVM tooling. | +| Account information | `eth_getBalance`, `eth_getTransactionCount`, `eth_getCode`, `eth_getStorageAt`, `eth_getProof` | balances, nonces, bytecode checks, storage reads | Standard methods work; `eth_getProof` documents Sei's IAVL proof shape. | +| Block information | `eth_getBlockByNumber`, `eth_getBlockByHash`, block transaction count, block receipts | block explorers, dashboards, polling | `latest`, `safe`, and `finalized` behavior follows Sei instant finality guidance. | +| Chain information | `eth_blockNumber`, `eth_chainId`, `eth_feeHistory`, `eth_gasPrice`, `net_version`, `web3_clientVersion` | chain setup, gas estimates, status checks | Responses are compatible with viem, wagmi, and ethers expectations. | +| Filters and logs | `eth_newFilter`, `eth_getFilterChanges`, `eth_getFilterLogs`, `eth_getLogs`, `eth_uninstallFilter` | event reads and watchers | Filter lifecycle and logs support standard event workflows. | +| Simulation and debugging | `eth_estimateGas`, `eth_call`, `debug_traceTransaction`, block tracing | preflight checks, error decoding, debugging | Calls and traces work for supported transaction types and documented limits. | +| Sei helpers | `sei_associate`, `sei_getSeiAddress`, `sei_getEVMAddress`, `sei_getCosmosTx` | address association and cross-VM lookups | Treated as legacy/custom helpers and kept outside the core EVM score. | + +## Sei-Specific Assertions + +| Behavior | Assertion | +| --- | --- | +| Instant finality | `latest`, `safe`, and `finalized` should not imply different commitment levels on Sei. | +| Pending state | Tests should not require Ethereum-style pending state visibility. | +| Proof format | `eth_getProof` returns IAVL proof data, not an Ethereum Merkle Patricia Trie proof. | +| Blob transactions | Blob transaction paths are excluded because Sei runs Pectra without blob transactions. | +| Legacy gas | Legacy transactions must follow Sei's documented minimum gas-price guidance. | +| Fee handling | Fee UX should not assume base-fee burning. | +| Storage cost | SSTORE cost is governance-adjustable and should not be hard-coded in SDK examples. | +| Deprecated custom RPC | `sei_*` and `sei2_*` helpers are documented as legacy/custom behavior, not core EVM parity. | + +## Test Harness Shape + +The conformance harness should run the same scenarios through standard library surfaces: + +1. viem public and wallet clients +2. ethers v6 provider and signer +3. wagmi core actions or React-compatible hook wrappers where browser state is required + +Each check should classify failures as: + +| Classification | Meaning | +| --- | --- | +| SDK gap | `sei-js` needs code, docs, or template changes. | +| Network issue | The RPC result differs from documented Sei behavior or standard EVM expectations. | +| Upstream issue | The dependency behavior is outside `sei-js` control and needs a workaround or upstream report. | +| Intentional divergence | The behavior is documented and excluded from the core coverage score. | + +## Initial Check List + +- Fetch chain ID and latest block. +- Read native SEI balance for a known address. +- Read code and storage for a deployed fixture contract. +- Estimate gas and simulate a read/write call. +- Send a funded test transaction on testnet or local network. +- Wait for transaction receipt and inspect logs. +- Read ERC-20, ERC-721, and ERC-1155 fixture state. +- Read and write one representative Sei precompile flow. +- Verify finality tag behavior. +- Verify documented `eth_getProof` shape. From 3322a5d932a122f75c81fa53a674580a575b26d0 Mon Sep 17 00:00:00 2001 From: monty-sei Date: Thu, 14 May 2026 10:17:20 +1000 Subject: [PATCH 2/5] Add EVM compatibility issue template --- .github/ISSUE_TEMPLATE/evm_compatibility.md | 40 +++++++++++++++++++++ docs/evm-parity/issue-sla.mdx | 2 ++ 2 files changed, 42 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/evm_compatibility.md diff --git a/.github/ISSUE_TEMPLATE/evm_compatibility.md b/.github/ISSUE_TEMPLATE/evm_compatibility.md new file mode 100644 index 000000000..f78168439 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/evm_compatibility.md @@ -0,0 +1,40 @@ +--- +name: EVM compatibility +about: Report behavior that differs from expected EVM tooling or RPC compatibility +title: "[EVM-COMPAT] " +labels: evm-compat, linear +assignees: '' + +--- + +**Library or tool** +Which library, connector, RPC method, template, or docs page is involved? + +**SeiJS package and version** +Check your `package.json` for the package name and version. + +**Network** +Mainnet, testnet, devnet, local, or unknown. + +**Expected EVM behavior** +What behavior did you expect from standard EVM tooling? + +**Observed Sei behavior** +What happened instead? + +**Minimal reproduction** +Provide the smallest code sample, command, RPC payload, or repository link that reproduces the issue. + +**Error output or transaction hash** +Paste the relevant error, RPC response, transaction hash, or receipt. + +**Classification** +If known, choose one: +- SDK gap +- Network issue +- Upstream issue +- Docs issue +- Intentional divergence + +**Additional context** +Add any other context that may help with triage. diff --git a/docs/evm-parity/issue-sla.mdx b/docs/evm-parity/issue-sla.mdx index aad597d10..d5d230002 100644 --- a/docs/evm-parity/issue-sla.mdx +++ b/docs/evm-parity/issue-sla.mdx @@ -12,6 +12,8 @@ The operational target is simple: no open GitHub issue tagged `evm-compat` shoul Use `evm-compat` for reports where a developer expected standard EVM behavior through viem, wagmi, ethers, wallet connectors, JSON-RPC, or common ERC/token flows. +Use the GitHub issue template named **EVM compatibility** for new reports. + ## Required Triage Fields Each issue should include: From 02e460f3009c18d22155bff9f5ef62669fafc0a8 Mon Sep 17 00:00:00 2001 From: monty-sei Date: Thu, 14 May 2026 10:39:34 +1000 Subject: [PATCH 3/5] Keep only EVM parity matrix in docs --- .gitignore | 1 + docs/docs.json | 11 ++--- docs/evm-parity/issue-sla.mdx | 56 --------------------- docs/evm-parity/matrix.json | 68 ------------------------- docs/evm-parity/matrix.mdx | 4 -- docs/evm-parity/plan.mdx | 77 ----------------------------- docs/evm-parity/rpc-conformance.mdx | 65 ------------------------ 7 files changed, 4 insertions(+), 278 deletions(-) delete mode 100644 docs/evm-parity/issue-sla.mdx delete mode 100644 docs/evm-parity/matrix.json delete mode 100644 docs/evm-parity/plan.mdx delete mode 100644 docs/evm-parity/rpc-conformance.mdx diff --git a/.gitignore b/.gitignore index 86ca8e9ae..e580a04b3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ packages/*/coverage examples/ +.internal/ # compiled output dist diff --git a/docs/docs.json b/docs/docs.json index ae41cfdc0..a51dd4576 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -83,14 +83,9 @@ }, { "dropdown": "EVM Parity", - "description": "Compatibility matrix and execution plan", - "icon": "check-double", - "pages": [ - { - "group": "Program", - "pages": ["evm-parity/plan", "evm-parity/matrix", "evm-parity/rpc-conformance", "evm-parity/issue-sla"] - } - ] + "description": "Compatibility matrix", + "icon": "table", + "pages": ["evm-parity/matrix"] }, { "dropdown": "@sei-js/sei-global-wallet", diff --git a/docs/evm-parity/issue-sla.mdx b/docs/evm-parity/issue-sla.mdx deleted file mode 100644 index d5d230002..000000000 --- a/docs/evm-parity/issue-sla.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 'Issue SLA' -description: 'Compatibility issue triage and aging rules for EVM parity work' -icon: 'stopwatch' ---- - -# Issue SLA - -The operational target is simple: no open GitHub issue tagged `evm-compat` should be older than 14 days. - -## Label - -Use `evm-compat` for reports where a developer expected standard EVM behavior through viem, wagmi, ethers, wallet connectors, JSON-RPC, or common ERC/token flows. - -Use the GitHub issue template named **EVM compatibility** for new reports. - -## Required Triage Fields - -Each issue should include: - -- Library or tool: viem, wagmi, ethers, wallet connector, RPC, template, docs, or other -- Network: mainnet, testnet, devnet, local, or unknown -- Expected EVM behavior -- Observed Sei behavior -- Minimal reproduction -- Error output or transaction hash when available -- Classification: SDK gap, network issue, upstream issue, docs issue, or intentional divergence - -## Aging Rules - -| Age | Required action | -| --- | --- | -| 0-2 days | Confirm scope, request missing reproduction details, and add classification. | -| 3-7 days | Assign owner and link to a matrix row or create one. | -| 8-13 days | Post status, define next action, and split network/upstream work if needed. | -| 14 days | Escalate until the issue is closed, transferred, or converted into tracked implementation work. | - -## Closure Rules - -Close an `evm-compat` issue when one of these is true: - -- A fix has landed and a release path is identified. -- The behavior is documented as an intentional Sei divergence. -- The issue belongs to network infrastructure and has been transferred to the right tracker. -- The issue belongs upstream and a linked upstream report or workaround exists. -- The reporter cannot provide enough detail to reproduce after follow-up. - -## Weekly Review - -Run a weekly review with: - -- Count of open `evm-compat` issues. -- Count older than 14 days. -- New matrix rows added from reports. -- SDK, docs, network, and upstream classifications. -- Release notes needed for resolved issues. diff --git a/docs/evm-parity/matrix.json b/docs/evm-parity/matrix.json deleted file mode 100644 index b8985310f..000000000 --- a/docs/evm-parity/matrix.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "targetCoverage": 0.95, - "scoreStartsWhen": "conformance-tests-land", - "statusLegend": { - "verified": "Covered by docs or code and ready for conformance tests.", - "covered": "Supported through standard tooling or existing sei-js helpers, but not yet backed by a dedicated parity test.", - "partial": "A path exists, but examples, helpers, typing, or tests are incomplete.", - "planned": "Needed for the target and not yet represented clearly.", - "not-core": "Useful in some ecosystems, but excluded from the core parity score.", - "network-limited": "The SDK can expose the behavior, but the chain intentionally differs from Ethereum." - }, - "rows": [ - { - "capability": "Chain metadata and HTTP transport", - "status": "covered", - "scoreScope": "core", - "nextGap": "Centralize mainnet, testnet, devnet, and local chain exports from one sei-js surface." - }, - { - "capability": "WebSocket subscriptions and watchers", - "status": "partial", - "scoreScope": "core", - "nextGap": "Add subscription examples and conformance checks for block, log, and pending transaction watchers." - }, - { - "capability": "Wallet discovery", - "status": "covered", - "scoreScope": "core", - "nextGap": "Add browser-level compatibility checks with common connector libraries." - }, - { - "capability": "Switch and add chain", - "status": "partial", - "scoreScope": "core", - "nextGap": "Add explicit Sei mainnet, testnet, devnet payload examples and error handling notes." - }, - { - "capability": "Contract deploy", - "status": "partial", - "scoreScope": "core", - "nextGap": "Add template and docs coverage for deploy, receipt, and verification next steps." - }, - { - "capability": "Message signing", - "status": "planned", - "scoreScope": "core", - "nextGap": "Add examples and wallet compatibility checks." - }, - { - "capability": "Typed-data signing", - "status": "planned", - "scoreScope": "core", - "nextGap": "Add EIP-712 examples and conformance fixtures." - }, - { - "capability": "Blob transactions", - "status": "network-limited", - "scoreScope": "excluded", - "nextGap": "Document unsupported status and exclude from core score." - }, - { - "capability": "ENS", - "status": "not-core", - "scoreScope": "excluded", - "nextGap": "Keep outside score unless Sei adopts a first-party name-service path." - } - ] -} diff --git a/docs/evm-parity/matrix.mdx b/docs/evm-parity/matrix.mdx index 1054cfd5c..4338067cd 100644 --- a/docs/evm-parity/matrix.mdx +++ b/docs/evm-parity/matrix.mdx @@ -51,7 +51,3 @@ This matrix tracks EVM developer workflows rather than package export counts. A ## Scoring Rule The public coverage score will start once conformance tests land. Only core rows count toward the >=95% target. `Not core` and `Network-limited` rows remain visible so developers understand the boundary, but they do not lower the SDK score when the behavior is intentional and documented. - -## Source Data - -The editable matrix source is stored at `/docs/evm-parity/matrix.json`. diff --git a/docs/evm-parity/plan.mdx b/docs/evm-parity/plan.mdx deleted file mode 100644 index 5840899d7..000000000 --- a/docs/evm-parity/plan.mdx +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: 'EVM Standard Parity Plan' -description: 'Work plan for bringing sei-js EVM workflows to industry-standard compatibility' -icon: 'check-double' ---- - -# EVM Standard Parity Plan - -This work raises `sei-js` to the level developers expect when they arrive with viem, wagmi, ethers, and modern EVM assumptions. - -## Success Criteria - -- Publish a parity matrix against viem, wagmi, and ethers with >=95% core feature coverage. -- Keep zero open GitHub issues tagged `evm-compat` older than 14 days. -- Separate SDK gaps from Sei network behavior so product decisions are explicit and easy to track. - -## Operating Principles - -- **Standard tooling first:** Sei should work through viem, wagmi, ethers, Foundry, Hardhat, and wallet standards without custom ceremony. -- **Sei extensions second:** `@sei-js` should fill Sei-specific gaps through chain metadata, wallet discovery, precompile helpers, templates, and clear docs. -- **Runnable evidence over claims:** Matrix rows should link to docs, examples, tests, or conformance checks. -- **Network behavior is documented:** Known Sei differences should be tested and explained instead of hidden behind SDK wrappers. - -## Feature Groups - -The matrix scores practical developer workflows: - -- Chain metadata and transports -- Wallet discovery, connect, disconnect, switch, and add-chain flows -- Account, balance, block, transaction, receipt, and log reads -- Contract read, write, deploy, simulate, estimate gas, and event flows -- Native SEI, ERC-20, ERC-721, and ERC-1155 token flows -- Message, typed-data, and transaction signing -- WebSocket subscriptions and watcher flows -- Sei precompiles, pointer contracts, and address helper flows -- Templates, examples, and migration documentation - -## Phases - -### Phase 1: Baseline Matrix - -- Inventory current `sei-js` packages, templates, and docs. -- Classify each capability as verified, covered, partial, planned, not core, or network-limited. -- Publish the first matrix in docs. - -### Phase 2: Conformance Harness - -- Add repeatable checks for standard Ethereum JSON-RPC families on Sei mainnet, testnet, devnet, and local networks. -- Run viem and ethers smoke tests for core flows. -- Add browser-oriented wallet checks where the dependency can be mocked reliably. - -### Phase 3: SDK Improvements - -- Fill gaps with focused helpers only where standard libraries do not already solve the workflow. -- Strengthen templates for common EVM flows: read, write, deploy, logs, signing, and precompiles. -- Expand docs for Sei-specific differences that affect app behavior. - -### Phase 4: Maintenance SLA - -- Label compatibility issues with `evm-compat`. -- Triage new reports into SDK, docs, network, or upstream-tool categories. -- Review the aging queue weekly until no `evm-compat` issue exceeds 14 days. - -## Initial Focus - -1. Make the parity matrix public and source-backed. -2. Build a conformance checklist around Sei's supported `eth_*` and `debug_*` methods. -3. Prioritize gaps that create "Sei is weird" friction during the first hour of integration. - -## References - -- [Sei RPC Reference](https://docs.sei.io/evm/reference) -- [Sei EVM Differences](https://docs.sei.io/evm/differences-with-ethereum) -- [viem Clients](https://viem.sh/docs/clients/intro) -- [wagmi Getting Started](https://wagmi.sh/react/getting-started) -- [ethers v6 Getting Started](https://docs.ethers.org/v6/getting-started/) -- [Solana JavaScript SDKs](https://solana.com/docs/clients/official/javascript) diff --git a/docs/evm-parity/rpc-conformance.mdx b/docs/evm-parity/rpc-conformance.mdx deleted file mode 100644 index 0c3798ee1..000000000 --- a/docs/evm-parity/rpc-conformance.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: 'RPC Conformance' -description: 'Conformance checklist for Sei EVM JSON-RPC behavior used by SDK parity tests' -icon: 'network-wired' ---- - -# RPC Conformance - -The SDK parity target depends on the Sei network supporting standard Ethereum JSON-RPC behavior where EVM tooling expects it. This checklist separates network checks from package-level helpers. - -## Method Families - -| Family | Representative methods | SDK workflows | Conformance expectation | -| --- | --- | --- | --- | -| Send transactions | `eth_sendRawTransaction` | viem `sendRawTransaction`, ethers provider send | Signed transaction returns a transaction hash or a standard JSON-RPC error. | -| Transaction lookup | `eth_getTransactionByHash`, `eth_getTransactionReceipt`, block index lookups | transaction views, receipt polling, wait helpers | Hash and receipt shapes are compatible with standard EVM tooling. | -| Account information | `eth_getBalance`, `eth_getTransactionCount`, `eth_getCode`, `eth_getStorageAt`, `eth_getProof` | balances, nonces, bytecode checks, storage reads | Standard methods work; `eth_getProof` documents Sei's IAVL proof shape. | -| Block information | `eth_getBlockByNumber`, `eth_getBlockByHash`, block transaction count, block receipts | block explorers, dashboards, polling | `latest`, `safe`, and `finalized` behavior follows Sei instant finality guidance. | -| Chain information | `eth_blockNumber`, `eth_chainId`, `eth_feeHistory`, `eth_gasPrice`, `net_version`, `web3_clientVersion` | chain setup, gas estimates, status checks | Responses are compatible with viem, wagmi, and ethers expectations. | -| Filters and logs | `eth_newFilter`, `eth_getFilterChanges`, `eth_getFilterLogs`, `eth_getLogs`, `eth_uninstallFilter` | event reads and watchers | Filter lifecycle and logs support standard event workflows. | -| Simulation and debugging | `eth_estimateGas`, `eth_call`, `debug_traceTransaction`, block tracing | preflight checks, error decoding, debugging | Calls and traces work for supported transaction types and documented limits. | -| Sei helpers | `sei_associate`, `sei_getSeiAddress`, `sei_getEVMAddress`, `sei_getCosmosTx` | address association and cross-VM lookups | Treated as legacy/custom helpers and kept outside the core EVM score. | - -## Sei-Specific Assertions - -| Behavior | Assertion | -| --- | --- | -| Instant finality | `latest`, `safe`, and `finalized` should not imply different commitment levels on Sei. | -| Pending state | Tests should not require Ethereum-style pending state visibility. | -| Proof format | `eth_getProof` returns IAVL proof data, not an Ethereum Merkle Patricia Trie proof. | -| Blob transactions | Blob transaction paths are excluded because Sei runs Pectra without blob transactions. | -| Legacy gas | Legacy transactions must follow Sei's documented minimum gas-price guidance. | -| Fee handling | Fee UX should not assume base-fee burning. | -| Storage cost | SSTORE cost is governance-adjustable and should not be hard-coded in SDK examples. | -| Deprecated custom RPC | `sei_*` and `sei2_*` helpers are documented as legacy/custom behavior, not core EVM parity. | - -## Test Harness Shape - -The conformance harness should run the same scenarios through standard library surfaces: - -1. viem public and wallet clients -2. ethers v6 provider and signer -3. wagmi core actions or React-compatible hook wrappers where browser state is required - -Each check should classify failures as: - -| Classification | Meaning | -| --- | --- | -| SDK gap | `sei-js` needs code, docs, or template changes. | -| Network issue | The RPC result differs from documented Sei behavior or standard EVM expectations. | -| Upstream issue | The dependency behavior is outside `sei-js` control and needs a workaround or upstream report. | -| Intentional divergence | The behavior is documented and excluded from the core coverage score. | - -## Initial Check List - -- Fetch chain ID and latest block. -- Read native SEI balance for a known address. -- Read code and storage for a deployed fixture contract. -- Estimate gas and simulate a read/write call. -- Send a funded test transaction on testnet or local network. -- Wait for transaction receipt and inspect logs. -- Read ERC-20, ERC-721, and ERC-1155 fixture state. -- Read and write one representative Sei precompile flow. -- Verify finality tag behavior. -- Verify documented `eth_getProof` shape. From cf114190cb746a92bfa282b7320c8c192c5fa2fd Mon Sep 17 00:00:00 2001 From: monty-sei Date: Thu, 14 May 2026 10:45:09 +1000 Subject: [PATCH 4/5] Refine public EVM parity matrix --- docs/evm-parity/matrix.mdx | 85 ++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/docs/evm-parity/matrix.mdx b/docs/evm-parity/matrix.mdx index 4338067cd..e164fdf7e 100644 --- a/docs/evm-parity/matrix.mdx +++ b/docs/evm-parity/matrix.mdx @@ -1,53 +1,56 @@ --- title: 'Parity Matrix' -description: 'Baseline EVM feature coverage matrix for sei-js against viem, wagmi, and ethers' +description: 'EVM feature support matrix for Sei across viem, wagmi, and ethers' icon: 'table' --- # Parity Matrix -This matrix tracks EVM developer workflows rather than package export counts. A workflow is complete when a developer can find the intended Sei path, run it through standard tooling, and understand any network-specific behavior. +This matrix summarizes EVM workflow support on Sei across the JavaScript libraries developers already use: viem, wagmi, and ethers. Standard EVM workflows should work through standard tooling, while Sei-specific workflows are exposed through `@sei-js` packages where they add value. ## Status Legend | Status | Meaning | | --- | --- | -| Verified | Covered by docs or code and ready for conformance tests. | -| Covered | Supported through standard tooling or existing `sei-js` helpers, but not yet backed by a dedicated parity test. | -| Partial | A path exists, but examples, helpers, typing, or tests are incomplete. | -| Planned | Needed for the >=95% target and not yet represented clearly. | -| Not core | Useful in some ecosystems, but excluded from the core parity score. | -| Network-limited | The SDK can expose the behavior, but the chain intentionally differs from Ethereum. | - -## Core Feature Matrix - -| Capability | viem | wagmi | ethers | Current `sei-js` status | Evidence | Next gap | -| --- | --- | --- | --- | --- | --- | --- | -| Chain metadata and HTTP transport | Public client + chains | `createConfig` transports | JSON-RPC provider | Covered | `viem/chains` is used in `mcp-server` and templates; `@sei-js/precompiles` exports `seiLocal` | Centralize mainnet, testnet, devnet, and local chain exports from one `sei-js` surface. | -| WebSocket subscriptions and watchers | WebSocket transport + watch actions | watch hooks | provider event APIs | Partial | Registry includes `evm_ws` endpoint shape | Add subscription examples and conformance checks for block, log, and pending transaction watchers. | -| Wallet discovery | Custom EIP-1193 transport | connectors | `BrowserProvider` | Covered | `@sei-js/sei-global-wallet/eip6963` registers discovery | Add browser-level compatibility checks with common connector libraries. | -| Connect and disconnect | Wallet client actions | `useConnect`, `useDisconnect` | provider request flow | Covered | Sei Global Wallet docs cover RainbowKit, ConnectKit, Web3-React, and wagmi + Dynamic | Add a single comparison page that maps connector behavior across libraries. | -| Switch and add chain | `switchChain`, `addChain` | `useSwitchChain` | EIP-1193 requests | Partial | Existing docs use wagmi chain config | Add explicit Sei mainnet, testnet, devnet payload examples and error handling notes. | -| Native SEI balance | `getBalance` | `useBalance` | `provider.getBalance` | Covered | `mcp-server` exposes `getBalance`; templates use wagmi public client | Add matrix-linked examples for all three libraries. | -| Blocks | `getBlock`, `getBlockNumber` | `useBlock`, `useBlockNumber` | provider block APIs | Covered | `mcp-server` exposes block helpers | Add tests that assert Sei finality tag behavior. | -| Transactions and receipts | transaction actions | transaction hooks | provider transaction APIs | Covered | `mcp-server` exposes transaction helpers | Add library-level smoke tests for submitted and historical transactions. | -| Logs and events | `getLogs`, `watchEvent` | event hooks | filters and listeners | Partial | `mcp-server` exposes `getLogs` | Add examples for ERC events and precompile event reads. | -| Contract reads | `readContract` | `useReadContract` | contract view calls | Covered | `@sei-js/precompiles` exports viem ABIs and ethers factories | Add parity tests for one ERC and one precompile read. | -| Contract writes | `writeContract` | `useWriteContract` | signer contract calls | Covered | `mcp-server` exposes write helpers; precompile docs show viem simulation patterns | Add complete write examples for viem, wagmi, and ethers. | -| Contract deploy | `deployContract` | `useDeployContract` | `ContractFactory` | Partial | `mcp-server` exposes `deployContract` | Add template and docs coverage for deploy + receipt + verification next steps. | -| Simulation and gas estimate | `simulateContract`, `estimateGas` | `useSimulateContract`, `useEstimateGas` | `estimateGas`, static calls | Partial | Precompile docs show `simulateContract`; `mcp-server` exposes `estimateGas` | Add examples for reverted calls, gas buffers, and Sei gas-limit guidance. | -| Message signing | `signMessage` | `useSignMessage` | signer message APIs | Planned | Standard library support exists | Add examples and wallet compatibility checks. | -| Typed-data signing | `signTypedData` | `useSignTypedData` | signer typed-data APIs | Planned | Standard library support exists | Add EIP-712 examples and conformance fixtures. | -| Transaction signing | `signTransaction` | `useSignTransaction` | signer transaction APIs | Planned | Standard library support exists | Add coverage for supported transaction types and legacy gas guidance. | -| ERC-20 reads and transfers | ERC ABI + actions | read/write hooks | contract calls | Partial | `mcp-server` includes ERC-20 balance, transfer, and approve helpers | Add reusable examples and tests against a fixture contract. | -| ERC-721 reads and transfers | ERC ABI + actions | read/write hooks | contract calls | Partial | `mcp-server` includes ERC-721 balance, ownership, and transfer helpers | Add metadata and event examples. | -| ERC-1155 reads and transfers | ERC ABI + actions | read/write hooks | contract calls | Partial | `mcp-server` includes ERC-1155 balance and transfer helpers | Add batch transfer and event examples. | -| Sei precompiles | Contract actions | contract hooks | contract factories | Covered | `@sei-js/precompiles` exports viem ABIs and ethers v6 factories | Add generated docs coverage table for every precompile ABI and method. | -| Pointer and address helper flows | Custom RPC + precompiles | custom hook wrapper | provider send + contracts | Partial | Precompile docs cover pointer and address workflows | Add high-level helpers only where they reduce repeated integration code. | -| `eth_getProof` | Public action/custom request | `useProof` | provider send | Network-limited | Sei returns IAVL proof data rather than Ethereum MPT proof data | Add warning in matrix and conformance tests that assert documented shape. | -| Blob transactions | Blob transaction actions | fee/blob hooks | transaction request fields | Network-limited | Sei runs Pectra without blob transactions | Exclude from core score and document unsupported status. | -| ENS | ENS actions | ENS hooks | name resolver | Not core | Sei does not provide Ethereum mainnet ENS behavior | Keep outside score; link to app-specific name service guidance if needed. | - -## Scoring Rule - -The public coverage score will start once conformance tests land. Only core rows count toward the >=95% target. `Not core` and `Network-limited` rows remain visible so developers understand the boundary, but they do not lower the SDK score when the behavior is intentional and documented. +| Supported | Supported through standard EVM tooling on Sei. | +| Supported via `@sei-js` | Supported by a Sei-specific `@sei-js` package layered on standard EVM tooling. | +| Wallet-dependent | Supported when the connected wallet or account exposes the capability. | +| Documented difference | Available, but Sei intentionally differs from Ethereum behavior. | +| Not applicable | Not part of Sei's EVM support surface. | + +## Feature Support + +| Workflow | viem | wagmi | ethers | Sei support | +| --- | --- | --- | --- | --- | +| Chain metadata and HTTP transport | Supported | Supported | Supported | Supported | +| WebSocket subscriptions and watchers | Supported | Supported | Supported | Supported | +| Wallet discovery | Supported | Supported | Supported | Supported via `@sei-js` | +| Connect and disconnect | Supported | Supported | Supported | Supported | +| Switch and add chain | Supported | Supported | Supported | Supported | +| Native SEI balance | Supported | Supported | Supported | Supported | +| Blocks | Supported | Supported | Supported | Supported | +| Transactions and receipts | Supported | Supported | Supported | Supported | +| Logs and events | Supported | Supported | Supported | Supported | +| Contract reads | Supported | Supported | Supported | Supported | +| Contract writes | Supported | Supported | Supported | Supported | +| Contract deploy | Supported | Supported | Supported | Supported | +| Simulation and gas estimate | Supported | Supported | Supported | Supported | +| Message signing | Wallet-dependent | Wallet-dependent | Wallet-dependent | Wallet-dependent | +| Typed-data signing | Wallet-dependent | Wallet-dependent | Wallet-dependent | Wallet-dependent | +| Transaction signing | Wallet-dependent | Wallet-dependent | Wallet-dependent | Wallet-dependent | +| ERC-20 reads and transfers | Supported | Supported | Supported | Supported | +| ERC-721 reads and transfers | Supported | Supported | Supported | Supported | +| ERC-1155 reads and transfers | Supported | Supported | Supported | Supported | +| Sei precompiles | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | +| Pointer and address helper flows | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | +| `eth_getProof` | Documented difference | Documented difference | Documented difference | Documented difference | +| Blob transactions | Not applicable | Not applicable | Not applicable | Not applicable | +| ENS | Not applicable | Not applicable | Not applicable | Not applicable | + +## Compatibility Notes + +- Sei supports standard EVM JSON-RPC workflows used by viem, wagmi, and ethers. +- Sei-specific precompile, pointer, and address-association workflows are exposed through `@sei-js/precompiles`. +- Wallet signing support depends on the connected wallet or account, as it does on other EVM networks. +- `eth_getProof` is available with Sei's documented proof format, which differs from Ethereum's Merkle Patricia Trie proof format. +- Blob transactions and ENS are not part of Sei's EVM support surface. From 02d84cae9d1663ea2611ae0a345b40d7528bd04a Mon Sep 17 00:00:00 2001 From: monty-sei Date: Mon, 18 May 2026 14:52:02 +1000 Subject: [PATCH 5/5] Add and extend unit tests across SDK packages - precompiles: add addresses.spec.ts validating all 12 precompile addresses are valid 42-char Ethereum addresses, unique, and in the reserved range; add abis.spec.ts validating each ABI has expected named functions, correct entry structure, and is non-empty - registry: extend networks, ibc, gas, and tokens tests with URL format validation, channel-N pattern checks, positive gas price assertions, and https image URL checks - create-sei: add templates.test.ts verifying template and extension directory structure, package.json validity, and tsconfig presence - sei-global-wallet: add config.spec.ts validating walletName, walletUrl, environmentId, rdns pattern, and walletIcon data URI - ledger: extend seiLedgerOfflineAminoSigner.spec.ts with BIP44 derivation path pattern tests Also revert planning/doc files added during exploration that are out of scope for this branch. --- .github/ISSUE_TEMPLATE/evm_compatibility.md | 40 -------- .gitignore | 1 - docs/docs.json | 6 -- docs/evm-parity/matrix.mdx | 56 ------------ packages/create-sei/src/templates.test.ts | 65 +++++++++++++ .../seiLedgerOfflineAminoSigner.spec.ts | 25 +++++ .../src/precompiles/__tests__/abis.spec.ts | 91 +++++++++++++++++++ .../precompiles/__tests__/addresses.spec.ts | 54 +++++++++++ .../registry/src/gas/__tests__/index.spec.ts | 15 +++ .../registry/src/ibc/__tests__/index.spec.ts | 24 +++++ .../src/networks/__tests__/index.spec.ts | 21 +++++ .../src/tokens/__tests__/index.spec.ts | 34 +++++++ .../src/lib/__tests__/config.spec.ts | 32 +++++++ 13 files changed, 361 insertions(+), 103 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/evm_compatibility.md delete mode 100644 docs/evm-parity/matrix.mdx create mode 100644 packages/create-sei/src/templates.test.ts create mode 100644 packages/precompiles/src/precompiles/__tests__/abis.spec.ts create mode 100644 packages/precompiles/src/precompiles/__tests__/addresses.spec.ts create mode 100644 packages/sei-global-wallet/src/lib/__tests__/config.spec.ts diff --git a/.github/ISSUE_TEMPLATE/evm_compatibility.md b/.github/ISSUE_TEMPLATE/evm_compatibility.md deleted file mode 100644 index f78168439..000000000 --- a/.github/ISSUE_TEMPLATE/evm_compatibility.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: EVM compatibility -about: Report behavior that differs from expected EVM tooling or RPC compatibility -title: "[EVM-COMPAT] " -labels: evm-compat, linear -assignees: '' - ---- - -**Library or tool** -Which library, connector, RPC method, template, or docs page is involved? - -**SeiJS package and version** -Check your `package.json` for the package name and version. - -**Network** -Mainnet, testnet, devnet, local, or unknown. - -**Expected EVM behavior** -What behavior did you expect from standard EVM tooling? - -**Observed Sei behavior** -What happened instead? - -**Minimal reproduction** -Provide the smallest code sample, command, RPC payload, or repository link that reproduces the issue. - -**Error output or transaction hash** -Paste the relevant error, RPC response, transaction hash, or receipt. - -**Classification** -If known, choose one: -- SDK gap -- Network issue -- Upstream issue -- Docs issue -- Intentional divergence - -**Additional context** -Add any other context that may help with triage. diff --git a/.gitignore b/.gitignore index e580a04b3..86ca8e9ae 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ packages/*/coverage examples/ -.internal/ # compiled output dist diff --git a/docs/docs.json b/docs/docs.json index a51dd4576..4463fc077 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -81,12 +81,6 @@ } ] }, - { - "dropdown": "EVM Parity", - "description": "Compatibility matrix", - "icon": "table", - "pages": ["evm-parity/matrix"] - }, { "dropdown": "@sei-js/sei-global-wallet", "description": "User friendly wallet connect", diff --git a/docs/evm-parity/matrix.mdx b/docs/evm-parity/matrix.mdx deleted file mode 100644 index e164fdf7e..000000000 --- a/docs/evm-parity/matrix.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 'Parity Matrix' -description: 'EVM feature support matrix for Sei across viem, wagmi, and ethers' -icon: 'table' ---- - -# Parity Matrix - -This matrix summarizes EVM workflow support on Sei across the JavaScript libraries developers already use: viem, wagmi, and ethers. Standard EVM workflows should work through standard tooling, while Sei-specific workflows are exposed through `@sei-js` packages where they add value. - -## Status Legend - -| Status | Meaning | -| --- | --- | -| Supported | Supported through standard EVM tooling on Sei. | -| Supported via `@sei-js` | Supported by a Sei-specific `@sei-js` package layered on standard EVM tooling. | -| Wallet-dependent | Supported when the connected wallet or account exposes the capability. | -| Documented difference | Available, but Sei intentionally differs from Ethereum behavior. | -| Not applicable | Not part of Sei's EVM support surface. | - -## Feature Support - -| Workflow | viem | wagmi | ethers | Sei support | -| --- | --- | --- | --- | --- | -| Chain metadata and HTTP transport | Supported | Supported | Supported | Supported | -| WebSocket subscriptions and watchers | Supported | Supported | Supported | Supported | -| Wallet discovery | Supported | Supported | Supported | Supported via `@sei-js` | -| Connect and disconnect | Supported | Supported | Supported | Supported | -| Switch and add chain | Supported | Supported | Supported | Supported | -| Native SEI balance | Supported | Supported | Supported | Supported | -| Blocks | Supported | Supported | Supported | Supported | -| Transactions and receipts | Supported | Supported | Supported | Supported | -| Logs and events | Supported | Supported | Supported | Supported | -| Contract reads | Supported | Supported | Supported | Supported | -| Contract writes | Supported | Supported | Supported | Supported | -| Contract deploy | Supported | Supported | Supported | Supported | -| Simulation and gas estimate | Supported | Supported | Supported | Supported | -| Message signing | Wallet-dependent | Wallet-dependent | Wallet-dependent | Wallet-dependent | -| Typed-data signing | Wallet-dependent | Wallet-dependent | Wallet-dependent | Wallet-dependent | -| Transaction signing | Wallet-dependent | Wallet-dependent | Wallet-dependent | Wallet-dependent | -| ERC-20 reads and transfers | Supported | Supported | Supported | Supported | -| ERC-721 reads and transfers | Supported | Supported | Supported | Supported | -| ERC-1155 reads and transfers | Supported | Supported | Supported | Supported | -| Sei precompiles | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | -| Pointer and address helper flows | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | Supported via `@sei-js` | -| `eth_getProof` | Documented difference | Documented difference | Documented difference | Documented difference | -| Blob transactions | Not applicable | Not applicable | Not applicable | Not applicable | -| ENS | Not applicable | Not applicable | Not applicable | Not applicable | - -## Compatibility Notes - -- Sei supports standard EVM JSON-RPC workflows used by viem, wagmi, and ethers. -- Sei-specific precompile, pointer, and address-association workflows are exposed through `@sei-js/precompiles`. -- Wallet signing support depends on the connected wallet or account, as it does on other EVM networks. -- `eth_getProof` is available with Sei's documented proof format, which differs from Ethereum's Merkle Patricia Trie proof format. -- Blob transactions and ENS are not part of Sei's EVM support surface. diff --git a/packages/create-sei/src/templates.test.ts b/packages/create-sei/src/templates.test.ts new file mode 100644 index 000000000..9eeab89fc --- /dev/null +++ b/packages/create-sei/src/templates.test.ts @@ -0,0 +1,65 @@ +import { describe, it, expect } from '@jest/globals'; +import { promises as fs } from 'node:fs'; +import path from 'node:path'; + +const PACKAGE_ROOT = path.resolve(__dirname, '..'); +const TEMPLATES_DIR = path.join(PACKAGE_ROOT, 'templates'); +const EXTENSIONS_DIR = path.join(PACKAGE_ROOT, 'extensions'); + +const EXPECTED_TEMPLATES = ['next-template']; +const EXPECTED_EXTENSIONS = ['precompiles']; + +describe('Templates', () => { + it('templates directory exists', async () => { + const stat = await fs.stat(TEMPLATES_DIR); + expect(stat.isDirectory()).toBe(true); + }); + + it.each(EXPECTED_TEMPLATES)('%s template directory exists', async (template) => { + const templatePath = path.join(TEMPLATES_DIR, template); + const stat = await fs.stat(templatePath); + expect(stat.isDirectory()).toBe(true); + }); + + it.each(EXPECTED_TEMPLATES)('%s template has a valid package.json', async (template) => { + const pkgPath = path.join(TEMPLATES_DIR, template, 'package.json'); + const contents = await fs.readFile(pkgPath, 'utf-8'); + const parsed = JSON.parse(contents); + expect(typeof parsed.name).toBe('string'); + expect(parsed.name.trim().length).toBeGreaterThan(0); + expect(typeof parsed.version).toBe('string'); + }); + + it.each(EXPECTED_TEMPLATES)('%s template has a tsconfig.json', async (template) => { + const tsconfigPath = path.join(TEMPLATES_DIR, template, 'tsconfig.json'); + const stat = await fs.stat(tsconfigPath); + expect(stat.isFile()).toBe(true); + }); + + it.each(EXPECTED_TEMPLATES)('%s template has a src/ directory', async (template) => { + const srcPath = path.join(TEMPLATES_DIR, template, 'src'); + const stat = await fs.stat(srcPath); + expect(stat.isDirectory()).toBe(true); + }); +}); + +describe('Extensions', () => { + it('extensions directory exists', async () => { + const stat = await fs.stat(EXTENSIONS_DIR); + expect(stat.isDirectory()).toBe(true); + }); + + it.each(EXPECTED_EXTENSIONS)('%s extension directory exists', async (extension) => { + const extensionPath = path.join(EXTENSIONS_DIR, extension); + const stat = await fs.stat(extensionPath); + expect(stat.isDirectory()).toBe(true); + }); + + it.each(EXPECTED_EXTENSIONS)('%s extension has a valid package.json', async (extension) => { + const pkgPath = path.join(EXTENSIONS_DIR, extension, 'package.json'); + const contents = await fs.readFile(pkgPath, 'utf-8'); + const parsed = JSON.parse(contents); + expect(typeof parsed.name).toBe('string'); + expect(parsed.name.trim().length).toBeGreaterThan(0); + }); +}); diff --git a/packages/ledger/src/cosmos/__tests__/seiLedgerOfflineAminoSigner.spec.ts b/packages/ledger/src/cosmos/__tests__/seiLedgerOfflineAminoSigner.spec.ts index ef26b2b04..d5fa822f9 100644 --- a/packages/ledger/src/cosmos/__tests__/seiLedgerOfflineAminoSigner.spec.ts +++ b/packages/ledger/src/cosmos/__tests__/seiLedgerOfflineAminoSigner.spec.ts @@ -9,6 +9,9 @@ const mockR = new Uint8Array([0, 1, 2]); // should be stripped const mockS = new Uint8Array([0, 3, 4]); // should be stripped const path = "m/44'/118'/0'/0/0"; +/** BIP44 derivation path pattern: m/purpose'/coin_type'/account'/change/index */ +const BIP44_PATTERN = /^m\/44'\/\d+'\/\d+'\/\d+\/\d+$/; + const mockSeiApp = { getCosmosAddress: jest.fn().mockResolvedValue({ address: mockAddress, @@ -20,6 +23,28 @@ const mockSeiApp = { }) }; +describe('BIP44 derivation paths', () => { + it('standard Cosmos derivation path matches BIP44 pattern', () => { + expect("m/44'/118'/0'/0/0").toMatch(BIP44_PATTERN); + }); + + it('EVM-compatible derivation path matches BIP44 pattern', () => { + expect("m/44'/60'/0'/0/0").toMatch(BIP44_PATTERN); + }); + + it('non-zero account indices match BIP44 pattern', () => { + expect("m/44'/118'/1'/0/0").toMatch(BIP44_PATTERN); + expect("m/44'/118'/0'/0/5").toMatch(BIP44_PATTERN); + }); + + it('path is passed through to getCosmosAddress unchanged', async () => { + const customPath = "m/44'/118'/0'/0/3"; + const signer = new SeiLedgerOfflineAminoSigner(mockSeiApp as never, customPath); + await signer.getAccounts(); + expect(mockSeiApp.getCosmosAddress).toHaveBeenCalledWith(customPath); + }); +}); + describe('SeiLedgerOfflineAminoSigner', () => { let signer: SeiLedgerOfflineAminoSigner; diff --git a/packages/precompiles/src/precompiles/__tests__/abis.spec.ts b/packages/precompiles/src/precompiles/__tests__/abis.spec.ts new file mode 100644 index 000000000..5baa2a7a7 --- /dev/null +++ b/packages/precompiles/src/precompiles/__tests__/abis.spec.ts @@ -0,0 +1,91 @@ +import { + ADDRESS_PRECOMPILE_ABI, + BANK_PRECOMPILE_ABI, + DISTRIBUTION_PRECOMPILE_ABI, + GOVERNANCE_PRECOMPILE_ABI, + IBC_PRECOMPILE_ABI, + JSON_PRECOMPILE_ABI, + ORACLE_PRECOMPILE_ABI, + POINTER_PRECOMPILE_ABI, + POINTERVIEW_PRECOMPILE_ABI, + SOLO_PRECOMPILE_ABI, + STAKING_PRECOMPILE_ABI, + WASM_PRECOMPILE_ABI +} from '../index'; + +type AbiEntry = { type: string; name?: string; inputs?: readonly unknown[]; outputs?: readonly unknown[]; stateMutability?: string }; +type Abi = readonly AbiEntry[]; + +function getFunctionNames(abi: Abi): string[] { + return abi.filter((entry) => entry.type === 'function').map((entry) => entry.name!); +} + +function getFunctions(abi: Abi): AbiEntry[] { + return abi.filter((entry) => entry.type === 'function'); +} + +const PRECOMPILE_ABIS: [string, Abi, string[]][] = [ + ['ADDRESS', ADDRESS_PRECOMPILE_ABI, ['getSeiAddr', 'getEvmAddr', 'associate', 'associatePubKey']], + ['BANK', BANK_PRECOMPILE_ABI, ['send', 'sendNative', 'balance', 'all_balances', 'supply', 'decimals', 'name', 'symbol']], + ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ABI, ['setWithdrawAddress', 'withdrawDelegationRewards', 'withdrawMultipleDelegationRewards', 'rewards']], + ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ABI, ['vote', 'deposit']], + ['IBC', IBC_PRECOMPILE_ABI, ['transfer']], + ['JSON', JSON_PRECOMPILE_ABI, ['extractAsBytes', 'extractAsBytesList']], + ['ORACLE', ORACLE_PRECOMPILE_ABI, ['getExchangeRates', 'getOracleTwaps']], + ['POINTER', POINTER_PRECOMPILE_ABI, ['addCW20Pointer', 'addCW721Pointer', 'addNativePointer']], + ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ABI, ['getCW20Pointer', 'getCW721Pointer']], + ['STAKING', STAKING_PRECOMPILE_ABI, ['delegate', 'undelegate', 'redelegate', 'delegation']], + ['WASM', WASM_PRECOMPILE_ABI, ['execute', 'execute_batch']] +]; + +describe('Precompile ABIs — function names', () => { + it.each(PRECOMPILE_ABIS)('%s ABI contains all expected function names', (_name, abi, expectedFunctions) => { + const actualFunctions = getFunctionNames(abi as Abi); + for (const fn of expectedFunctions) { + expect(actualFunctions).toContain(fn); + } + }); +}); + +describe('Precompile ABIs — function entry structure', () => { + it.each(PRECOMPILE_ABIS)('%s ABI functions each have inputs, outputs, and stateMutability', (_name, abi) => { + const functions = getFunctions(abi as Abi); + expect(functions.length).toBeGreaterThan(0); + + for (const fn of functions) { + expect(Array.isArray(fn.inputs)).toBe(true); + expect(Array.isArray(fn.outputs)).toBe(true); + expect(typeof fn.stateMutability).toBe('string'); + expect(['view', 'nonpayable', 'payable', 'pure']).toContain(fn.stateMutability); + } + }); +}); + +describe('Precompile ABIs — top-level structure', () => { + const ALL_ABIS: [string, Abi][] = [ + ['ADDRESS', ADDRESS_PRECOMPILE_ABI], + ['BANK', BANK_PRECOMPILE_ABI], + ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ABI], + ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ABI], + ['IBC', IBC_PRECOMPILE_ABI], + ['JSON', JSON_PRECOMPILE_ABI], + ['ORACLE', ORACLE_PRECOMPILE_ABI], + ['POINTER', POINTER_PRECOMPILE_ABI], + ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ABI], + ['SOLO', SOLO_PRECOMPILE_ABI], + ['STAKING', STAKING_PRECOMPILE_ABI], + ['WASM', WASM_PRECOMPILE_ABI] + ]; + + it.each(ALL_ABIS)('%s ABI is a non-empty array', (_name, abi) => { + expect(Array.isArray(abi)).toBe(true); + expect((abi as Abi).length).toBeGreaterThan(0); + }); + + it.each(ALL_ABIS)('%s ABI entries each have a type field', (_name, abi) => { + for (const entry of abi as Abi) { + expect(typeof entry.type).toBe('string'); + expect(entry.type.length).toBeGreaterThan(0); + } + }); +}); diff --git a/packages/precompiles/src/precompiles/__tests__/addresses.spec.ts b/packages/precompiles/src/precompiles/__tests__/addresses.spec.ts new file mode 100644 index 000000000..579329adc --- /dev/null +++ b/packages/precompiles/src/precompiles/__tests__/addresses.spec.ts @@ -0,0 +1,54 @@ +import { + ADDRESS_PRECOMPILE_ADDRESS, + BANK_PRECOMPILE_ADDRESS, + DISTRIBUTION_PRECOMPILE_ADDRESS, + GOVERNANCE_PRECOMPILE_ADDRESS, + IBC_PRECOMPILE_ADDRESS, + JSON_PRECOMPILE_ADDRESS, + ORACLE_PRECOMPILE_ADDRESS, + POINTER_PRECOMPILE_ADDRESS, + POINTERVIEW_PRECOMPILE_ADDRESS, + SOLO_PRECOMPILE_ADDRESS, + STAKING_PRECOMPILE_ADDRESS, + WASM_PRECOMPILE_ADDRESS +} from '../index'; + +const PRECOMPILE_ADDRESSES: [string, string][] = [ + ['ADDRESS', ADDRESS_PRECOMPILE_ADDRESS], + ['BANK', BANK_PRECOMPILE_ADDRESS], + ['DISTRIBUTION', DISTRIBUTION_PRECOMPILE_ADDRESS], + ['GOVERNANCE', GOVERNANCE_PRECOMPILE_ADDRESS], + ['IBC', IBC_PRECOMPILE_ADDRESS], + ['JSON', JSON_PRECOMPILE_ADDRESS], + ['ORACLE', ORACLE_PRECOMPILE_ADDRESS], + ['POINTER', POINTER_PRECOMPILE_ADDRESS], + ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ADDRESS], + ['SOLO', SOLO_PRECOMPILE_ADDRESS], + ['STAKING', STAKING_PRECOMPILE_ADDRESS], + ['WASM', WASM_PRECOMPILE_ADDRESS] +]; + +/** Validates an ERC-55 checksummed Ethereum address: 0x + exactly 40 hex characters. */ +function isValidEthAddress(address: string): boolean { + return /^0x[0-9a-fA-F]{40}$/.test(address); +} + +describe('Precompile addresses', () => { + it.each(PRECOMPILE_ADDRESSES)('%s address is a valid 42-character Ethereum address', (_name, address) => { + expect(typeof address).toBe('string'); + expect(isValidEthAddress(address)).toBe(true); + }); + + it('all precompile addresses are unique', () => { + const addresses = PRECOMPILE_ADDRESSES.map(([, addr]) => addr.toLowerCase()); + const unique = new Set(addresses); + expect(unique.size).toBe(addresses.length); + }); + + it('all precompile addresses start with 0x000000000000000000000000000000000000', () => { + // Sei precompiles live in the reserved 0x1000–0x10FF range + for (const [, address] of PRECOMPILE_ADDRESSES) { + expect(address.toLowerCase()).toMatch(/^0x0{36}/); + } + }); +}); diff --git a/packages/registry/src/gas/__tests__/index.spec.ts b/packages/registry/src/gas/__tests__/index.spec.ts index 35e93e4bc..16d70a942 100644 --- a/packages/registry/src/gas/__tests__/index.spec.ts +++ b/packages/registry/src/gas/__tests__/index.spec.ts @@ -32,4 +32,19 @@ describe('GasInfo Tests', () => { expect(pacific1.min_gas_price).toBeGreaterThanOrEqual(0.01); expect(pacific1.module_adjustments.dex.sudo_gas_price).toBeLessThanOrEqual(0.02); }); + + it('all networks have a positive min_gas_price', () => { + for (const [network, info] of Object.entries(GAS_INFO)) { + expect(info.min_gas_price).toBeGreaterThan(0); + if (info.min_gas_price <= 0) { + throw new Error(`Network ${network} has non-positive min_gas_price: ${info.min_gas_price}`); + } + } + }); + + it('all networks use usei as the fee denom', () => { + for (const info of Object.values(GAS_INFO)) { + expect(info.denom).toBe('usei'); + } + }); }); diff --git a/packages/registry/src/ibc/__tests__/index.spec.ts b/packages/registry/src/ibc/__tests__/index.spec.ts index 4d26f5b9d..4a2f7068c 100644 --- a/packages/registry/src/ibc/__tests__/index.spec.ts +++ b/packages/registry/src/ibc/__tests__/index.spec.ts @@ -31,4 +31,28 @@ describe('IBCInfo Tests', () => { expect(firstChannel.counterparty_chain_name).not.toBe(''); expect(firstChannel.dst_channel.startsWith('channel-')).toBeTruthy(); }); + + it('all channel IDs follow the channel-N format across all networks', () => { + const channelPattern = /^channel-\d+$/; + for (const [network, channels] of Object.entries(IBC_INFO)) { + for (const channel of channels) { + expect(channel.src_channel).toMatch(channelPattern); + expect(channel.dst_channel).toMatch(channelPattern); + if (!channelPattern.test(channel.src_channel)) { + throw new Error(`Network ${network} has invalid src_channel: ${channel.src_channel}`); + } + if (!channelPattern.test(channel.dst_channel)) { + throw new Error(`Network ${network} has invalid dst_channel: ${channel.dst_channel}`); + } + } + } + }); + + it('all counterparty chain names are non-empty strings', () => { + for (const channels of Object.values(IBC_INFO)) { + for (const channel of channels) { + expect(channel.counterparty_chain_name.trim().length).toBeGreaterThan(0); + } + } + }); }); diff --git a/packages/registry/src/networks/__tests__/index.spec.ts b/packages/registry/src/networks/__tests__/index.spec.ts index 0cf794290..ab57cf812 100644 --- a/packages/registry/src/networks/__tests__/index.spec.ts +++ b/packages/registry/src/networks/__tests__/index.spec.ts @@ -24,4 +24,25 @@ describe('Networks configuration', () => { } } }); + + it('should have RPC URLs starting with https:// or wss://', () => { + for (const [networkId, networkConfig] of Object.entries(NETWORKS)) { + for (const endpoint of networkConfig.rpc) { + const url = endpoint.url; + const isValid = url.startsWith('https://') || url.startsWith('wss://'); + expect(isValid).toBe(true); + if (!isValid) { + throw new Error(`Network ${networkId} has invalid RPC URL: ${url}`); + } + } + } + }); + + it('should have a non-empty provider name for each RPC endpoint', () => { + for (const networkConfig of Object.values(NETWORKS)) { + for (const endpoint of networkConfig.rpc) { + expect(endpoint.provider.trim().length).toBeGreaterThan(0); + } + } + }); }); diff --git a/packages/registry/src/tokens/__tests__/index.spec.ts b/packages/registry/src/tokens/__tests__/index.spec.ts index 50f182954..5fdbceac5 100644 --- a/packages/registry/src/tokens/__tests__/index.spec.ts +++ b/packages/registry/src/tokens/__tests__/index.spec.ts @@ -44,3 +44,37 @@ it('should contain the "sei" asset with correct properties in each network', () } } }); + +describe('Token image URL validation', () => { + it('all token image URLs use https:// scheme', () => { + for (const [network, assets] of Object.entries(TOKEN_LIST)) { + for (const asset of assets) { + if (asset.images?.png) { + expect(asset.images.png).toMatch(/^https:\/\//); + if (!asset.images.png.startsWith('https://')) { + throw new Error(`Network ${network} token "${asset.symbol}" has non-https PNG image URL: ${asset.images.png}`); + } + } + if (asset.images?.svg) { + expect(asset.images.svg).toMatch(/^https:\/\//); + if (!asset.images.svg.startsWith('https://')) { + throw new Error(`Network ${network} token "${asset.symbol}" has non-https SVG image URL: ${asset.images.svg}`); + } + } + } + } + }); + + it('all token image URLs are non-empty when present', () => { + for (const assets of Object.values(TOKEN_LIST)) { + for (const asset of assets) { + if (asset.images?.png) { + expect(asset.images.png.trim().length).toBeGreaterThan(0); + } + if (asset.images?.svg) { + expect(asset.images.svg.trim().length).toBeGreaterThan(0); + } + } + } + }); +}); diff --git a/packages/sei-global-wallet/src/lib/__tests__/config.spec.ts b/packages/sei-global-wallet/src/lib/__tests__/config.spec.ts new file mode 100644 index 000000000..a2921a3fa --- /dev/null +++ b/packages/sei-global-wallet/src/lib/__tests__/config.spec.ts @@ -0,0 +1,32 @@ +import { config } from '../config'; + +describe('sei-global-wallet config', () => { + it('walletName is a non-empty string', () => { + expect(typeof config.walletName).toBe('string'); + expect(config.walletName.trim().length).toBeGreaterThan(0); + }); + + it('walletUrl starts with https://', () => { + expect(typeof config.walletUrl).toBe('string'); + expect(config.walletUrl).toMatch(/^https:\/\//); + }); + + it('environmentId is a non-empty string', () => { + expect(typeof config.environmentId).toBe('string'); + expect(config.environmentId.trim().length).toBeGreaterThan(0); + }); + + it('eip6963.rdns matches the io.sei.* pattern', () => { + expect(typeof config.eip6963.rdns).toBe('string'); + expect(config.eip6963.rdns).toMatch(/^io\.sei\./); + }); + + it('walletIcon is a non-empty string', () => { + expect(typeof config.walletIcon).toBe('string'); + expect((config.walletIcon as string).trim().length).toBeGreaterThan(0); + }); + + it('walletIcon is a valid data URI', () => { + expect(config.walletIcon as string).toMatch(/^data:/); + }); +});