@keypo/synapse-storage-sdk
Version:
TypeScript SDK for encrypted file storage on Filecoin via Synapse
48 lines • 1.5 kB
TypeScript
/**
* Storage operations manager for Synapse Storage SDK
*/
import type { Synapse } from '@filoz/synapse-sdk';
import type { StorageCallbacks, UploadProgress, DownloadProgress, BalanceInfo } from '../../types/index.js';
export interface StorageConfig {
capacityGB: number;
persistenceDays: number;
withCDN: boolean;
minDaysThreshold: number;
}
export declare class StorageManager {
private synapse;
private config;
constructor(synapse: Synapse, config?: Partial<StorageConfig>);
/**
* Check wallet and Synapse balances
*/
checkBalances(): Promise<BalanceInfo>;
/**
* Validate and prepare payment for upload
*/
validatePayment(skipCheck?: boolean): Promise<boolean>;
/**
* Find optimal proofset for upload based on withCDN configuration
*/
private getOptimalProofset;
/**
* Upload data to Filecoin
*/
upload(data: Uint8Array, callbacks?: StorageCallbacks, onProgress?: (status: UploadProgress) => void, serviceProvider?: {
providerId?: number;
providerAddress?: string;
forceCreateDataSet?: boolean;
}): Promise<{
pieceCid: any;
datasetCreated: boolean;
}>;
/**
* Download data from Filecoin
*/
download(pieceCid: string, onProgress?: (status: DownloadProgress) => void): Promise<Uint8Array>;
/**
* Deposit USDFC to Synapse
*/
deposit(amount: number): Promise<void>;
}
//# sourceMappingURL=StorageManager.d.ts.map