From 05c372f7dc0e143337be2f3946db569d5101bda4 Mon Sep 17 00:00:00 2001 From: nickkelly1 Date: Fri, 16 Aug 2024 13:19:50 -0500 Subject: [PATCH] devop: add rango swap to blast and telos --- packages/swap/src/common/supportedNetworks.ts | 22 +++++++++++++++++++ packages/swap/src/configs.ts | 2 ++ packages/swap/src/providers/rango/index.ts | 12 +++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/packages/swap/src/common/supportedNetworks.ts b/packages/swap/src/common/supportedNetworks.ts index f748c8ec6..755303002 100644 --- a/packages/swap/src/common/supportedNetworks.ts +++ b/packages/swap/src/common/supportedNetworks.ts @@ -254,6 +254,28 @@ const NetworkDetails: Record = { signerType: [SignerType.secp256k1], type: NetworkType.EVM, }, + [SupportedNetworkName.Blast]: { + id: SupportedNetworkName.Blast, + decimals: 18, + logoURI: "https://assets.coingecko.com/coins/images/35494/standard/Blast.jpg", + name: "Blast", + symbol: "ETH", + cgId: "ethereum", + rank: 20, + signerType: [SignerType.secp256k1], + type: NetworkType.EVM, + }, + [SupportedNetworkName.Telos]: { + id: SupportedNetworkName.Telos, + decimals: 18, + logoURI: "https://assets.coingecko.com/coins/images/7588/standard/tlos_png.png", + name: "Telos", + symbol: "TLOS", + cgId: "telos", + rank: 21, + signerType: [SignerType.secp256k1], + type: NetworkType.EVM, + }, }; export const isSupportedNetwork = (networkName: SupportedNetworkName) => !!NetworkDetails[networkName]; diff --git a/packages/swap/src/configs.ts b/packages/swap/src/configs.ts index f84f78fda..432183689 100644 --- a/packages/swap/src/configs.ts +++ b/packages/swap/src/configs.ts @@ -64,6 +64,8 @@ const TOKEN_LISTS: { [NetworkNames.Base]: `https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/swaplists/${SupportedNetworkName.Base}.json`, [NetworkNames.MaticZK]: `https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/swaplists/${SupportedNetworkName.MaticZK}.json`, [NetworkNames.Rootstock]: `https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/swaplists/${SupportedNetworkName.Rootstock}.json`, + [NetworkNames.Blast]: `https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/swaplists/${SupportedNetworkName.Blast}.json`, + [NetworkNames.Telos]: `https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/swaplists/${SupportedNetworkName.Telos}.json`, }; const CHANGELLY_LIST = diff --git a/packages/swap/src/providers/rango/index.ts b/packages/swap/src/providers/rango/index.ts index ebb7b6e54..0af1968dd 100644 --- a/packages/swap/src/providers/rango/index.ts +++ b/packages/swap/src/providers/rango/index.ts @@ -167,16 +167,26 @@ class Rango extends ProviderClass { network: SupportedNetworkName, blockchains: BlockchainMeta[] ) { - if (!Object.keys(supportedNetworks).includes(network as unknown as string)) + // We must support this network + if (!Object.keys(supportedNetworks).includes(network as unknown as string)) { return false; + } + if (blockchains.length) { + // Join Rango networks and our supported networks by their chain id + + // Extract our info about this supported network const { chainId } = Object.entries(supportedNetworks).find( (chain) => chain[0] === (network as unknown as string) )[1]; + + // Does Rango support this chain id? return !!blockchains.find( (chain: BlockchainMeta) => Number(chain.chainId) === Number(chainId) )?.enabled; } + + // Rango didn't give us anything so just assume Rango supports this network return true; }