From aabea15a18dfad2d9dfba842a8d866dd429256cb Mon Sep 17 00:00:00 2001 From: Jan Turk Date: Fri, 4 Oct 2024 00:56:06 +0200 Subject: [PATCH] Add Fraxtal network --- .../providers/etherscan/configs.ts | 1 + .../libs/assets-handlers/assetinfo-mew.ts | 4 +++ .../libs/assets-handlers/token-lists.ts | 1 + .../assets-handlers/types/tokenbalance-mew.ts | 3 +- .../providers/ethereum/networks/fraxtal.ts | 29 +++++++++++++++++ .../ethereum/networks/icons/fraxtal.svg | 32 +++++++++++++++++++ .../src/providers/ethereum/networks/index.ts | 2 ++ packages/types/src/networks.ts | 2 ++ 8 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 packages/extension/src/providers/ethereum/networks/fraxtal.ts create mode 100755 packages/extension/src/providers/ethereum/networks/icons/fraxtal.svg diff --git a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts index 64aa911bc..c904df373 100644 --- a/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts +++ b/packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts @@ -68,6 +68,7 @@ const NetworkEndpoints: Record = { [NetworkNames.Mode]: "https://explorer.mode.network/", [NetworkNames.ProofOfPlayApex]: "https://explorer.apex.proofofplay.com/", [NetworkNames.Scroll]: "https://api.scrollscan.com/", + [NetworkNames.Fraxtal]: "https://api.fraxscan.com/", }; export { NetworkEndpoints }; diff --git a/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts b/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts index 27e45a6f3..24399d099 100644 --- a/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts +++ b/packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts @@ -175,6 +175,10 @@ const supportedNetworks: Record = { tbName: "rari", cgPlatform: undefined, }, + [NetworkNames.Fraxtal]: { + tbName: "frax", + cgPlatform: CoingeckoPlatform.Fraxtal, + }, }; const getTokens = ( diff --git a/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts b/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts index d9ab4eb20..c1ddbb282 100644 --- a/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts +++ b/packages/extension/src/providers/ethereum/libs/assets-handlers/token-lists.ts @@ -40,6 +40,7 @@ const TokenList: Record = { [NetworkNames.OpBNB]: `https://tokens.coingecko.com/${CoingeckoPlatform.OpBNB}/all.json`, [NetworkNames.Scroll]: `https://tokens.coingecko.com/${CoingeckoPlatform.Scroll}/all.json`, [NetworkNames.Rari]: `https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/tokenlists/rari.json`, + [NetworkNames.Fraxtal]: `https://tokens.coingecko.com/${CoingeckoPlatform.Fraxtal}/all.json`, }; const getKnownNetworkTokens = async ( diff --git a/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts b/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts index 35e0adb59..c0b1dde97 100644 --- a/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts +++ b/packages/extension/src/providers/ethereum/libs/assets-handlers/types/tokenbalance-mew.ts @@ -62,4 +62,5 @@ export type SupportedNetworkNames = | NetworkNames.Mode | NetworkNames.OpBNB | NetworkNames.Scroll - | NetworkNames.Rari; + | NetworkNames.Rari + | NetworkNames.Fraxtal; diff --git a/packages/extension/src/providers/ethereum/networks/fraxtal.ts b/packages/extension/src/providers/ethereum/networks/fraxtal.ts new file mode 100644 index 000000000..7fb84abb7 --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/fraxtal.ts @@ -0,0 +1,29 @@ +import { CoingeckoPlatform, NetworkNames } from "@enkryptcom/types"; +import { EvmNetwork, EvmNetworkOptions } from "../types/evm-network"; +import assetsInfoHandler from "@/providers/ethereum/libs/assets-handlers/assetinfo-mew"; +import mewNFTHandler from "@/libs/nft-handlers/mew"; +import { EtherscanActivity } from "../libs/activity-handlers"; +import wrapActivityHandler from "@/libs/activity-state/wrap-activity-handler"; + +const fraxtalOptions: EvmNetworkOptions = { + name: NetworkNames.Fraxtal, + name_long: "Fraxtal", + homePage: "https://www.frax.com/", + blockExplorerTX: "https://fraxscan.com/tx/[[txHash]]", + blockExplorerAddr: "https://fraxscan.com/address/[[address]]", + chainID: "0xfc", + isTestNetwork: false, + currencyName: "frxETH", + currencyNameLong: "Frax Ether", + node: "https://rpc.frax.com", + icon: require("./icons/fraxtal.svg"), + coingeckoID: "fraxtal", + coingeckoPlatform: CoingeckoPlatform.Fraxtal, + NFTHandler: mewNFTHandler, + assetsInfoHandler, + activityHandler: wrapActivityHandler(EtherscanActivity), +}; + +const fraxtal = new EvmNetwork(fraxtalOptions); + +export default fraxtal; diff --git a/packages/extension/src/providers/ethereum/networks/icons/fraxtal.svg b/packages/extension/src/providers/ethereum/networks/icons/fraxtal.svg new file mode 100755 index 000000000..158a6ac8d --- /dev/null +++ b/packages/extension/src/providers/ethereum/networks/icons/fraxtal.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/extension/src/providers/ethereum/networks/index.ts b/packages/extension/src/providers/ethereum/networks/index.ts index cd771d291..090a36b88 100644 --- a/packages/extension/src/providers/ethereum/networks/index.ts +++ b/packages/extension/src/providers/ethereum/networks/index.ts @@ -57,6 +57,7 @@ import opbnbNode from "./op-bnb"; import palmNode from "./palm"; import proofOfPlayApexNode from "./pop-apex"; import scrollNode from "./scroll"; +import fraxtalNode from "./fraxtal"; export default { sepolia: sepoliaNode, @@ -127,4 +128,5 @@ export default { palm: palmNode, popApex: proofOfPlayApexNode, scroll: scrollNode, + frax: fraxtalNode, }; diff --git a/packages/types/src/networks.ts b/packages/types/src/networks.ts index 235ff9bf3..fb41cb5fd 100644 --- a/packages/types/src/networks.ts +++ b/packages/types/src/networks.ts @@ -91,6 +91,7 @@ export enum NetworkNames { ProofOfPlayApex = "ProofOfPlayApex", Scroll = "scroll", Rari = "rari", + Fraxtal = "fraxtal", } export enum CoingeckoPlatform { @@ -146,4 +147,5 @@ export enum CoingeckoPlatform { Mode = "mode", OpBNB = "opbnb", Scroll = "scroll", + Fraxtal = "fraxtal", }