Files
js/utils/network.ts
T
1064350681 Any EVM + middleware (#814)
* homepage: infinite looping logo carousel

* split partners logo among two rows on mobile

* remove lazy loading from partner logos

* Fix partner logo cut off on safari

* fade-in logo carousel at the container edge

* v1

* v2

* remove temp code changes

* switch network *technically* works, and new chains package

* Fix src warning in AsyncContractTypeCell

* Updated Design for config form, fix metadata error

* add initial deployment status modal

* Fix contract duplication bug in dashboard

* Make RPC url always editable

* v3 - middleware + refactor

* reset form when selecting custom option

* Fix crash on sources tab for unsupported chains

* add missing deps in effects

* /evm - use SSG with fallback

* /evm - add ensQuery dehydration back

* /solana - fix program page loading issue

* Allow editing details for custom chains

* solana program context

* fix build crash

* fix all the networkOrAddress getters

* use chain icons from chains package

* separation of fallback and final page

* Fix wrong default network type in form

* validation improvements in configure network form

* disable custom chains from dropdown on On non thirdweb contracts deploy page

* Fix wrong network slug

* custom chain improvement

* Fix Lightmode UI of Network Config Form

* UI improvements for network search dropdown

* UI tweaks

* code review cleanup

* UI tweaks

* Network Config Form: Better Keyboard UX

* fix broken /contracts/release and /contracts/deploy routes

* add configure networks button for custom contract deployment page

* UI tweaks for network configurator

* fix merge

* add the icon to the custom chain

* Bunch of Improvements

* Improve auto chain configuration
* Do not allow adding custom network with existing chain id
* Show delete default chains with 1-click add
* Convert delete dialog to a popover
* Retain all fields when selecting a chain from list
* Allow configuring chain Icons
* Allow using chainId as network slug for custom networks
* Remove unnecessary chainInfos object passed in provider

* configurable slug + prefill form

* improve scrollbar styling

* upgrade to newer sdk etc

* make it work

* Various testjame improvements

* Stop form submit event propagation
* preselect “testnet” for custom network based on name
* Clear form errors when selecting a network from list
* Improved UI for Delete network popover
* Disable “Add Network” button when on add network page
* Change fallback chain icon

* custom and search tabs

* reduce layout shift when switching tabs

* allChains caching with idb

* Add IPFS upload button for icon input

* Deploy Modal, chain icon, code cleanup

* Fix Deploy Modal not working for custom contract deployment
* Fix Fantom testnet icon
* Remove useDashboardNetwork()
* Update Deploy Modal wording in case for 3 prompt scenario
* Remove hardhat and localhost from CURRENCIES object
* Remove gateway.ipfscdn.io from images.remotePatterns in next config

* add chain config tracking

* remove useChainInfos()

* Remove EVM_RPC_URL_MAP usage as much as possible

* Fix Network Switcher for non-default chains

* upgrade new dev sdk versions

* fix versions

* Fix contractInfo.chain not available on contract page of custom chain

* Fix contract page links in overview page

* Update default chain Icon

* bunch of UI improvements for network configuration modal

* Better active state for add network button and chains
* Suggest a slug for custom network
* Show chain id next to network names in list
* Allow searching by chain id
* Autofocus on first input of the form
* Add cross button for clearing search input
* Toggle search results open state with chevron icon
* Add icons in chain list

* handle wallet connected to unsupported network in <SupportedNetworkSelect/>

* No reload required after adding a network

* revert last commit - reload still required

* handle case where wallet is connected to an auto configured chain - show it as unknown network

* update dependencies and switch to activeChain and supportedChains

* nightly sdk versions

* Improved Icon Uploader

* always use default chains for polygon registry work

* dev version & updated list fetching

* Improved Chain ID input in Network Configurator

* Improved Network ID validation and prefill

* Hide etherscan verification button for non-default chains

* Form Refactor + network type toolip

* update deps

* update package versions

* upgrade dependencies

* show "create custom"  when no search results found

* slug calculated from prefillName should not be considered dirty

* open edit screen when selecting already configured network from list

* fuzzy search with fuse.js

* replace thirdweb key with it's value in form

* temp fix for getChainRPC throwing error

* update to newer chains package

* lots of rpc cleanup etc

* fix nightly maybe?

* upgrade to nightly packages

* add initial import contract search input

* fix localhost

* clean up smoe more stuff

* lots of updates

* Show "Request Testnet Funds" button in wallet when applicable (#856)

* fix crash on events page

* Fix Links in Overview page

* import contract improvements

* Fix wrong explorer tab link in ContractPermissionsPage

* make search faster (individual queries)

* properly split contract and program routing

* remove all via stuff etc

* various further improvements

* add a proxy and setup storage to hit that proxy

* further cleanup

---------

Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2023-02-14 09:37:47 +00:00

48 lines
1.5 KiB
TypeScript

/* eslint-disable line-comment-position */
import { DashboardSolanaNetwork } from "./solanaUtils";
import { ChainId, SUPPORTED_CHAIN_ID } from "@thirdweb-dev/sdk/evm";
export const SupportedNetworkToChainIdMap = {
ethereum: ChainId.Mainnet, // 1
goerli: ChainId.Goerli, // 5
polygon: ChainId.Polygon, // 137
mumbai: ChainId.Mumbai, // 80001
fantom: ChainId.Fantom, // 250
"fantom-testnet": ChainId.FantomTestnet, // 4002
avalanche: ChainId.Avalanche, // 43114
"avalanche-fuji": ChainId.AvalancheFujiTestnet, // 43113
optimism: ChainId.Optimism, // 10
"optimism-goerli": ChainId.OptimismGoerli, // 420
arbitrum: ChainId.Arbitrum, // 42161
"arbitrum-goerli": ChainId.ArbitrumGoerli, // 421613
binance: ChainId.BinanceSmartChainMainnet,
"binance-testnet": ChainId.BinanceSmartChainTestnet,
} as const;
export const NetworkToBlockTimeMap: Record<SUPPORTED_CHAIN_ID, string> = {
[ChainId.Mainnet]: "14",
[ChainId.Goerli]: "14",
[ChainId.Polygon]: "2",
[ChainId.Mumbai]: "2",
[ChainId.Fantom]: "0.7",
[ChainId.FantomTestnet]: "0.7",
[ChainId.Avalanche]: "3",
[ChainId.AvalancheFujiTestnet]: "3",
[ChainId.Optimism]: "13",
[ChainId.OptimismGoerli]: "13",
[ChainId.Arbitrum]: "15",
[ChainId.ArbitrumGoerli]: "15",
[ChainId.BinanceSmartChainMainnet]: "3",
[ChainId.BinanceSmartChainTestnet]: "3",
// Temporary placeholders for now
[ChainId.Localhost]: "1",
[ChainId.Hardhat]: "1",
};
export type SupportedNetwork =
| keyof typeof SupportedNetworkToChainIdMap
| DashboardSolanaNetwork;