@wallet-abstractor/evm
v0.1.1
Published
EVM chain adapter for wallet-abstractor (Ethereum, Polygon, BSC, etc.)
Readme
@wallet-abstractor/evm
EVM chain adapter for Wallet Abstractor
Connect to MetaMask, Coinbase Wallet, and other EIP-1193 compatible wallets on Ethereum, Polygon, BSC, Arbitrum, Optimism, and more.
Installation
npm install @wallet-abstractor/core @wallet-abstractor/evmSupported Chains
- Ethereum Mainnet (chainId: 1)
- Goerli Testnet (chainId: 5)
- Sepolia Testnet (chainId: 11155111)
- Polygon (chainId: 137)
- Polygon Amoy (chainId: 80002)
- BNB Smart Chain (chainId: 56)
- BSC Testnet (chainId: 97)
- Arbitrum One (chainId: 42161)
- Optimism (chainId: 10)
- Avalanche C-Chain (chainId: 43114)
- zkSync Era (chainId: 324)
- Base (chainId: 8453)
Supported Wallets
- MetaMask
- Coinbase Wallet
- Trust Wallet
- Any EIP-1193 compatible wallet
Quick Start
import { createAdapter } from '@wallet-abstractor/core';
import '@wallet-abstractor/evm';
const wallet = createAdapter({
chain: 'evm',
network: 'ethereum', // or 'polygon', 'bsc', 'arbitrum', etc.
});
// Connect
const account = await wallet.connect();
console.log('Connected:', account.address);
// Get balance
const balance = await wallet.getBalance();
console.log(`Balance: ${balance.formatted} ${balance.symbol}`);
// Sign message
const signature = await wallet.signMessage('Hello Ethereum!');
// Send transaction
const txHash = await wallet.sendTransaction({
to: '0x742d35Cc6634C0532925a3b8D4e6D3b6e8d3e8B6',
value: 1000000000000000000n, // 1 ETH
});
// Switch network
await wallet.switchNetwork(137); // PolygonEVM-Specific Features
import { EvmAdapter } from '@wallet-abstractor/evm';
const wallet = new EvmAdapter({ network: 'ethereum' });
// Get current chain ID
const chainId = wallet.getCurrentChainId();
// Add custom network
await wallet.addNetwork(12345);
// Get provider info
import { detectWalletType, isEvmWalletAvailable } from '@wallet-abstractor/evm';
if (isEvmWalletAvailable()) {
const walletType = detectWalletType(); // 'metamask' | 'coinbase' | 'unknown'
}Related Packages
- @wallet-abstractor/core - Core abstraction layer
- @wallet-abstractor/solana - Solana adapter
License
MIT
