Skip to content

Commit

Permalink
devop: add rango swap to blast and telos
Browse files Browse the repository at this point in the history
  • Loading branch information
NickKelly1 committed Aug 16, 2024
1 parent ffbe73d commit 05c372f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
22 changes: 22 additions & 0 deletions packages/swap/src/common/supportedNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,28 @@ const NetworkDetails: Record<SupportedNetworkName, NetworkInfo> = {
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];
Expand Down
2 changes: 2 additions & 0 deletions packages/swap/src/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
12 changes: 11 additions & 1 deletion packages/swap/src/providers/rango/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

1 comment on commit 05c372f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.