filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
79 lines • 2.43 kB
TypeScript
import { EventEmitter } from 'node:events';
import type { ProviderInfo } from '@filoz/synapse-sdk';
/**
* Test utilities for mocking Synapse SDK components
*
* This file provides realistic mock implementations for testing Synapse integrations.
* It simulates the key SDK behaviors including:
* - Provider discovery and selection
* - Data set creation and management
* - Upload lifecycle with proper callback ordering
* - Network identification
*/
export declare const mockProviderInfo: ProviderInfo;
/**
* Mock storage context that simulates SDK's storage operations
*
* In production, StorageContext manages:
* - Communication with PDP servers
* - On-chain data set operations
* - Upload lifecycle and retries
* - Provider health monitoring
*/
export declare class MockStorageContext extends EventEmitter {
readonly dataSetId = 123;
readonly serviceProvider: string;
upload(_data: ArrayBuffer | Uint8Array, options?: any): Promise<any>;
}
/**
* Mock Synapse instance simulating the main SDK class
*
* Real Synapse manages:
* - Wallet and transaction signing
* - Network configuration and RPC communication
* - Contract interactions
* - Storage context factory
*/
export declare class MockSynapse extends EventEmitter {
private _storageContext;
readonly storage: {
createContext: (options?: any) => Promise<any>;
upload: (data: any, options: any) => Promise<any> | undefined;
};
/**
* Mock network identification
* Real networks: 314 (mainnet), 314159 (calibration testnet)
*/
getNetwork(): any;
/**
* Mock provider getter - returns a mock provider with destroy method
*/
getProvider(): any;
/**
* Mock signer getter
*/
getSigner(): any;
/**
* Mock client getter (returns owner wallet)
*/
getClient(): any;
/**
* Mock session key creation
*/
createSessionKey(_sessionWallet: any): any;
/**
* Mock session key setter
*/
setSession(_sessionKey: any): void;
/**
* Create a storage context with lifecycle callbacks
*
* Real process:
* 1. Query on-chain registry for active providers
* 2. Select best provider based on criteria
* 3. Check for existing data set or create new one
* 4. Initialize upload session
*/
createStorageContext(options?: any): Promise<any>;
}
//# sourceMappingURL=synapse-mocks.d.ts.map