UNPKG

@metamask/multichain-network-controller

Version:
199 lines 7.87 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.TRX_SHASTA_NATIVE_ASSET = exports.TRX_NILE_NATIVE_ASSET = exports.TRX_NATIVE_ASSET = exports.SOL_DEVNET_NATIVE_ASSET = exports.SOL_TESTNET_NATIVE_ASSET = exports.SOL_NATIVE_ASSET = exports.BTC_REGTEST_NATIVE_ASSET = exports.BTC_SIGNET_NATIVE_ASSET = exports.BTC_TESTNET4_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_TESTNET4_NATIVE_ASSET = `${keyring_api_1.BtcScope.Testnet4}/slip44:0`; exports.BTC_SIGNET_NATIVE_ASSET = `${keyring_api_1.BtcScope.Signet}/slip44:0`; exports.BTC_REGTEST_NATIVE_ASSET = `${keyring_api_1.BtcScope.Regtest}/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`; exports.TRX_NATIVE_ASSET = `${keyring_api_1.TrxScope.Mainnet}/slip44:195`; exports.TRX_NILE_NATIVE_ASSET = `${keyring_api_1.TrxScope.Nile}/slip44:195`; exports.TRX_SHASTA_NATIVE_ASSET = `${keyring_api_1.TrxScope.Shasta}/slip44:195`; /** * 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.Testnet4]: { chainId: keyring_api_1.BtcScope.Testnet4, name: 'Bitcoin Testnet4', nativeCurrency: exports.BTC_TESTNET4_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.BtcScope.Signet]: { chainId: keyring_api_1.BtcScope.Signet, name: 'Bitcoin Mutinynet', nativeCurrency: exports.BTC_SIGNET_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.BtcScope.Regtest]: { chainId: keyring_api_1.BtcScope.Regtest, name: 'Bitcoin Regtest', nativeCurrency: exports.BTC_REGTEST_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, }, [keyring_api_1.TrxScope.Mainnet]: { chainId: keyring_api_1.TrxScope.Mainnet, name: 'Tron', nativeCurrency: exports.TRX_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.TrxScope.Nile]: { chainId: keyring_api_1.TrxScope.Nile, name: 'Tron Nile', nativeCurrency: exports.TRX_NILE_NATIVE_ASSET, isEvm: false, }, [keyring_api_1.TrxScope.Shasta]: { chainId: keyring_api_1.TrxScope.Shasta, name: 'Tron Shasta', nativeCurrency: exports.TRX_SHASTA_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.Testnet4, keyring_api_1.BtcScope.Signet, keyring_api_1.BtcScope.Regtest, keyring_api_1.SolScope.Testnet, keyring_api_1.SolScope.Devnet, keyring_api_1.TrxScope.Nile, keyring_api_1.TrxScope.Shasta, ]; /** * 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, }, [keyring_api_1.TrxScope.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: { includeInStateLogs: true, persist: true, includeInDebugSnapshot: true, usedInUi: true, }, selectedMultichainNetworkChainId: { includeInStateLogs: true, persist: true, includeInDebugSnapshot: true, usedInUi: true, }, isEvmSelected: { includeInStateLogs: true, persist: true, includeInDebugSnapshot: true, usedInUi: true, }, networksWithTransactionActivity: { includeInStateLogs: true, persist: true, includeInDebugSnapshot: true, usedInUi: 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.Testnet4]: 'tBTC', [keyring_api_1.BtcScope.Signet]: 'sBTC', [keyring_api_1.BtcScope.Regtest]: 'rBTC', [keyring_api_1.SolScope.Mainnet]: 'SOL', [keyring_api_1.SolScope.Testnet]: 'tSOL', [keyring_api_1.SolScope.Devnet]: 'dSOL', [keyring_api_1.TrxScope.Mainnet]: 'TRX', [keyring_api_1.TrxScope.Nile]: 'tTRX', [keyring_api_1.TrxScope.Shasta]: 'sTRX', }; /** * 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.Testnet4]: 8, [keyring_api_1.BtcScope.Signet]: 8, [keyring_api_1.BtcScope.Regtest]: 8, [keyring_api_1.SolScope.Mainnet]: 5, [keyring_api_1.SolScope.Testnet]: 5, [keyring_api_1.SolScope.Devnet]: 5, [keyring_api_1.TrxScope.Mainnet]: 6, [keyring_api_1.TrxScope.Nile]: 6, [keyring_api_1.TrxScope.Shasta]: 6, }; //# sourceMappingURL=constants.cjs.map