Waldrop SDK · API Reference

Types

The TypeScript shapes returned by SDK methods. Source of truth is src/types.ts in the SDK repo — these are kept verbatim.

Read-side

BlobRef

interface BlobRef {
  blobId: string;            // Walrus content-addressed id
  sizeBytes: number;         // on-chain `original_size` (pre-encryption)
  sizeDisplay: string;       // human, e.g. "1.23 MB"
  storedEpoch: number;
  expiryEpoch: number;
  encrypted: boolean;
  sealPolicyId: string | null;
  contentHashHex: string;    // SHA-256 of original bytes, hex
  contentType: string;       // MIME
  originalName: string;      // filename
}

BlobStoreSummary

interface BlobStoreSummary {
  blobStoreId: string;
  totalSizeBytes: number;
  totalBlobs: number;
  viewers: string[];         // empty for pre-ACL-upgrade stores
}

FetchedBlob

interface FetchedBlob {
  bytes: Uint8Array;         // exactly as uploaded — still encrypted if applicable
  contentType: string;
  sizeBytes: number;
}

Write-side

UploadBlobArgs

interface UploadBlobArgs {
  data: Uint8Array;
  fileName: string;
  contentType: string;
  epochs: number;
  senderAddress: string;
  subscriptionId: string;
  signer: TransactionSigner;
  blobStoreId?: string;                    // omit ⇒ create + register in one PTB
  encrypted?: boolean;                     // true ⇒ SEAL (requires blobStoreId)
  publisherUrl?: string;
  publisherHeaders?: Record<string, string>;
  initialShareViewers?: string[];          // bundle add_blob_share calls
  onProgress?: (e: UploadProgressEvent) => void;
}

UploadBlobResult

interface UploadBlobResult {
  blobId: string;
  sizeBytes: number;
  storedEpoch: number;
  expiryEpoch: number;
  transactionDigest: string;
  blobStoreId: string | null;              // null if tx effects weren't returned
  sealMarker: string | null;               // null for plaintext
}

UploadBundleArgs · BundleFile

interface BundleFile {
  name: string;
  data: Uint8Array;
}

interface UploadBundleArgs extends Omit<UploadBlobArgs,
  "data" | "fileName" | "contentType"> {
  files: BundleFile[];
  fileName?: string;                       // default: waldrop-bundle-<ts>.tar
}

UploadProgressEvent

type UploadStage = "encrypting" | "uploading" | "registering" | "done";

interface UploadProgressEvent {
  stage: UploadStage;
  percent: number;                         // 0–100 coarse
}

RegisterBlobArgs · UploadCheckpoint

interface UploadCheckpoint {
  blobId: string;
  sizeBytes: number;
  contentHash: Uint8Array;
  fileName: string;
  contentType: string;
  encrypted: boolean;
  sealMarker?: string;
}

interface RegisterBlobArgs {
  checkpoint: UploadCheckpoint;
  epochs: number;
  senderAddress: string;
  subscriptionId: string;
  signer: TransactionSigner;
  blobStoreId?: string;                    // required if checkpoint.encrypted
  initialShareViewers?: string[];
  onProgress?: (e: UploadProgressEvent) => void;
}

TransactionSigner

interface TransactionSigner {
  signAndExecuteTransaction(input: { transaction: Transaction }):
    Promise<{ digest: string; effects?: unknown }>;
}

Matches dapp-kit's dAppKit.signAndExecuteTransaction shape — pass dAppKit directly in a dapp. In Node, wrap a keypair (see Node integration).

Crypto

EncryptBlobArgs · EncryptResult

interface EncryptBlobArgs {
  data: Uint8Array;
  blobStoreId: string;
}

interface EncryptResult {
  encryptedBytes: Uint8Array;
  sealMarker: string;                      // 16-byte hex, record on BlobRef
}

DecryptBlobArgs

interface DecryptBlobArgs {
  bytes: Uint8Array;
  blobStoreId: string;
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  signer: any;                             // dapp-kit signer or Ed25519Keypair
}

Cost

EstimateArgs · EstimateResult

interface EstimateArgs {
  bytesPerBlob: number;
  numBlobs?: number;                       // default 1
  epochs: number;
  pricing?: WalrusSystemSnapshot;          // skip live fetch
}

interface EstimateResult extends CostBreakdown {
  pricing: WalrusSystemSnapshot;
  totalWal: number;                        // totalFrost / 1e9
}

interface CostBreakdown {
  totalFrost: number;
  storageFrost: number;
  writeFrost: number;
  totalUnits: number;                      // 1 MiB encoded units
  isAvailable: boolean;
}

WalrusSystemSnapshot

interface WalrusSystemSnapshot {
  currentEpoch: number;
  epochDurationMs: number;                 // 0 on testnet (lives on Staking obj)
  epochDays: number;                       // rounded; 0 when unavailable
  storagePricePerUnitFrost: number;
  writePricePerUnitFrost: number;
  isAvailable: boolean;
}

Subscription

GetSubscriptionArgs · SubscriptionSummary

interface GetSubscriptionArgs {
  owner: string;
}

interface SubscriptionSummary {
  subscriptionId: string;
  planTier: number;                        // 0 FREE, 1 STARTER, 2 PRO, 3 ENTERPRISE
  startedEpoch: number;
  expiresEpoch: number;
  status: number;                          // 0 ACTIVE, 1 CANCELLED, 2 EXPIRED
}

Client

WaldropClientOptions

interface WaldropClientOptions {
  network?: "testnet";
  suiGrpcUrl?: string;
  walrusAggregatorUrl?: string;
  walrusPublisherUrl?: string;
  packageId?: string;
  suiClient?: unknown;                     // SuiGrpcClient — kept loose so dapp-kit fits
  fetchTimeoutMs?: number;
}
Edit this page on GitHub ↗
Waldrop · 2026cryptokarigar