UNPKG

@stoar/sdk

Version:

JavaScript/TypeScript SDK for STOAR - Decentralized file storage on Arweave

52 lines 1.61 kB
import { type StoarConfig, type UploadOptions, type UploadResult, type BatchUploadOptions, type BatchUploadResult, type FileMetadata, type QueryOptions, type QueryResult } from "../types"; export declare class StoarClient { private arweave; private wallet?; private config; constructor(config?: StoarConfig); /** * Initialize the client with a wallet */ init(walletSource?: string | ArrayBuffer | object): Promise<void>; /** * Upload a single file to Arweave */ uploadFile(data: Buffer | Uint8Array | string, metadata: FileMetadata, options?: UploadOptions): Promise<UploadResult>; /** * Upload multiple files as an AR bundle */ uploadBatch(files: Array<{ data: Buffer | Uint8Array; metadata: FileMetadata; }>, options?: BatchUploadOptions): Promise<BatchUploadResult>; /** * Query transactions */ query(options?: QueryOptions): Promise<QueryResult[]>; /** * Get file data by transaction ID */ getFile(transactionId: string): Promise<Uint8Array>; /** * Get wallet address */ getAddress(): string; /** * Get wallet balance in AR */ getBalance(): Promise<string>; /** * Check if wallet has sufficient balance for upload * @throws InsufficientBalanceError if balance is 0 or negative */ private checkBalance; /** * Helper method to extract tags from transaction */ private extractTags; /** * Helper method to build tag query for ArQL */ private buildTagQuery; } //# sourceMappingURL=node.d.ts.map