UNPKG

@bsv/wallet-toolbox

Version:

BRC100 conforming wallet, wallet storage and wallet signer components

80 lines 3.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createDefaultWalletServicesOptions = createDefaultWalletServicesOptions; exports.arcDefaultUrl = arcDefaultUrl; exports.arcGorillaPoolUrl = arcGorillaPoolUrl; const utilityHelpers_1 = require("../utility/utilityHelpers"); const ChaintracksServiceClient_1 = require("./chaintracker/chaintracks/ChaintracksServiceClient"); function createDefaultWalletServicesOptions(chain, arcCallbackUrl, arcCallbackToken, taalArcApiKey, gorillaPoolArcApiKey, bitailsApiKey, deploymentId, chaintracks) { if (chain === 'mock') { throw new Error(`createDefaultWalletServicesOptions does not support 'mock' chain. Use MockServices directly.`); } deploymentId || (deploymentId = `wallet-toolbox-${(0, utilityHelpers_1.randomBytesHex)(16)}`); //const chaintracksUrl = `https://npm-registry.babbage.systems:${chain === 'main' ? 8084 : 8083}` const chaintracksUrl = `https://${chain}net-chaintracks.babbage.systems`; // The mainnet endpoint is always used since these are fiat exchange rates, // independent of the chain being used. const chaintracksFiatExchangeRatesUrl = `https://mainnet-chaintracks.babbage.systems/getFiatExchangeRates`; chaintracks || (chaintracks = new ChaintracksServiceClient_1.ChaintracksServiceClient(chain, chaintracksUrl)); const o = { chain, taalApiKey: undefined, bsvExchangeRate: { timestamp: new Date('2025-08-31'), base: 'USD', rate: 26.17 }, bsvUpdateMsecs: 1000 * 60 * 15, // 15 minutes fiatExchangeRates: { timestamp: new Date('2025-08-31'), base: 'USD', rates: { USD: 1, GBP: 0.7528, EUR: 0.8558 }, rateTimestamps: { USD: new Date('2025-08-31'), GBP: new Date('2025-08-31'), EUR: new Date('2025-08-31') } }, fiatUpdateMsecs: 1000 * 60 * 60 * 24, // 24 hours disableMapiCallback: true, // MAPI callback's are deprecated. Rely on WalletMonitor by default. exchangeratesapiKey: 'bd539d2ff492bcb5619d5f27726a766f', chaintracksFiatExchangeRatesUrl, chaintracks, arcUrl: arcDefaultUrl(chain), arcConfig: { apiKey: taalArcApiKey !== null && taalArcApiKey !== void 0 ? taalArcApiKey : undefined, deploymentId, callbackUrl: arcCallbackUrl !== null && arcCallbackUrl !== void 0 ? arcCallbackUrl : undefined, callbackToken: arcCallbackToken !== null && arcCallbackToken !== void 0 ? arcCallbackToken : undefined }, arcGorillaPoolUrl: arcGorillaPoolUrl(chain), arcGorillaPoolConfig: { apiKey: gorillaPoolArcApiKey !== null && gorillaPoolArcApiKey !== void 0 ? gorillaPoolArcApiKey : undefined, deploymentId, callbackUrl: arcCallbackUrl !== null && arcCallbackUrl !== void 0 ? arcCallbackUrl : undefined, callbackToken: arcCallbackToken !== null && arcCallbackToken !== void 0 ? arcCallbackToken : undefined }, bitailsApiKey }; return o; } function arcDefaultUrl(chain) { switch (chain) { case 'main': return 'https://arc.taal.com'; case 'test': return 'https://arc-test.taal.com'; case 'teratest': return 'https://arc-teratest.taal.com'; case 'mock': return ''; } } function arcGorillaPoolUrl(chain) { return chain === 'main' ? 'https://arc.gorillapool.io' : undefined; } //# sourceMappingURL=createDefaultWalletServicesOptions.js.map