TypeScript SDK
The TypeScript SDK gives you typed, programmatic access to OpenTusk. Zero dependencies — uses native fetch.
-
Install
Terminal window npm install @opentusk/sdk -
Upload a file
import { OpenTuskClient } from '@opentusk/sdk';import { readFile } from 'fs/promises';const opentusk = new OpenTuskClient({ apiKey: 'otk_your_key' });// List vaultsconst vaults = await opentusk.vaults.list();console.log(vaults);// Upload to your default vaultconst data = await readFile('./report.pdf');const file = await opentusk.files.upload({name: 'report.pdf',mimeType: 'application/pdf',vaultId: vaults[0].id,data,});console.log(file.status); // "hot" -
Wait for Walrus sync (optional)
await opentusk.files.waitForStatus(file.id, ['synced'], {timeout: 120000,});console.log('File durably stored on Walrus');
What happens next
Section titled “What happens next”Your file is hot — stored in a fast cache and immediately downloadable. In the background, OpenTusk syncs it to the Walrus decentralized network for durability.
uploading → hot → synced → cold ↑ durable on WalrusNext steps
Section titled “Next steps” SDK reference Every method, namespace, and type.
Upload & file lifecycle How files move through hot, synced, and cold.
Vaults Public vs shared, creation, and visibility.
Webhooks Get notified when files change status.