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

Add Associate methods to Addr Precompile #196

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/dry-parents-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sei-js/evm": patch
---

Update addr precompiles
3 changes: 3 additions & 0 deletions packages/evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ The Address precompile contract enables the retrieval of associated EVM addresse
|----------------------------------------------------------------------------------------|-------------------|------------------------|------------------------------------------------------------------|
| [`getEvmAddr`](/sei-js/docs/interfaces/evm.AddressPrecompileFunctions.html#getEvmAddr) | `addr: ` `string` | `{ response: string }` | Retrieves the associated EVM address for a given Cosmos address. |
| [`getSeiAddr`](/sei-js/docs/interfaces/evm.AddressPrecompileFunctions.html#getSeiAddr) | `addr: ` `string` | `{ response: string }` | Retrieves the associated Cosmos address for a given EVM address. |
| [`associate`](/sei-js/docs/interfaces/evm.AddressPrecompileFunctions.html#associate) | `v: ` `string`, `r: ` `string`, `s: ` `string`, `customMessage: ` `string` | `{ response: string }` | Associates an EVM address with it's corresponding Sei Native address on chain using a signature. |
| [`associatePubKey`](/sei-js/docs/interfaces/evm.AddressPrecompileFunctions.html#associatePubKey) | `pubKeyHex: ` `string` | `{ response: string }` | Associates an EVM address with it's corresponding Cosmos address on chain using the Hex-Encoded compressed pubkey (excluding the '0x'). |


#### Precompile Address
0x0000000000000000000000000000000000001004
Expand Down
16 changes: 15 additions & 1 deletion packages/evm/src/precompiles/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,19 @@ export const ADDRESS_PRECOMPILE_ABI = [
outputs: [{ internalType: 'string', name: 'response', type: 'string' }],
stateMutability: 'view',
type: 'function'
}
},
{
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'
},
] as const;
Loading