Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wallet-association.mdx #193

Merged
merged 1 commit into from
Dec 16, 2024
Merged
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
56 changes: 55 additions & 1 deletion pages/dev-advanced-concepts/wallet-association.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,61 @@ next: true

Wallet association on the Sei network ensures the public key becomes known to the chain. Without this step, the chain cannot determine the Bech32 (`sei...`) address or the EVM-compatible (`0x...`) address from one another.

Below are **4 distinct methods** for associating a wallet. Each method differs in terms of security considerations and required actions.

Below are **4 distinct methods** for associating a wallet along with relevant defitnitions. Each method differs in terms of security considerations and required actions.

---

## **Global Constants**

These constants for the `addr` precompile can also be found in the repo [Sei-Chain/precompiles](https://github.com/sei-protocol/sei-chain/tree/44fd60cec6a5ef301df1472431d6db40b382e486/precompiles/addr):

```ts
// Constants for precompile address and ABI
export const ADDRESS_PRECOMPILE_ADDRESS = '0x0000000000000000000000000000000000001004';

export const ADDRESS_PRECOMPILE_ABI = [
{
inputs: [
{ internalType: 'string', name: 'v', type: 'string' },
{ internalType: 'string', name: 'r', type: 'string' },
{ internalType: 'string', name: 's', type: 'string' },
{ internalType: 'string', name: 'customMessage', type: 'string' }
],
name: 'associate',
outputs: [
{ internalType: 'string', name: 'seiAddr', type: 'string' },
{ internalType: 'address', name: 'evmAddr', type: 'address' }
],
stateMutability: 'nonpayable',
type: 'function'
},
{
inputs: [{ internalType: 'string', name: 'pubKeyHex', type: 'string' }],
name: 'associatePubKey',
outputs: [
{ internalType: 'string', name: 'seiAddr', type: 'string' },
{ internalType: 'address', name: 'evmAddr', type: 'address' }
],
stateMutability: 'nonpayable',
type: 'function'
},
{
inputs: [{ internalType: 'address', name: 'addr', type: 'address' }],
name: 'getSeiAddr',
outputs: [{ internalType: 'string', name: 'response', type: 'string' }],
stateMutability: 'view',
type: 'function'
},
{
inputs: [{ internalType: 'string', name: 'addr', type: 'string' }],
name: 'getEvmAddr',
outputs: [{ internalType: 'address', name: 'response', type: 'address' }],
stateMutability: 'view',
type: 'function'
}
];
```

---

Expand Down
Loading