Wallet Integration
Wallet Integration
Section titled “Wallet Integration”The SDK provides a built-in helper class for Bittensor wallet connections. For EVM and Solana, you use standard ecosystem libraries (wagmi, viem, Solana Wallet Adapter) alongside the SDK’s transaction payload methods.
Supported Wallets
Section titled “Supported Wallets”| Chain | Supported Wallets |
|---|---|
| EVM (Ethereum, Arbitrum, etc.) | MetaMask, Rabbit, Rainbow, any WalletConnect-compatible wallet |
| Bittensor | Talisman, Subwallet, Polkadot.js |
| Solana | Phantom, Solflare |
Bittensor Wallets
Section titled “Bittensor Wallets”The SDK includes a built-in BittensorWallet class for connecting Polkadot.js-compatible browser extensions.
Connect
Section titled “Connect”try { const account = await sdk.wallets.bittensor.connect();
console.log('Address:', account.address); console.log('Extension:', account.source); // e.g. 'talisman' console.log('Name:', account.name);} catch (err) { console.error('Failed to connect Bittensor wallet:', err); // Common error: "No compatible wallet extension found"}Check Connection Status
Section titled “Check Connection Status”if (sdk.wallets.bittensor.isConnected()) { const account = sdk.wallets.bittensor.getAccount(); console.log('Currently connected:', account);}Disconnect
Section titled “Disconnect”sdk.wallets.bittensor.disconnect();EVM Wallets
Section titled “EVM Wallets”For EVM chains, manage wallet connections with Wagmi, Ethers.js, or viem. The SDK’s bridge() method returns a transaction payload that you sign and send using your chosen library.
// 1. Request connected accountsconst accounts = await window.ethereum.request({ method: 'eth_requestAccounts',});const evmAddress = accounts[0];
// 2. Pass address to SDK callsconst response = await sdk.bridge.bridge({ fromChain: 'ethereum', fromWallet: evmAddress, // ...other params});import { useAccount, useSendTransaction } from 'wagmi';
const { address } = useAccount();const { sendTransaction } = useSendTransaction();
// Use address in SDK call, then send the returned payloadconst response = await sdk.bridge.bridge({ fromChain: 'ethereum', fromWallet: address, // ...other params});
if (response.evmTransaction) { sendTransaction(response.evmTransaction);}Solana Wallets
Section titled “Solana Wallets”For Solana, use the Solana Wallet Adapter to manage connections. Pass the connected public key address to SDK calls.
// 1. Connect Phantom walletawait window.solana.connect();const solAddress = window.solana.publicKey.toString();
// 2. Pass address to SDK callsconst response = await sdk.bridge.bridge({ fromChain: 'solana', fromWallet: solAddress, // ...other params});import { useWallet } from '@solana/wallet-adapter-react';
const { publicKey, connect } = useWallet();
await connect();
const response = await sdk.bridge.bridge({ fromChain: 'solana', fromWallet: publicKey.toString(), // ...other params});