SDK for building applications on Selendra blockchain.
TypeScript SDK for Selendra blockchain with full support for:
- ✅ 30 Pallets - Complete coverage of all Selendra runtime pallets
- ✅ EVM Support - Full Ethereum compatibility via Frontier
- ✅ React Hooks - Production-ready hooks for dApp development
- ✅ Unified Accounts - Seamless Substrate ↔ EVM account mapping
- ✅ Type Safety - Full TypeScript with comprehensive types
| Package | Description | NPM |
|---|---|---|
@selendrajs/sdk |
Core SDK with all pallets | |
@selendrajs/cli |
Command-line interface |
# Core SDK
npm install @selendrajs/sdk
# CLI (global)
npm install -g @selendrajs/cliimport { createSDK } from "@selendrajs/sdk";
// Connect to Selendra
const sdk = createSDK({ rpcUrl: "wss://rpc.selendra.org" });
await sdk.connect();
// Query balance
const balance = await sdk.pallets.balances.queries.getBalance("5GrwvaEF...");
console.log(`Balance: ${balance.free}`);
// Transfer tokens
const result = await sdk.pallets.balances.manager.transfer(
signer,
signerAddress,
{ dest: "5FHneW46...", value: "1000000000000000000" }
);
// Disconnect
await sdk.disconnect();import {
SelendraProvider,
useSelendra,
useBalance,
} from "@selendrajs/sdk/react";
function App() {
return (
<SelendraProvider config={{ rpcUrl: "wss://rpc.selendra.org" }}>
<Wallet />
</SelendraProvider>
);
}
function Wallet() {
const { isConnected } = useSelendra();
const { balance, isLoading } = useBalance("5GrwvaEF...");
if (!isConnected) return <div>Connecting...</div>;
if (isLoading) return <div>Loading...</div>;
return <div>Balance: {balance?.free}</div>;
}- Balances - Token transfers and queries
- Staking - Validator nomination and rewards
- Session - Session key management
- Democracy - Proposals and referenda
- Council - Collective decision-making
- Technical Committee - Technical governance
- Treasury - Community funding
- Elections - Council elections (Phragmen)
- Identity - On-chain identity
- Multisig - Multi-signature accounts
- Proxy - Account delegation
- Vesting - Token vesting schedules
- Utility - Batch transactions
- Contracts - ink! WASM contracts
- EVM - Ethereum Virtual Machine
- Ethereum - Ethereum transaction compatibility
- XVM - Cross-VM calls
- Aleph - Consensus and finality
- Elections - Validator elections
- Committee Management - Validator performance
- Operations - Account maintenance
- Unified Accounts - Substrate ↔ EVM mapping
- Sudo - Privileged operations
- Safe Mode - Emergency protection
- Tx Pause - Transaction pausing
- Scheduler - Scheduled calls
- Preimage - Preimage storage
selendra-sdk/
├── packages/
│ ├── core/ # @selendrajs/sdk
│ │ ├── src/
│ │ │ ├── core/ # SDK core classes
│ │ │ ├── pallets/ # All 30 pallet implementations
│ │ │ ├── providers/ # Connection providers
│ │ │ ├── react/ # React hooks
│ │ │ ├── unified/ # Unified accounts
│ │ │ ├── types/ # TypeScript types
│ │ │ └── utils/ # Utilities
│ │ ├── tests/ # Jest tests
│ │ └── examples/ # Usage examples
│ │
│ └── cli/ # @selendrajs/cli
│ ├── src/
│ │ ├── commands/ # CLI commands
│ │ ├── utils/ # CLI utilities
│ │ └── templates/ # Project templates
│ └── example/ # Example projects
│
├── package.json # Workspace root
└── README.md
# Create new project
selendra init my-dapp
# Check network status
selendra status --network testnet
# Check balance
selendra balance 0x742d35Cc6634C0532925a3b844Bc9e7595f3f4A
# Create account
selendra account new
# Deploy contract
selendra deploy MyToken --network testnet
# Staking info
selendra stake infoSee CLI README for full documentation.
See the packages/core/examples/ directory for comprehensive examples:
balance/- Balance queries and transfersstaking/- Staking operationsgovernance/- Democracy, Council, Treasurypools/- Nomination poolsevm/- EVM interactionscontracts/- ink! smart contractsunified/- Unified accounts
# Install dependencies
npm install
# Build all packages
npm run build
# Run tests
npm test
# Build specific packages
npm run build:core
npm run build:cli
# Run CLI in development
npm run cli -- status --network testnetThe legacy Rust and old TypeScript implementations are preserved in the legacy branch:
git checkout legacyApache-2.0 - see LICENSE
Contributions welcome! Please read our contributing guidelines before submitting PRs.