A powerful TypeScript SDK for interacting with multiple blockchain networks, including the Selendra network, Polkadot ecosystem, and Ethereum EVM chains. This SDK provides a unified interface for wallet operations, token management, and transaction handling across different blockchain networks.
- π Multi-chain support:
- Selendra Network
- Polkadot Ecosystem
- Ethereum EVM Chains
- πΌ Unified wallet interface
- π° Token management (ERC-20, native tokens)
- π Secure account management
- π Real-time balance queries
- π Network switching capabilities
- π Message signing
- π Transaction history
# Using npm
npm install bitriel-wallet-sdk
# Using yarn
yarn add bitriel-wallet-sdk
# Using pnpm
pnpm add bitriel-wallet-sdk
import { BitrielWalletSDK } from "bitriel-wallet-sdk";
// Initialize the SDK
const sdk = new BitrielWalletSDK();
// Get supported networks
const networks = sdk.getSupportedNetworks();
// Connect to a network (e.g., Selendra Mainnet)
await sdk.connect("selendra");
// Get wallet state
const walletState = await sdk.getWalletState();
// Send a transaction
const txHash = await sdk.sendTransaction({
to: "0x...",
value: "1000000000000000000", // 1 SEL
});
// Sign a message
const signature = await sdk.signMessage("Hello, World!");
// Disconnect
await sdk.disconnect();
- Mainnet
- Testnet
- Polkadot Mainnet
- Kusama
- Ethereum Mainnet
- Polygon Mainnet
new BitrielWalletSDK(options?: SDKOptions)
-
connect(networkId: string): Promise<void>
- Connects to the specified network
- Throws an error if the network is not supported
- Returns a promise that resolves when connected
-
disconnect(): Promise<void>
- Disconnects from the current network
- Cleans up resources and connections
-
getWalletState(): Promise<WalletState>
- Returns the current wallet state including:
- Address
- Network
- Balances (native and tokens)
- Connection status
- Returns the current wallet state including:
-
sendTransaction(tx: TransactionRequest): Promise<string>
- Sends a transaction and returns the transaction hash
- Supports both EVM and Polkadot transaction formats
- Handles gas estimation and fee calculation
-
signMessage(message: string): Promise<string>
- Signs a message using the current account
- Returns the signature in the appropriate format for the network
-
getSupportedNetworks(): NetworkConfig[]
- Returns a list of all supported networks
- Includes network details and configuration
-
getCurrentNetwork(): NetworkConfig | null
- Returns the currently connected network
- Returns null if not connected
-
getTokenBalance(tokenAddress: string): Promise<string>
- Returns the balance of a specific token
- Supports both ERC-20 and native tokens
-
getTokenInfo(tokenAddress: string): Promise<TokenInfo>
- Returns detailed information about a token
- Includes decimals, symbol, and name
- Clone the repository:
git clone https://github.com/bitriel/wallet-sdk.git
cd wallet-sdk
- Install dependencies:
pnpm install
- Build the project:
pnpm build
- Run tests:
pnpm test
The SDK includes comprehensive tests:
- Unit tests:
pnpm test
- Watch mode:
pnpm test:watch
- Coverage report:
pnpm test:coverage
- Integration tests:
pnpm test:execute
-
Connection Failures
- Ensure you have a stable internet connection
- Check if the network is supported
- Verify network configuration
-
Transaction Failures
- Check sufficient balance
- Verify gas/fee settings
- Ensure correct network selection
-
Token Operations
- Verify token contract address
- Check token decimals
- Ensure token is supported on the network
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers.