@ultraos/wallet-sdk
v0.6.1
Published
Ultra Wallet SDK provides an easy-to-use client for interacting with the Ultra blockchain wallet, either through the browser extension or via a web fallback.
Readme
Ultra Wallet SDK
Ultra Wallet SDK provides an easy-to-use client for interacting with the Ultra blockchain wallet, either through the browser extension or via a web fallback.
✨ Features
- Automatically detects and uses the Ultra Wallet Extension if available.
- Falls back to a Web Wallet if the extension is not installed.
- Connect, sign messages and sign transactions with a simple API.
- Environment support:
mainnet,testnet(browser extension only), or a custom Web Wallet URL.
📦 Installation
npm install @ultraos/wallet-sdkor
yarn add @ultraos/wallet-sdk🚀 Usage
import { UltraWalletSDK } from '@ultraos/wallet-sdk';
// Basic initialization (auto-detect extension or fallback to mainnet Web Wallet)
const ultra = new UltraWalletSDK();
// Optionally initialize with environment configuration
const ultraTestnet = new UltraWalletSDK({ environment: 'testnet' });
// Connect
await ultra.connect();
// Sign a message
const signature = await ultra.signMessage('message: Hello, Ultra!');
// Sign a transaction
await ultra.signTransaction({
contract: 'eosio.token',
action: 'transfer',
data: { from: 'user', to: 'receiver', quantity: '1.00000000 UOS', memo: '' },
// authorization defaults to the connected account's `active` permission
});⚙️ Configuration
You can pass options during initialization:
new UltraWalletSDK({
environment: 'testnet', // or 'mainnet', or provide custom URL
provider: 'web', // or 'extension', use a specific provider independently of auto-detection
});📚 API
Methods
All methods resolve to UltraResponse<T> ({ status: 'success', data: T }) and reject with
{ status, code, message }.
| Method | Extension | Web Wallet |
| ------------------------------------------------------------------------------------- | --------- | ---------- |
| connect(params?: ConnectParams) / disconnect() | ✅ | ✅ |
| signMessage(message: string) | ✅ | ✅ |
| signTransaction(transaction, options?: { signOnly?: boolean }) | ✅ | ✅ |
| getChainId() | ✅ | ✅ |
| getAccounts() / getSelectedAccount() / getAvailableAuthorizations() | ✅ | — |
| getNetwork() / getNetworks() / switchNetwork(chainId) | ✅ | — |
| on(event, cb) / off(event, cb) — accountChanged, networkChanged, disconnect | ✅ | — |
| dispose() | ✅ | ✅ |
The Web Wallet is currently deployed for mainnet only.
Full documentation: https://developers.ultra.io/products/ultra-wallet-sdk/
Tests are run with Jest.
