From 9dd76f9d7e7328d1999131b270efafa092720005 Mon Sep 17 00:00:00 2001 From: Dinshaw Kothari Date: Wed, 2 Jul 2025 11:54:38 +0530 Subject: [PATCH] feat(statics): add pharos chain config Ticket: WIN-5799 # Ticket: WIN-5799 --- modules/bitgo/test/v2/unit/keychains.ts | 1 + modules/sdk-core/src/bitgo/environments.ts | 11 ++++++++++ modules/statics/src/base.ts | 2 ++ modules/statics/src/coins.ts | 20 +++++++++++++++++++ modules/statics/src/networks.ts | 20 +++++++++++++++++++ .../unit/fixtures/expectedColdFeatures.ts | 2 ++ 6 files changed, 56 insertions(+) diff --git a/modules/bitgo/test/v2/unit/keychains.ts b/modules/bitgo/test/v2/unit/keychains.ts index c2c7f5c7de..eed0fa5b53 100644 --- a/modules/bitgo/test/v2/unit/keychains.ts +++ b/modules/bitgo/test/v2/unit/keychains.ts @@ -79,6 +79,7 @@ describe('V2 Keychains', function () { n.asset !== UnderlyingAsset.MANTRA && n.asset !== UnderlyingAsset.MON && n.asset !== UnderlyingAsset.WORLD && + n.asset !== UnderlyingAsset.PHRS && n.asset !== UnderlyingAsset.STT && n.asset !== UnderlyingAsset.SONEIUM && n.asset !== UnderlyingAsset.VET && diff --git a/modules/sdk-core/src/bitgo/environments.ts b/modules/sdk-core/src/bitgo/environments.ts index f9f22d087a..64336f7dbb 100644 --- a/modules/sdk-core/src/bitgo/environments.ts +++ b/modules/sdk-core/src/bitgo/environments.ts @@ -86,6 +86,7 @@ interface EnvironmentTemplate { soneiumExplorerApiToken?: string; stxNodeUrl: string; vetNodeUrl: string; + // The key here is coinName and it will be same for both mainnet and testnet (eg: 'phrs') evm?: { [key: string]: { baseUrl: string; @@ -198,6 +199,11 @@ const mainnetBase: EnvironmentTemplate = { xdcExplorerBaseUrl: 'https://api.etherscan.io/v2', wemixExplorerBaseUrl: 'https://api.etherscan.io/v2', sgbExplorerBaseUrl: 'https://songbird-explorer.flare.network', + evm: { + phrs: { + baseUrl: 'https://testnet.dplabs-internal.com', // TODO: WIN-5787 add mainnet url when its available + }, + }, icpNodeUrl: 'https://ic0.app', worldExplorerBaseUrl: 'https://worldscan.org/', somniaExplorerBaseUrl: 'https://shannon-explorer.somnia.network/', //TODO: WIN-5278: change it with mainnet explorer, when its available @@ -275,6 +281,11 @@ const testnetBase: EnvironmentTemplate = { worldExplorerBaseUrl: 'https://sepolia.worldscan.org/', somniaExplorerBaseUrl: 'https://shannon-explorer.somnia.network/', soneiumExplorerBaseUrl: 'https://soneium-minato.blockscout.com', + evm: { + phrs: { + baseUrl: 'https://testnet.dplabs-internal.com', + }, + }, stxNodeUrl: 'https://api.testnet.hiro.so', vetNodeUrl: 'https://rpc-testnet.vechain.energy', }; diff --git a/modules/statics/src/base.ts b/modules/statics/src/base.ts index 04aa6541ae..8c1befac81 100644 --- a/modules/statics/src/base.ts +++ b/modules/statics/src/base.ts @@ -68,6 +68,7 @@ export enum CoinFamily { MON = 'mon', POLYGON = 'polygon', POLYX = 'polyx', + PHRS = 'phrs', NEAR = 'near', OAS = 'oas', OFC = 'ofc', @@ -469,6 +470,7 @@ export enum UnderlyingAsset { OPETH = 'opeth', OSMO = 'osmo', POLYGON = 'polygon', + PHRS = 'phrs', RBTC = 'rbtc', // RSK main coin SEI = 'sei', SGB = 'sgb', diff --git a/modules/statics/src/coins.ts b/modules/statics/src/coins.ts index e7991b7ce4..ae965f857d 100644 --- a/modules/statics/src/coins.ts +++ b/modules/statics/src/coins.ts @@ -1293,6 +1293,26 @@ export const coins = CoinMap.fromCoins([ BaseUnit.ETH, [...EVM_FEATURES, CoinFeature.SHARED_EVM_SIGNING] ), + account( + 'bc2c6d82-69ee-4745-b213-6f83e90199db', + 'phrs', + 'Pharos', + Networks.main.phrs, + 18, + UnderlyingAsset.PHRS, + BaseUnit.ETH, + [...EVM_FEATURES, CoinFeature.SHARED_EVM_SIGNING, CoinFeature.SHARED_EVM_SDK] + ), + account( + '06b62cc0-1ab1-4473-8d14-c86f31e0b224', + 'tphrs', + 'Pharos Testnet', + Networks.test.phrs, + 18, + UnderlyingAsset.PHRS, + BaseUnit.ETH, + [...EVM_FEATURES, CoinFeature.SHARED_EVM_SIGNING, CoinFeature.SHARED_EVM_SDK] + ), account( '251b78df-90c5-4ff5-b07a-8cc23f27c5ff', 'soneium', diff --git a/modules/statics/src/networks.ts b/modules/statics/src/networks.ts index cc26ecd863..bdae6c3ba5 100644 --- a/modules/statics/src/networks.ts +++ b/modules/statics/src/networks.ts @@ -1274,6 +1274,24 @@ class ApeChainTestnet extends Testnet implements EthereumNetwork { nativeCoinOperationHashPrefix = '33111'; } +class Pharos extends Mainnet implements EthereumNetwork { + name = 'Pharos'; + family = CoinFamily.PHRS; + explorerUrl = ''; // TODO: WIN-5787 Add mainnet url when available + accountExplorerUrl = ''; // TODO: WIN-5787 Add mainnet url when available + chainId = 688688; // TODO: WIN-5787 Add mainnet id when available + nativeCoinOperationHashPrefix = '688688'; +} + +class PharosTestnet extends Testnet implements EthereumNetwork { + name = 'PharosTestnet'; + family = CoinFamily.PHRS; + explorerUrl = 'https://testnet.pharosscan.xyz/tx/'; + accountExplorerUrl = 'https://testnet.pharosscan.xyz/address/'; + chainId = 688688; + nativeCoinOperationHashPrefix = '688688'; +} + class Xdc extends Mainnet implements EthereumNetwork { name = 'XdcChain'; family = CoinFamily.XDC; @@ -1557,6 +1575,7 @@ export const Networks = { mantra: Object.freeze(new Mantra()), polygon: Object.freeze(new Polygon()), polyx: Object.freeze(new Polymesh()), + phrs: Object.freeze(new Pharos()), oas: Object.freeze(new Oas()), ofc: Object.freeze(new Ofc()), optimism: Object.freeze(new Optimism()), @@ -1639,6 +1658,7 @@ export const Networks = { mantra: Object.freeze(new MantraTestnet()), polygon: Object.freeze(new PolygonTestnet()), polyx: Object.freeze(new PolymeshTestnet()), + phrs: Object.freeze(new PharosTestnet()), oas: Object.freeze(new OasTestnet()), ofc: Object.freeze(new OfcTestnet()), optimism: Object.freeze(new OptimismTestnet()), diff --git a/modules/statics/test/unit/fixtures/expectedColdFeatures.ts b/modules/statics/test/unit/fixtures/expectedColdFeatures.ts index c5387756e2..3c6a65c6c7 100644 --- a/modules/statics/test/unit/fixtures/expectedColdFeatures.ts +++ b/modules/statics/test/unit/fixtures/expectedColdFeatures.ts @@ -89,6 +89,7 @@ export const expectedColdFeatures = { 'vet', 'wemix', 'world', + 'phrs', 'xdc', 'zeta', 'tada', @@ -108,6 +109,7 @@ export const expectedColdFeatures = { 'tflr', 'tmon', 'tworld', + 'tphrs', 'thash', 'thorchain:rune', 'tia',