From ba6963057cd1893a1f9965740aa56bf7e3a633ff Mon Sep 17 00:00:00 2001 From: Tina <59578595+tinaszheng@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:40:19 -0500 Subject: [PATCH 1/3] feat: dont show affiliates that have no referral code (#1369) --- src/hooks/useAffiliatesLeaderboard.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hooks/useAffiliatesLeaderboard.ts b/src/hooks/useAffiliatesLeaderboard.ts index f8587813f..9443ed59e 100644 --- a/src/hooks/useAffiliatesLeaderboard.ts +++ b/src/hooks/useAffiliatesLeaderboard.ts @@ -25,10 +25,12 @@ export const useAffiliatesLeaderboard = () => { }); const data = await response.json(); - return data?.affiliateList?.map((stat: IAffiliateStats, i: number) => ({ - ...stat, - rank: i + 1, - })); + return data?.affiliateList + ?.filter((stat: IAffiliateStats) => Boolean(stat.affiliateReferralCode)) + ?.map((stat: IAffiliateStats, i: number) => ({ + ...stat, + rank: i + 1, + })); } catch (error) { log('useAffiliateLeaderboard', error, { endpoint }); throw error; From 613d3b120c581bcd2e42feb2e92366fa13cd0832 Mon Sep 17 00:00:00 2001 From: Tina <59578595+tinaszheng@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:35:54 -0500 Subject: [PATCH 2/3] feat: add placeholder for new deposit flow (#1367) --- src/constants/dialogs.ts | 3 +++ src/layout/DialogManager.tsx | 2 ++ src/layout/Header/HeaderDesktop.tsx | 11 ++++++++- src/lib/testFlags.ts | 4 ++++ .../dialogs/DepositDialog2/DepositDialog2.tsx | 24 +++++++++++++++++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/views/dialogs/DepositDialog2/DepositDialog2.tsx diff --git a/src/constants/dialogs.ts b/src/constants/dialogs.ts index 28c3018af..15b8c5f44 100644 --- a/src/constants/dialogs.ts +++ b/src/constants/dialogs.ts @@ -85,6 +85,7 @@ export type UnlimitedAnnouncementDialogProps = {}; export type UnstakeDialogProps = {}; export type VaultDepositWithdrawDialogProps = { initialType?: 'DEPOSIT' | 'WITHDRAW' }; export type WithdrawDialogProps = {}; +export type DepositDialog2Props = {}; export type WithdrawalGatedDialogProps = { transferType: 'withdrawal' | 'transfer'; estimatedUnblockTime?: string | null; @@ -108,6 +109,8 @@ export const DialogTypes = unionize( ConfirmPendingDeposit: ofType(), Criteria: ofType(), Deposit: ofType(), + /* TODO: rename Deposit2 to Deposit once old deposit flow is deprecated */ + Deposit2: ofType(), DisconnectWallet: ofType(), DisplaySettings: ofType(), ExchangeOffline: ofType(), diff --git a/src/layout/DialogManager.tsx b/src/layout/DialogManager.tsx index d9dd3c5bd..ce4d7bbe8 100644 --- a/src/layout/DialogManager.tsx +++ b/src/layout/DialogManager.tsx @@ -14,6 +14,7 @@ import { ClosePositionDialog } from '@/views/dialogs/ClosePositionDialog'; import { ComplianceConfigDialog } from '@/views/dialogs/ComplianceConfigDialog'; import { ConfirmPendingDepositDialog } from '@/views/dialogs/ConfirmPendingDepositDialog'; import { DepositDialog } from '@/views/dialogs/DepositDialog'; +import { DepositDialog2 } from '@/views/dialogs/DepositDialog2/DepositDialog2'; import { FillDetailsDialog } from '@/views/dialogs/DetailsDialog/FillDetailsDialog'; import { OrderDetailsDialog } from '@/views/dialogs/DetailsDialog/OrderDetailsDialog'; import { DisconnectDialog } from '@/views/dialogs/DisconnectDialog'; @@ -81,6 +82,7 @@ export const DialogManager = React.memo(() => { ComplianceConfig: (args) => , ConfirmPendingDeposit: (args) => , Deposit: (args) => , + Deposit2: (args) => , DisconnectWallet: (args) => , DisplaySettings: (args) => , ExchangeOffline: (args) => , diff --git a/src/layout/Header/HeaderDesktop.tsx b/src/layout/Header/HeaderDesktop.tsx index b8ca7b5ba..bed64d4f6 100644 --- a/src/layout/Header/HeaderDesktop.tsx +++ b/src/layout/Header/HeaderDesktop.tsx @@ -40,6 +40,7 @@ import { openDialog } from '@/state/dialogs'; import { isTruthy } from '@/lib/isTruthy'; import { MustBigNumber } from '@/lib/numbers'; +import { testFlags } from '@/lib/testFlags'; export const HeaderDesktop = () => { const stringGetter = useStringGetter(); @@ -195,7 +196,15 @@ export const HeaderDesktop = () => { ? ButtonAction.Secondary : ButtonAction.Primary } - onClick={() => dispatch(openDialog(DialogTypes.Deposit({})))} + onClick={() => { + dispatch( + openDialog( + testFlags.showNewDepositFlow + ? DialogTypes.Deposit2({}) + : DialogTypes.Deposit({}) + ) + ); + }} state={{ isDisabled: !dydxAccounts }} > {stringGetter({ key: STRING_KEYS.DEPOSIT })} diff --git a/src/lib/testFlags.ts b/src/lib/testFlags.ts index d7972c798..46ba5cbc5 100644 --- a/src/lib/testFlags.ts +++ b/src/lib/testFlags.ts @@ -59,6 +59,10 @@ class TestFlags { get showInstantDepositToggle() { return !!this.queryParams.funkit_toggle; } + + get showNewDepositFlow() { + return !!this.queryParams.deposit_rewrite; + } } export const testFlags = new TestFlags(); diff --git a/src/views/dialogs/DepositDialog2/DepositDialog2.tsx b/src/views/dialogs/DepositDialog2/DepositDialog2.tsx new file mode 100644 index 000000000..95280c5e1 --- /dev/null +++ b/src/views/dialogs/DepositDialog2/DepositDialog2.tsx @@ -0,0 +1,24 @@ +import { DepositDialog2Props, DialogProps } from '@/constants/dialogs'; +import { STRING_KEYS } from '@/constants/localization'; + +import { useBreakpoints } from '@/hooks/useBreakpoints'; +import { useStringGetter } from '@/hooks/useStringGetter'; + +import { Dialog, DialogPlacement } from '@/components/Dialog'; + +export const DepositDialog2 = ({ setIsOpen }: DialogProps) => { + const { isMobile } = useBreakpoints(); + const stringGetter = useStringGetter(); + + return ( + + New deposit flow goes here! + + ); +}; From 9c409a59257b34214ad3bbd4e63c4fff27ab721a Mon Sep 17 00:00:00 2001 From: Tina <59578595+tinaszheng@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:57:02 -0500 Subject: [PATCH 3/3] chore: remove ethers as an explicit dependency (#1371) --- package.json | 4 +--- pnpm-lock.yaml | 20 +++++++------------ .../WithdrawForm/WithdrawForm.tsx | 4 ++-- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 7c1ee1f09..83aa04068 100644 --- a/package.json +++ b/package.json @@ -59,9 +59,8 @@ "@dydxprotocol/v4-client-js": "1.12.2", "@dydxprotocol/v4-localization": "^1.1.257", "@dydxprotocol/v4-proto": "^7.0.0-dev.0", - "@funkit/connect": "^4.0.2", "@emotion/is-prop-valid": "^1.3.0", - "@ethersproject/providers": "^5.7.2", + "@funkit/connect": "^4.0.2", "@hugocxl/react-to-image": "^0.0.9", "@js-joda/core": "^5.5.3", "@keplr-wallet/types": "^0.12.121", @@ -122,7 +121,6 @@ "color": "^4.2.3", "cosmjs-types": "^0.9.0", "crypto-js": "^4.1.1", - "ethers": "^6.6.1", "export-to-csv": "^1.2.3", "fast-json-stable-stringify": "^2.1.0", "graz": "^0.1.19", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index decb8d7dc..f33cf8843 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,9 +44,6 @@ dependencies: '@emotion/is-prop-valid': specifier: ^1.3.0 version: 1.3.0 - '@ethersproject/providers': - specifier: ^5.7.2 - version: 5.7.2 '@funkit/connect': specifier: ^4.0.2 version: 4.0.2(@ethersproject/address@5.7.0)(@ethersproject/networks@5.7.1)(@ethersproject/solidity@5.7.0)(@tanstack/react-query@5.37.1)(@types/react@18.3.3)(babel-plugin-macros@3.1.0)(hardhat@2.22.13)(react-dom@18.2.0)(react@18.2.0)(typescript@5.6.3)(viem@2.16.2)(wagmi@2.10.9) @@ -230,9 +227,6 @@ dependencies: crypto-js: specifier: ^4.1.1 version: 4.1.1 - ethers: - specifier: ^6.6.1 - version: 6.6.1 export-to-csv: specifier: ^1.2.3 version: 1.2.3 @@ -2637,8 +2631,8 @@ packages: - fp-ts dev: false - /@chain-registry/types@0.50.33: - resolution: {integrity: sha512-1zArCjYizFdfbP3L1WCUm3iL7Kf7VBS8N87SEqaTg6rC+fePYsq90LGpFuq2wzNPfQWPT7tsMT22ISeDIYflLA==} + /@chain-registry/types@0.50.35: + resolution: {integrity: sha512-U01vuZ5CDdpmKhDkc+xRVQZyEqdYbqzdL2SQXq+AiVLEmWwkDSjASQK3V4Lyn5h91jTJqCIYbwLbPuOtOF6JjA==} dev: false /@coinbase/wallet-sdk@3.9.3: @@ -9543,7 +9537,7 @@ packages: '@solana/wallet-adapter-base': 0.9.23(@solana/web3.js@1.93.2) '@solana/web3.js': 1.93.2 axios: 1.6.7 - chain-registry: 1.69.59 + chain-registry: 1.69.61 cosmjs-types: 0.8.0 keccak256: 1.0.6 kujira.js: 0.9.162 @@ -14188,10 +14182,10 @@ packages: type-detect: 4.1.0 dev: true - /chain-registry@1.69.59: - resolution: {integrity: sha512-8NUDiFtgXJAOpFTGwAnBzps3Kfn/tlvLNVZ8W6J/5JbGf7R8ZSSeuMM+g8xm1toI7nbjgzN1HDGh/VjazVbbQw==} + /chain-registry@1.69.61: + resolution: {integrity: sha512-6OBR/nCn3UPGrqnmQk1Pw73c6oGia6FIlLVoPM++LSO4Tv8gM8mW0ahl2VBH0URoq9yCB1h/+CD7+DNaounagA==} dependencies: - '@chain-registry/types': 0.50.33 + '@chain-registry/types': 0.50.35 dev: false /chalk@2.4.2: @@ -19604,7 +19598,7 @@ packages: '@ethersproject/bignumber': 5.7.0 '@keplr-wallet/types': 0.11.64 '@types/google-protobuf': 3.15.12 - chain-registry: 1.69.59 + chain-registry: 1.69.61 cosmjs-types: 0.8.0 long: 4.0.0 text-encoding: 0.7.0 diff --git a/src/views/forms/AccountManagementFormsNew/WithdrawForm/WithdrawForm.tsx b/src/views/forms/AccountManagementFormsNew/WithdrawForm/WithdrawForm.tsx index 25710ca4f..4fcefc9e5 100644 --- a/src/views/forms/AccountManagementFormsNew/WithdrawForm/WithdrawForm.tsx +++ b/src/views/forms/AccountManagementFormsNew/WithdrawForm/WithdrawForm.tsx @@ -2,10 +2,10 @@ import type { ChangeEvent, FormEvent } from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { TYPE_URL_MSG_WITHDRAW_FROM_SUBACCOUNT } from '@dydxprotocol/v4-client-js'; -import { parseUnits } from 'ethers'; import type { NumberFormatValues } from 'react-number-format'; import { shallowEqual } from 'react-redux'; import styled from 'styled-components'; +import { parseUnits } from 'viem'; import { AutoSweepConfig } from '@/constants/abacus'; import { AlertType } from '@/constants/alerts'; @@ -180,7 +180,7 @@ export const WithdrawForm = () => { }, recipient: dydxAddress, assetId: 0, - quantums: parseUnits(debouncedAmount, usdcDecimals), + quantums: parseUnits(debouncedAmount, usdcDecimals).toString(), }), msgTypeURL: TYPE_URL_MSG_WITHDRAW_FROM_SUBACCOUNT, },