From 9e50d70087367d0c28a6f25d6ad6888bd9bd7105 Mon Sep 17 00:00:00 2001 From: Dmytro Date: Tue, 6 Feb 2024 16:12:58 +0000 Subject: [PATCH] Add new testnet to SkaleNetworks --- .gitmodules | 2 +- helper-scripts | 2 +- skale-network | 2 +- src/core/constants.ts | 11 +++++++---- src/core/contracts.ts | 4 +++- src/core/interfaces/Config.ts | 2 +- src/core/metadata.ts | 8 ++++++-- src/core/network.ts | 6 +++++- src/metadata/addresses/testnet.json | 10 ++++++++++ src/metadata/faucet.json | 3 ++- src/metadata/proxy.json | 3 ++- 11 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 src/metadata/addresses/testnet.json diff --git a/.gitmodules b/.gitmodules index 5343ec4..883b2b7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,4 +5,4 @@ [submodule "skale-network"] path = skale-network url = https://github.com/skalenetwork/skale-network.git - branch = add-additional-metadata + branch = master diff --git a/helper-scripts b/helper-scripts index c253fa6..2541831 160000 --- a/helper-scripts +++ b/helper-scripts @@ -1 +1 @@ -Subproject commit c253fa60f1862753e0546dd9ade72b41e425cf99 +Subproject commit 2541831d3a8bf6691d994f37f379ac36d760c0a4 diff --git a/skale-network b/skale-network index 261d890..c7d1848 160000 --- a/skale-network +++ b/skale-network @@ -1 +1 @@ -Subproject commit 261d890cb564312cc0d1fae4dc500bd7d2b2759d +Subproject commit c7d184841f2bde3469c6b102156181bd003a52d8 diff --git a/src/core/constants.ts b/src/core/constants.ts index 0b8214f..f80b9f5 100644 --- a/src/core/constants.ts +++ b/src/core/constants.ts @@ -55,21 +55,24 @@ export const MAINNET_EXPLORER_URLS: { [skaleNetwork: string]: string } = { mainnet: 'https://etherscan.io', staging: 'https://goerli.etherscan.io/', legacy: 'https://goerli.etherscan.io/', - regression: 'https://goerli.etherscan.io/' + regression: 'https://goerli.etherscan.io/', + testnet: 'https://holesky.etherscan.io/' } export const BASE_EXPLORER_URLS: { [skaleNetwork: string]: string } = { mainnet: 'explorer.mainnet.skalenodes.com', staging: 'explorer.staging-v3.skalenodes.com', legacy: 'legacy-explorer.skalenodes.com', - regression: 'regression-explorer.skalenodes.com' + regression: 'regression-explorer.skalenodes.com', + testnet: 'testnet-explorer.skalenodes.com' } export const MAINNET_WS_ENDPOINTS: { [skaleNetwork: string]: string } = { mainnet: 'wss://ethereum.publicnode.com', staging: 'wss://ethereum-goerli.publicnode.com', - legacy: 'wss://ethereum-goerli.publicnode.com ', - regression: 'wss://ethereum-goerli.publicnode.com ' + legacy: 'wss://ethereum-goerli.publicnode.com', + regression: 'wss://ethereum-goerli.publicnode.com', + testnet: 'wss://ethereum-holesky.publicnode.com' } // ETA constants diff --git a/src/core/contracts.ts b/src/core/contracts.ts index 3dd8614..a216b3f 100644 --- a/src/core/contracts.ts +++ b/src/core/contracts.ts @@ -34,6 +34,7 @@ import mainnetAddresses from '../metadata/addresses/mainnet.json' import stagingAddresses from '../metadata/addresses/staging.json' import legacyAddresses from '../metadata/addresses/legacy.json' import regressionAddresses from '../metadata/addresses/regression.json' +import testnetAddresses from '../metadata/addresses/testnet.json' import sChainAbi from '../metadata/schainAbi.json' import mainnetAbi from '../metadata/mainnetAbi.json' @@ -52,7 +53,8 @@ export const IMA_ADDRESSES = { mainnet: mainnetAddresses, staging: stagingAddresses, legacy: legacyAddresses, - regression: regressionAddresses + regression: regressionAddresses, + testnet: testnetAddresses } export const IMA_ABIS = { diff --git a/src/core/interfaces/Config.ts b/src/core/interfaces/Config.ts index 9f15d77..44982be 100644 --- a/src/core/interfaces/Config.ts +++ b/src/core/interfaces/Config.ts @@ -23,7 +23,7 @@ import { TokenConnectionsMap, TokenMetadataMap, MetaportTheme } from '.' -export type SkaleNetwork = 'mainnet' | 'staging' | 'legacy' | 'regression' +export type SkaleNetwork = 'mainnet' | 'staging' | 'legacy' | 'regression' | 'testnet' export interface MetaportConfig { openOnLoad?: boolean diff --git a/src/core/metadata.ts b/src/core/metadata.ts index 1c8b7f5..72bddc0 100644 --- a/src/core/metadata.ts +++ b/src/core/metadata.ts @@ -29,11 +29,13 @@ import mainnetMeta from '../meta/mainnet/chains.json' import stagingMeta from '../meta/staging/chains.json' import legacyMeta from '../meta/legacy/chains.json' import regressionMeta from '../meta/regression/chains.json' +import testnetMeta from '../meta/testnet/chains.json' import * as MAINNET_CHAIN_ICONS from '../meta/mainnet/icons' import * as STAGING_CHAIN_ICONS from '../meta/staging/icons' import * as LEGACY_CHAIN_ICONS from '../meta/legacy/icons' import * as REGRESSION_CHAIN_ICONS from '../meta/regression/icons' +import * as TESTNET_CHAIN_ICONS from '../meta/testnet/icons' import * as icons from '../icons' @@ -41,14 +43,16 @@ const CHAIN_ICONS: { [network in SkaleNetwork]: any } = { mainnet: MAINNET_CHAIN_ICONS, staging: STAGING_CHAIN_ICONS, legacy: LEGACY_CHAIN_ICONS, - regression: REGRESSION_CHAIN_ICONS + regression: REGRESSION_CHAIN_ICONS, + testnet: TESTNET_CHAIN_ICONS } export const CHAINS_META: NetworksMetadataMap = { mainnet: mainnetMeta, staging: stagingMeta, legacy: legacyMeta, - regression: regressionMeta + regression: regressionMeta, + testnet: testnetMeta } function transformChainName(chainName: string): string { diff --git a/src/core/network.ts b/src/core/network.ts index 2c5bd06..0507cf1 100644 --- a/src/core/network.ts +++ b/src/core/network.ts @@ -49,7 +49,8 @@ export const CHAIN_IDS: { [network in SkaleNetwork]: number } = { staging: 5, legacy: 5, regression: 5, - mainnet: 1 + mainnet: 1, + testnet: 17000 } export function isMainnetChainId(chainId: number | BigInt, skaleNetwork: SkaleNetwork): boolean { @@ -93,6 +94,9 @@ export function getMainnetAbi(network: string) { if (network === 'regression') { return { ...IMA_ABIS.mainnet, ...IMA_ADDRESSES.regression } } + if (network === 'testnet') { + return { ...IMA_ABIS.mainnet, ...IMA_ADDRESSES.testnet } + } return { ...IMA_ABIS.mainnet, ...IMA_ADDRESSES.mainnet } } diff --git a/src/metadata/addresses/testnet.json b/src/metadata/addresses/testnet.json new file mode 100644 index 0000000..d0aee73 --- /dev/null +++ b/src/metadata/addresses/testnet.json @@ -0,0 +1,10 @@ +{ + "message_proxy_mainnet_address": "0x682ef859e1cE314ceD13A6FA32cE77AaeCE98e28", + "linker_address": "0x840A1BCa22c6D67Ed1076A1018b404EbcaA8a10c", + "community_pool_address": "0xF263049E4D7b331154077e30dD4de72F779E9554", + "deposit_box_eth_address": "0xe1A65b7677866A80B6e4263469FAC22ddc26F4b8", + "deposit_box_erc20_address": "0x4121c9218a65e12f027714AE956Aea7B9C220dAE", + "deposit_box_erc721_address": "0x024cdFF8Cd5cF334243B2fC2fd3eA1Fc1C9ebec5", + "deposit_box_erc1155_address": "0xb990E0D1F115398D7E6A8E4269e68b9034366280", + "deposit_box_erc721_with_metadata_address": "0x81caAfd5DF89d9DA44054c0a0a305E35DD7e958E" +} \ No newline at end of file diff --git a/src/metadata/faucet.json b/src/metadata/faucet.json index 3c7476e..5b70171 100644 --- a/src/metadata/faucet.json +++ b/src/metadata/faucet.json @@ -65,5 +65,6 @@ "func": "0x0c11dedd" } }, - "regression": null + "regression": null, + "testnet": null } \ No newline at end of file diff --git a/src/metadata/proxy.json b/src/metadata/proxy.json index 5344ffc..71feccb 100644 --- a/src/metadata/proxy.json +++ b/src/metadata/proxy.json @@ -3,5 +3,6 @@ "staging": "staging-v3.skalenodes.com", "legacy": "legacy-proxy.skalenodes.com", "regression": "regression-proxy.skalenodes.com", - "qatestnet": "new-testnet-proxy.skalenodes.com" + "qatestnet": "new-testnet-proxy.skalenodes.com", + "testnet": "testnet.skalenodes.com" } \ No newline at end of file