UNPKG

@metamask/multichain-network-controller

Version:
126 lines 5.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MULTICHAIN_NETWORK_DECIMAL_PLACES = exports.MULTICHAIN_NETWORK_TICKER = exports.MULTICHAIN_NETWORK_CONTROLLER_METADATA = exports.getDefaultMultichainNetworkControllerState = exports.NETWORKS_METADATA = exports.NON_EVM_TESTNET_IDS = exports.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS = exports.SOL_DEVNET_NATIVE_ASSET = exports.SOL_TESTNET_NATIVE_ASSET = exports.SOL_NATIVE_ASSET = exports.BTC_SIGNET_NATIVE_ASSET = exports.BTC_TESTNET_NATIVE_ASSET = exports.BTC_NATIVE_ASSET = void 0; const keyring_api_1 = require("@metamask/keyring-api"); const network_controller_1 = require("@metamask/network-controller"); exports.BTC_NATIVE_ASSET = `${keyring_api_1.BtcScope.Mainnet}/slip44:0`; exports.BTC_TESTNET_NATIVE_ASSET = `${keyring_api_1.BtcScope.Testnet}/slip44:0`; exports.BTC_SIGNET_NATIVE_ASSET = `${keyring_api_1.BtcScope.Signet}/slip44:0`; exports.SOL_NATIVE_ASSET = `${keyring_api_1.SolScope.Mainnet}/slip44:501`; exports.SOL_TESTNET_NATIVE_ASSET = `${keyring_api_1.SolScope.Testnet}/slip44:501`; exports.SOL_DEVNET_NATIVE_ASSET = `${keyring_api_1.SolScope.Devnet}/slip44:501`; /** * Supported networks by the MultichainNetworkController */ exports.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS = { [keyring_api_1.BtcScope.Mainnet]: { chainId: keyring_api_1.BtcScope.Mainnet, name: 'Bitcoin', nativeCurrency: exports.BTC_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.BtcScope.Testnet]: { chainId: keyring_api_1.BtcScope.Testnet, name: 'Bitcoin Testnet', nativeCurrency: exports.BTC_TESTNET_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.BtcScope.Signet]: { chainId: keyring_api_1.BtcScope.Signet, name: 'Bitcoin Signet', nativeCurrency: exports.BTC_SIGNET_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.SolScope.Mainnet]: { chainId: keyring_api_1.SolScope.Mainnet, name: 'Solana', nativeCurrency: exports.SOL_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.SolScope.Testnet]: { chainId: keyring_api_1.SolScope.Testnet, name: 'Solana Testnet', nativeCurrency: exports.SOL_TESTNET_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.SolScope.Devnet]: { chainId: keyring_api_1.SolScope.Devnet, name: 'Solana Devnet', nativeCurrency: exports.SOL_DEVNET_NATIVE_ASSET, isEvm: false, }, }; /** * Array of all the Non-EVM chain IDs. * This is a temporary mention until we develop * a more robust solution to identify testnet networks. */ exports.NON_EVM_TESTNET_IDS = [ keyring_api_1.BtcScope.Testnet, keyring_api_1.BtcScope.Signet, keyring_api_1.SolScope.Testnet, keyring_api_1.SolScope.Devnet, ]; /** * Metadata for the supported networks. */ exports.NETWORKS_METADATA = { [keyring_api_1.BtcScope.Mainnet]: { features: [], status: network_controller_1.NetworkStatus.Available, }, [keyring_api_1.SolScope.Mainnet]: { features: [], status: network_controller_1.NetworkStatus.Available, }, }; /** * Default state of the {@link MultichainNetworkController}. * * @returns The default state of the {@link MultichainNetworkController}. */ const getDefaultMultichainNetworkControllerState = () => ({ multichainNetworkConfigurationsByChainId: exports.AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS, selectedMultichainNetworkChainId: keyring_api_1.SolScope.Mainnet, isEvmSelected: true, networksWithTransactionActivity: {}, }); exports.getDefaultMultichainNetworkControllerState = getDefaultMultichainNetworkControllerState; /** * {@link MultichainNetworkController}'s metadata. * * This allows us to choose if fields of the state should be persisted or not * using the `persist` flag; and if they can be sent to Sentry or not, using * the `anonymous` flag. */ exports.MULTICHAIN_NETWORK_CONTROLLER_METADATA = { multichainNetworkConfigurationsByChainId: { persist: true, anonymous: true }, selectedMultichainNetworkChainId: { persist: true, anonymous: true }, isEvmSelected: { persist: true, anonymous: true }, networksWithTransactionActivity: { persist: true, anonymous: true }, }; /** * Multichain network ticker for the supported networks. * TODO: This should be part of the assets-controllers or the snap itself. */ exports.MULTICHAIN_NETWORK_TICKER = { [keyring_api_1.BtcScope.Mainnet]: 'BTC', [keyring_api_1.BtcScope.Testnet]: 'tBTC', [keyring_api_1.BtcScope.Signet]: 'sBTC', [keyring_api_1.SolScope.Mainnet]: 'SOL', [keyring_api_1.SolScope.Testnet]: 'tSOL', [keyring_api_1.SolScope.Devnet]: 'dSOL', }; /** * Multichain network asset decimals for the supported networks. * TODO: This should be part of the assets-controllers or the snap itself. */ exports.MULTICHAIN_NETWORK_DECIMAL_PLACES = { [keyring_api_1.BtcScope.Mainnet]: 8, [keyring_api_1.BtcScope.Testnet]: 8, [keyring_api_1.BtcScope.Signet]: 8, [keyring_api_1.SolScope.Mainnet]: 5, [keyring_api_1.SolScope.Testnet]: 5, [keyring_api_1.SolScope.Devnet]: 5, }; //# sourceMappingURL=constants.cjs.map