鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

1k-adding-chains

为 OneKey 钱包扩展对新区块链的支持,涵盖从底层链逻辑实现、链配置注册、交易与地址处理到 UI 适配和全流程测试的完整开发流程,确保新链能无缝集成进现有多链架构。

区块链
访问 GitHub
文档Skills.MD
name
1k-adding-chains
description
Guide for adding new blockchain chains to OneKey. Use when implementing new chain support, adding blockchain protocols, or understanding chain architecture. Triggers on chain, blockchain, protocol, network, coin, token, add chain, new chain.
allowed-tools
Read, Grep, Glob, Write, Edit

Adding New Chains to OneKey

Overview

OneKey supports 40+ blockchains with pluggable chain implementations. This guide covers the process of adding new chain support.

Steps to Add a New Chain

1. Implement Chain Core Logic

Location: packages/core/src/chains/

Create a new directory for the chain:

▼
text
复制代码
packages/core/src/chains/mychain/ ├── index.ts # Main exports ├── types.ts # Chain-specific types ├── CoreChainSoftware/ # Software wallet implementation │ └── index.ts ├── sdkMychain/ # SDK wrapper if needed │ └── index.ts └── @tests/ # Chain tests └── index.test.ts

2. Add Chain Configuration

Location: packages/shared/src/config/chains/

Add chain constants and configuration:

▼
typescript
复制代码
export const CHAIN_MYCHAIN = { id: 'mychain', name: 'My Chain', symbol: 'MYC', decimals: 18, // ... other chain config };

3. Update UI Components for Chain-Specific Features

Location: packages/kit/src/

Add any chain-specific UI components or modifications needed for:

  • Transaction building
  • Address display
  • Token management
  • Network selection

4. Add Tests for Chain Functionality

Location: packages/core/src/chains/mychain/@tests/

Write comprehensive tests:

▼
typescript
复制代码
describe('MyChain', () => { it('should generate valid addresses', () => { // test address generation }); it('should sign transactions correctly', () => { // test transaction signing }); it('should validate addresses', () => { // test address validation }); });

Chain Implementation Checklist

  • Core chain logic in packages/core/src/chains/
  • Chain configuration in packages/shared/
  • Address generation and validation
  • Transaction building and signing
  • Balance fetching
  • Token support (if applicable)
  • Hardware wallet support (if applicable)
  • UI components updated
  • Tests written and passing
  • Documentation added

Reference Existing Implementations

Look at existing chain implementations for guidance:

  • EVM chains: packages/core/src/chains/evm/
  • Bitcoin: packages/core/src/chains/btc/
  • Solana: packages/core/src/chains/sol/

Common Patterns

Chain Registry Pattern

▼
typescript
复制代码
// packages/core/src/chains/index.ts export const chainRegistry = { evm: () => import('./evm'), btc: () => import('./btc'), sol: () => import('./sol'), mychain: () => import('./mychain'), };

Address Validation

▼
typescript
复制代码
export function validateAddress(address: string): boolean { // Implement chain-specific validation return isValidAddress(address); }

Transaction Building

▼
typescript
复制代码
export async function buildTransaction(params: TxParams): Promise<UnsignedTx> { // Build unsigned transaction return { // transaction data }; }
区块链

快捷安装

复制到终端去安装 Skill

npxskillsaddOneKeyHQ/app-monorepo--skill"1k-adding-chains"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
property-based-testing
通过生成随机输入验证代码在各类边界条件下的行为一致性,适用于序列化、解析、归一化及纯函数等场景,能有效发现隐含缺陷并提升测试覆盖率,尤其适合需要高可靠性的算法与智能合约验证。
compliance-checker
能够对基础设施配置进行合规性评估,检查是否符合 SOC2、HIPAA 和 PCI DSS 等行业标准,识别潜在的安全风险与违规项,并生成改进建议报告,适用于安全审计与合规审查场景。
orchestration
作为系统的核心协调中枢,负责将用户复杂需求拆解为并行任务流,动态调度不同能力的智能体协同工作,自动管理任务依赖与执行状态,并在后台静默完成多线程探索、分析与实现,最终整合结果交付完整解决方案。
skill-adapter
对基础设施配置进行多标准合规性评估,覆盖 SOC2、HIPAA 和 PCI DSS 等主流框架,自动识别配置偏差与安全风险,并生成可操作的整改建议报告,支撑持续合规治理与审计准备。
contract-test-creator
自动生成符合行业规范的契约测试代码与配置,提供从框架搭建到单元测试、集成测试及模拟对象编写的全流程支持,适用于需要实现高质量自动化测试验证的开发场景。