Skip to content

Commit b2d53c7

Browse files
Merge pull request #11 from sei-protocol/docs/clarify-association-method-availability
Retire deprecated sei_* association methods, document addr precompile
2 parents cfa889e + ca10e83 commit b2d53c7

2 files changed

Lines changed: 132 additions & 206 deletions

File tree

‎evm/reference.mdx‎

Lines changed: 39 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Sei fully supports the standard Ethereum JSON-RPC API, so existing EVM tooling (
1919
- [Simulation & Debugging](#simulation--debugging)
2020
- [Sei Custom Endpoints (Deprecated)](#sei-custom-endpoints)
2121
- [Legacy API Configuration](#legacy-api-configuration)
22-
- [Address & Cross-VM Helpers](#address--cross-vm-helpers)
22+
- [Address Resolution](#address-resolution)
23+
- [Cross-VM Transaction Lookup](#cross-vm-transaction-lookup)
2324

2425
## Overview
2526

@@ -734,9 +735,6 @@ To enable additional legacy methods, add them to this array. All other `sei_*` a
734735

735736
| Method | Description |
736737
| ------ | ----------- |
737-
| `sei_associate` | Associate Sei and EVM addresses |
738-
| `sei_getSeiAddress` | Get Sei address for an EVM address |
739-
| `sei_getEVMAddress` | Get EVM address for a Sei address |
740738
| `sei_getCosmosTx` | Get Cosmos transaction by EVM tx hash |
741739
| `sei_getEvmTx` | Get EVM transaction by Cosmos tx hash |
742740
| `sei_getTransactionErrorByHash` | Get error message for a failed transaction |
@@ -777,99 +775,59 @@ To enable additional legacy methods, add them to this array. All other `sei_*` a
777775

778776
</Accordion>
779777

780-
### Address & Cross-VM Helpers
778+
### Address Resolution
781779

782-
These endpoints provide cross-VM address resolution and transaction lookup between the EVM and Cosmos environments. `sei_getSeiAddress`, `sei_getEVMAddress`, and `sei_getCosmosTx` are enabled by default.
780+
For resolving the EVM (`0x…`) ↔ Sei (`sei1…`) address pair, use the **`addr` precompile at `0x0000000000000000000000000000000000001004`** via a standard `eth_call`. The precompile is universally available on every Sei RPC, is not part of the deprecated `sei_*` namespace, and is the canonical resolution path going forward.
783781

784-
<Accordion title="View Address & Cross-VM Helper Endpoints">
785-
#### sei_associate
786-
787-
Sends a transaction to establish association between the signer's Sei address
788-
and EVM address on-chain.
789-
790-
- **Parameters**:
791-
792-
| Type | Description |
793-
| :------- | :--------------------------------------------------------------------------------- |
794-
| `object` | A custom object containing a string message and the v, r, s of the signed message. |
795-
796-
Object Schema:
797-
798-
```json
799-
{
800-
custom_message: // Any string message
801-
r: // The R-part of the signature over the Keccak256 hash of the custom message.
802-
s: // The S-part of the signature over the Keccak256 hash of the custom message.
803-
v: // The V-part of the signature over the Keccak256 hash of the custom message.
804-
}
805-
```
806-
807-
- **Result**:
808-
809-
| Type | Description |
810-
| :------- | :------------------------------------ |
811-
| `string` | The transaction hash of the association transaction. |
812-
813-
---
814-
815-
#### sei_getSeiAddress
816-
817-
Returns the Sei (bech32) address associated with an EVM address.
818-
819-
- **Parameters**:
820-
821-
| Type | Description |
822-
| :------- | :---------------------------------- |
823-
| `string` | The EVM address (0x-prefixed hex). |
824-
825-
- **Result**:
826-
827-
| Type | Description |
828-
| :------- | :------------------------------------- |
829-
| `string` | The associated Sei bech32 address. |
830-
831-
**Example Request**
832-
833-
```json
834-
{
782+
```bash
783+
# EVM → Sei (getSeiAddr(address), selector 0x0c3c20ed)
784+
curl -X POST $SEIEVM -H "Content-Type: application/json" -d '{
835785
"jsonrpc": "2.0",
836-
"method": "sei_getSeiAddress",
837-
"params": ["0x1234567890abcdef1234567890abcdef12345678"],
786+
"method": "eth_call",
787+
"params": [{
788+
"to": "0x0000000000000000000000000000000000001004",
789+
"data": "0x0c3c20ed000000000000000000000000<evmAddressWithout0x>"
790+
}, "latest"],
838791
"id": 1
839-
}
792+
}'
840793
```
841794

842-
---
795+
In TypeScript with viem:
843796

844-
#### sei_getEVMAddress
797+
```ts
798+
import { createPublicClient, http } from 'viem';
799+
import { sei } from 'viem/chains';
845800

846-
Returns the EVM address associated with a Sei (bech32) address.
801+
const ADDR_PRECOMPILE = '0x0000000000000000000000000000000000001004';
802+
const ADDR_ABI = [
803+
{ name: 'getSeiAddr', type: 'function', stateMutability: 'view',
804+
inputs: [{ name: 'addr', type: 'address' }],
805+
outputs: [{ name: 'response', type: 'string' }] },
806+
{ name: 'getEvmAddr', type: 'function', stateMutability: 'view',
807+
inputs: [{ name: 'addr', type: 'string' }],
808+
outputs: [{ name: 'response', type: 'address' }] },
809+
] as const;
847810

848-
- **Parameters**:
811+
const client = createPublicClient({ chain: sei, transport: http() });
849812

850-
| Type | Description |
851-
| :------- | :------------------------------ |
852-
| `string` | The Sei bech32 address. |
813+
const seiAddr = await client.readContract({
814+
address: ADDR_PRECOMPILE, abi: ADDR_ABI, functionName: 'getSeiAddr', args: ['0x…'],
815+
});
853816

854-
- **Result**:
817+
const evmAddr = await client.readContract({
818+
address: ADDR_PRECOMPILE, abi: ADDR_ABI, functionName: 'getEvmAddr', args: ['sei1…'],
819+
});
820+
```
855821

856-
| Type | Description |
857-
| :------- | :------------------------------- |
858-
| `string` | The associated EVM address. |
822+
The call reverts when the input address is not yet associated. See [Accounts](/learn/accounts) for the full association lifecycle and how the bidirectional mapping is established.
859823

860-
**Example Request**
824+
<Note>The legacy JSON-RPC helpers `sei_getSeiAddress` and `sei_getEVMAddress` historically served this role and are still enabled by default on nodes today, but they belong to the deprecated `sei_*` namespace and may be removed in a future release. New integrations should call the precompile.</Note>
861825

862-
```json
863-
{
864-
"jsonrpc": "2.0",
865-
"method": "sei_getEVMAddress",
866-
"params": ["sei1..."],
867-
"id": 1
868-
}
869-
```
826+
### Cross-VM Transaction Lookup
870827

871-
---
828+
`sei_getCosmosTx` resolves the underlying Cosmos transaction hash for a given EVM transaction. It does not yet have a precompile equivalent and is enabled by default on Sei nodes.
872829

830+
<Accordion title="View Cross-VM Lookup Endpoints">
873831
#### sei_getCosmosTx
874832

875833
Returns the Cosmos transaction details for a given EVM transaction hash.

0 commit comments

Comments
 (0)