diff --git a/.env b/.env index fd0d076938..d9261b3bc7 100644 --- a/.env +++ b/.env @@ -33,6 +33,9 @@ REACT_APP_NETWORK_URL_1=https://mainnet.infura.io/v3/586e7e6b7c7e437aa41f5da496a REACT_APP_NETWORK_URL_5=https://goerli.infura.io/v3/586e7e6b7c7e437aa41f5da496a749f5 REACT_APP_NETWORK_URL_100=https://rpc.gnosischain.com +# Wallet Connect +# REACT_APP_WALLET_CONNECT_V1_BRIDGE='https://safe-walletconnect.safe.global' + # Wallets REACT_APP_PORTIS_ID="c0e2bf01-4b08-4fd5-ac7b-8e26b58cd236" REACT_APP_FORTMATIC_KEY="pk_live_6AED76CA755EFDC7" diff --git a/.env.production b/.env.production index cfc9170438..6d993730ae 100644 --- a/.env.production +++ b/.env.production @@ -29,6 +29,9 @@ REACT_APP_NETWORK_URL_5=https://goerli.infura.io/v3/586e7e6b7c7e437aa41f5da496a7 #REACT_APP_NETWORK_URL_100=https://rpc.gnosischain.com/oe-only REACT_APP_NETWORK_URL_100=https://rpc.gnosischain.com +# Wallet Connect +# REACT_APP_WALLET_CONNECT_V1_BRIDGE='https://safe-walletconnect.safe.global' + # Wallets REACT_APP_PORTIS_ID="c0e2bf01-4b08-4fd5-ac7b-8e26b58cd236" REACT_APP_FORTMATIC_KEY="pk_live_9E53F9A29112A9FC" diff --git a/.github/workflows/vercel.yml b/.github/workflows/vercel.yml index 5577ca9209..2cc3832678 100644 --- a/.github/workflows/vercel.yml +++ b/.github/workflows/vercel.yml @@ -41,6 +41,7 @@ jobs: REACT_APP_GOOGLE_ANALYTICS_ID=${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID }} REACT_APP_AMPLITUDE_KEY=${{ secrets.REACT_APP_AMPLITUDE_KEY }} REACT_APP_LAUNCH_DARKLY_KEY=${{ secrets.REACT_APP_LAUNCH_DARKLY_KEY }} + REACT_APP_WALLET_CONNECT_V1_BRIDGE=${{ secrets.REACT_APP_WALLET_CONNECT_V1_BRIDGE }} vercel build -t ${{ secrets.VERCEL_TOKEN }} --prod - name: Get the version diff --git a/README.md b/README.md index 64282bac93..5f480f0396 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,16 @@ The plan: `emergency.js` is not cached by browser and loaded before all. +## Wallet Connect + +The app uses a Wallet Connect v1 bridge. + +You can define your own bridge by setting the following environment variable: + +```ini +REACT_APP_WALLET_CONNECT_V1_BRIDGE='https://bridge.walletconnect.org' +``` + ## Documentation 1. [Oveall Architecture](docs/architecture-overview.md) diff --git a/src/common/pure/OrderSubmittedContent/index.tsx b/src/common/pure/OrderSubmittedContent/index.tsx index 494a0b76fe..a1849346e8 100644 --- a/src/common/pure/OrderSubmittedContent/index.tsx +++ b/src/common/pure/OrderSubmittedContent/index.tsx @@ -42,7 +42,7 @@ export function OrderSubmittedContent({ chainId, hash, onDismiss }: OrderSubmitt Order Submitted {/*TODO: unify and fix explorer link. Refs: ExplorerLink, DisplayLink, EnhancedTransactionLink*/} - + View on Explorer ↗ diff --git a/src/legacy/components/AddressInputPanel/index.tsx b/src/legacy/components/AddressInputPanel/index.tsx index 712ce2e541..4ce146695c 100644 --- a/src/legacy/components/AddressInputPanel/index.tsx +++ b/src/legacy/components/AddressInputPanel/index.tsx @@ -115,7 +115,7 @@ export function AddressInputPanel({ {label ?? Recipient} {address && chainId && ( - + (View on Explorer) )} diff --git a/src/legacy/components/ExplorerLink/index.tsx b/src/legacy/components/ExplorerLink/index.tsx index b746f4f2c4..2c57b79697 100644 --- a/src/legacy/components/ExplorerLink/index.tsx +++ b/src/legacy/components/ExplorerLink/index.tsx @@ -1,33 +1,83 @@ +import { PropsWithChildren } from 'react' + +import { SupportedChainId } from '@cowprotocol/cow-sdk' + import { ExternalLink } from 'legacy/theme' -import { BlockExplorerLinkType, getExplorerLabel, getEtherscanLink } from 'legacy/utils' +import { getExplorerLabel, getEtherscanLink } from 'legacy/utils' +import { getExplorerBaseUrl } from 'legacy/utils/explorer' import { supportedChainId } from 'legacy/utils/supportedChainId' import { useWalletInfo } from 'modules/wallet' -interface Props { - id: string - type?: BlockExplorerLinkType +interface PropsBase extends PropsWithChildren { + // type?: BlockExplorerLinkType label?: string className?: string + defaultChain?: SupportedChainId +} + +interface PropsWithId extends PropsBase { + type: 'transaction' | 'token' | 'address' | 'block' | 'token-transfer' + id: string +} + +interface PropsWithoutId extends PropsBase { + type: 'cow-explorer-home' } +export type Props = PropsWithId | PropsWithoutId + /** * Creates a link to the relevant explorer: Etherscan, GP Explorer or Blockscout * @param props */ export function ExplorerLink(props: Props) { - const { id, label, type = 'transaction', className } = props const { chainId: _chainId } = useWalletInfo() - const chainId = supportedChainId(_chainId) + const chainId = supportedChainId(_chainId) || props.defaultChain if (!chainId) { return null } - const linkLabel = label || getExplorerLabel(chainId, id, type) + const url = getUrl(chainId, props) + const { className } = props + + const linkContent = getContent(chainId, props) return ( - - {linkLabel} + + {linkContent} ) } + +function getUrl(chainId: SupportedChainId, props: Props) { + const { type } = props + + if (type === 'cow-explorer-home') { + return getExplorerBaseUrl(chainId) + } + + // return + return getEtherscanLink(chainId, type, props.id) +} + +function getLabel(chainId: SupportedChainId, props: Props) { + const { label, type } = props + + const id = type !== 'cow-explorer-home' ? props.id : undefined + + return label || getExplorerLabel(chainId, type, id) +} +function getContent(chainId: SupportedChainId, props: Props) { + if (props.children) { + return props.children + } + + const linkLabel = getLabel(chainId, props) + + return ( + <> + {linkLabel} + + ) +} diff --git a/src/legacy/components/Popups/TransactionPopupMod.tsx b/src/legacy/components/Popups/TransactionPopupMod.tsx index 8398e4ee95..8dd6a4e4f2 100644 --- a/src/legacy/components/Popups/TransactionPopupMod.tsx +++ b/src/legacy/components/Popups/TransactionPopupMod.tsx @@ -40,7 +40,7 @@ export default function TransactionPopup({ ) : ( summary )} - {chainId && } + {chainId && } ) diff --git a/src/legacy/components/SearchModal/ImportToken/index.tsx b/src/legacy/components/SearchModal/ImportToken/index.tsx index 651a4e4688..1d2312a50b 100644 --- a/src/legacy/components/SearchModal/ImportToken/index.tsx +++ b/src/legacy/components/SearchModal/ImportToken/index.tsx @@ -68,7 +68,7 @@ function CardComponent({ theme, key, token, chainId, list }: CardComponentProps) {chainId && ( - + {token.address} )} diff --git a/src/legacy/components/SearchModal/ManageTokens/ManageTokensMod.tsx b/src/legacy/components/SearchModal/ManageTokens/ManageTokensMod.tsx index ff35bb0613..f288c3c4b8 100644 --- a/src/legacy/components/SearchModal/ManageTokens/ManageTokensMod.tsx +++ b/src/legacy/components/SearchModal/ManageTokens/ManageTokensMod.tsx @@ -88,7 +88,7 @@ export default function ManageTokens({ setModalView, setImportToken, ImportToken - + {/* MOD */} @@ -96,7 +96,7 @@ export default function ManageTokens({ setModalView, setImportToken, ImportToken removeToken(chainId, token.address)} /> - + )) diff --git a/src/legacy/components/SearchModal/TokenImportCard/TokenImportCardMod.tsx b/src/legacy/components/SearchModal/TokenImportCard/TokenImportCardMod.tsx index c09ee3dfa3..97794db10d 100644 --- a/src/legacy/components/SearchModal/TokenImportCard/TokenImportCardMod.tsx +++ b/src/legacy/components/SearchModal/TokenImportCard/TokenImportCardMod.tsx @@ -51,7 +51,7 @@ const TokenImportCard = ({ list, token }: TokenImportCardProps) => { {chainId && ( - + {token.address} )} diff --git a/src/legacy/components/Tokens/TokensTableRow.tsx b/src/legacy/components/Tokens/TokensTableRow.tsx index d8519827d3..5c2c477129 100644 --- a/src/legacy/components/Tokens/TokensTableRow.tsx +++ b/src/legacy/components/Tokens/TokensTableRow.tsx @@ -199,7 +199,7 @@ const DataRow = ({ {fiatValue} - + diff --git a/src/legacy/components/TransactionConfirmationModal/DisplayLink.tsx b/src/legacy/components/TransactionConfirmationModal/DisplayLink.tsx index e4ad008fef..8e52480795 100644 --- a/src/legacy/components/TransactionConfirmationModal/DisplayLink.tsx +++ b/src/legacy/components/TransactionConfirmationModal/DisplayLink.tsx @@ -27,9 +27,9 @@ export function DisplayLink({ id, chainId }: DisplayLinkProps) { ? orderCreationHash : undefined const href = ethFlowHash - ? getBlockExplorerUrl(chainId, ethFlowHash, 'transaction') - : getEtherscanLink(chainId, id, 'transaction') - const label = getExplorerLabel(chainId, ethFlowHash || id, 'transaction') + ? getBlockExplorerUrl(chainId, 'transaction', ethFlowHash) + : getEtherscanLink(chainId, 'transaction', id) + const label = getExplorerLabel(chainId, 'transaction', ethFlowHash || id) return ( diff --git a/src/legacy/components/Version/index.tsx b/src/legacy/components/Version/index.tsx index 68750d4eb0..bf38131000 100644 --- a/src/legacy/components/Version/index.tsx +++ b/src/legacy/components/Version/index.tsx @@ -15,7 +15,7 @@ import pkg from '../../../../package.json' function _getContractsUrls(chainId: ChainId, contractAddressMap: typeof GP_SETTLEMENT_CONTRACT_ADDRESS) { const contractAddress = contractAddressMap[chainId] if (!contractAddress) return '-' - return getEtherscanLink(chainId, contractAddress, 'address') + return getEtherscanLink(chainId, 'address', contractAddress) } const VERSIONS: Record< diff --git a/src/legacy/components/swap/UnsupportedCurrencyFooter/UnsupportedCurrencyFooterMod.tsx b/src/legacy/components/swap/UnsupportedCurrencyFooter/UnsupportedCurrencyFooterMod.tsx index c20278188b..aa99cc7cb1 100644 --- a/src/legacy/components/swap/UnsupportedCurrencyFooter/UnsupportedCurrencyFooterMod.tsx +++ b/src/legacy/components/swap/UnsupportedCurrencyFooter/UnsupportedCurrencyFooterMod.tsx @@ -99,7 +99,7 @@ export default function UnsupportedCurrencyFooter({ {token.symbol} {chainId && ( - + {token.address} )} diff --git a/src/legacy/constants/index.ts b/src/legacy/constants/index.ts index 1c6efdc606..abb912ce83 100644 --- a/src/legacy/constants/index.ts +++ b/src/legacy/constants/index.ts @@ -141,7 +141,7 @@ export const FLASHBOTS_LINK = 'https://explore.flashbots.net/' export const GAS_PRICE_UPDATE_THRESHOLD = ms`5s` export const GAS_FEE_ENDPOINTS = { [ChainId.MAINNET]: 'https://api.blocknative.com/gasprices/blockprices', - [ChainId.GNOSIS_CHAIN]: 'https://blockscout.com/xdai/mainnet/api/v1/gas-price-oracle', + [ChainId.GNOSIS_CHAIN]: 'https://gnosis.blockscout.com/api/v1/gas-price-oracle', [ChainId.GOERLI]: '', } export const GAS_API_KEYS = { diff --git a/src/legacy/hooks/useActivityDerivedState.ts b/src/legacy/hooks/useActivityDerivedState.ts index deb6af7851..02876405e1 100644 --- a/src/legacy/hooks/useActivityDerivedState.ts +++ b/src/legacy/hooks/useActivityDerivedState.ts @@ -93,7 +93,7 @@ export function getActivityLinkUrl(params: { if (transactionHash) { // It's an Ethereum transaction: Etherscan link - return getEtherscanLink(chainId, transactionHash, 'transaction') + return getEtherscanLink(chainId, 'transaction', transactionHash) } else if (safeTransaction && safeTransaction) { // It's a safe transaction: Gnosis Safe Web link const { safe, safeTxHash } = safeTransaction @@ -102,7 +102,7 @@ export function getActivityLinkUrl(params: { } else if (order) { if (order.orderCreationHash && (order.status === OrderStatus.CREATING || order.status === OrderStatus.FAILED)) { // It's a EthFlow transaction: Etherscan link - return getEtherscanLink(chainId, order.orderCreationHash, 'transaction') + return getEtherscanLink(chainId, 'transaction', order.orderCreationHash) } else { // It's an order: GP Explorer link return getExplorerOrderLink(chainId, id) diff --git a/src/legacy/utils/index.ts b/src/legacy/utils/index.ts index 81a7679f67..027f2c6eca 100644 --- a/src/legacy/utils/index.ts +++ b/src/legacy/utils/index.ts @@ -62,7 +62,7 @@ export function formattedFeeAmount(feeAmount: FeeAmount): number { return feeAmount / 10000 } -const GP_ORDER_ID_LENGTH = 114 // 112 (56 bytes in hex) + 2 (it's prefixed with "0x") +const COW_ORDER_ID_LENGTH = 114 // 112 (56 bytes in hex) + 2 (it's prefixed with "0x") const ETHERSCAN_URLS: { [chainId in ChainId]: string } = { 1: 'etherscan.io', @@ -73,7 +73,13 @@ const ETHERSCAN_URLS: { [chainId in ChainId]: string } = { 100: 'gnosisscan.io', } -export type BlockExplorerLinkType = 'transaction' | 'token' | 'address' | 'block' | 'token-transfer' +export type BlockExplorerLinkType = + | 'transaction' + | 'token' + | 'address' + | 'block' + | 'token-transfer' + | 'cow-explorer-home' function getEtherscanUrl(chainId: ChainId, data: string, type: BlockExplorerLinkType): string { const url = ETHERSCAN_URLS[chainId] || ETHERSCAN_URLS[1] @@ -101,26 +107,28 @@ function getEtherscanUrl(chainId: ChainId, data: string, type: BlockExplorerLink } // Get the right block explorer URL by chainId -export function getBlockExplorerUrl(chainId: ChainId, data: string, type: BlockExplorerLinkType): string { +export function getBlockExplorerUrl(chainId: ChainId, type: BlockExplorerLinkType, data: string): string { return getEtherscanUrl(chainId, data, type) } -export function isGpOrder(data: string, type: BlockExplorerLinkType) { - return type === 'transaction' && data.length === GP_ORDER_ID_LENGTH +export function isCowOrder(type: BlockExplorerLinkType, data?: string) { + if (!data) return false + + return type === 'transaction' && data.length === COW_ORDER_ID_LENGTH } -export function getEtherscanLink(chainId: ChainId, data: string, type: BlockExplorerLinkType): string { - if (isGpOrder(data, type)) { - // Explorer for GP orders: - // If a transaction has the size of the GP orderId, then it's a meta-tx +export function getEtherscanLink(chainId: ChainId, type: BlockExplorerLinkType, data: string): string { + if (isCowOrder(type, data)) { + // Explorer for CoW orders: + // If a transaction has the size of the CoW orderId, then it's a meta-tx return getExplorerOrderLink(chainId, data) } else { return getEtherscanUrl(chainId, data, type) } } -export function getExplorerLabel(chainId: ChainId, data: string, type: BlockExplorerLinkType): string { - if (isGpOrder(data, type)) { +export function getExplorerLabel(chainId: ChainId, type: BlockExplorerLinkType, data?: string): string { + if (isCowOrder(type, data) || type === 'cow-explorer-home') { return 'View on Explorer' } else if (chainId === ChainId.GNOSIS_CHAIN) { return 'View on Gnosisscan' diff --git a/src/modules/account/containers/AccountDetails/index.tsx b/src/modules/account/containers/AccountDetails/index.tsx index 5c747a56fe..77ab68eb0d 100644 --- a/src/modules/account/containers/AccountDetails/index.tsx +++ b/src/modules/account/containers/AccountDetails/index.tsx @@ -187,7 +187,7 @@ export function AccountDetails({ const disconnectWallet = useDisconnectWallet() const explorerOrdersLink = account && chainId && getExplorerAddressLink(chainId, account) - const explorerLabel = chainId && account ? getExplorerLabel(chainId, account, 'address') : undefined + const explorerLabel = chainId && account ? getExplorerLabel(chainId, 'address', account) : undefined const activities = useMultipleActivityDescriptors({ chainId, ids: pendingTransactions.concat(confirmedTransactions) }) const activitiesGroupedByDate = groupActivitiesByDay(activities) @@ -264,7 +264,7 @@ export function AccountDetails({ {explorerLabel} ↗ diff --git a/src/modules/mainMenu/constants/mainMenu.ts b/src/modules/mainMenu/constants/mainMenu.tsx similarity index 88% rename from src/modules/mainMenu/constants/mainMenu.ts rename to src/modules/mainMenu/constants/mainMenu.tsx index 06ad41396a..9d21a0d683 100644 --- a/src/modules/mainMenu/constants/mainMenu.ts +++ b/src/modules/mainMenu/constants/mainMenu.tsx @@ -1,3 +1,7 @@ +import { SupportedChainId } from '@cowprotocol/cow-sdk' + +import { Globe } from 'react-feather' + import IMAGE_CODE from 'legacy/assets/cow-swap/code.svg' import IMAGE_COOKIE_POLICY from 'legacy/assets/cow-swap/cookie-policy.svg' import IMAGE_DISCORD from 'legacy/assets/cow-swap/discord.svg' @@ -9,6 +13,7 @@ import IMAGE_PIE from 'legacy/assets/cow-swap/pie.svg' import IMAGE_PRIVACY_POLICY from 'legacy/assets/cow-swap/privacy-policy.svg' import IMAGE_TERMS_AND_CONDITIONS from 'legacy/assets/cow-swap/terms-and-conditions.svg' import IMAGE_TWITTER from 'legacy/assets/cow-swap/twitter.svg' +import { ExplorerLink } from 'legacy/components/ExplorerLink' import { CONTRACTS_CODE_LINK, DISCORD_LINK, DOCS_LINK, DUNE_DASHBOARD_LINK, TWITTER_LINK } from 'legacy/constants' import { ADVANCED_ORDERS_FEATURE_FLAG } from 'constants/featureFlags' @@ -22,6 +27,14 @@ export const isBasicMenuLink = (item: any): item is BasicMenuLink => { return !!(item.title && item.url) } +function ExplorerMenuLink() { + return ( + + CoW Explorer + + ) +} + export const FAQ_MENU: InternalLink[] = [ { id: MainMenuItemId.FAQ_OVERVIEW, title: 'Overview', url: Routes.FAQ }, { id: MainMenuItemId.FAQ_PROTOCOL, title: 'Protocol', url: Routes.FAQ_PROTOCOL }, @@ -43,17 +56,17 @@ export const MAIN_MENU: MenuTreeItem[] = [ items: [ { links: [ - { id: MainMenuItemId.SWAP, kind: MenuItemKind.DYNAMIC_LINK, title: 'Swap', url: Routes.SWAP }, + { id: MainMenuItemId.SWAP, kind: MenuItemKind.PARAMETRIZED_LINK, title: 'Swap', url: Routes.SWAP }, { id: MainMenuItemId.LIMIT_ORDERS, - kind: MenuItemKind.DYNAMIC_LINK, + kind: MenuItemKind.PARAMETRIZED_LINK, title: 'Limit orders', url: Routes.LIMIT_ORDER, }, FeatureFlag.get(ADVANCED_ORDERS_FEATURE_FLAG) ? { id: MainMenuItemId.ADVANCED_ORDERS, - kind: MenuItemKind.DYNAMIC_LINK, + kind: MenuItemKind.PARAMETRIZED_LINK, title: 'Advanced orders', url: Routes.ADVANCED_ORDERS, } @@ -95,6 +108,10 @@ export const MAIN_MENU: MenuTreeItem[] = [ kind: MenuItemKind.EXTERNAL_LINK, }, { id: MainMenuItemId.MORE_ABOUT, title: 'About', url: Routes.ABOUT, iconSVG: IMAGE_INFO }, + { + kind: MenuItemKind.CUSTOM_ITEM, + Item: ExplorerMenuLink, + }, { id: MainMenuItemId.MORE_STATISTICS, title: 'Statistics', diff --git a/src/modules/mainMenu/pure/MenuTree/index.tsx b/src/modules/mainMenu/pure/MenuTree/index.tsx index 9eb31e6a06..c1037d25a6 100644 --- a/src/modules/mainMenu/pure/MenuTree/index.tsx +++ b/src/modules/mainMenu/pure/MenuTree/index.tsx @@ -9,7 +9,8 @@ import { ExternalLink as ExternalLinkComponent } from 'legacy/theme/components' import { DropDownItem, - DynamicLink, + ParametrizedLink, + CustomItem, ExternalLink, InternalLink, MainMenuContext, @@ -44,15 +45,20 @@ function MenuImage(props: MenuImageProps) { } interface InternalExternalLinkProps { - link: InternalLink | ExternalLink | DynamicLink + link: InternalLink | ExternalLink | ParametrizedLink | CustomItem context: MainMenuContext } function Link({ link, context }: InternalExternalLinkProps) { + if (link.kind === MenuItemKind.CUSTOM_ITEM) { + const { Item: LinkComponent } = link + return <>{LinkComponent()} + } + const { kind, title, url, iconSVG, icon } = link const menuImage = const isExternal = kind === MenuItemKind.EXTERNAL_LINK - const isDynamic = kind === MenuItemKind.DYNAMIC_LINK + const isDynamic = kind === MenuItemKind.PARAMETRIZED_LINK const { handleMobileMenuOnClick, tradeContext } = context const internalUrl = isDynamic ? parameterizeTradeRoute(tradeContext, url as Routes) : url @@ -146,10 +152,12 @@ function MenuItemWithDropDown(props: MenuItemWithDropDownProps) { return case undefined: // INTERNAL - case MenuItemKind.DYNAMIC_LINK: + case MenuItemKind.PARAMETRIZED_LINK: case MenuItemKind.EXTERNAL_LINK: // Render Internal/External links return + case MenuItemKind.CUSTOM_ITEM: + return <>{menuItem.Item} default: return null } diff --git a/src/modules/mainMenu/types.ts b/src/modules/mainMenu/types.ts index 918f44af74..3e822676e5 100644 --- a/src/modules/mainMenu/types.ts +++ b/src/modules/mainMenu/types.ts @@ -6,7 +6,8 @@ export enum MenuItemKind { DROP_DOWN = 'DROP_DOWN', EXTERNAL_LINK = 'EXTERNAL_LINK', DARK_MODE_BUTTON = 'DARK_MODE_BUTTON', - DYNAMIC_LINK = 'DYNAMIC_LINK', + PARAMETRIZED_LINK = 'PARAMETRIZED_LINK', + CUSTOM_ITEM = 'CUSTOM_ITEM', } export enum MainMenuItemId { @@ -24,6 +25,7 @@ export enum MainMenuItemId { ACCOUNT_TOKENS = 'ACCOUNT_TOKENS', MORE_DOCUMENTATION = 'MORE_DOCUMENTATION', MORE_ABOUT = 'MORE_ABOUT', + MORE_EXPLORER = 'MORE_EXPLORER', MORE_STATISTICS = 'MORE_STATISTICS', MORE_CONTRACT = 'MORE_CONTRACT', MORE_DISCORD = 'MORE_DISCORD', @@ -40,7 +42,7 @@ export interface BasicMenuLink { title: string url: string icon?: string // If icon uses a regular tag - iconSVG?: string // If icon is a inline component + iconSVG?: string } export interface InternalLink extends BasicMenuLink { @@ -50,13 +52,18 @@ export interface InternalLink extends BasicMenuLink { export interface ExternalLink extends BasicMenuLink { kind: MenuItemKind.EXTERNAL_LINK } -export interface DynamicLink extends BasicMenuLink { - kind: MenuItemKind.DYNAMIC_LINK +export interface ParametrizedLink extends BasicMenuLink { + kind: MenuItemKind.PARAMETRIZED_LINK url: Routes } +export interface CustomItem { + kind: MenuItemKind.CUSTOM_ITEM + Item: () => React.ReactNode +} + export type DarkModeLink = { kind: MenuItemKind.DARK_MODE_BUTTON } -export type MenuLink = InternalLink | ExternalLink | DarkModeLink | DynamicLink +export type MenuLink = InternalLink | ExternalLink | DarkModeLink | ParametrizedLink | CustomItem export interface DropDownSubItem { sectionTitle?: string @@ -69,7 +76,7 @@ export interface DropDownItem { items: DropDownSubItem[] } -export type MenuTreeItem = InternalLink | ExternalLink | DropDownItem | DynamicLink +export type MenuTreeItem = InternalLink | ExternalLink | DropDownItem | ParametrizedLink | CustomItem export interface MainMenuContext { darkMode: boolean diff --git a/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx b/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx index 42a7ec5105..07eaec6403 100644 --- a/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx +++ b/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx @@ -149,7 +149,7 @@ export function OrderRow({ const creationTimeAgo = useTimeAgo(parsedCreationTime, TIME_AGO_UPDATE_INTERVAL) // TODO: set the real value when API returns it // const executedTimeAgo = useTimeAgo(expirationTime, TIME_AGO_UPDATE_INTERVAL) - const activityUrl = chainId && activityId ? getEtherscanLink(chainId, activityId, 'transaction') : undefined + const activityUrl = chainId && activityId ? getEtherscanLink(chainId, 'transaction', activityId) : undefined const [isInverted, setIsInverted] = useState(() => { // On mount, apply smart quote selection diff --git a/src/modules/ordersTable/pure/ReceiptModal/IdField.tsx b/src/modules/ordersTable/pure/ReceiptModal/IdField.tsx index 8556e7c1d1..73eef077b1 100644 --- a/src/modules/ordersTable/pure/ReceiptModal/IdField.tsx +++ b/src/modules/ordersTable/pure/ReceiptModal/IdField.tsx @@ -11,7 +11,7 @@ export type Props = { } export function IdField({ id, chainId }: Props) { - const activityUrl = getEtherscanLink(chainId, id, 'transaction') + const activityUrl = getEtherscanLink(chainId, 'transaction', id) return ( diff --git a/src/modules/utm/hooks.ts b/src/modules/utm/hooks.ts index 382184da58..b50342482e 100644 --- a/src/modules/utm/hooks.ts +++ b/src/modules/utm/hooks.ts @@ -57,7 +57,7 @@ export function useInitializeUtm(): void { () => { const searchParams = new URLSearchParams(search) const utm = getUtmParams(searchParams) - if (utm.utmCampaign || utm.utmCampaign || utm.utmContent || utm.utmMedium || utm.utmSource) { + if (utm.utmSource || utm.utmMedium || utm.utmCampaign || utm.utmContent || utm.utmTerm) { // Only overrides the UTM if the URL includes at least one UTM param setUtm(utm) } diff --git a/src/modules/wallet/web3-react/connection/walletConnect.tsx b/src/modules/wallet/web3-react/connection/walletConnect.tsx index 02a2d74aa1..3f649e067a 100644 --- a/src/modules/wallet/web3-react/connection/walletConnect.tsx +++ b/src/modules/wallet/web3-react/connection/walletConnect.tsx @@ -42,7 +42,7 @@ const [web3WalletConnect, web3WalletConnectHooks] = initializeConnector - + View contract ↗ @@ -280,7 +279,7 @@ export default function Profile() { View contract ↗ diff --git a/src/pages/Account/LockedGnoVesting/index.tsx b/src/pages/Account/LockedGnoVesting/index.tsx index 6613b12ca7..bcd3ad354f 100644 --- a/src/pages/Account/LockedGnoVesting/index.tsx +++ b/src/pages/Account/LockedGnoVesting/index.tsx @@ -203,7 +203,7 @@ const LockedGnoVesting: React.FC = ({ openModal, closeModal, vested, allo - View contract ↗ + View contract ↗
Copy contract