@ultraos/wallet-sdk
v0.2.0
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, sign transactions, and initiate purchases with a simple API.
- Environment support:
mainnet,testnet, or custom wallet URLs.
📦 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: '' },
authorizations: ['user@active'],
});⚙️ 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 independetly of auto-detection
});📚 API
Methods
connect(): Promise<ConnectResult>disconnect(): Promise<void>signMessage(message: string): Promise<string>signTransaction(transaction: BlockchainTransaction | BlockchainTransaction[]): Promise<SignTransactionResult>getChainId(): Promise<string>purchaseItem(itemType: PurchaseItemType, itemId: string): Promise<PurchaseItemResult>
Tests are run with Jest.
