bump abacus + use new env config format
This commit is contained in:
parent
4ebeb21841
commit
99395b34c5
@ -40,7 +40,7 @@
|
||||
"@cosmjs/proto-signing": "^0.32.1",
|
||||
"@cosmjs/stargate": "^0.32.1",
|
||||
"@cosmjs/tendermint-rpc": "^0.32.1",
|
||||
"@dydxprotocol/v4-abacus": "^1.4.2",
|
||||
"@dydxprotocol/v4-abacus": "^1.4.4",
|
||||
"@dydxprotocol/v4-client-js": "^1.0.20",
|
||||
"@dydxprotocol/v4-localization": "^1.1.30",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
|
||||
25
pnpm-lock.yaml
generated
25
pnpm-lock.yaml
generated
@ -1,9 +1,5 @@
|
||||
lockfileVersion: '6.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
overrides:
|
||||
follow-redirects: 1.15.3
|
||||
|
||||
@ -30,14 +26,14 @@ dependencies:
|
||||
specifier: ^0.32.1
|
||||
version: 0.32.2
|
||||
'@dydxprotocol/v4-abacus':
|
||||
specifier: ^1.4.2
|
||||
version: 1.4.2
|
||||
specifier: ^1.4.4
|
||||
version: 1.4.4
|
||||
'@dydxprotocol/v4-client-js':
|
||||
specifier: ^1.0.20
|
||||
version: 1.0.20
|
||||
'@dydxprotocol/v4-localization':
|
||||
specifier: ^1.1.30
|
||||
version: 1.1.30
|
||||
specifier: ^1.1.28
|
||||
version: 1.1.29
|
||||
'@ethersproject/providers':
|
||||
specifier: ^5.7.2
|
||||
version: 5.7.2
|
||||
@ -1290,8 +1286,8 @@ packages:
|
||||
resolution: {integrity: sha512-Gg5t+eR7vPJMAmhkFt6CZrzPd0EKpAslWwk5rFVYZpJsM8JG5KT9XQ99hgNM3Ov6ScNoIWbXkpX27F6A9cXR4Q==}
|
||||
dev: false
|
||||
|
||||
/@dydxprotocol/v4-abacus@1.4.2:
|
||||
resolution: {integrity: sha512-+hugk0RulMwMthR2xCMYXohcC3sEYqVW/lmiq0RUuHZ9yrjmgy48xl0aZUmXGUYXyoiHXPS4AULhRKHQ4OOLwg==}
|
||||
/@dydxprotocol/v4-abacus@1.4.4:
|
||||
resolution: {integrity: sha512-5Hwpxyk89M03L8IBTv8lpX9O03uJuQu81q1rE2uTA27uAp357Vb+AbURdX/OtXuSBCYsLIyzlzraQrfi989J2w==}
|
||||
dev: false
|
||||
|
||||
/@dydxprotocol/v4-client-js@1.0.20:
|
||||
@ -1323,8 +1319,13 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
<<<<<<< HEAD
|
||||
/@dydxprotocol/v4-localization@1.1.30:
|
||||
resolution: {integrity: sha512-TZfWWRSOxcjLHs972wlJVVHkE7+DVqAUnGZSs24HYHsPtUkPhZiNXMOA2Vk9YddQxumhM79xIRH0cmJSe5DDUg==}
|
||||
=======
|
||||
/@dydxprotocol/v4-localization@1.1.29:
|
||||
resolution: {integrity: sha512-o9lxsYl5ObqO9OUyxiKuUxoBmYZk0qGDeNxGScY8uMRq4Ahhz3BPxAC7jUYypCNAMpieiQjVGxMnnhIbwEkm2w==}
|
||||
>>>>>>> d67495d (bump abacus + use new env config format)
|
||||
dev: false
|
||||
|
||||
/@dydxprotocol/v4-proto@4.0.0-dev.0:
|
||||
@ -16053,3 +16054,7 @@ packages:
|
||||
/zwitch@2.0.4:
|
||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||
dev: true
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -14,5 +14,10 @@ export const isDev = CURRENT_MODE === 'DEV';
|
||||
export const AVAILABLE_ENVIRONMENTS = environments.deployments[CURRENT_MODE];
|
||||
export const CURRENT_ABACUS_DEPLOYMENT = CURRENT_MODE;
|
||||
export const ENVIRONMENT_CONFIG_MAP = environments.environments;
|
||||
export const TOKEN_CONFIG_MAP = environments.tokens;
|
||||
export const LINKS_CONFIG_MAP = environments.links;
|
||||
export const WALLETS_CONFIG_MAP = environments.wallets;
|
||||
export const GOVERNANCE_CONFIG_MAP = environments.governance;
|
||||
export type DydxNetwork = keyof typeof ENVIRONMENT_CONFIG_MAP;
|
||||
export type DydxChainId = keyof typeof TOKEN_CONFIG_MAP;
|
||||
export const DEFAULT_APP_ENVIRONMENT = AVAILABLE_ENVIRONMENTS.default as DydxNetwork;
|
||||
|
||||
@ -24,7 +24,7 @@ import {
|
||||
|
||||
import { isMetaMask } from '@/lib/wallet/providers';
|
||||
|
||||
import { DydxNetwork, ENVIRONMENT_CONFIG_MAP } from './networks';
|
||||
import { DydxChainId, WALLETS_CONFIG_MAP } from './networks';
|
||||
|
||||
// Wallet connection types
|
||||
|
||||
@ -291,17 +291,17 @@ export const COSMOS_DERIVATION_PATH = "m/44'/118'/0'/0/0";
|
||||
/**
|
||||
* @description typed data to sign for dYdX Chain onboarding
|
||||
*/
|
||||
export const getSignTypedData = (selectedNetwork: DydxNetwork) =>
|
||||
export const getSignTypedData = (selectedDydxChainId: DydxChainId) =>
|
||||
({
|
||||
primaryType: 'dYdX',
|
||||
domain: {
|
||||
name: ENVIRONMENT_CONFIG_MAP[selectedNetwork].wallets.signTypedDataDomainName,
|
||||
name: WALLETS_CONFIG_MAP[selectedDydxChainId].signTypedDataDomainName,
|
||||
},
|
||||
types: {
|
||||
dYdX: [{ name: 'action', type: 'string' }],
|
||||
},
|
||||
message: {
|
||||
action: ENVIRONMENT_CONFIG_MAP[selectedNetwork].wallets.signTypedDataAction,
|
||||
action: WALLETS_CONFIG_MAP[selectedDydxChainId].signTypedDataAction,
|
||||
},
|
||||
} as const);
|
||||
|
||||
|
||||
@ -18,10 +18,10 @@ import type { ResolutionString } from 'public/tradingview/charting_library';
|
||||
import type { ConnectNetworkEvent, NetworkConfig } from '@/constants/abacus';
|
||||
import { DEFAULT_TRANSACTION_MEMO } from '@/constants/analytics';
|
||||
import { type Candle, RESOLUTION_MAP } from '@/constants/candles';
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { ENVIRONMENT_CONFIG_MAP, TOKEN_CONFIG_MAP } from '@/constants/networks';
|
||||
import { DydxChainAsset } from '@/constants/wallets';
|
||||
|
||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||
import { getSelectedDydxChainId, getSelectedNetwork } from '@/state/appSelectors';
|
||||
|
||||
import { log } from '@/lib/telemetry';
|
||||
|
||||
@ -41,7 +41,8 @@ const useDydxClientContext = () => {
|
||||
// ------ Network ------ //
|
||||
|
||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||
const tokensConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].tokens;
|
||||
const selectedDydxChainId = useSelector(getSelectedDydxChainId);
|
||||
const tokensConfigs = TOKEN_CONFIG_MAP[selectedDydxChainId];
|
||||
|
||||
const [networkConfig, setNetworkConfig] = useState<NetworkConfig>();
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { GOVERNANCE_CONFIG_MAP } from '@/constants/networks';
|
||||
import { useSelectedNetwork } from '@/hooks';
|
||||
|
||||
export interface GovernanceVariables {
|
||||
@ -10,7 +10,7 @@ export interface GovernanceVariables {
|
||||
}
|
||||
|
||||
export const useGovernanceVariables = (): GovernanceVariables => {
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const governanceVars = ENVIRONMENT_CONFIG_MAP[selectedNetwork].governance as GovernanceVariables;
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
const governanceVars = GOVERNANCE_CONFIG_MAP[selectedDydxChainId] as GovernanceVariables;
|
||||
return governanceVars;
|
||||
};
|
||||
|
||||
@ -175,7 +175,7 @@ export const notificationTypes: NotificationTypeConfig[] = [
|
||||
useTrigger: ({ trigger }) => {
|
||||
const stringGetter = useStringGetter();
|
||||
const { transferNotifications } = useLocalNotifications();
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
|
||||
useEffect(() => {
|
||||
for (const transfer of transferNotifications) {
|
||||
@ -184,7 +184,7 @@ export const notificationTypes: NotificationTypeConfig[] = [
|
||||
const icon = <Icon iconName={isFinished ? IconName.Transfer : IconName.Clock} />;
|
||||
|
||||
const transferType =
|
||||
type ?? fromChainId === ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId
|
||||
type ?? fromChainId === selectedDydxChainId
|
||||
? TransferNotificationTypes.Withdrawal
|
||||
: TransferNotificationTypes.Deposit;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { LocalStorageKey } from '@/constants/localStorage';
|
||||
import { DEFAULT_APP_ENVIRONMENT, DydxNetwork, ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { DEFAULT_APP_ENVIRONMENT, DydxChainId, DydxNetwork, ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
|
||||
import { useAccounts, useLocalStorage } from '@/hooks';
|
||||
|
||||
@ -14,6 +14,7 @@ import { validateAgainstAvailableEnvironments } from '@/lib/network';
|
||||
export const useSelectedNetwork = (): {
|
||||
switchNetwork: (network: DydxNetwork) => void;
|
||||
selectedNetwork: DydxNetwork;
|
||||
selectedDydxChainId: DydxChainId;
|
||||
} => {
|
||||
const dispatch = useDispatch();
|
||||
const { disconnect } = useAccounts();
|
||||
@ -35,5 +36,9 @@ export const useSelectedNetwork = (): {
|
||||
[dispatch, disconnect, setLocalStorageNetwork]
|
||||
);
|
||||
|
||||
return { switchNetwork, selectedNetwork };
|
||||
return {
|
||||
switchNetwork,
|
||||
selectedNetwork,
|
||||
selectedDydxChainId: ENVIRONMENT_CONFIG_MAP[selectedNetwork as DydxNetwork].dydxChainId as DydxChainId,
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { TOKEN_CONFIG_MAP } from '@/constants/networks';
|
||||
import { DydxChainAsset } from '@/constants/wallets';
|
||||
|
||||
import { useSelectedNetwork } from '@/hooks';
|
||||
@ -25,8 +25,8 @@ export const useTokenConfigs = (): {
|
||||
chainTokenDecimals: number;
|
||||
chainTokenLabel: string;
|
||||
} => {
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const tokensConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].tokens;
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
const tokensConfigs = TOKEN_CONFIG_MAP[selectedDydxChainId];
|
||||
|
||||
return {
|
||||
tokensConfigs,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { LINKS_CONFIG_MAP } from '@/constants/networks';
|
||||
|
||||
import { useSelectedNetwork } from '@/hooks';
|
||||
|
||||
@ -7,6 +7,7 @@ const FALLBACK_URL = 'https://help.dydx.exchange/';
|
||||
export interface LinksConfigs {
|
||||
tos: string;
|
||||
privacy: string;
|
||||
statusPage: string;
|
||||
mintscan: string;
|
||||
mintscanBase: string;
|
||||
feedback?: string;
|
||||
@ -27,12 +28,13 @@ export interface LinksConfigs {
|
||||
}
|
||||
|
||||
export const useURLConfigs = (): LinksConfigs => {
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const linksConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].links as LinksConfigs;
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
const linksConfigs = LINKS_CONFIG_MAP[selectedDydxChainId] as LinksConfigs;
|
||||
|
||||
return {
|
||||
tos: linksConfigs.tos,
|
||||
privacy: linksConfigs.privacy,
|
||||
statusPage: linksConfigs.statusPage,
|
||||
mintscan: linksConfigs.mintscan,
|
||||
mintscanBase: linksConfigs.mintscanBase,
|
||||
feedback: linksConfigs.feedback || FALLBACK_URL,
|
||||
|
||||
@ -4,7 +4,7 @@ import { useSelector } from 'react-redux';
|
||||
import { EvmDerivedAddresses } from '@/constants/account';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { LocalStorageKey } from '@/constants/localStorage';
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { ENVIRONMENT_CONFIG_MAP, WALLETS_CONFIG_MAP } from '@/constants/networks';
|
||||
|
||||
import {
|
||||
type DydxAddress,
|
||||
@ -32,7 +32,7 @@ import {
|
||||
WalletType as CosmosWalletType,
|
||||
} from 'graz';
|
||||
|
||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||
import { getSelectedDydxChainId } from '@/state/appSelectors';
|
||||
|
||||
import { resolveWagmiConnector } from '@/lib/wagmi';
|
||||
import { getWalletConnection, parseWalletError } from '@/lib/wallet';
|
||||
@ -91,8 +91,8 @@ export const useWalletConnection = () => {
|
||||
|
||||
// Wallet connection
|
||||
|
||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||
const walletConnectConfig = ENVIRONMENT_CONFIG_MAP[selectedNetwork].wallets.walletconnect;
|
||||
const selectedDydxChainId = useSelector(getSelectedDydxChainId);
|
||||
const walletConnectConfig = WALLETS_CONFIG_MAP[selectedDydxChainId].walletconnect;
|
||||
const wagmiConnector = useMemo(
|
||||
() =>
|
||||
walletType && walletConnectionType
|
||||
|
||||
@ -3,9 +3,9 @@ import styled, { type AnyStyledComponent, css } from 'styled-components';
|
||||
import { AbacusApiStatus } from '@/constants/abacus';
|
||||
import { ButtonSize, ButtonType } from '@/constants/buttons';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { ENVIRONMENT_CONFIG_MAP, isDev } from '@/constants/networks';
|
||||
import { isDev } from '@/constants/networks';
|
||||
|
||||
import { useApiState, useSelectedNetwork, useStringGetter } from '@/hooks';
|
||||
import { useApiState, useStringGetter, useURLConfigs } from '@/hooks';
|
||||
import { ChatIcon, LinkOutIcon } from '@/icons';
|
||||
|
||||
import { layoutMixins } from '@/styles/layoutMixins';
|
||||
@ -28,8 +28,7 @@ enum ExchangeStatus {
|
||||
export const FooterDesktop = () => {
|
||||
const stringGetter = useStringGetter();
|
||||
const { height, indexerHeight, status, statusErrorMessage } = useApiState();
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { statusPage } = ENVIRONMENT_CONFIG_MAP[selectedNetwork].links;
|
||||
const { statusPage } = useURLConfigs();
|
||||
|
||||
const { exchangeStatus, label } =
|
||||
!status || status === AbacusApiStatus.NORMAL
|
||||
|
||||
@ -34,7 +34,13 @@ import {
|
||||
import { DEFAULT_TRANSACTION_MEMO } from '@/constants/analytics';
|
||||
import { DialogTypes } from '@/constants/dialogs';
|
||||
import { UNCOMMITTED_ORDER_TIMEOUT_MS } from '@/constants/trade';
|
||||
import { ENVIRONMENT_CONFIG_MAP, DydxNetwork, isTestnet } from '@/constants/networks';
|
||||
import {
|
||||
ENVIRONMENT_CONFIG_MAP,
|
||||
DydxNetwork,
|
||||
isTestnet,
|
||||
LINKS_CONFIG_MAP,
|
||||
DydxChainId,
|
||||
} from '@/constants/networks';
|
||||
|
||||
import { RootStore } from '@/state/_store';
|
||||
import { addUncommittedOrderClientId, removeUncommittedOrderClientId } from '@/state/account';
|
||||
@ -238,9 +244,10 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
||||
|
||||
if (isTestnet) {
|
||||
console.log(
|
||||
`${ENVIRONMENT_CONFIG_MAP[
|
||||
this.compositeClient.network.getString() as DydxNetwork
|
||||
]?.links?.mintscan?.replace('{tx_hash}', hash.toString())}`
|
||||
`${LINKS_CONFIG_MAP[
|
||||
ENVIRONMENT_CONFIG_MAP[this.compositeClient.network.getString() as DydxNetwork]
|
||||
.dydxChainId as DydxChainId
|
||||
]?.mintscan?.replace('{tx_hash}', hash.toString())}`
|
||||
);
|
||||
} else console.log(`txHash: ${hash}`);
|
||||
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
import { DydxChainId, ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import type { RootState } from './_store';
|
||||
|
||||
export const getApiState = (state: RootState) => state.app.apiState;
|
||||
export const getSelectedNetwork = (state: RootState) => state.app.selectedNetwork;
|
||||
|
||||
export const getSelectedDydxChainId = (state: RootState) =>
|
||||
ENVIRONMENT_CONFIG_MAP[state.app.selectedNetwork].dydxChainId as DydxChainId;
|
||||
|
||||
@ -25,7 +25,7 @@ import { Switch } from '@/components/Switch';
|
||||
import { WithReceipt } from '@/components/WithReceipt';
|
||||
import { WithTooltip } from '@/components/WithTooltip';
|
||||
|
||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||
import { getSelectedNetwork, getSelectedDydxChainId } from '@/state/appSelectors';
|
||||
|
||||
import { track } from '@/lib/analytics';
|
||||
import { isTruthy } from '@/lib/isTruthy';
|
||||
@ -98,7 +98,8 @@ export const GenerateKeys = ({
|
||||
EvmDerivedAccountStatus.Derived,
|
||||
].includes(status);
|
||||
|
||||
const signTypedData = getSignTypedData(selectedNetwork);
|
||||
const selectedDydxChainId = useSelector(getSelectedDydxChainId);
|
||||
const signTypedData = getSignTypedData(selectedDydxChainId);
|
||||
const { signTypedDataAsync } = useSignTypedData({
|
||||
...signTypedData,
|
||||
domain: {
|
||||
|
||||
@ -10,7 +10,7 @@ import { TransferInputField, TransferInputTokenResource, TransferType } from '@/
|
||||
import { AlertType } from '@/constants/alerts';
|
||||
import { ButtonSize } from '@/constants/buttons';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { ENVIRONMENT_CONFIG_MAP, isMainnet } from '@/constants/networks';
|
||||
import { isMainnet } from '@/constants/networks';
|
||||
import { MAX_CCTP_TRANSFER_AMOUNT, MAX_PRICE_IMPACT, NumberSign } from '@/constants/numbers';
|
||||
import type { EvmAddress } from '@/constants/wallets';
|
||||
|
||||
@ -56,7 +56,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
const [error, setError] = useState<Error | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [requireUserActionInWallet, setRequireUserActionInWallet] = useState(false);
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
|
||||
const { evmAddress, signerWagmi, publicClientWagmi, nobleAddress } = useAccounts();
|
||||
|
||||
@ -262,9 +262,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
if (txHash) {
|
||||
addTransferNotification({
|
||||
txHash: txHash,
|
||||
toChainId: !isCctp
|
||||
? ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId
|
||||
: getNobleChainId(),
|
||||
toChainId: !isCctp ? selectedDydxChainId : getNobleChainId(),
|
||||
fromChainId: chainIdStr || undefined,
|
||||
toAmount: summary?.usdcSize || undefined,
|
||||
triggeredAt: Date.now(),
|
||||
|
||||
@ -9,7 +9,7 @@ import { TransferInputField, TransferInputTokenResource, TransferType } from '@/
|
||||
import { AlertType } from '@/constants/alerts';
|
||||
import { ButtonSize } from '@/constants/buttons';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { ENVIRONMENT_CONFIG_MAP, isMainnet } from '@/constants/networks';
|
||||
import { isMainnet } from '@/constants/networks';
|
||||
import { TransferNotificationTypes } from '@/constants/notifications';
|
||||
import { MAX_CCTP_TRANSFER_AMOUNT, MAX_PRICE_IMPACT, NumberSign } from '@/constants/numbers';
|
||||
|
||||
@ -54,7 +54,7 @@ export const WithdrawForm = () => {
|
||||
const stringGetter = useStringGetter();
|
||||
const [error, setError] = useState<string>();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
|
||||
const { sendSquidWithdraw } = useSubaccount();
|
||||
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
||||
@ -177,9 +177,7 @@ export const WithdrawForm = () => {
|
||||
addTransferNotification({
|
||||
txHash: txHash,
|
||||
type: TransferNotificationTypes.Withdrawal,
|
||||
fromChainId: !isCctp
|
||||
? ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId
|
||||
: getNobleChainId(),
|
||||
fromChainId: !isCctp ? selectedDydxChainId : getNobleChainId(),
|
||||
toChainId: chainIdStr || undefined,
|
||||
toAmount: debouncedAmountBN.toNumber(),
|
||||
triggeredAt: Date.now(),
|
||||
|
||||
@ -9,7 +9,6 @@ import { TransferInputField, TransferType } from '@/constants/abacus';
|
||||
import { AlertType } from '@/constants/alerts';
|
||||
import { ButtonShape, ButtonSize } from '@/constants/buttons';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { NumberSign } from '@/constants/numbers';
|
||||
import { DydxChainAsset } from '@/constants/wallets';
|
||||
|
||||
@ -63,7 +62,7 @@ export const TransferForm = ({
|
||||
const { dydxAddress } = useAccounts();
|
||||
const { transfer } = useSubaccount();
|
||||
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
const { tokensConfigs, usdcLabel, chainTokenLabel } = useTokenConfigs();
|
||||
|
||||
const {
|
||||
@ -239,7 +238,7 @@ export const TransferForm = ({
|
||||
|
||||
const networkOptions = [
|
||||
{
|
||||
chainId: ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId,
|
||||
chainId: selectedDydxChainId,
|
||||
label: (
|
||||
<Styled.InlineRow>
|
||||
<AssetIcon symbol="DYDX" /> {stringGetter({ key: STRING_KEYS.DYDX_CHAIN })}
|
||||
@ -322,7 +321,7 @@ export const TransferForm = ({
|
||||
/>
|
||||
<Styled.NetworkSelectMenu
|
||||
label={stringGetter({ key: STRING_KEYS.NETWORK })}
|
||||
value={ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId}
|
||||
value={selectedDydxChainId}
|
||||
slotTriggerAfter={null}
|
||||
>
|
||||
{networkOptions.map(({ chainId, label }) => (
|
||||
|
||||
@ -11,7 +11,6 @@ import { LoadingSpinner } from '@/components/Loading/LoadingSpinner';
|
||||
|
||||
import { layoutMixins } from '@/styles/layoutMixins';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { TransferNotificationTypes } from '@/constants/notifications';
|
||||
|
||||
type ElementProps = {
|
||||
@ -32,9 +31,8 @@ enum TransferStatusStep {
|
||||
|
||||
export const TransferStatusSteps = ({ className, status, type }: ElementProps & StyleProps) => {
|
||||
const stringGetter = useStringGetter();
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { selectedDydxChainId } = useSelectedNetwork();
|
||||
const { mintscan: mintscanTxUrl } = useURLConfigs();
|
||||
const dydxChainId = ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId;
|
||||
|
||||
const { currentStep, steps } = useMemo(() => {
|
||||
const routeStatus = status?.routeStatus;
|
||||
@ -55,7 +53,7 @@ export const TransferStatusSteps = ({ className, status, type }: ElementProps &
|
||||
link:
|
||||
type === TransferNotificationTypes.Deposit
|
||||
? status?.fromChain?.transactionUrl
|
||||
: routeStatus?.[0]?.chainId === dydxChainId && routeStatus[0].txHash
|
||||
: routeStatus?.[0]?.chainId === selectedDydxChainId && routeStatus[0].txHash
|
||||
? `${mintscanTxUrl?.replace('{tx_hash}', routeStatus[0].txHash.replace('0x', ''))}`
|
||||
: undefined,
|
||||
},
|
||||
@ -81,7 +79,7 @@ export const TransferStatusSteps = ({ className, status, type }: ElementProps &
|
||||
link:
|
||||
type === TransferNotificationTypes.Withdrawal
|
||||
? status?.toChain?.transactionUrl
|
||||
: currentStatus?.chainId === dydxChainId && currentStatus?.txHash
|
||||
: currentStatus?.chainId === selectedDydxChainId && currentStatus?.txHash
|
||||
? `${mintscanTxUrl?.replace('{tx_hash}', currentStatus.txHash.replace('0x', ''))}`
|
||||
: undefined,
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user