@bsv/wallet-toolbox-client
Version:
Client only Wallet Storage
27 lines • 1.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createNoDbChaintracks = createNoDbChaintracks;
const Chaintracks_1 = require("./Chaintracks");
const ChaintracksFetch_1 = require("./util/ChaintracksFetch");
const createDefaultNoDbChaintracksOptions_1 = require("./createDefaultNoDbChaintracksOptions");
async function createNoDbChaintracks(chain, whatsonchainApiKey = '', maxPerFile = 100000, maxRetained = 2, fetch, cdnUrl = 'https://cdn.projectbabbage.com/blockheaders/', liveHeightThreshold = 2000, reorgHeightThreshold = 400, bulkMigrationChunkSize = 500, batchInsertLimit = 400, addLiveRecursionLimit = 36) {
try {
fetch || (fetch = new ChaintracksFetch_1.ChaintracksFetch());
const co = (0, createDefaultNoDbChaintracksOptions_1.createDefaultNoDbChaintracksOptions)(chain, whatsonchainApiKey, maxPerFile, maxRetained, fetch, cdnUrl, liveHeightThreshold, reorgHeightThreshold, bulkMigrationChunkSize, batchInsertLimit, addLiveRecursionLimit);
const chaintracks = new Chaintracks_1.Chaintracks(co);
const available = chaintracks.makeAvailable();
return {
chain,
fetch,
maxPerFile,
storage: co.storage,
chaintracks,
available
};
}
catch (error) {
console.error('Error setting up Chaintracks with NoDb Storage:', error);
throw error;
}
}
//# sourceMappingURL=createNoDbChaintracks.js.map