Multi-chain wallet adapter for Enclave - supports EVM and Tron ecosystems
npm install @enclave-hq/wallet-sdk> Multi-chain wallet adapter for Enclave - supports EVM and Tron ecosystems

@enclave-hq/wallet-sdk is a powerful, extensible wallet adapter library that provides a unified interface for connecting to multiple blockchain wallets across different ecosystems (EVM and Tron).
- π Multi-Chain Support: Unified interface for EVM (Ethereum, BSC, Polygon, etc.) and Tron
- π Multiple Wallets: MetaMask, TronLink, WalletConnect, and private key support
- β‘οΈ Easy Integration: Simple API with React hooks
- π― Type-Safe: Full TypeScript support with comprehensive type definitions
- π Secure: Standard-compliant signing (EIP-191, TIP-191, EIP-712)
- π¦ Tree-Shakeable: Modern build system with ESM and CJS support
- π¨ Extensible: Plugin-based architecture for adding new wallets and chains
``bash`
npm install @enclave-hq/wallet-sdkor
yarn add @enclave-hq/wallet-sdkor
pnpm add @enclave-hq/wallet-sdk
`typescript
import { WalletManager, WalletType } from '@enclave-hq/wallet-sdk'
// Create wallet manager
const walletManager = new WalletManager()
// Connect to MetaMask
const account = await walletManager.connect(WalletType.METAMASK, 1) // Ethereum Mainnet
console.log('Connected:', account.universalAddress)
// Output: "1:0x1234567890123456789012345678901234567890"
// Sign a message
const signature = await walletManager.signMessage('Hello World')
// Disconnect
await walletManager.disconnect()
`
`tsx
import React from 'react'
import { WalletProvider, useWallet, useAccount, useConnect } from '@enclave-hq/wallet-sdk/react'
import { WalletType } from '@enclave-hq/wallet-sdk'
// 1. Wrap your app with WalletProvider
function App() {
return (
)
}
// 2. Use wallet hooks in your components
function YourApp() {
const { account, isConnected } = useAccount()
const { connect, isConnecting } = useConnect()
const { disconnect } = useWallet()
const handleConnect = async () => {
try {
await connect(WalletType.METAMASK)
} catch (error) {
console.error('Connection failed:', error)
}
}
if (!isConnected) {
return (
)
}
return (
Connected: {account?.nativeAddress}
$3
`tsx
import React, { useState } from 'react'
import { useQRCodeSigner, QRCodeModal } from '@enclave-hq/wallet-sdk/react'function SignButton() {
const [showModal, setShowModal] = useState(false)
const { qrCodeDataUrl, status, startSign, cancel, error } = useQRCodeSigner({
requestId:
sign-${Date.now()},
requestUrl: https://example.com/sign?requestId=sign-${Date.now()},
pollUrl: 'https://api.example.com/sign/status',
}) const handleSign = async () => {
setShowModal(true)
try {
const signature = await startSign()
console.log('Signature:', signature)
setShowModal(false)
} catch (error) {
console.error('Sign failed:', error)
}
}
return (
<>
isOpen={showModal}
onClose={() => {
cancel()
setShowModal(false)
}}
qrCodeDataUrl={qrCodeDataUrl}
status={status}
error={error}
title="δ½Ώη¨ι±ε
ζ«η ηΎε"
/>
>
)
}
`π― Core Concepts
$3
A chain-agnostic address format:
chainId:address`typescript
// Example:
"1:0x1234..." // Ethereum Mainnet
"56:0x5678..." // BSC Mainnet
"195:TJmm..." // Tron Mainnet
`$3
The SDK uses a hybrid architecture where you can:
- Connect multiple wallets simultaneously (EVM + Tron)
- Designate one as the "primary wallet" for default operations
- Switch the primary wallet dynamically
`typescript
// Connect MetaMask as primary wallet
await walletManager.connect(WalletType.METAMASK)// Connect TronLink as additional wallet
await walletManager.connectAdditional(WalletType.TRONLINK)
// Switch primary wallet to TronLink
await walletManager.switchPrimaryWallet(ChainType.TRON)
// Get all connected wallets
const wallets = walletManager.getConnectedWallets()
`π Supported Wallets
| Wallet | Chain Type | Status |
|--------|------------|--------|
| MetaMask | EVM | β
Supported |
| TronLink | Tron | β
Supported |
| WalletConnect | EVM | β
Supported |
| WalletConnect Tron | Tron | β
Supported |
| Coinbase Wallet | EVM | π§ Coming Soon |
| Private Key | EVM/Tron | β
Dev Only |
| QR Code Signing | EVM/Tron | β
Supported |
π Documentation
Full documentation is available in the
/docs folder:- Architecture Design
- Design Goals
- API Reference
- Integration Guide
- State Management
- Standards & Signing
- QR Code Signing - δΊη»΄η ηΎεεθ½
- TRON Wallet Signing - TRON ι±ε
ηΎεζ―ζ
π§ͺ Running the Example
A fully functional example application is included:
`bash
cd example
npm install
npm run dev
`Open http://localhost:3000 to see the demo.
π οΈ Development
`bash
Install dependencies
npm installBuild the SDK
npm run buildWatch mode (for development)
npm run devRun linter
npm run lintType check
npm run type-check
``MIT Β© Enclave Team
Contributions are welcome! Please read our Contributing Guide for details.
- Enclave Documentation
- GitHub Repository
- Report Issues
---
Built with β€οΈ by the Enclave Team