diff --git a/.changeset/sharp-seas-fix.md b/.changeset/sharp-seas-fix.md new file mode 100644 index 000000000..78af6d2e8 --- /dev/null +++ b/.changeset/sharp-seas-fix.md @@ -0,0 +1,9 @@ +--- +"@sei-js/create-sei": patch +"@sei-js/ledger": patch +"@sei-js/mcp-server": patch +"@sei-js/precompiles": patch +"@sei-js/sei-global-wallet": patch +--- + +Update README files in NPM diff --git a/packages/create-sei/README.md b/packages/create-sei/README.md index 792f00c9b..76a955a68 100644 --- a/packages/create-sei/README.md +++ b/packages/create-sei/README.md @@ -1,36 +1,27 @@ -# Create Sei App +
-This repository contains various templates for kick-starting a Sei application out of the box, as well as a CLI (Command Line Interface) tool that can be used to create projects using the given templates. +# @sei-js/create-sei -You can use either: -- Next.js -- Vite.js +[![npm version](https://badge.fury.io/js/@sei-js%2Fcreate-sei.svg)](https://badge.fury.io/js/@sei-js%2Fcreate-sei) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) +[![Sei Network](https://img.shields.io/badge/Sei-Network-red)](https://sei.io) -to scaffold your project. +**Scaffold new Sei applications with pre-configured templates and tooling** -## Scaffold your project -Simply run `npx @sei-js/create-sei app` to run the setup wizard and choose the template you want to use. +[Documentation](https://sei-js.docs.sei.io/create-sei/welcome) • [GitHub](https://github.com/sei-protocol/sei-js) • [NPM](https://www.npmjs.com/package/@sei-js/create-sei) • [Telegram](https://t.me/+LPW_1djQwRQwMzlk) -## EVM Applications (Recommended) -Building on our EVM (Ethereum Virtual Machine) is the easiest way to get your dApp kick-started on Sei! The mature EVM ecosystem provides many tools out of the box to help developers build faster, including deploying smart contracts and other helpful connection libraries. +
-This tool will offer multiple variants of EVM tooling, including -- [Wagmi](https://wagmi.sh/core/getting-started) ([Viem](https://viem.sh/)): Recommended -- [Ethers](https://docs.ethers.org/v6/) +## 🚀 Quick Start -Both variants use [@sei-js/evm](https://sei-protocol.github.io/sei-js/modules/evm.html) +```bash +npx @sei-js/create-sei app -n my-sei-app +``` -If you are new to Web3 development, we recommend using Wagmi since it provides helpful hooks out of the box. +## 📚 Documentation -## Cosmos Applications -Cosmos based Sei Applications interact with the CosmWasm VM on the chain. Use this if you are a seasoned CosmWasm developer, or if you intend to interact with CosmWasm Smart Contracts, as well as other chains in the Cosmos ecosystem. +For complete documentation, examples, and guides, visit: +**[sei-js.docs.sei.io/create-sei](https://sei-js.docs.sei.io/create-sei/welcome)** -If you think your app might require interaction with native Cosmos modules, you should check the list of [precompiles](https://www.docs.sei.io/dev-interoperability/precompiles/addr) to determine if the same support can be offered by the EVM. -Cosmos Applications use -- [CosmosKit](https://hyperweb.io/stack/cosmos-kit) -- [@sei-js/cosmjs](https://sei-protocol.github.io/sei-js/modules/cosmjs.html) -- [Cosmjs](https://github.com/cosmos/cosmjs) - -## Contributing -We love contributions from the amazing Sei community! If you have a dApp template to contribute, do make a Pull Request into the [sei-js](https://github.com/sei-protocol/sei-js) repository. diff --git a/packages/ledger/README.md b/packages/ledger/README.md index 888593429..6ddbf4c1c 100644 --- a/packages/ledger/README.md +++ b/packages/ledger/README.md @@ -1,151 +1,27 @@ -# @sei-js/ledger - -## Table of Contents -- [Installation](#installation) -- [Usage](#usage) -- [createTransportAndApp](#createtransportandapp) - - [Parameters](#createTransportAndApp-parameters) -- [getAddresses](#getaddresses) - - [Parameters](#getAddresses-parameters) -- [SeiLedgerOfflineAminoSigner](#seiledgerofflineaminosigner) - - [Constructor](#SeiLedgerOfflineAminoSigner-constructor) - - [getAccounts](#SeiLedgerOfflineAminoSigner-getAccounts) - - [signAmino](#SeiLedgerOfflineAminoSigner-signAmino) -- [removeLeadingZeros](#removeleadingzeros) - - [Parameters](#removeLeadingZeros-parameters) - -## Installation -```bash -yarn add @sei-js/ledger -``` - -## Example Usage -```typescript -import { - coins, - SigningStargateClient, - StdFee -} from "@cosmjs/stargate"; - -import { - createTransportAndApp, - getAddresses, - SeiLedgerOfflineAminoSigner -} from "@sei-js/ledger"; - -const testApp = async () => { - const validatorAddress = "seivaloper1sq7x0r2mf3gvwr2l9amtlye0yd3c6dqa4th95v"; - const rpcUrl = "https://rpc-testnet.sei-apis.com/"; - const memo = "Delegation"; - const path = "m/44'/60'/0'/0/0"; - - const {app} = await createTransportAndApp(); - const {nativeAddress} = await getAddresses(app, path); - const ledgerSigner = new SeiLedgerOfflineAminoSigner(app, path) - const signingStargateClient = await SigningStargateClient.connectWithSigner(rpcUrl, ledgerSigner) - - const msgDelegate = { - typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", - value: { - delegatorAddress: nativeAddress.address, - validatorAddress: validatorAddress, - amount: coins(500, "usei"), - }, - }; - - const fee: StdFee = { - amount: [{denom: "usei", amount: "20000"}], - gas: "200000", - }; - - const result = await signingStargateClient.signAndBroadcast(nativeAddress.address, [msgDelegate], fee, memo) - console.log("Broadcast result:", result); -}; - -testApp(); -``` - - -## createTransportAndApp - -### Parameters: -- None. - -### Returns: -- `Promise<{transport: Transport, app: SeiApp}>`: A promise that resolves to an object containing the `transport` and `app` instances. +
-### Usage: -```typescript -import { createTransportAndApp } from '@sei-js/ledger'; - -const { transport, app } = await createTransportAndApp(); -console.log(transport, app); -``` - -## getAddresses - -### Parameters: -- `app` (`SeiApp`): An instance of the Ledger Sei app. -- `path` (`string`): The HD derivation path (e.g., `"m/44'/60'/0'/0/0"`). - -### Returns: -- `Promise<{evmAddress: string, nativeAddress: string}>`: A promise that resolves to an object containing the EVM and Cosmos addresses. - -### Usage: -```typescript -import { getAddresses } from '@sei-js/ledger'; - -const { evmAddress, nativeAddress } = await getAddresses(app, "m/44'/60'/0'/0/0"); -console.log(evmAddress, nativeAddress); -``` - -## SeiLedgerOfflineAminoSigner - -### Constructor - -```typescript -new SeiLedgerOfflineAminoSigner(app: SeiApp, path: string) -``` +# @sei-js/ledger -#### Parameters: -- `app` (`SeiApp`): An instance of the Ledger Sei app. -- `path` (`string`): The HD derivation path (e.g., `"m/44'/60'/0'/0/0"`). +[![npm version](https://badge.fury.io/js/@sei-js%2Fledger.svg)](https://badge.fury.io/js/@sei-js%2Fledger) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) +[![Sei Network](https://img.shields.io/badge/Sei-Network-red)](https://sei.io) -#### Usage: -```typescript -import { SeiLedgerOfflineAminoSigner } from '@sei-js/ledger'; +**Hardware wallet integration for secure transaction signing** -const ledgerSigner = new SeiLedgerOfflineAminoSigner(app, "m/44'/60'/0'/0/0"); -``` +[Documentation](https://sei-js.docs.sei.io/ledger/introduction) • [GitHub](https://github.com/sei-protocol/sei-js) • [NPM](https://www.npmjs.com/package/@sei-js/ledger) • [Telegram](https://t.me/+LPW_1djQwRQwMzlk) -### getAccounts +
-#### Returns: -- `Promise`: A promise that resolves to an array of `AccountData` objects containing the address and public key. +## 🚀 Quick Start -#### Usage: -```typescript -import { SeiLedgerOfflineAminoSigner } from '@sei-js/ledger'; - -const accounts = await ledgerSigner.getAccounts(); -console.log(accounts); // { address: 'sei1...', pubkey: { type: 'tendermint/PubKeySecp256k1', value: '...' } } +```bash +npm install @sei-js/ledger ``` -### signAmino +## 📚 Documentation -#### Parameters: -- `_signerAddress` (`string`): The address of the signer (unused in this method). -- `signDoc` (`StdSignDoc`): The sign document to be signed. +For complete documentation, examples, and guides, visit: +**[sei-js.docs.sei.io/ledger](https://sei-js.docs.sei.io/ledger/introduction)** -#### Returns: -- `Promise`: A promise that resolves to an object containing the signed document and the signature. -#### Usage: -```typescript -import { SeiLedgerOfflineAminoSigner } from '@sei-js/ledger'; -import { StdSignDoc } from '@cosmjs/amino'; - -const signDoc: StdSignDoc = { /* your StdSignDoc object */ }; -const signResponse = await ledgerSigner.signAmino('sei123...', signDoc); -console.log(signResponse.signed, signResponse.signature); -``` diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index 66b88d01c..49739120b 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -1,456 +1,57 @@ -# SEI MCP Server +
-![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg) -![EVM Networks](https://img.shields.io/badge/Networks-30+-green) -![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6) -![Viem](https://img.shields.io/badge/Viem-1.0+-green) +# @sei-js/mcp-server -Sei Model Context Protocol (Sei MCP) server provides blockchain services for Sei blockchain. -This server enables AI assistants and agents to interact via unified interface. +[![npm version](https://badge.fury.io/js/@sei-js%2Fmcp-server.svg)](https://badge.fury.io/js/@sei-js%2Fmcp-server) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) +[![Sei Network](https://img.shields.io/badge/Sei-Network-red)](https://sei.io) -## 📋 Contents +**Enable AI assistants to interact with the Sei blockchain** -- [Overview](#overview) -- [Features](#features) -- [Supported Networks](#supported-networks) -- [Prerequisites](#prerequisites) -- [Installation](#installation) -- [Server Configuration](#server-configuration) -- [Usage](#usage) -- [API Reference](#api-reference) - - [Tools](#tools) - - [Resources](#resources) -- [Security Considerations](#security-considerations) -- [Project Structure](#project-structure) -- [Development](#development) -- [License](#license) +[Documentation](https://sei-js.docs.sei.io/mcp-server/introduction) • [GitHub](https://github.com/sei-protocol/sei-js) • [NPM](https://www.npmjs.com/package/@sei-js/mcp-server) • [Telegram](https://t.me/+LPW_1djQwRQwMzlk) -## 🔭 Overview +
-The Sei MCP EVM Server leverages the Model Context Protocol to provide blockchain services to AI agents. -It supports a wide range of services including: +## 🚀 Quick Start -- Reading blockchain state (balances, transactions, blocks, etc.) -- Interacting with smart contracts -- Transferring tokens (native, ERC20, ERC721, ERC1155) -- Querying token metadata and balances +### Basic Setup (Read-Only) -All services are exposed through a consistent interface of MCP tools and resources, making it easy for AI agents to -discover and use blockchain functionality. +Start with read-only blockchain data access: -## ✨ Features - -### Blockchain Data Access - -- **Chain information** including blockNumber, chainId, and RPCs -- **Block data** access by number, hash, or latest -- **Transaction details** and receipts with decoded logs -- **Address balances** for native tokens and all token standards - -### Token services - -- **ERC20 Tokens** - - Get token metadata (name, symbol, decimals, supply) - - Check token balances - - Transfer tokens between addresses - - Approve spending allowances - -- **NFTs (ERC721)** - - Get collection and token metadata - - Verify token ownership - - Transfer NFTs between addresses - - Retrieve token URIs and count holdings - -- **Multi-tokens (ERC1155)** - - Get token balances and metadata - - Transfer tokens with quantity - - Access token URIs - -### Smart Contract Interactions - -- **Read contract state** through view/pure functions -- **Write services** with private key signing -- **Contract verification** to distinguish from EOAs -- **Event logs** retrieval and filtering - -### Comprehensive Transaction Support - -- **Native token transfers** across all supported networks -- **Gas estimation** for transaction planning -- **Transaction status** and receipt information -- **Error handling** with descriptive messages - -## 🌐 Supported Networks - -- Sei Mainnet -- Sei Testnet -- Sei Devnet - -## 🛠️ Prerequisites - -- Yarn Package Manager -- Node.js 18.0.0 or higher - -## 📦 Local Development - -```bash -# Clone the repository -git clone https://github.com/sei-protocol/sei-js.git -cd sei-js/packages/mcp-server - -# Install dependencies with Yarn -yarn install -``` - -## ⚙️ Server Configuration - -The server uses the following default configuration: - -- **Default Chain ID**: 1329 (Sei Mainnet) -- **Server Port**: 3001 -- **Server Host**: 0.0.0.0 (accessible from any network interface) - -These values are hardcoded in the application. If you need to modify them, you can edit the following files: - -- For chain configuration: `src/core/chains.ts` -- For server configuration: `src/server/http-server.ts` - -### Environment Variables - -The server supports loading configuration from environment variables: - -- `PRIVATE_KEY`: **Required** private key for any blockchain operations that involve signing transactions (e.g., transferring tokens, interacting with smart contracts that modify state). This is the **sole method** for providing a private key. If this environment variable is not set when a transaction-signing tool is invoked, the tool will return an error message instructing the AI assistant to ask the user to set the `PRIVATE_KEY` environment variable and restart the MCP server. - -Create a `.env` file in the root directory based on the `.env.example` template: - -```bash -# .env.example -PRIVATE_KEY=your_private_key_here -``` - -> **SECURITY WARNING**: Never commit your actual private key to version control. The `.env` file is included in `.gitignore` by default. - -## 🚀 Usage - -### Using with Claude Desktop - -1. Install the [Claude Desktop](https://claude.ai/download). -2. Go to Settings > Developer > Edit Config. -3. Add the following to the `mcpServers` section: ```json { "mcpServers": { "sei": { "command": "npx", - "args": [ - "-y", - "@sei-js/mcp-server" - ], - "env": { - "PRIVATE_KEY": "your_private_key_here" - } + "args": ["-y", "@sei-js/mcp-server"] } } } ``` -4. Save the configuration file and restart Claude. -When done, Claude will add new prompts, resources and tools. -To access prompts, click "+" button in the bottom left corner. And then "Add from sei". - -![Sei Prompts](img/ClaudeSeiPrompts.png) - -From there, click "Add from sei" to and for example, add a "my_wallet_address" prompt. -Claude should invoke now `get_address_from_private_key` tool and return the wallet address. -Sometimes, model may fail to understand tbe prompt or random question. Try to add a bit more context or retry with -extensive thinking option. -All tools available could be found by clicking "Search And Tools" button and then "sei". - -![Claude Search And Tools](img/ClaudeSearchAndTools.png) -![Sei Tools](img/ClaudeSeiTools.png) - - -### Using npx (No Installation Required) - -You can run the Sei MCP Server directly without installation using npx: - -```bash -# Run the server in stdio mode (for CLI tools) -npx @sei-protocol/mcp-server - -# Run the server in HTTP mode (for web applications) -npx @sei-protocol/mcp-server --http -``` +### Full Setup (With Wallet) -### Running the Server Locally - -Start the server using stdio (for embedding in CLI tools): - -```bash -# Start the stdio server -yarn start - -# Development mode with auto-reload -yarn dev -``` - -Or start the HTTP server with SSE for web applications: - -```bash -# Start the HTTP server -yarn start:http - -# Development mode with auto-reload -yarn dev:http -``` - -### Connecting to the Server - -Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the [MCP Inspector](https://github.com/modelcontextprotocol/inspector). - -### Connecting from Cursor - -To connect to the MCP server from Cursor: - -1. Open Cursor and go to Settings (gear icon in the bottom left) -2. Scroll down to "MCP" section -3. Click "Add new Global MCP server" -4. In mcp.json tab add the following configuration +To enable transactions and wallet tools, add the wallet mode flag and private key: ```json { "mcpServers": { - "sei-mcp-server": { + "sei": { "command": "npx", - "args": [ - "-y", - "@sei-js/mcp-server" - ], + "args": ["-y", "@sei-js/mcp-server"], "env": { - "PRIVATE_KEY": "your_private_key_here" + "WALLET_MODE": "private-key", + "PRIVATE_KEY": "0x123..." } } } } ``` -### Example: HTTP Mode with SSE - -If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration: - -```json -{ - "mcpServers": { - "sei-mcp-sse": { - "url": "http://localhost:3001/sse" - } - } -} -``` - -This connects directly to the HTTP server's SSE endpoint, which is useful for: -- Web applications that need to connect to the MCP server from the browser -- Environments where running local commands isn't ideal -- Sharing a single MCP server instance among multiple users or applications - -To use this configuration: -1. Create a `.cursor` directory in your project root if it doesn't exist -2. Save the above JSON as `mcp.json` in the `.cursor` directory -3. Restart Cursor or open your project -4. Cursor will detect the configuration and offer to enable the server(s) - -### Example: Using the MCP Server in Cursor - -After configuring the MCP server with `mcp.json`, you can easily use it in Cursor. Here's an example workflow: - -1. Create a new JavaScript/TypeScript file in your project: - -```javascript -// blockchain-example.js -async function main() { - try { - // Get Sei balance for an address - console.log("Getting Sei balance for 0x1234..."); - - // When using with Cursor, you can simply ask Cursor to: - // "Check the Sei balance of 0x1234 on mainnet" - // Or "Transfer 0.1 Sei from my wallet to 0x1234" - - // Cursor will use the MCP server to execute these operations - // without requiring any additional code from you - - // This is the power of the MCP integration - your AI assistant - // can directly interact with blockchain data and operations - } catch (error) { - console.error("Error:", error.message); - } -} - -main(); -``` - -2. With the file open in Cursor, you can ask Cursor to: - - - "Check the current Sei balance of 0x1234 on mainnet" - - "Show me the latest block on Sei" - - "Check if 0x1234... is a contract address" - -3. Cursor will use the MCP server to execute these operations and return the results directly in your conversation. - -The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language. - -### Connecting using Claude CLI - -If you're using Claude CLI, you can connect to the MCP server with just two commands: - -Install the Claude CLI with the following command: -```bash -npm install -g @anthropic-ai/claude-code -``` - - -```bash -# Add the MCP server -claude mcp add sei-mcp-server npx @sei-js/mcp-server - -# Start Claude with the MCP server enabled -claude -``` - -### Example: Getting a Token Balance - -```javascript -// Example of using the MCP client to check a token balance -const mcp = new McpClient("http://localhost:3000"); - -const result = await mcp.invokeTool("get-token-balance", { - tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1", // USDC on Sei - ownerAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", - network: "sei" -}); - -console.log(result); -// { -// tokenAddress: "0x3894085ef7ff0f0aedf52e2a2704928d1ec074f1", -// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", -// network: "sei", -// raw: "1000000000", -// formatted: "1000", -// symbol: "USDC", -// decimals: 6 -// } -``` - -## 📚 API Reference - -### Tools - -The server provides the following MCP tools for agents. - -#### Token services - -| Tool Name | Description | Key Parameters | -|-----------|-------------|----------------| -| `get-token-info` | Get ERC20 token metadata | `tokenAddress` (address), `network` | -| `get-token-balance` | Check ERC20 token balance | `tokenAddress` (address), `ownerAddress` (address), `network` | -| `transfer-token` | Transfer ERC20 tokens | `tokenAddress` (address), `toAddress` (address), `amount`, `network` | -| `approve-token-spending` | Approve token allowances | `tokenAddress` (address), `spenderAddress` (address), `amount`, `network` | -| `get-nft-info` | Get NFT metadata | `tokenAddress` (address), `tokenId`, `network` | -| `check-nft-ownership` | Verify NFT ownership | `tokenAddress` (address), `tokenId`, `ownerAddress` (address), `network` | -| `get-nft-balance` | Count NFTs owned | `tokenAddress` (address), `ownerAddress` (address), `network` | -| `get-erc1155-token-uri` | Get ERC1155 metadata | `tokenAddress` (address), `tokenId`, `network` | -| `get-erc1155-balance` | Check ERC1155 balance | `tokenAddress` (address), `tokenId`, `ownerAddress` (address), `network` | -| `transfer-erc1155` | Transfer ERC1155 tokens | `tokenAddress` (address), `tokenId`, `amount`, `toAddress` (address), `network` | - -#### Blockchain services - -| Tool Name | Description | Key Parameters | -|-------------------|--------------------------------|---------------------------------------------------------| -| `get-chain-info` | Get network information | `network` | -| `get-balance` | Get native token balance | `address` (address), `network` | -| `transfer-sei` | Send native tokens | `to` (address), `amount`, `network` | -| `get-transaction` | Get transaction details | `txHash`, `network` | -| `read-contract` | Read smart contract state | `contractAddress` (address), `abi`, `functionName`, `args` (optional), `network` | -| `deploy-contract` | Deploy smart contract | `bytecode`, `abi`, `args`, `network` | -| `write-contract` | Write to smart contract | `contractAddress` (address), `abi`, `functionName`, `args` (optional), `network` | -| `is-contract` | Check if address is a contract | `address` (address), `network` | - -### Resources - -The server exposes blockchain data through the following MCP resource URIs. - -#### Blockchain Resources - -| Resource URI Pattern | Description | -|-----------|------------------------------------------| -| `evm://{network}/chain` | Chain information for a specific network | -| `evm://chain` | Sei mainnet chain information | -| `evm://{network}/block/{blockNumber}` | Block data by number | -| `evm://{network}/block/latest` | Latest block data | -| `evm://{network}/address/{address}/balance` | Native token balance | -| `evm://{network}/tx/{txHash}` | Transaction details | -| `evm://{network}/tx/{txHash}/receipt` | Transaction receipt with logs | - -#### Token Resources - -| Resource URI Pattern | Description | -|-----------|-------------| -| `evm://{network}/token/{tokenAddress}` | ERC20 token information | -| `evm://{network}/token/{tokenAddress}/balanceOf/{address}` | ERC20 token balance | -| `evm://{network}/nft/{tokenAddress}/{tokenId}` | NFT (ERC721) token information | -| `evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}` | NFT ownership verification | -| `evm://{network}/erc1155/{tokenAddress}/{tokenId}/uri` | ERC1155 token URI | -| `evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}` | ERC1155 token balance | - -## 🔒 Security Considerations - -- **Private keys** are used only for transaction signing and are never stored by the server -- Consider implementing additional authentication mechanisms for production use -- Use HTTPS for the HTTP server in production environments -- Implement rate limiting to prevent abuse -- For high-value services, consider adding confirmation steps - -## 📁 Project Structure - -``` -... -mcp-server/ -├── src/ -│ ├── index.ts # Main stdio server entry point -│ ├── server/ # Server-related files -│ │ ├── http-server.ts # HTTP server with SSE -│ │ └── server.ts # General server setup -│ ├── core/ -│ │ ├── chains.ts # Chain definitions and utilities -│ │ ├── config.ts # MCP configuration -│ │ ├── resources.ts # MCP resources implementation -│ │ ├── tools.ts # MCP tools implementation -│ │ ├── prompts.ts # MCP prompts implementation -│ │ └── services/ # Core blockchain services -│ │ ├── index.ts # Operation exports -│ │ ├── balance.ts # Balance services -│ │ ├── transfer.ts # Token transfer services -│ │ ├── utils.ts # Utility functions -│ │ ├── tokens.ts # Token metadata services -│ │ ├── contracts.ts # Contract interactions -│ │ ├── transactions.ts # Transaction services -│ │ └── blocks.ts # Block services -│ │ └── clients.ts # RPC client utilities -├── package.json -├── tsconfig.json -└── README.md -``` - -## 🛠️ Development - -To modify or extend the server: +## 📚 Documentation -1. Add new services in the appropriate file under `src/core/services/` -2. Register new tools in `src/core/tools.ts` -3. Register new resources in `src/core/resources.ts` -4. Add new network support in `src/core/chains.ts` -5. To change server configuration, edit the hardcoded values in `src/server/http-server.ts` +For complete documentation, examples, and guides, visit: +**[sei-js.docs.sei.io/mcp-server](https://sei-js.docs.sei.io/mcp-server/introduction)** -## 📄 License -This project is licensed under the terms of the [MIT License](./LICENSE). diff --git a/packages/precompiles/README.md b/packages/precompiles/README.md index aa29c2ac3..c5f12dafd 100644 --- a/packages/precompiles/README.md +++ b/packages/precompiles/README.md @@ -1,147 +1,33 @@ +
+ # @sei-js/precompiles [![npm version](https://badge.fury.io/js/@sei-js%2Fprecompiles.svg)](https://badge.fury.io/js/@sei-js%2Fprecompiles) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) +[![Sei Network](https://img.shields.io/badge/Sei-Network-red)](https://sei.io) -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: +**TypeScript utilities for interacting with Sei's precompile contracts** -```bash -# For Ethers.js users -npm install ethers@^6.0.0 +[Documentation](https://sei-js.docs.sei.io/precompiles/introduction) • [GitHub](https://github.com/sei-protocol/sei-js) • [NPM](https://www.npmjs.com/package/@sei-js/precompiles) • [Telegram](https://t.me/+LPW_1djQwRQwMzlk) -# 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'] -}) +```bash +npm install @sei-js/precompiles ``` -### Staking Precompile - Validator Operations +Works seamlessly with your favorite Ethereum development tools: +- **Viem** - Type-safe contract interactions +- **Ethers.js** - Contract factories and utilities +- **Wagmi** - React hooks for precompile contracts +- **Hardhat/Foundry** - Testing and deployment -```typescript -import { STAKING_PRECOMPILE_ADDRESS, stakingPrecompileAbi } from '@sei-js/precompiles' +## 📚 Documentation -// Delegate to validator -await writeContract({ - address: STAKING_PRECOMPILE_ADDRESS, - abi: stakingPrecompileAbi, - functionName: 'delegate', - args: [validatorAddress, amount] -}) -``` +For complete documentation, examples, and guides, visit: +**[sei-js.docs.sei.io/precompiles](https://sei-js.docs.sei.io/precompiles/introduction)** -## 🆘 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) diff --git a/packages/sei-global-wallet/README.md b/packages/sei-global-wallet/README.md index 120335b2b..479f2555f 100644 --- a/packages/sei-global-wallet/README.md +++ b/packages/sei-global-wallet/README.md @@ -1,24 +1,35 @@ -# Sei Global Wallet Package +
-This repository provides [Dynamic Global Wallet](https://docs.dynamic.xyz/global-wallets/overview) support for Sei. +# @sei-js/sei-global-wallet -## Getting Started +[![npm version](https://badge.fury.io/js/@sei-js%2Fsei-global-wallet.svg)](https://badge.fury.io/js/@sei-js%2Fsei-global-wallet) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) +[![Sei Network](https://img.shields.io/badge/Sei-Network-red)](https://sei.io) -1.**Install Sei Global Wallet Package** +**Universal wallet connections using the EIP-6963 standard** + +[Documentation](https://sei-js.docs.sei.io/sei-global-wallet/introduction) • [GitHub](https://github.com/sei-protocol/sei-js) • [NPM](https://www.npmjs.com/package/@sei-js/sei-global-wallet) • [Telegram](https://t.me/+LPW_1djQwRQwMzlk) + +
+ +## 🚀 Quick Start ```bash npm install @sei-js/sei-global-wallet ``` -2.**Importing the Sei Global Wallet** -To use this wallet with any wallet provider that supports the EIP-6963 standard, you need to import the wallet package in your project. - +Then import to register with EIP-6963 standard: + ```javascript - import "@sei-js/sei-global-wallet/eip6963"; - ``` +import '@sei-js/sei-global-wallet/eip6963'; +``` + +This single import enables Sei Global Wallet across all compatible wallet libraries (RainbowKit, ConnectKit, Web3-React, Wagmi, etc.). + +## 📚 Documentation -3.**Use Sei Global Wallet** - Your wallet is now ready to use within the project. +For complete documentation, examples, and guides, visit: +**[sei-js.docs.sei.io/sei-global-wallet](https://sei-js.docs.sei.io/sei-global-wallet/introduction)** ----