UNPKG

@metamask/multichain-account-service

Version:
41 lines 1.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BtcAccountProvider = exports.BTC_ACCOUNT_PROVIDER_DEFAULT_CONFIG = exports.BTC_ACCOUNT_PROVIDER_NAME = void 0; const keyring_api_1 = require("@metamask/keyring-api"); const analytics_1 = require("../analytics/index.cjs"); const SnapAccountProvider_1 = require("./SnapAccountProvider.cjs"); exports.BTC_ACCOUNT_PROVIDER_NAME = 'Bitcoin'; exports.BTC_ACCOUNT_PROVIDER_DEFAULT_CONFIG = { maxConcurrency: 3, createAccounts: { timeoutMs: 3000, }, discovery: { enabled: true, timeoutMs: 2000, maxAttempts: 3, backOffMs: 1000, }, resyncAccounts: { autoRemoveExtraSnapAccounts: true, }, }; class BtcAccountProvider extends SnapAccountProvider_1.SnapAccountProvider { constructor(messenger, config = exports.BTC_ACCOUNT_PROVIDER_DEFAULT_CONFIG, trace = analytics_1.traceFallback) { super(BtcAccountProvider.BTC_SNAP_ID, messenger, config, trace); // TODO: Remove once the Snap is fully v2 — discovery is then driven by the // Snap's own supported scopes via `createAccounts({ bip44:discover })`. this.v1DiscoveryScopes = [keyring_api_1.BtcScope.Mainnet]; } getName() { return BtcAccountProvider.NAME; } isAccountCompatible(account) { return (account.type === keyring_api_1.BtcAccountType.P2wpkh && Object.values(keyring_api_1.BtcAccountType).includes(account.type)); } } exports.BtcAccountProvider = BtcAccountProvider; BtcAccountProvider.NAME = exports.BTC_ACCOUNT_PROVIDER_NAME; BtcAccountProvider.BTC_SNAP_ID = 'npm:@metamask/bitcoin-wallet-snap'; //# sourceMappingURL=BtcAccountProvider.cjs.map