@cubewire/wallet-ts-sdk
v0.2.6
Published
TypeScript SDK for the Cubewire Wallet API (Speakeasy-generated, typed client and models).
Readme
@cubewire/wallet-ts-sdk
Type-safe TypeScript SDK for the Cubewire Wallet API — manage vaults, transactions, policies, signing, and more.
Features
- Full Wallet API coverage — vaults, transactions, signing, policies, assets, networks, webhooks, and more
- Type-safe — generated models and operations with full TypeScript types
- Tree-shakeable — standalone functions for minimal bundle size (FUNCTIONS.md)
- Configurable retries — built-in backoff strategy for transient failures
- Multi-runtime — Node.js 18+, Bun, Deno, and browsers (RUNTIMES.md)
Installation
npm install @cubewire/wallet-ts-sdkThis package is published as an ES Module (ESM) only. For CommonJS, use
await import().
Quick Start
1. Get API credentials from the Cubewire Dashboard → Settings → API Keys.
2. Initialize the SDK:
import { SDK } from "@cubewire/wallet-ts-sdk";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});3. Make API calls:
const vaults = await sdk.vaults.getVaults();
const tx = await sdk.transactions.createTransactionSend({
sender: { vaultId: "e06476b1-e31b-433f-a225-d43ded705399" },
chainId: 1,
to: "0x...",
value: "1000000000000000000",
});Available Resources
| Resource | Description |
|---|---|
| sdk.vaults | Create, list, update, and manage vaults |
| sdk.transactions | Send, broadcast, simulate, and query transactions |
| sdk.signing | Sign data and EIP-712 typed data |
| sdk.policies | Create and manage transaction policies |
| sdk.assets | Discover and manage vault assets and balances |
| sdk.networks | Configure blockchain networks and tokens |
| sdk.organizations | Manage organization settings, HSM, and compliance |
| sdk.roles | Manage roles and permissions |
| sdk.webhooks | Create and manage webhooks |
| sdk.auditLogs | Query audit logs and compliance reports |
| sdk.namedLists | Manage named lists for policy conditions |
| sdk.oauth2 | Request OAuth2 access tokens |
For the full list of operations, see FUNCTIONS.md or the API reference on GitHub.
Error Handling
All HTTP errors extend SDKError:
import { SDK } from "@cubewire/wallet-ts-sdk";
import * as errors from "@cubewire/wallet-ts-sdk/models/errors";
try {
const result = await sdk.vaults.getVaultsById({ id: "..." });
} catch (error) {
if (error instanceof errors.SDKError) {
console.log(error.statusCode); // e.g. 404
console.log(error.message);
console.log(error.body);
}
}Retries
Override the default retry strategy per-call or globally:
const result = await sdk.vaults.getVaults({}, {
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});Documentation
Full guides and API reference at docs.cubewire.com:
- Introduction
- Authentication & OAuth2
- Managing Vaults
- Transactions
- Smart Contracts
- Policies & Approvals
- Networks
Contributing
This SDK is generated by Speakeasy. Manual changes to generated files will be overwritten on the next generation. Report issues or feature requests upstream.
License
MIT © Cubewire
