UNPKG

@bancor/carbon-sdk

Version:

The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfi

25 lines 1.36 kB
import { Fetcher } from '../common/types'; import { ChainCache } from './ChainCache'; import { ChainSync } from './ChainSync'; export { ChainCache, ChainSync }; export * from './types'; /** * Initializes a cache and a syncer for the cache - this default initialization logic * can be used in most cases. If you need to customize the initialization logic, you can * use the ChainCache and ChainSync classes directly. * @param {Fetcher} fetcher - fetcher to use for syncing the cache * @param {string} cachedData - serialized cache data to initialize the cache with * @param {number} numOfPairsToBatch - number of pairs to fetch in a single batch - adapt this value based on the RPC limits and testing * @param {number} msToWaitBetweenSyncs - number of milliseconds to wait between syncs * @param {number} chunkSize - number of blocks to fetch in a single chunk * @returns an object with the initialized cache and a function to start syncing the cache * @example * const { cache, startDataSync } = initSyncedCache(fetcher, cachedData); * await startDataSync(); * // cache is now synced */ export declare const initSyncedCache: (fetcher: Fetcher, cachedData?: string, numOfPairsToBatch?: number, msToWaitBetweenSyncs?: number, chunkSize?: number) => { cache: ChainCache; startDataSync: () => Promise<void>; }; //# sourceMappingURL=index.d.ts.map