diff --git a/.env.example b/.env.example index 247e73171..7bfb065f4 100644 --- a/.env.example +++ b/.env.example @@ -126,5 +126,15 @@ REACT_APP_DISABLED_CHAINS= # - /token-list REACT_APP_DISABLED_CHAINS_FOR_AVAILABLE_ROUTES= +# Comma-separated list of token symbols to disable in the UI and the following API handlers: +# - /available-routes +# - /token-list +REACT_APP_DISABLED_TOKENS_FOR_AVAILABLE_ROUTES= + # Comma-separated list of wallet addresses to block from UI REACT_APP_WALLET_BLACKLIST= + +# Gas estimation padding multiplier. +# JSON with format: {[chainId]: } +# e.g: { "1": 1.1, "10": 1.05 } +REACT_APP_GAS_ESTIMATION_MULTIPLIER_PER_CHAIN={"1": 1.1} diff --git a/api/_constants.ts b/api/_constants.ts index c2969c1c8..a1cb05615 100644 --- a/api/_constants.ts +++ b/api/_constants.ts @@ -17,13 +17,13 @@ const defaultRelayerFeeCapitalCostConfig: { } = { ETH: { lowerBound: ethers.utils.parseUnits("0.0001").toString(), - upperBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.0004").toString(), cutoff: ethers.utils.parseUnits("750").toString(), decimals: 18, }, WETH: { lowerBound: ethers.utils.parseUnits("0.0001").toString(), - upperBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.0004").toString(), cutoff: ethers.utils.parseUnits("750").toString(), decimals: 18, }, @@ -35,20 +35,20 @@ const defaultRelayerFeeCapitalCostConfig: { }, DAI: { lowerBound: ethers.utils.parseUnits("0.0001").toString(), - upperBound: ethers.utils.parseUnits("0.0001").toString(), - cutoff: ethers.utils.parseUnits("250000").toString(), + upperBound: ethers.utils.parseUnits("0.0004").toString(), + cutoff: ethers.utils.parseUnits("1500000").toString(), decimals: 18, }, USDC: { lowerBound: ethers.utils.parseUnits("0.0001").toString(), - upperBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.0004").toString(), cutoff: ethers.utils.parseUnits("1500000").toString(), decimals: 6, }, USDT: { lowerBound: ethers.utils.parseUnits("0.0001").toString(), - upperBound: ethers.utils.parseUnits("0.0001").toString(), - cutoff: ethers.utils.parseUnits("250000").toString(), + upperBound: ethers.utils.parseUnits("0.0004").toString(), + cutoff: ethers.utils.parseUnits("1500000").toString(), decimals: 6, }, UMA: { @@ -63,12 +63,36 @@ const defaultRelayerFeeCapitalCostConfig: { cutoff: ethers.utils.parseUnits("5000").toString(), decimals: 18, }, + ACX: { + lowerBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.001").toString(), + cutoff: ethers.utils.parseUnits("1000000").toString(), + decimals: 18, + }, + BAL: { + lowerBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.001").toString(), + cutoff: ethers.utils.parseUnits("10000").toString(), + decimals: 18, + }, + POOL: { + lowerBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.001").toString(), + cutoff: ethers.utils.parseUnits("10000").toString(), + decimals: 18, + }, BOBA: { lowerBound: ethers.utils.parseUnits("0.0003").toString(), upperBound: ethers.utils.parseUnits("0.001").toString(), cutoff: ethers.utils.parseUnits("100000").toString(), decimals: 18, }, + SNX: { + lowerBound: ethers.utils.parseUnits("0.0001").toString(), + upperBound: ethers.utils.parseUnits("0.0005").toString(), + cutoff: ethers.utils.parseUnits("10000").toString(), + decimals: 18, + }, }; const relayerFeeCapitalCostOverrides: Record< diff --git a/api/_utils.ts b/api/_utils.ts index 5a491d8e6..8ab12cc8e 100644 --- a/api/_utils.ts +++ b/api/_utils.ts @@ -58,11 +58,6 @@ export const DEFAULT_GAS_MARKUP = 0; // Don't permit HUB_POOL_CHAIN_ID=0 export const HUB_POOL_CHAIN_ID = Number(REACT_APP_HUBPOOL_CHAINID || 1); -// Permit REACT_APP_FLAT_RELAY_CAPITAL_FEE=0 -export const FLAT_RELAY_CAPITAL_FEE = Number( - process.env.REACT_APP_FLAT_RELAY_CAPITAL_FEE ?? 0.03 -); // 0.03% - // Tokens that should be disabled in the routes export const DISABLED_ROUTE_TOKENS = ( process.env.DISABLED_ROUTE_TOKENS || "" @@ -84,6 +79,10 @@ export const DISABLED_CHAINS_FOR_AVAILABLE_ROUTES = ( process.env.REACT_APP_DISABLED_CHAINS_FOR_AVAILABLE_ROUTES || "" ).split(","); +export const DISABLED_TOKENS_FOR_AVAILABLE_ROUTES = ( + process.env.REACT_APP_DISABLED_TOKENS_FOR_AVAILABLE_ROUTES || "" +).split(","); + const _ENABLED_ROUTES = HUB_POOL_CHAIN_ID === 1 ? enabledMainnetRoutesAsJson @@ -443,7 +442,6 @@ export const getRelayerFeeCalculator = (destinationChainId: number) => { const relayerFeeCalculatorConfig = { feeLimitPercent: maxRelayFeePct * 100, - capitalCostsPercent: FLAT_RELAY_CAPITAL_FEE, // This is set same way in ./src/utils/bridge.ts queries: queryFn(), capitalCostsConfig: relayerFeeCapitalCostConfig, }; diff --git a/api/available-routes.ts b/api/available-routes.ts index 779507a32..566d5933b 100644 --- a/api/available-routes.ts +++ b/api/available-routes.ts @@ -8,6 +8,7 @@ import { ENABLED_ROUTES, handleErrorCondition, DISABLED_CHAINS_FOR_AVAILABLE_ROUTES, + DISABLED_TOKENS_FOR_AVAILABLE_ROUTES, } from "./_utils"; import { TypedVercelRequest } from "./_types"; @@ -64,10 +65,14 @@ const handler = async ( originChainId: number; destinationChainId: number; destinationToken: string; + fromTokenSymbol: string; }) => ![route.originChainId, route.destinationChainId].some((chainId) => DISABLED_CHAINS_FOR_AVAILABLE_ROUTES.includes(String(chainId)) ) && + !DISABLED_TOKENS_FOR_AVAILABLE_ROUTES.some( + (s) => s.toUpperCase() === route.fromTokenSymbol.toUpperCase() + ) && (!originToken || originToken.toLowerCase() === route.originToken.toLowerCase()) && (!originChainId || originChainId === String(route.originChainId)) && @@ -81,12 +86,18 @@ const handler = async ( originChainId: route.fromChain, originToken: route.fromTokenAddress, destinationChainId: route.toChain, + fromTokenSymbol: route.fromTokenSymbol, // Resolve destination chain directly from the // l1TokensToDestinationTokens map destinationToken: l1TokensToDestinationTokens[route.l1TokenAddress][route.toChain], }) - ); + ).map((route) => ({ + originChainId: route.originChainId, + originToken: route.originToken, + destinationChainId: route.destinationChainId, + destinationToken: route.destinationToken, + })); // Two different explanations for how `stale-while-revalidate` works: diff --git a/api/suggested-fees.ts b/api/suggested-fees.ts index 945a363f2..0e7d47db6 100644 --- a/api/suggested-fees.ts +++ b/api/suggested-fees.ts @@ -233,6 +233,7 @@ const handler = async ( responseJson, }); + response.setHeader("Cache-Control", "s-maxage=10"); response.status(200).json(responseJson); } catch (error) { return handleErrorCondition("suggested-fees", response, logger, error); diff --git a/api/token-list.ts b/api/token-list.ts index d1962c179..a25062a91 100644 --- a/api/token-list.ts +++ b/api/token-list.ts @@ -5,6 +5,7 @@ import { getFallbackTokenLogoURI, ENABLED_ROUTES, DISABLED_CHAINS_FOR_AVAILABLE_ROUTES, + DISABLED_TOKENS_FOR_AVAILABLE_ROUTES, } from "./_utils"; import { TypedVercelRequest } from "./_types"; import { TOKEN_SYMBOLS_MAP } from "./_constants"; @@ -18,6 +19,9 @@ const handler = async (_: TypedVercelRequest<{}>, response: VercelResponse) => { (route) => ![route.fromChain, route.toChain].some((chainId) => DISABLED_CHAINS_FOR_AVAILABLE_ROUTES.includes(String(chainId)) + ) && + !DISABLED_TOKENS_FOR_AVAILABLE_ROUTES.some( + (s) => s.toUpperCase() === route.fromTokenSymbol.toUpperCase() ) ) .reduce( diff --git a/index.html b/index.html index 7d4a3eb87..122c44919 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + - + - + diff --git a/package.json b/package.json index 655a06b96..04e4557a1 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,16 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@google-cloud/logging": "^10.1.1", "@reach/dialog": "^0.16.2", + "@safe-global/safe-apps-provider": "^0.18.0", + "@safe-global/safe-apps-sdk": "^8.1.0", "@sentry/react": "^7.37.2", "@uma/sdk": "^0.22.2", - "@web3-onboard/coinbase": "^2.2.4", - "@web3-onboard/core": "^2.20.4", - "@web3-onboard/gnosis": "^2.1.10", - "@web3-onboard/injected-wallets": "^2.10.2", - "@web3-onboard/react": "^2.8.9", - "@web3-onboard/walletconnect": "^2.4.1", + "@web3-onboard/coinbase": "^2.2.5", + "@web3-onboard/core": "^2.21.2", + "@web3-onboard/gnosis": "^2.2.0", + "@web3-onboard/injected-wallets": "^2.10.6", + "@web3-onboard/react": "^2.8.13", + "@web3-onboard/walletconnect": "^2.4.6", "axios": "^0.27.2", "bnc-notify": "^1.9.8", "copy-to-clipboard": "^3.3.3", @@ -50,7 +52,7 @@ }, "scripts": { "start": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite", - "dev": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite --port $PORT", + "dev": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite --port $PORT --host", "build": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && tsc && vite build", "analyze": "yarn build --stats && webpack-bundle-analyzer build/bundle-stats.json -m server -r build/bundle-stats.html", "test": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && jest --env jsdom src", diff --git a/patches/@web3-onboard+walletconnect+2.4.1.patch b/patches/@web3-onboard+walletconnect+2.4.1.patch deleted file mode 100644 index efb5267e3..000000000 --- a/patches/@web3-onboard+walletconnect+2.4.1.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/@web3-onboard/walletconnect/dist/v2.js b/node_modules/@web3-onboard/walletconnect/dist/v2.js -index e24edd8..459a4ab 100644 ---- a/node_modules/@web3-onboard/walletconnect/dist/v2.js -+++ b/node_modules/@web3-onboard/walletconnect/dist/v2.js -@@ -48,7 +48,7 @@ function walletConnect(options) { - ? // @ts-ignore - // Required as WC package does not support hex numbers - requiredChains.map(chainID => parseInt(chainID)) -- : [1]; -+ : []; - // Defaults to the chains provided within the web3-onboard init chain property - const optionalChainsParsed = Array.isArray(optionalChains) && - optionalChains.length && diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 000000000..af00acc86 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/logo-small.png b/public/logo-small.png index cd657fe18..978787174 100644 Binary files a/public/logo-small.png and b/public/logo-small.png differ diff --git a/public/thumbnail.png b/public/thumbnail.png new file mode 100644 index 000000000..eef64146c Binary files /dev/null and b/public/thumbnail.png differ diff --git a/src/ampli/index.ts b/src/ampli/index.ts index 834422d3f..ec2843e2e 100644 --- a/src/ampli/index.ts +++ b/src/ampli/index.ts @@ -1,5 +1,6 @@ /* tslint:disable */ /* eslint-disable */ +// @ts-nocheck /** * Ampli - A strong typed wrapper for your Analytics * @@ -7,7 +8,7 @@ * To update run 'ampli pull web' * * Required dependencies: @amplitude/analytics-browser@^1.3.0 - * Tracking Plan Version: 48 + * Tracking Plan Version: 50 * Build: 1.0.0 * Runtime: browser:typescript-ampli-v2 * @@ -31,10 +32,10 @@ export const ApiKey: Record = { */ export const DefaultConfiguration: BrowserOptions = { plan: { - version: "48", + version: "50", branch: "main", source: "web", - versionId: "b6ae0501-d357-497d-9c93-27640ad3cd9f", + versionId: "5b6bde07-5ed3-4021-967f-fdaec4b35a87", }, ...{ ingestionMetadata: { @@ -65,6 +66,8 @@ export type LoadOptions = | LoadOptionsWithClientInstance; export interface IdentifyProperties { + AcxVolumeNative?: any; + AcxVolumeUsd?: any; AllAssetsAllNetworksWalletCurrentBalanceUsd?: string; /** * List of wallet addresses connected during Wallet Connect Transaction Completed event. @@ -84,6 +87,39 @@ export interface IdentifyProperties { * | Item Type | string | */ AllWalletChainIds?: string[]; + ArbitrumAcxWalletCurrentBalance?: any; + ArbitrumBalWalletCurrentBalance?: any; + ArbitrumDaiWalletCurrentBalance?: any; + ArbitrumEthWalletCurrentBalance?: any; + ArbitrumUmaWalletCurrentBalance?: any; + ArbitrumUsdcWalletCurrentBalance?: any; + ArbitrumWbtcWalletCurrentBalance?: any; + ArbitrumWethWalletCurrentBalance?: any; + BalVolumeNative?: any; + BalVolumeUsd?: any; + BobaAcxWalletCurrentBalance?: any; + BobaBobaWalletCurrentBalance?: any; + BobaDaiWalletCurrentBalance?: any; + BobaEthWalletCurrentBalance?: any; + BobaUmaWalletCurrentBalance?: any; + BobaUsdcWalletCurrentBalance?: any; + BobaVolumeNative?: any; + BobaVolumeUsd?: any; + BobaWbtcWalletCurrentBalance?: any; + BobaWethWalletCurrentBalance?: any; + DaiVolumeNative?: any; + DaiVolumeUsd?: any; + EthereumAcxWalletCurrentBalance?: any; + EthereumBalWalletCurrentBalance?: any; + EthereumBobaWalletCurrentBalance?: any; + EthereumDaiWalletCurrentBalance?: any; + EthereumEthWalletCurrentBalance?: any; + EthereumUmaWalletCurrentBalance?: any; + EthereumUsdcWalletCurrentBalance?: any; + EthereumWbtcWalletCurrentBalance?: any; + EthereumWethWalletCurrentBalance?: any; + EthVolumeNative?: any; + EthVolumeUsd?: any; initial_dclid?: any; initial_fbclid?: any; initial_gbraid?: any; @@ -101,6 +137,32 @@ export interface IdentifyProperties { initial_utm_source?: any; initial_utm_term?: any; initial_wbraid?: any; + L1L2Transfers?: any; + L2L1Transfers?: any; + L2L2Transfers?: any; + OptimismAcxWalletCurrentBalance?: any; + OptimismBalWalletCurrentBalance?: any; + OptimismDaiWalletCurrentBalance?: any; + OptimismEthWalletCurrentBalance?: any; + OptimismUmaWalletCurrentBalance?: any; + OptimismUsdcWalletCurrentBalance?: any; + OptimismWbtcWalletCurrentBalance?: any; + OptimismWethWalletCurrentBalance?: any; + PolygonAcxWalletCurrentBalance?: any; + PolygonBalWalletCurrentBalance?: any; + PolygonDaiWalletCurrentBalance?: any; + PolygonUmaWalletCurrentBalance?: any; + PolygonUsdcWalletCurrentBalance?: any; + PolygonWbtcWalletCurrentBalance?: any; + PolygonWethWalletCurrentBalance?: any; + referrer?: any; + referring_domain?: any; + TotalTransfers?: any; + TotalVolumeUsd?: any; + UmaVolumeNative?: any; + UmaVolumeUsd?: any; + UsdcVolumeNative?: any; + UsdcVolumeUsd?: any; /** * Currently connected wallet address */ @@ -109,6 +171,10 @@ export interface IdentifyProperties { * Type of wallet connected */ WalletType?: string; + WbtcVolumeNative?: any; + WbtcVolumeUsd?: any; + WethVolumeNative?: any; + WethVolumeUsd?: any; } export interface ConnectWalletButtonClickedProperties { @@ -123,13 +189,17 @@ export interface ConnectWalletButtonClickedProperties { /** * | Rule | Value | * |---|---| - * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton | + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | */ element: | "connectWalletButton" | "web3OnboardModal" | "maxButton" - | "quickSwapButton"; + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; /** * | Rule | Value | * |---|---| @@ -148,7 +218,7 @@ export interface ConnectWalletButtonClickedProperties { /** * | Rule | Value | * |---|---| - * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm | + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | */ section: | "navbar" @@ -162,7 +232,21 @@ export interface ConnectWalletButtonClickedProperties { | "myTransactionsTable" | "bridgeForm" | "claimReferralRewardsForm" - | "stakeForm"; + | "stakeForm" + | "depositConfirmation"; +} + +export interface DepositNetworkMismatchProperties { + /** + * Id of the fromChain + */ + fromChainId: string; + signerAddress: string; + signerChainId: string; + /** + * Id of the toChain + */ + toChainId: string; } export interface DisconnectWalletButtonClickedProperties { @@ -170,7 +254,79 @@ export interface DisconnectWalletButtonClickedProperties { * Action user did to trigger the event. */ action: string; - element: string; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | + */ + element: + | "connectWalletButton" + | "web3OnboardModal" + | "maxButton" + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | splashPage, bridgePage, poolPage, rewardsPage, transactionsPage, stakingPage, referralPage, airdropPage, 404Page | + */ + page: + | "splashPage" + | "bridgePage" + | "poolPage" + | "rewardsPage" + | "transactionsPage" + | "stakingPage" + | "referralPage" + | "airdropPage" + | "404Page"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | + */ + section: + | "navbar" + | "mobileNavSidebar" + | "addLiquidityForm" + | "removeLiquidityForm" + | "airdropSplashFlow" + | "referralTable" + | "rewardsTable" + | "unstakeForm" + | "myTransactionsTable" + | "bridgeForm" + | "claimReferralRewardsForm" + | "stakeForm" + | "depositConfirmation"; +} + +export interface EarnByAddingLiquidityClickedProperties { + /** + * Action user did to trigger the event. + * + * | Rule | Value | + * |---|---| + * | Enum Values | onClick, onKeyPress | + */ + action: "onClick" | "onKeyPress"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | + */ + element: + | "connectWalletButton" + | "web3OnboardModal" + | "maxButton" + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; /** * | Rule | Value | * |---|---| @@ -186,7 +342,25 @@ export interface DisconnectWalletButtonClickedProperties { | "referralPage" | "airdropPage" | "404Page"; - section: string; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | + */ + section: + | "navbar" + | "mobileNavSidebar" + | "addLiquidityForm" + | "removeLiquidityForm" + | "airdropSplashFlow" + | "referralTable" + | "rewardsTable" + | "unstakeForm" + | "myTransactionsTable" + | "bridgeForm" + | "claimReferralRewardsForm" + | "stakeForm" + | "depositConfirmation"; } export interface FromChainSelectedProperties { @@ -216,18 +390,81 @@ export interface MaxTokenAmountClickedProperties { /** * | Rule | Value | * |---|---| - * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton | + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | */ element: | "connectWalletButton" | "web3OnboardModal" | "maxButton" - | "quickSwapButton"; + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; page: string; /** * | Rule | Value | * |---|---| - * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm | + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | + */ + section: + | "navbar" + | "mobileNavSidebar" + | "addLiquidityForm" + | "removeLiquidityForm" + | "airdropSplashFlow" + | "referralTable" + | "rewardsTable" + | "unstakeForm" + | "myTransactionsTable" + | "bridgeForm" + | "claimReferralRewardsForm" + | "stakeForm" + | "depositConfirmation"; +} + +export interface MonitorDepositProgressClickedProperties { + /** + * Action user did to trigger the event. + * + * | Rule | Value | + * |---|---| + * | Enum Values | onClick, onKeyPress | + */ + action: "onClick" | "onKeyPress"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | + */ + element: + | "connectWalletButton" + | "web3OnboardModal" + | "maxButton" + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | splashPage, bridgePage, poolPage, rewardsPage, transactionsPage, stakingPage, referralPage, airdropPage, 404Page | + */ + page: + | "splashPage" + | "bridgePage" + | "poolPage" + | "rewardsPage" + | "transactionsPage" + | "stakingPage" + | "referralPage" + | "airdropPage" + | "404Page"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | */ section: | "navbar" @@ -241,7 +478,8 @@ export interface MaxTokenAmountClickedProperties { | "myTransactionsTable" | "bridgeForm" | "claimReferralRewardsForm" - | "stakeForm"; + | "stakeForm" + | "depositConfirmation"; } export interface PageViewedProperties { @@ -292,13 +530,17 @@ export interface QuickSwapButtonClickedProperties { /** * | Rule | Value | * |---|---| - * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton | + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | */ element: | "connectWalletButton" | "web3OnboardModal" | "maxButton" - | "quickSwapButton"; + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; /** * | Rule | Value | * |---|---| @@ -317,7 +559,7 @@ export interface QuickSwapButtonClickedProperties { /** * | Rule | Value | * |---|---| - * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm | + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | */ section: | "navbar" @@ -331,7 +573,8 @@ export interface QuickSwapButtonClickedProperties { | "myTransactionsTable" | "bridgeForm" | "claimReferralRewardsForm" - | "stakeForm"; + | "stakeForm" + | "depositConfirmation"; } export interface ToAccountChangedProperties { @@ -375,6 +618,65 @@ export interface TokenSelectedProperties { tokenSymbol: string; } +export interface TrackInExplorerClickedProperties { + /** + * Action user did to trigger the event. + * + * | Rule | Value | + * |---|---| + * | Enum Values | onClick, onKeyPress | + */ + action: "onClick" | "onKeyPress"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | + */ + element: + | "connectWalletButton" + | "web3OnboardModal" + | "maxButton" + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | splashPage, bridgePage, poolPage, rewardsPage, transactionsPage, stakingPage, referralPage, airdropPage, 404Page | + */ + page: + | "splashPage" + | "bridgePage" + | "poolPage" + | "rewardsPage" + | "transactionsPage" + | "stakingPage" + | "referralPage" + | "airdropPage" + | "404Page"; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | navbar, mobileNavSidebar, addLiquidityForm, removeLiquidityForm, airdropSplashFlow, referralTable, rewardsTable, unstakeForm, myTransactionsTable, bridgeForm, claimReferralRewardsForm, stakeForm, depositConfirmation | + */ + section: + | "navbar" + | "mobileNavSidebar" + | "addLiquidityForm" + | "removeLiquidityForm" + | "airdropSplashFlow" + | "referralTable" + | "rewardsTable" + | "unstakeForm" + | "myTransactionsTable" + | "bridgeForm" + | "claimReferralRewardsForm" + | "stakeForm" + | "depositConfirmation"; +} + export interface TransferDepositCompletedProperties { /** * Capital fee percent, in decimals @@ -1082,7 +1384,20 @@ export interface WalletSelectedProperties { * Action user did to trigger the event. */ action: string; - element: string; + /** + * | Rule | Value | + * |---|---| + * | Enum Values | connectWalletButton, web3OnboardModal, maxButton, quickSwapButton, trackInExplorerLink, monitorDepositProgressLink, earnByAddingLiquidityAndStakingLink, disconnectWalletButton | + */ + element: + | "connectWalletButton" + | "web3OnboardModal" + | "maxButton" + | "quickSwapButton" + | "trackInExplorerLink" + | "monitorDepositProgressLink" + | "earnByAddingLiquidityAndStakingLink" + | "disconnectWalletButton"; page: string; /** * Type of wallet attempted to connect @@ -1098,7 +1413,7 @@ export interface WebVitalsProperties { } export class Identify implements BaseEvent { - event_type = "Identify"; + event_type = amplitude.Types.SpecialEventType.IDENTIFY; constructor(public event_properties?: IdentifyProperties) { this.event_properties = event_properties; @@ -1117,6 +1432,14 @@ export class ConnectWalletButtonClicked implements BaseEvent { } } +export class DepositNetworkMismatch implements BaseEvent { + event_type = "DepositNetworkMismatch"; + + constructor(public event_properties: DepositNetworkMismatchProperties) { + this.event_properties = event_properties; + } +} + export class DisconnectWalletButtonClicked implements BaseEvent { event_type = "DisconnectWalletButtonClicked"; @@ -1127,6 +1450,14 @@ export class DisconnectWalletButtonClicked implements BaseEvent { } } +export class EarnByAddingLiquidityClicked implements BaseEvent { + event_type = "EarnByAddingLiquidityClicked"; + + constructor(public event_properties: EarnByAddingLiquidityClickedProperties) { + this.event_properties = event_properties; + } +} + export class FeesInfoExpanded implements BaseEvent { event_type = "FeesInfoExpanded"; } @@ -1147,6 +1478,16 @@ export class MaxTokenAmountClicked implements BaseEvent { } } +export class MonitorDepositProgressClicked implements BaseEvent { + event_type = "MonitorDepositProgressClicked"; + + constructor( + public event_properties: MonitorDepositProgressClickedProperties + ) { + this.event_properties = event_properties; + } +} + export class PageViewed implements BaseEvent { event_type = "PageViewed"; @@ -1187,6 +1528,14 @@ export class TokenSelected implements BaseEvent { } } +export class TrackInExplorerClicked implements BaseEvent { + event_type = "TrackInExplorerClicked"; + + constructor(public event_properties: TrackInExplorerClickedProperties) { + this.event_properties = event_properties; + } +} + export class TransferDepositCompleted implements BaseEvent { event_type = "TransferDepositCompleted"; @@ -1303,7 +1652,8 @@ export class Ampli { this.amplitude = options.client.instance; } else if (apiKey) { this.amplitude = amplitude.createInstance(); - return this.amplitude.init(apiKey, undefined, { ...DefaultConfiguration, ...options.client?.configuration }); + const configuration = (options.client && 'configuration' in options.client) ? options.client.configuration : {}; + return this.amplitude.init(apiKey, undefined, { ...DefaultConfiguration, ...configuration }); } else { console.error("ERROR: ampli.load() requires 'environment', 'client.apiKey', or 'client.instance'"); } @@ -1344,6 +1694,17 @@ export class Ampli { ); } + /** + * Flush the event. + */ + flush() : PromiseResult { + if (!this.isInitializedAndEnabled()) { + return getVoidPromiseResult(); + } + + return this.amplitude!.flush(); + } + /** * Track event * @@ -1394,6 +1755,23 @@ export class Ampli { return this.track(new ConnectWalletButtonClicked(properties), options); } + /** + * DepositNetworkMismatch + * + * [View in Tracking Plan](https://data.amplitude.com/risklabs/Risk%20Labs/events/main/latest/DepositNetworkMismatch) + * + * This event tracks instances where a transfer deposit is attempted to a network that does not match the intended network + * + * @param properties The event's properties (e.g. fromChainId) + * @param options Amplitude event options. + */ + depositNetworkMismatch( + properties: DepositNetworkMismatchProperties, + options?: EventOptions, + ) { + return this.track(new DepositNetworkMismatch(properties), options); + } + /** * DisconnectWalletButtonClicked * @@ -1413,6 +1791,23 @@ export class Ampli { return this.track(new DisconnectWalletButtonClicked(properties), options); } + /** + * EarnByAddingLiquidityClicked + * + * [View in Tracking Plan](https://data.amplitude.com/risklabs/Risk%20Labs/events/main/latest/EarnByAddingLiquidityClicked) + * + * This event tracks when a user clicks on the "Earn by Adding Liquidity" CTA within the application + * + * @param properties The event's properties (e.g. action) + * @param options Amplitude event options. + */ + earnByAddingLiquidityClicked( + properties: EarnByAddingLiquidityClickedProperties, + options?: EventOptions, + ) { + return this.track(new EarnByAddingLiquidityClicked(properties), options); + } + /** * FeesInfoExpanded * @@ -1468,6 +1863,23 @@ export class Ampli { return this.track(new MaxTokenAmountClicked(properties), options); } + /** + * MonitorDepositProgressClicked + * + * [View in Tracking Plan](https://data.amplitude.com/risklabs/Risk%20Labs/events/main/latest/MonitorDepositProgressClicked) + * + * This event tracks when a user clicks on the "Monitor Progress" button within the application + * + * @param properties The event's properties (e.g. action) + * @param options Amplitude event options. + */ + monitorDepositProgressClicked( + properties: MonitorDepositProgressClickedProperties, + options?: EventOptions, + ) { + return this.track(new MonitorDepositProgressClicked(properties), options); + } + /** * PageViewed * @@ -1561,6 +1973,23 @@ export class Ampli { return this.track(new TokenSelected(properties), options); } + /** + * TrackInExplorerClicked + * + * [View in Tracking Plan](https://data.amplitude.com/risklabs/Risk%20Labs/events/main/latest/TrackInExplorerClicked) + * + * This event tracks when a user clicks on the "Track in explorer" button within the application + * + * @param properties The event's properties (e.g. action) + * @param options Amplitude event options. + */ + trackInExplorerClicked( + properties: TrackInExplorerClickedProperties, + options?: EventOptions, + ) { + return this.track(new TrackInExplorerClicked(properties), options); + } + /** * TransferDepositCompleted * diff --git a/src/assets/arrow-star-ring.svg b/src/assets/arrow-star-ring.svg new file mode 100644 index 000000000..61992e19a --- /dev/null +++ b/src/assets/arrow-star-ring.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/splash-mesh-bg-mobile.png b/src/assets/splash-mesh-bg-mobile.png new file mode 100644 index 000000000..6c46c7d28 Binary files /dev/null and b/src/assets/splash-mesh-bg-mobile.png differ diff --git a/src/components/ErrorBoundary/ErrorBoundary.tsx b/src/components/ErrorBoundary/ErrorBoundary.tsx index 1a88ee8ec..3cfdbec96 100644 --- a/src/components/ErrorBoundary/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary/ErrorBoundary.tsx @@ -5,16 +5,20 @@ import Sentry from "utils/sentry"; import { Wrapper, InnerWrapper, ButtonsWrapper } from "./ErrorBoundary.styles"; -export function FallbackComponent() { +export function FallbackComponent(props: { error: Error }) { return ( Something went wrong + Sorry, an error occurred. + + {props.error.name}: {props.error.message} + - Sorry, an error occurred. We've been notified about this issue and - we'll take a look at it shortly. + We've been notified about this issue and we'll take a look at it + shortly. You can also try reloading the page, request support on Discord or @@ -24,9 +28,12 @@ export function FallbackComponent() { window.location.reload()}> Reload - - Discord - + window.open("https://discord.across.to", "_blank")} + > + Discord +