filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
74 lines • 2.41 kB
TypeScript
/**
* Mock implementation of @filoz/synapse-sdk for testing
*
* This file demonstrates how to create test mocks for Synapse SDK integration.
* Key testing patterns:
* 1. Mock the async SDK creation process
* 2. Simulate storage context callbacks for lifecycle testing
* 3. Generate realistic piece CIDs and IDs for verification
* 4. Provide deterministic behavior for unit tests
*/
import { MockSynapse, mockProviderInfo } from './synapse-mocks.js';
export declare const Synapse: {
create: import("vitest").Mock<() => Promise<MockSynapse>>;
};
/**
* Mock StorageContext that simulates the real SDK's storage interface
*
* In production, this manages:
* - Data set creation and tracking
* - Provider selection and communication
* - Upload lifecycle with callbacks
* - On-chain transaction coordination
*/
export declare class StorageContext {
dataSetId: number;
serviceProvider: string;
/**
* Mock upload method that simulates the full upload lifecycle
*
* Real SDK upload process:
* 1. Upload data to PDP server
* 2. Server calculates CommP (piece commitment)
* 3. Piece gets added to data set (on-chain transaction)
* 4. Transaction confirmation triggers callbacks
*/
upload(_data: ArrayBuffer | Uint8Array, options?: any): Promise<any>;
}
export declare const RPC_URLS: {
calibration: {
websocket: string;
};
mainnet: {
websocket: string;
};
};
export declare const METADATA_KEYS: {
WITH_IPFS_INDEXING: string;
IPFS_ROOT_CID: string;
};
/**
* Mock PDPVerifier for testing scheduled removals
*/
export declare class PDPVerifier {
getScheduledRemovals(_dataSetId: number): Promise<number[]>;
}
/**
* Mock PDPServer for testing piece data from provider
*/
export declare class PDPServer {
getDataSet(_dataSetId: number): Promise<{
pieces: any[];
}>;
}
export type DataSetPieceData = {
pieceId: number;
pieceCid: string;
};
export declare const CREATE_DATA_SET_TYPEHASH = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
export declare const ADD_PIECES_TYPEHASH = "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321";
export type SynapseOptions = any;
export type UploadCallbacks = any;
export type ProviderInfo = typeof mockProviderInfo;
export { StorageContext as StorageService };
//# sourceMappingURL=synapse-sdk.d.ts.map