From cf70ca854c313224db95a3d1d920ad8455808de2 Mon Sep 17 00:00:00 2001 From: cordt-sei <165932662+cordt-sei@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:00:47 -0700 Subject: [PATCH] Update wallet-association.mdx add constants defs --- .../wallet-association.mdx | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/pages/dev-advanced-concepts/wallet-association.mdx b/pages/dev-advanced-concepts/wallet-association.mdx index 4023b946..f610172d 100644 --- a/pages/dev-advanced-concepts/wallet-association.mdx +++ b/pages/dev-advanced-concepts/wallet-association.mdx @@ -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' + } +]; +``` ---