-
Notifications
You must be signed in to change notification settings - Fork 51
Renamed @sei-js/evm to @sei-js/precompiles
#259
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5016e93
Renamed `@sei-js/evm` to `@sei-js/precompiles`
codebycarson 4489ea4
Added changeset
codebycarson 4c5eb07
Removed and hid test files
codebycarson 1524e7a
Fixed TypeDoc issues
codebycarson be93c14
More typedoc fixes
codebycarson 8058237
Fixed broken tests due to local chain id change
codebycarson d315e43
Fixed ABI in ethers precompile
codebycarson eff13b8
Merge branch 'main' of github.com:sei-protocol/sei-js into feature/re…
codebycarson a047553
Updated yarn lock
codebycarson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@sei-js/precompiles": minor | ||
| --- | ||
|
|
||
| Rename @sei-js/evm to @sei-js/precompiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| # testing | ||
| packages/*/coverage | ||
|
|
||
| examples/ | ||
|
|
||
| # compiled output | ||
| dist | ||
|
|
||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| # @sei-js/evm | ||
| # @sei-js/precompiles | ||
|
|
||
| <!-- Switched name to @sei-js/precompiles --> | ||
|
|
||
| ## 2.0.4 | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| # @sei-js/precompiles | ||
|
|
||
| [](https://badge.fury.io/js/@sei-js%2Fprecompiles) | ||
| [](https://opensource.org/licenses/MIT) | ||
|
|
||
| TypeScript utilities and helpers for interacting with Sei's precompile contracts. Provides seamless integration with popular Ethereum development tools like Viem and Ethers.js, offering typed interfaces, contract factories, ABI's, contract addresses, and utilities specifically designed for Sei's precompile ecosystem. | ||
|
|
||
| ## 📦 Installation | ||
|
|
||
| ```bash | ||
| npm install @sei-js/precompiles | ||
| ``` | ||
|
|
||
| ```bash | ||
| yarn add @sei-js/precompiles | ||
| ``` | ||
|
|
||
| ```bash | ||
| pnpm add @sei-js/precompiles | ||
| ``` | ||
|
|
||
| ### Peer Dependencies | ||
|
|
||
| This package requires either `ethers` (v6+) or `viem` (v2+) as peer dependencies: | ||
|
|
||
| ```bash | ||
| # For Ethers.js users | ||
| npm install ethers@^6.0.0 | ||
|
|
||
| # For Viem users | ||
| npm install viem@^2.0.0 | ||
| ``` | ||
|
|
||
| ## 🚀 Quick Start | ||
|
|
||
| ### With Viem | ||
|
|
||
| ```typescript | ||
| import { createPublicClient, http } from 'viem' | ||
| import { seiMainnet } from '@sei-js/precompiles/viem' | ||
| import { BANK_PRECOMPILE_ADDRESS, bankPrecompileAbi } from '@sei-js/precompiles' | ||
|
|
||
| const client = createPublicClient({ | ||
| chain: seiMainnet, | ||
| transport: http() | ||
| }) | ||
|
|
||
| // Read token balance | ||
| const balance = await client.readContract({ | ||
| address: BANK_PRECOMPILE_ADDRESS, | ||
| abi: bankPrecompileAbi, | ||
| functionName: 'balance', | ||
| args: ['0x...', 'usei'] | ||
| }) | ||
| ``` | ||
|
|
||
| ### With Ethers.js | ||
|
|
||
| ```typescript | ||
| import { ethers } from 'ethers' | ||
| import { getBankPrecompileEthersV6Contract } from '@sei-js/precompiles/ethers' | ||
|
|
||
| const provider = new ethers.JsonRpcProvider('https://evm-rpc.sei-apis.com') | ||
| const bankContract = getBankPrecompileEthersV6Contract(provider) | ||
|
|
||
| // Read token balance | ||
| const balance = await bankContract.balance('0x...', 'usei') | ||
| ``` | ||
|
|
||
| ## 📋 Available Precompiles | ||
|
|
||
| | Precompile | Address | Description | | ||
| |------------|---------|-------------| | ||
| | **Bank** | `0x0000000000000000000000000000000000001001` | Token operations and balance management | | ||
| | **Oracle** | `0x0000000000000000000000000000000000001002` | Price feeds and TWAP data | | ||
| | **JSON** | `0x0000000000000000000000000000000000001003` | JSON parsing utilities | | ||
| | **Address** | `0x0000000000000000000000000000000000001004` | Address association between EVM and Cosmos | | ||
| | **Staking** | `0x0000000000000000000000000000000000001005` | Validator operations and delegation | | ||
| | **Governance** | `0x0000000000000000000000000000000000001006` | Voting and proposal management | | ||
| | **Distribution** | `0x0000000000000000000000000000000000001007` | Reward distribution and claiming | | ||
| | **IBC** | `0x0000000000000000000000000000000000001009` | Cross-chain transfers | | ||
| | **Pointerview** | `0x000000000000000000000000000000000000100A` | Token pointer queries | | ||
| | **Pointer** | `0x000000000000000000000000000000000000100B` | Token pointer creation | | ||
| | **Confidential Transfers** | `0x0000000000000000000000000000000000001010` | Privacy-preserving transactions | | ||
| | **WASM** | `0x0000000000000000000000000000000000001002` | CosmWasm contract interaction | | ||
|
|
||
| ## 📖 Documentation | ||
|
|
||
| For comprehensive guides, examples, and API reference, visit our documentation: | ||
|
|
||
| **📚 [Complete Documentation →](https://seilabs.mintlify.app/precompiles)** | ||
|
|
||
| ### Quick Links | ||
|
|
||
| - **[Quick Start Guide](https://seilabs.mintlify.app/precompiles/quick-start)** - Get up and running in 5 minutes | ||
| - **[Viem Integration](https://seilabs.mintlify.app/precompiles/precompiles/viem)** - Type-safe precompile interactions with Viem | ||
| - **[Ethers.js Integration](https://seilabs.mintlify.app/precompiles/precompiles/ethers)** - Use precompile contract factories with Ethers.js | ||
|
|
||
| ## 🏗️ Usage Examples | ||
|
|
||
| ### Bank Precompile - Token Operations | ||
|
|
||
| ```typescript | ||
| import { BANK_PRECOMPILE_ADDRESS, bankPrecompileAbi } from '@sei-js/precompiles' | ||
|
|
||
| // Send tokens | ||
| await writeContract({ | ||
| address: BANK_PRECOMPILE_ADDRESS, | ||
| abi: bankPrecompileAbi, | ||
| functionName: 'send', | ||
| args: [fromAddress, toAddress, 'usei', amount] | ||
| }) | ||
| ``` | ||
|
|
||
| ### Oracle Precompile - Price Data | ||
|
|
||
| ```typescript | ||
| import { ORACLE_PRECOMPILE_ADDRESS, oraclePrecompileAbi } from '@sei-js/precompiles' | ||
|
|
||
| // Get exchange rate | ||
| const rate = await readContract({ | ||
| address: ORACLE_PRECOMPILE_ADDRESS, | ||
| abi: oraclePrecompileAbi, | ||
| functionName: 'getExchangeRate', | ||
| args: ['ATOM'] | ||
| }) | ||
| ``` | ||
|
|
||
| ### Staking Precompile - Validator Operations | ||
|
|
||
| ```typescript | ||
| import { STAKING_PRECOMPILE_ADDRESS, stakingPrecompileAbi } from '@sei-js/precompiles' | ||
|
|
||
| // Delegate to validator | ||
| await writeContract({ | ||
| address: STAKING_PRECOMPILE_ADDRESS, | ||
| abi: stakingPrecompileAbi, | ||
| functionName: 'delegate', | ||
| args: [validatorAddress, amount] | ||
| }) | ||
| ``` | ||
|
|
||
| ## 🆘 Support | ||
|
|
||
| - **Documentation**: [https://seilabs.mintlify.app](https://seilabs.mintlify.app) | ||
| - **Discord**: [Sei Discord](https://discord.gg/sei) | ||
| - **GitHub Issues**: [Report a bug](https://github.com/sei-protocol/sei-js/issues) |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/evm/package.json → packages/precompiles/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed small typedoc issues in other packages, but this wont affect their builds and doesn't need a release. Just noticed as I was updating the comments inside the /precompiles package