From d79f2a104953a996ad387e19e003e852e791acea Mon Sep 17 00:00:00 2001 From: mj Date: Mon, 29 Apr 2024 00:35:08 -0400 Subject: [PATCH] Add atlantic-2 chain info (#161) * Add atlantic-2 chain info * minor edit * update to just say precompile * add changeset * update chain id * update rpc url * update changeset * hardcode precompile addresses in readme --- .changeset/hip-lizards-laugh.md | 5 ++ packages/evm/README.md | 24 +++--- packages/evm/src/chainInfo/chainInfo.ts | 4 + packages/evm/src/precompiles/address.ts | 22 ++--- packages/evm/src/precompiles/bank.ts | 22 ++--- packages/evm/src/precompiles/distribution.ts | 22 ++--- packages/evm/src/precompiles/governance.ts | 22 ++--- packages/evm/src/precompiles/ibc.ts | 22 ++--- packages/evm/src/precompiles/json.ts | 22 ++--- packages/evm/src/precompiles/staking.ts | 22 ++--- packages/evm/src/precompiles/wasm.ts | 22 ++--- packages/evm/src/providers/viem.ts | 90 ++++++++++++++++---- 12 files changed, 184 insertions(+), 115 deletions(-) create mode 100644 .changeset/hip-lizards-laugh.md diff --git a/.changeset/hip-lizards-laugh.md b/.changeset/hip-lizards-laugh.md new file mode 100644 index 00000000..6a603197 --- /dev/null +++ b/.changeset/hip-lizards-laugh.md @@ -0,0 +1,5 @@ +--- +"@sei-js/evm": patch +--- + +Update with Atlantic-2 chain info diff --git a/packages/evm/README.md b/packages/evm/README.md index efa1da5d..dbe6ef71 100644 --- a/packages/evm/README.md +++ b/packages/evm/README.md @@ -43,7 +43,7 @@ export const WalletProvider = ({ children }: { children: ReactNode }) => { ### Connection with ethers v6 The 'ethers' package is a popular library for interacting with the Ethereum blockchain. This package provides a helper function for creating an ethers provider that is connected to the Sei EVM. ```tsx -import { ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS } from '@sei-js/evm'; +import { ADDRESS_PRECOMPILE_ADDRESS } from '@sei-js/evm'; import { ethers } from 'ethers'; const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -51,7 +51,7 @@ const signer = await provider.getSigner(); const accounts = await provider.send('eth_requestAccounts', []); -const contract = getAddressPrecompileEthersV6Contract(ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, signer); +const contract = getAddressPrecompileEthersV6Contract(ADDRESS_PRECOMPILE_ADDRESS, signer); const cosmosAddress = await contract.getSeiAddr(accounts[0]); ``` @@ -112,8 +112,8 @@ 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. | -#### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS.html) +#### Precompile Address +0x0000000000000000000000000000000000001004

@@ -134,7 +134,7 @@ The Bank precompile contract provides functionalities for managing balances, sup | [`sendNative`](/sei-js/docs/interfaces/evm.BankPrecompileFunctions.html#sendNative) | `toNativeAddress: ` `string`, `value: ` `string` | `{ success: boolean }` | Sends native tokens to a specified address. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_BANK_PRECOMPILE_ADDRESS.html) +0x0000000000000000000000000000000000001001

@@ -151,7 +151,7 @@ The Distribution precompile contract facilitates operations related to rewards w | [`withdrawDelegationRewards`](/sei-js/docs/interfaces/evm.DistributionPrecompileFunctions.html#withdrawDelegationRewards) | `validator: ` `string` | `{ success: boolean }` | Withdraws delegation rewards for a given validator. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS.html) +0x0000000000000000000000000000000000001007

@@ -167,7 +167,7 @@ The Governance precompile contract supports actions to deposit funds into propos | [`vote`](/sei-js/docs/interfaces/evm.GovernancePrecompileFunctions.html#vote) | `proposalID: ` `string`, `option: ` `string` | `{ success: boolean }` | Votes on a governance proposal. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS.html) +0x0000000000000000000000000000000000001006

@@ -184,7 +184,7 @@ The JSON precompile contract facilitates interoperability between the EVM and Co | [`extractAsUint256`](/sei-js/docs/interfaces/evm.JSONPrecompileFunctions.html#extractAsUint256) | `input: ` `string`, `key: ` `string` | `{ response: string }` | Extracts data as a uint256 from the input using the specified key. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_JSON_PRECOMPILE_ADDRESS.html) +- [arctic-1](/sei-js/docs/variables/evm.JSON_PRECOMPILE_ADDRESS.html)

@@ -202,7 +202,7 @@ The Staking precompile contract provides functions for delegation, re-delegation | [`undelegate`](/sei-js/docs/interfaces/evm.StakingPrecompileFunctions.html#undelegate) | `valAddress: ` `string`, `amount: ` `string` | `{ success: boolean }` | Undelegates tokens from the specified validator. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_STAKING_PRECOMPILE_ADDRESS.html) +0x0000000000000000000000000000000000001005

@@ -219,7 +219,8 @@ The WASM precompile contract facilitates execution, instantiation, and querying | [`query`](/sei-js/docs/interfaces/evm.WasmPrecompileFunctions.html#query) | `contractAddress: ` `string`, `req: ` `Uint8Array` | `{ response: Uint8Array }` | Queries the specified contract with the provided request. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_WASM_PRECOMPILE_ADDRESS.html) +0x0000000000000000000000000000000000001002 +

@@ -234,4 +235,5 @@ The IBC precompile contract facilitates messages exchange between Sei and other | [`transfer`](/sei-js/docs/interfaces/evm.IbcPrecompileFunctions.html#transfer) | `toAddress: ` `string`, `port: ` `string`, `channel: ` `string`, `denom: ` `string`, `amount: ` `ethers.BigNumberish`, `revisionNumber: ` `BigInt`, `revisionHeight: ` `BigInt`, `timeoutTimestamp: ` `BigInt` | `{ success: boolean }` | Transfers tokens from the caller's address to another on a different (IBC compatible) chain. | #### Precompile Addresses -- [arctic-1](/sei-js/docs/variables/evm.ARCTIC_1_IBC_PRECOMPILE_ADDRESS.html) +0x0000000000000000000000000000000000001009 + diff --git a/packages/evm/src/chainInfo/chainInfo.ts b/packages/evm/src/chainInfo/chainInfo.ts index 2edd0f7c..a53bbb74 100644 --- a/packages/evm/src/chainInfo/chainInfo.ts +++ b/packages/evm/src/chainInfo/chainInfo.ts @@ -6,5 +6,9 @@ export const SeiChainInfo = { devnet: { chainId: 713715, defaultRpc: 'https://evm-rpc-arctic-1.sei-apis.com' + }, + testnet: { + chainId: 1328, + defaultRpc: 'https://evm-rpc-testnet.sei-apis.com/' } }; diff --git a/packages/evm/src/precompiles/address.ts b/packages/evm/src/precompiles/address.ts index 4a550549..ae853411 100644 --- a/packages/evm/src/precompiles/address.ts +++ b/packages/evm/src/precompiles/address.ts @@ -34,19 +34,19 @@ export type AddressPrecompileContract = ethers.Contract & AddressPrecompileFunct * @example * Wagmi: Use the `useReadContract` hook to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider * const { address } = useAccount(); * - * const associatedSeiAddress = useReadContract({ abi: ADDRESS_PRECOMPILE_ABI, address: ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, functionName: 'getSeiAddr', args: [address] }); + * const associatedSeiAddress = useReadContract({ abi: ADDRESS_PRECOMPILE_ABI, address: ADDRESS_PRECOMPILE_ADDRESS, functionName: 'getSeiAddr', args: [address] }); * ``` * * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { ADDRESS_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -54,14 +54,14 @@ export type AddressPrecompileContract = ethers.Contract & AddressPrecompileFunct * * const accounts = await provider.send('eth_requestAccounts', []); * - * const addressPrecompileContract = getAddressPrecompileEthersV6Contract(ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, signer); + * const addressPrecompileContract = getAddressPrecompileEthersV6Contract(ADDRESS_PRECOMPILE_ADDRESS, signer); * * const associatedSeiAddress = await addressPrecompileContract.getSeiAddr(accounts[0]); * ``` * * @category Cosmos Interoperability */ -export const ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001004'; +export const ADDRESS_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001004'; /** * The ABI for the precompile contract which can be used for interoperability between the EVM and Cosmos. @@ -70,19 +70,19 @@ export const ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000 * @example * Wagmi: Use the `useReadContract` hook to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider * const { address } = useAccount(); * - * const associatedSeiAddress = useReadContract({ abi: ADDRESS_PRECOMPILE_ABI, address: ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, functionName: 'getSeiAddr', args: [address] }); + * const associatedSeiAddress = useReadContract({ abi: ADDRESS_PRECOMPILE_ABI, address: ADDRESS_PRECOMPILE_ADDRESS, functionName: 'getSeiAddr', args: [address] }); * ``` * * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, AddressPrecompileContract } from '@sei-js/evm'; + * import { ADDRESS_PRECOMPILE_ADDRESS, AddressPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -90,7 +90,7 @@ export const ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000 * * const accounts = await provider.send('eth_requestAccounts', []); * - * const addressPrecompileContract = new ethers.Contract(ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI, signer) as AddressPrecompileContract; + * const addressPrecompileContract = new ethers.Contract(ADDRESS_PRECOMPILE_ADDRESS, ADDRESS_PRECOMPILE_ABI, signer) as AddressPrecompileContract; * * const associatedSeiAddress = await addressPrecompileContract.getSeiAddr(accounts[0]); * ``` @@ -121,7 +121,7 @@ export const ADDRESS_PRECOMPILE_ABI: Abi = [ * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { ADDRESS_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -129,7 +129,7 @@ export const ADDRESS_PRECOMPILE_ABI: Abi = [ * * const accounts = await provider.send('eth_requestAccounts', []); * - * const addressPrecompileContract = getAddressPrecompileEthersV6Contract(ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, signer); + * const addressPrecompileContract = getAddressPrecompileEthersV6Contract(ADDRESS_PRECOMPILE_ADDRESS, signer); * * const associatedSeiAddress = await addressPrecompileContract.connect().getSeiAddr(accounts[0]); * ``` diff --git a/packages/evm/src/precompiles/bank.ts b/packages/evm/src/precompiles/bank.ts index da32f9f3..7f1117d2 100644 --- a/packages/evm/src/precompiles/bank.ts +++ b/packages/evm/src/precompiles/bank.ts @@ -74,7 +74,7 @@ export type BankPrecompileContract = ethers.Contract & BankPrecompileFunctions; * @example * Wagmi: Use the `useReadContract` hook to read the balance of the connected account. * ```tsx - * import { ARCTIC_1_BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider @@ -82,7 +82,7 @@ export type BankPrecompileContract = ethers.Contract & BankPrecompileFunctions; * * const { data } = useReadContract({ * abi: BANK_PRECOMPILE_ABI, - * address: ARCTIC_1_BANK_PRECOMPILE_ADDRESS, + * address: BANK_PRECOMPILE_ADDRESS, * functionName: 'balance', * args: [address, 'usei'] * }); @@ -93,7 +93,7 @@ export type BankPrecompileContract = ethers.Contract & BankPrecompileFunctions; * @example * ethers v6: Use the `ethers` library and precompiles to read the balance of the connected account. * ```tsx - * import { ARCTIC_1_BANK_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { BANK_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -101,14 +101,14 @@ export type BankPrecompileContract = ethers.Contract & BankPrecompileFunctions; * * const accounts = await provider.send('eth_requestAccounts', []); * - * const bankPrecompileContract = getBankPrecompileEthersV6Contract(ARCTIC_1_BANK_PRECOMPILE_ADDRESS, signer); + * const bankPrecompileContract = getBankPrecompileEthersV6Contract(BANK_PRECOMPILE_ADDRESS, signer); * * const balance = await bankPrecompileContract.balance(accounts[0], 'usei'); * ``` * * @category Cosmos Interoperability */ -export const ARCTIC_1_BANK_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001001'; +export const BANK_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001001'; /** * The ABI for the precompile contract, which can be used for interoperability between the EVM and Cosmos. @@ -116,7 +116,7 @@ export const ARCTIC_1_BANK_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000000 * @example * Wagmi: Use the `useReadContract` hook to read the balance of the connected account. * ```tsx - * import { ARCTIC_1_BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider @@ -124,7 +124,7 @@ export const ARCTIC_1_BANK_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000000 * * const { data } = useReadContract({ * abi: BANK_PRECOMPILE_ABI, - * address: ARCTIC_1_BANK_PRECOMPILE_ADDRESS, + * address: BANK_PRECOMPILE_ADDRESS, * functionName: 'balance', * args: [address, 'usei'] * }); @@ -135,7 +135,7 @@ export const ARCTIC_1_BANK_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000000 * @example * ethers v6: Use the `ethers` library and precompiles to read the balance of the connected account. * ```tsx - * import { ARCTIC_1_BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, BankPrecompileContract } from '@sei-js/evm'; + * import { BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, BankPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -143,7 +143,7 @@ export const ARCTIC_1_BANK_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000000 * * const accounts = await provider.send('eth_requestAccounts', []); * - * const bankPrecompileContract = new ethers.Contract(ARCTIC_1_BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, signer) as BankPrecompileContract; + * const bankPrecompileContract = new ethers.Contract(BANK_PRECOMPILE_ADDRESS, BANK_PRECOMPILE_ABI, signer) as BankPrecompileContract; * * const balance = await bankPrecompileContract.balance(accounts[0], 'usei'); * ``` @@ -215,7 +215,7 @@ export const BANK_PRECOMPILE_ABI: Abi = [ * * @example * ```tsx - * import { ARCTIC_1_BANK_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { BANK_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -223,7 +223,7 @@ export const BANK_PRECOMPILE_ABI: Abi = [ * * const accounts = await provider.send('eth_requestAccounts', []); * - * const bankPrecompileContract = getBankPrecompileEthersV6Contract(ARCTIC_1_BANK_PRECOMPILE_ADDRESS, signer); + * const bankPrecompileContract = getBankPrecompileEthersV6Contract(BANK_PRECOMPILE_ADDRESS, signer); * * const balance = await bankPrecompileContract.balance(accounts[0], 'usei'); * ``` diff --git a/packages/evm/src/precompiles/distribution.ts b/packages/evm/src/precompiles/distribution.ts index 62dd3ce6..5dfa607b 100644 --- a/packages/evm/src/precompiles/distribution.ts +++ b/packages/evm/src/precompiles/distribution.ts @@ -34,7 +34,7 @@ export type DistributionPrecompileContract = ethers.Contract & DistributionPreco * @example * Wagmi: Use the `useWriteContract` hook to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useContractFunction } from '@wagmi/core'; * * // Make sure your component is wrapped in a WagmiProvider @@ -45,7 +45,7 @@ export type DistributionPrecompileContract = ethers.Contract & DistributionPreco * // Wherever you want to call the contract function * writeContract({ * abi: DISTRIBUTION_PRECOMPILE_ABI, - * address: ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, + * address: DISTRIBUTION_PRECOMPILE_ADDRESS, * functionName: 'setWithdrawAddress', * args: [accounts[0]] * }); @@ -56,20 +56,20 @@ export type DistributionPrecompileContract = ethers.Contract & DistributionPreco * @example * ethers v6: Use the `ethers` library and precompiles to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const contract = getDistributionPrecompileEthersV6Contract(ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, signer); + * const contract = getDistributionPrecompileEthersV6Contract(DISTRIBUTION_PRECOMPILE_ADDRESS, signer); * * const response = await contract.setWithdrawAddress('0xADDRESS'); * ``` * @category Cosmos Interoperability */ -export const ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001007'; +export const DISTRIBUTION_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001007'; /** * The ABI for the precompile contract, which can be used for interoperability between the EVM and Cosmos. @@ -77,7 +77,7 @@ export const ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS: `0x${string}` = '0x000000 * @example * Wagmi: Use the `useWriteContract` hook to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useContractFunction } from '@wagmi/core'; * * // Make sure your component is wrapped in a WagmiProvider @@ -88,7 +88,7 @@ export const ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS: `0x${string}` = '0x000000 * * writeContract({ * abi: DISTRIBUTION_PRECOMPILE_ABI, - * address: ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, + * address: DISTRIBUTION_PRECOMPILE_ADDRESS, * functionName: 'setWithdrawAddress', * args: [accounts[0]] * }); @@ -99,13 +99,13 @@ export const ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS: `0x${string}` = '0x000000 * @example * ethers v6: Use the `ethers` library and precompiles to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, DistributionPrecompileContract } from '@sei-js/evm'; + * import { DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, DistributionPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const contract = new ethers.Contract(ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, signer) as DistributionPrecompileContract; + * const contract = new ethers.Contract(DISTRIBUTION_PRECOMPILE_ADDRESS, DISTRIBUTION_PRECOMPILE_ABI, signer) as DistributionPrecompileContract; * * const response = await contract.setWithdrawAddress('0xADDRESS'); * ``` @@ -135,13 +135,13 @@ export const DISTRIBUTION_PRECOMPILE_ABI: Abi = [ * @example * ethers v6: Use the `ethers` library and precompiles to set the withdrawal address for rewards for the connected account. * ```tsx - * import { getDistributionPrecompileEthersV6Contract, ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { getDistributionPrecompileEthersV6Contract, DISTRIBUTION_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const contract = getDistributionPrecompileEthersV6Contract(ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, signer); + * const contract = getDistributionPrecompileEthersV6Contract(DISTRIBUTION_PRECOMPILE_ADDRESS, signer); * * const response = await contract.setWithdrawAddress('0xADDRESS'); * ``` diff --git a/packages/evm/src/precompiles/governance.ts b/packages/evm/src/precompiles/governance.ts index 10835401..445754b4 100644 --- a/packages/evm/src/precompiles/governance.ts +++ b/packages/evm/src/precompiles/governance.ts @@ -35,11 +35,11 @@ export type GovernancePrecompileContract = ethers.Contract & GovernancePrecompil * @example * Wagmi * ```tsx - * import { ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; ** * const depositResponse = useContractFunction( - * ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, + * GOVERNANCE_PRECOMPILE_ADDRESS, * GOVERNANCE_PRECOMPILE_ABI, * 'deposit' * ); @@ -48,13 +48,13 @@ export type GovernancePrecompileContract = ethers.Contract & GovernancePrecompil * @example * ethers v6 * ```tsx - * import { getGovernancePrecompileEthersV6Contract, ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, parseSei } from '@sei-js/evm'; + * import { getGovernancePrecompileEthersV6Contract, GOVERNANCE_PRECOMPILE_ADDRESS, parseSei } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const governancePrecompileContract = getGovernancePrecompileEthersV6Contract(ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, signer); + * const governancePrecompileContract = getGovernancePrecompileEthersV6Contract(GOVERNANCE_PRECOMPILE_ADDRESS, signer); * * //Surround with try/catch for detailed errors * const depositResponse = await governancePrecompileContract.connect(signer).deposit('1', { value: parseSei(1) }); @@ -62,7 +62,7 @@ export type GovernancePrecompileContract = ethers.Contract & GovernancePrecompil * * @category Cosmos Interoperability * */ -export const ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001006'; +export const GOVERNANCE_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001006'; /** * The ABI for the precompile contract, which can be used for interoperability between the EVM and Cosmos. @@ -70,11 +70,11 @@ export const ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000 * @example * Wagmi * ```tsx - * import { ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useContractFunction } from '@wagmi/core'; * * const depositResponse = useContractFunction( - * ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, + * GOVERNANCE_PRECOMPILE_ADDRESS, * GOVERNANCE_PRECOMPILE_ABI, * 'deposit' * ); @@ -83,13 +83,13 @@ export const ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000 * @example * ethers v6 * ```tsx - * import { getGovernancePrecompileEthersV6Contract, ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, parseSei } from '@sei-js/evm'; + * import { getGovernancePrecompileEthersV6Contract, GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, parseSei } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const governancePrecompileContract = new ethers.Contract(ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, signer) as GovernancePrecompileContract; + * const governancePrecompileContract = new ethers.Contract(GOVERNANCE_PRECOMPILE_ADDRESS, GOVERNANCE_PRECOMPILE_ABI, signer) as GovernancePrecompileContract; * * const depositResponse = await governancePrecompileContract.connect().deposit('PROPOSAL_ID', { value: parseSei(1) }); * ``` @@ -121,13 +121,13 @@ export const GOVERNANCE_PRECOMPILE_ABI: Abi = [ * @example * ethers v6 * ```tsx - * import { getGovernancePrecompileEthersV6Contract, ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, parseSei } from '@sei-js/evm'; + * import { getGovernancePrecompileEthersV6Contract, GOVERNANCE_PRECOMPILE_ADDRESS, parseSei } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const governancePrecompileContract = getGovernancePrecompileEthersV6Contract(ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, signer); + * const governancePrecompileContract = getGovernancePrecompileEthersV6Contract(GOVERNANCE_PRECOMPILE_ADDRESS, signer); * * //Surround with try/catch for detailed errors * const depositResponse = await governancePrecompileContract.connect(signer).deposit('1', { value: parseSei(1) }); diff --git a/packages/evm/src/precompiles/ibc.ts b/packages/evm/src/precompiles/ibc.ts index 8db1bb1f..9392985e 100644 --- a/packages/evm/src/precompiles/ibc.ts +++ b/packages/evm/src/precompiles/ibc.ts @@ -35,30 +35,30 @@ export type IbcPrecompileContract = ethers.Contract & IbcPrecompileFunctions; * @example * Wagmi: Use the `useReadContract` hook to transfer funds from the associated address to another Cosmos waller on a different chain. * ```tsx - * import { ARCTIC_1_IBC_PRECOMPILE_ADDRESS, IBC_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { IBC_PRECOMPILE_ADDRESS, IBC_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider - * const isSuccessful = useReadContract({ abi: IBC_PRECOMPILE_ABI, address: ARCTIC_1_IBC_PRECOMPILE_ADDRESS, functionName: 'transfer', args: [COSMOS_ADDRESS, PORT, ... ] }); + * const isSuccessful = useReadContract({ abi: IBC_PRECOMPILE_ABI, address: IBC_PRECOMPILE_ADDRESS, functionName: 'transfer', args: [COSMOS_ADDRESS, PORT, ... ] }); * ``` * * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_IBC_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { IBC_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); * - * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(ARCTIC_1_IBC_PRECOMPILE_ADDRESS, signer); + * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(IBC_PRECOMPILE_ADDRESS, signer); * * const queryResponse = await ibcPrecompileContract.transfer(cosmosAddress, 'transfer', 'channel-0', 'usei', 100, 1n, 1n, 1n); * ``` * * @category Cosmos Interoperability */ -export const ARCTIC_1_IBC_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001009'; +export const IBC_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001009'; /** * The ABI for the IBC precompile contract. @@ -66,23 +66,23 @@ export const ARCTIC_1_IBC_PRECOMPILE_ADDRESS: `0x${string}` = '0x000000000000000 * @example * Wagmi: Use the `useReadContract` hook to transfer funds from the associated address to another Cosmos waller on a different chain. * ```tsx - * import { ARCTIC_1_IBC_PRECOMPILE_ADDRESS, IBC_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { IBC_PRECOMPILE_ADDRESS, IBC_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider - * const isSuccessful = useReadContract({ abi: IBC_PRECOMPILE_ABI, address: ARCTIC_1_IBC_PRECOMPILE_ADDRESS, functionName: 'transfer', args: [COSMOS_ADDRESS, PORT, ... ] }); + * const isSuccessful = useReadContract({ abi: IBC_PRECOMPILE_ABI, address: IBC_PRECOMPILE_ADDRESS, functionName: 'transfer', args: [COSMOS_ADDRESS, PORT, ... ] }); * ``` * * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_IBC_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { IBC_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); * - * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(ARCTIC_1_IBC_PRECOMPILE_ADDRESS, signer); + * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(IBC_PRECOMPILE_ADDRESS, signer); * * const queryResponse = await ibcPrecompileContract.transfer(cosmosAddress, 'transfer', 'channel-0', 'usei', 100, 1n, 1n, 1n); * ``` @@ -113,13 +113,13 @@ export const IBC_PRECOMPILE_ABI: Abi = [ * * @example * ```tsx - * import { ARCTIC_1_IBC_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { IBC_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); * - * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(ARCTIC_1_IBC_PRECOMPILE_ADDRESS, signer); + * const ibcPrecompileContract = getIbcPrecompileEthersV6Contract(IBC_PRECOMPILE_ADDRESS, signer); * const cosmosAddress = 'cosmos1...'; * * const bool = await ibcPrecompileContract.transfer(cosmosAddress, 'transfer', 'channel-0', 'usei', 100, 1n, 1n, 1n); diff --git a/packages/evm/src/precompiles/json.ts b/packages/evm/src/precompiles/json.ts index 56b13a57..4e3264eb 100644 --- a/packages/evm/src/precompiles/json.ts +++ b/packages/evm/src/precompiles/json.ts @@ -46,32 +46,32 @@ export type JSONPrecompileContract = ethers.Contract & JSONPrecompileFunctions; * @example * Wagmi: Use the `useReadContract` hook to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider * const { address } = useAccount(); * - * const extractedBytes = useReadContract({ abi: JSON_PRECOMPILE_ABI, address: ARCTIC_1_JSON_PRECOMPILE_ADDRESS, functionName: 'extractAsBytes', args: ['0xINPUT', 'KEY'] }); + * const extractedBytes = useReadContract({ abi: JSON_PRECOMPILE_ABI, address: JSON_PRECOMPILE_ADDRESS, functionName: 'extractAsBytes', args: ['0xINPUT', 'KEY'] }); * ``` * * @example * ethers v6 * ```tsx - * import { ARCTIC_1_JSON_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { JSON_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); ** - * const jsonPrecompileContract = getJSONPrecompileEthersV6Contract(ARCTIC_1_JSON_PRECOMPILE_ADDRESS, signer); + * const jsonPrecompileContract = getJSONPrecompileEthersV6Contract(JSON_PRECOMPILE_ADDRESS, signer); * * const response = await jsonPrecompileContract.connect().extractAsBytes('0xINPUT', 'KEY'); * ``` * * @category Cosmos Interoperability */ -export const ARCTIC_1_JSON_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001003'; +export const JSON_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001003'; /** * The ABI for the precompile contract, which can be used for interoperability between the EVM and Cosmos. @@ -79,25 +79,25 @@ export const ARCTIC_1_JSON_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000000 * @example * Wagmi: Use the `useReadContract` hook to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider * const { address } = useAccount(); * - * const extractedBytes = useReadContract({ abi: JSON_PRECOMPILE_ABI, address: ARCTIC_1_JSON_PRECOMPILE_ADDRESS, functionName: 'extractAsBytes', args: ['0xINPUT', 'KEY'] }); + * const extractedBytes = useReadContract({ abi: JSON_PRECOMPILE_ABI, address: JSON_PRECOMPILE_ADDRESS, functionName: 'extractAsBytes', args: ['0xINPUT', 'KEY'] }); * ``` * * @example * ethers v6 * ```tsx - * import { ARCTIC_1_JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI, JSONPrecompileContract } from '@sei-js/evm'; + * import { JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI, JSONPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); ** - * const jsonPrecompileContract = new ethers.Contract(ARCTIC_1_JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI, signer) as JSONPrecompileContract; + * const jsonPrecompileContract = new ethers.Contract(JSON_PRECOMPILE_ADDRESS, JSON_PRECOMPILE_ABI, signer) as JSONPrecompileContract; * * const response = await jsonPrecompileContract.connect().extractAsBytes('0xINPUT', 'KEY'); * ``` @@ -142,7 +142,7 @@ export const JSON_PRECOMPILE_ABI: Abi = [ * * @example * ```tsx - * import { ARCTIC_1_JSON_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { JSON_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -150,7 +150,7 @@ export const JSON_PRECOMPILE_ABI: Abi = [ * * const accounts = await provider.send('eth_requestAccounts', []); * - * const jsonPrecompileContract = getJSONPrecompileEthersV6Contract(ARCTIC_1_JSON_PRECOMPILE_ADDRESS, signer); + * const jsonPrecompileContract = getJSONPrecompileEthersV6Contract(JSON_PRECOMPILE_ADDRESS, signer); * * const response = await jsonPrecompileContract.connect().extractAsBytes('0xINPUT', 'KEY'); * ``` diff --git a/packages/evm/src/precompiles/staking.ts b/packages/evm/src/precompiles/staking.ts index 868e2ca1..463995b5 100644 --- a/packages/evm/src/precompiles/staking.ts +++ b/packages/evm/src/precompiles/staking.ts @@ -46,7 +46,7 @@ export type StakingPrecompileContract = ethers.Contract & StakingPrecompileFunct * @example * Wagmi: Use the `useWriteContract` hook to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useContractFunction } from '@wagmi/core'; * * // Make sure your component is wrapped in a WagmiProvider @@ -57,7 +57,7 @@ export type StakingPrecompileContract = ethers.Contract & StakingPrecompileFunct * * writeContract({ * abi: STAKING_PRECOMPILE_ABI, - * address: ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, + * address: STAKING_PRECOMPILE_ADDRESS, * functionName: 'delegate', * args: ['0xVALIDATOR_ADDRESS', parseSei(1)] * }); @@ -68,20 +68,20 @@ export type StakingPrecompileContract = ethers.Contract & StakingPrecompileFunct * @example * ethers v6: Use the `ethers` library and precompiles to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, StakingPrecompileContract } from '@sei-js/evm'; + * import { STAKING_PRECOMPILE_ADDRESS, StakingPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const contract = getStakingPrecompileEthersV6Contract(ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, signer); + * const contract = getStakingPrecompileEthersV6Contract(STAKING_PRECOMPILE_ADDRESS, signer); * * * const response = await contract.connect().delegate('0xVALIDATOR_ADDRESS', parseSei(1)); * ``` * * @category Cosmos Interoperability */ -export const ARCTIC_1_STAKING_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001005'; +export const STAKING_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001005'; /** * The ABI for the precompile contract, which can be used for interoperability between the EVM and Cosmos. @@ -89,7 +89,7 @@ export const ARCTIC_1_STAKING_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000 * @example * Wagmi: Use the `useWriteContract` hook to set the withdrawal address for rewards for the connected account. * ```tsx - * import { ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useContractFunction } from '@wagmi/core'; * * // Make sure your component is wrapped in a WagmiProvider @@ -100,7 +100,7 @@ export const ARCTIC_1_STAKING_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000 * * writeContract({ * abi: STAKING_PRECOMPILE_ABI, - * address: ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, + * address: STAKING_PRECOMPILE_ADDRESS, * functionName: 'delegate', * args: ['0xVALIDATOR_ADDRESS', parseSei(1)] * }); @@ -110,13 +110,13 @@ export const ARCTIC_1_STAKING_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000 * * @example * ```tsx - * import { ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI, StakingPrecompileContract } from '@sei-js/evm'; + * import { STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI, StakingPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(); // or any other provider * const signer = provider.getSigner(); * - * const contract = new ethers.Contract(ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI, signer) as StakingPrecompileContract; + * const contract = new ethers.Contract(STAKING_PRECOMPILE_ADDRESS, STAKING_PRECOMPILE_ABI, signer) as StakingPrecompileContract; * * const response = await contract.connect().delegate('0xVALIDATOR_ADDRESS', parseSei(1)); * ``` @@ -158,7 +158,7 @@ export const STAKING_PRECOMPILE_ABI: Abi = [ * * @example * ```tsx - * import { ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, parseSei } from '@sei-js/evm'; + * import { STAKING_PRECOMPILE_ADDRESS, parseSei } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider @@ -166,7 +166,7 @@ export const STAKING_PRECOMPILE_ABI: Abi = [ * * const accounts = await provider.send('eth_requestAccounts', []); - * const contract = getStakingPrecompileEthersV6Contract(ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, signer); + * const contract = getStakingPrecompileEthersV6Contract(STAKING_PRECOMPILE_ADDRESS, signer); * * const response = await contract.connect().delegate('0xVALIDATOR_ADDRESS', parseSei(1)); * ``` diff --git a/packages/evm/src/precompiles/wasm.ts b/packages/evm/src/precompiles/wasm.ts index 1a60f576..be280bfb 100644 --- a/packages/evm/src/precompiles/wasm.ts +++ b/packages/evm/src/precompiles/wasm.ts @@ -45,30 +45,30 @@ export type WasmPrecompileContract = ethers.Contract & WasmPrecompileFunctions; * @example * Wagmi: Use the `useReadContract` hook to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider - * const associatedSeiAddress = useReadContract({ abi: WASM_PRECOMPILE_ABI, address: ARCTIC_1_WASM_PRECOMPILE_ADDRESS, functionName: 'query', args: [CW_CONTRACT_ADDRESS, REQUEST] }); + * const associatedSeiAddress = useReadContract({ abi: WASM_PRECOMPILE_ABI, address: WASM_PRECOMPILE_ADDRESS, functionName: 'query', args: [CW_CONTRACT_ADDRESS, REQUEST] }); * ``` * * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_WASM_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { WASM_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); * - * const wasmPrecompileContract = getWasmPrecompileEthersV6Contract(ARCTIC_1_WASM_PRECOMPILE_ADDRESS, signer); + * const wasmPrecompileContract = getWasmPrecompileEthersV6Contract(WASM_PRECOMPILE_ADDRESS, signer); * * const queryResponse = await addressPrecompileContract.connect().query(CW_CONTRACT_ADDRESS, REQUEST); * ``` * * @category Cosmos Interoperability */ -export const ARCTIC_1_WASM_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001002'; +export const WASM_PRECOMPILE_ADDRESS: `0x${string}` = '0x0000000000000000000000000000000000001002'; /** * The ABI for the precompile contract, which can be used for interoperability between the EVM and Cosmos. @@ -76,23 +76,23 @@ export const ARCTIC_1_WASM_PRECOMPILE_ADDRESS: `0x${string}` = '0x00000000000000 * @example * Wagmi: Use the `useReadContract` hook to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI } from '@sei-js/evm'; + * import { WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI } from '@sei-js/evm'; * import { useReadContract } from 'wagmi'; * * // Make sure your component is wrapped in a WagmiProvider - * const associatedSeiAddress = useReadContract({ abi: WASM_PRECOMPILE_ABI, address: ARCTIC_1_WASM_PRECOMPILE_ADDRESS, functionName: 'query', args: [CW_CONTRACT_ADDRESS, REQUEST] }); + * const associatedSeiAddress = useReadContract({ abi: WASM_PRECOMPILE_ABI, address: WASM_PRECOMPILE_ADDRESS, functionName: 'query', args: [CW_CONTRACT_ADDRESS, REQUEST] }); * ``` * * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI, WasmPrecompileContract } from '@sei-js/evm'; + * import { WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI, WasmPrecompileContract } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); * - * const wasmPrecompileContract = new ethers.Contract(ARCTIC_1_WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI, signer) as WasmPrecompileContract; + * const wasmPrecompileContract = new ethers.Contract(WASM_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI, signer) as WasmPrecompileContract; * * const queryResponse = await addressPrecompileContract.connect().query(CW_CONTRACT_ADDRESS, REQUEST); * ``` @@ -145,13 +145,13 @@ export const WASM_PRECOMPILE_ABI: Abi = [ * @example * ethers v6: Use the `ethers` library and precompiles to read the associated Cosmos address for the connected account. * ```tsx - * import { ARCTIC_1_WASM_PRECOMPILE_ADDRESS } from '@sei-js/evm'; + * import { WASM_PRECOMPILE_ADDRESS } from '@sei-js/evm'; * import { ethers } from 'ethers'; * * const provider = new ethers.BrowserProvider(window.ethereum); // or any other provider * const signer = await provider.getSigner(); * - * const wasmPrecompileContract = getWasmPrecompileEthersV6Contract(ARCTIC_1_WASM_PRECOMPILE_ADDRESS, signer); + * const wasmPrecompileContract = getWasmPrecompileEthersV6Contract(WASM_PRECOMPILE_ADDRESS, signer); * * const queryResponse = await addressPrecompileContract.connect().query(CONTRACT_ADDRESS, REQUEST); * ``` diff --git a/packages/evm/src/providers/viem.ts b/packages/evm/src/providers/viem.ts index bf122477..f30166a7 100644 --- a/packages/evm/src/providers/viem.ts +++ b/packages/evm/src/providers/viem.ts @@ -1,15 +1,15 @@ import { Chain } from 'viem'; import { SeiChainInfo } from '../chainInfo'; import { - ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS, - ARCTIC_1_BANK_PRECOMPILE_ADDRESS, - ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS, - ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS, - ARCTIC_1_JSON_PRECOMPILE_ADDRESS, - ARCTIC_1_STAKING_PRECOMPILE_ADDRESS, - ARCTIC_1_WASM_PRECOMPILE_ADDRESS + ADDRESS_PRECOMPILE_ADDRESS, + BANK_PRECOMPILE_ADDRESS, + DISTRIBUTION_PRECOMPILE_ADDRESS, + GOVERNANCE_PRECOMPILE_ADDRESS, + JSON_PRECOMPILE_ADDRESS, + STAKING_PRECOMPILE_ADDRESS, + WASM_PRECOMPILE_ADDRESS } from '../precompiles'; -import { ARCTIC_1_IBC_PRECOMPILE_ADDRESS } from '../precompiles/ibc'; +import { IBC_PRECOMPILE_ADDRESS } from '../precompiles/ibc'; /** * Creates and returns a Viem Chain with the default arctic-1 configs and precompile contracts added. @@ -42,14 +42,14 @@ export const ARCTIC_1_VIEM_CHAIN: Chain = { } }, contracts: { - addressPrecompile: { address: ARCTIC_1_ADDRESS_PRECOMPILE_ADDRESS }, - bankPrecompile: { address: ARCTIC_1_BANK_PRECOMPILE_ADDRESS }, - distributionPrecompile: { address: ARCTIC_1_DISTRIBUTION_PRECOMPILE_ADDRESS }, - governancePrecompile: { address: ARCTIC_1_GOVERNANCE_PRECOMPILE_ADDRESS }, - jsonPrecompile: { address: ARCTIC_1_JSON_PRECOMPILE_ADDRESS }, - stakingPrecompile: { address: ARCTIC_1_STAKING_PRECOMPILE_ADDRESS }, - wasmPrecompile: { address: ARCTIC_1_WASM_PRECOMPILE_ADDRESS }, - ibcPrecompile: { address: ARCTIC_1_IBC_PRECOMPILE_ADDRESS } + addressPrecompile: { address: ADDRESS_PRECOMPILE_ADDRESS }, + bankPrecompile: { address: BANK_PRECOMPILE_ADDRESS }, + distributionPrecompile: { address: DISTRIBUTION_PRECOMPILE_ADDRESS }, + governancePrecompile: { address: GOVERNANCE_PRECOMPILE_ADDRESS }, + jsonPrecompile: { address: JSON_PRECOMPILE_ADDRESS }, + stakingPrecompile: { address: STAKING_PRECOMPILE_ADDRESS }, + wasmPrecompile: { address: WASM_PRECOMPILE_ADDRESS }, + ibcPrecompile: { address: IBC_PRECOMPILE_ADDRESS } }, fees: undefined, id: SeiChainInfo.devnet.chainId, @@ -67,3 +67,61 @@ export const ARCTIC_1_VIEM_CHAIN: Chain = { sourceId: SeiChainInfo.devnet.chainId, testnet: true }; + +/** + * Creates and returns a Viem Chain with the default atlantic-2 configs and precompile contracts added. + * @example + * React: Use with `createWagmiConfig` for use in a WagmiProvider: + * ```tsx + * import { ReactNode } from 'react'; + * import { WagmiProvider } from 'wagmi'; + * import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; + * import { ATLANTIC_2_VIEM_CHAIN, createWagmiConfig } from '@sei-js/evm'; + * + * const queryClient = new QueryClient(); + * + * export const WalletProvider = ({ children }: { children: ReactNode }) => { + * return ( + * + * {children} + * + * ); + * }; + * ``` + * @returns A 'viem' package chain compatible with Wagmi and Viem. + * @category Viem + */ +export const ATLANTIC_2_VIEM_CHAIN: Chain = { + blockExplorers: { + default: { + name: 'SeiTrace', + url: 'https://seitrace.com' + } + }, + // Precompiles are at the same address. + contracts: { + addressPrecompile: { address: ADDRESS_PRECOMPILE_ADDRESS }, + bankPrecompile: { address: BANK_PRECOMPILE_ADDRESS }, + distributionPrecompile: { address: DISTRIBUTION_PRECOMPILE_ADDRESS }, + governancePrecompile: { address: GOVERNANCE_PRECOMPILE_ADDRESS }, + jsonPrecompile: { address: JSON_PRECOMPILE_ADDRESS }, + stakingPrecompile: { address: STAKING_PRECOMPILE_ADDRESS }, + wasmPrecompile: { address: WASM_PRECOMPILE_ADDRESS }, + ibcPrecompile: { address: IBC_PRECOMPILE_ADDRESS } + }, + fees: undefined, + id: SeiChainInfo.testnet.chainId, + name: 'atlantic-2', + nativeCurrency: { + name: 'usei', + decimals: 18, + symbol: 'USEI' + }, + rpcUrls: { + default: { + http: [SeiChainInfo.testnet.defaultRpc] + } + }, + sourceId: SeiChainInfo.testnet.chainId, + testnet: true +}; \ No newline at end of file