Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
238b5456b7 | ||
|
|
74961b8da5 | ||
|
|
92481e29fc | ||
|
|
c92f218493 | ||
|
|
b09fe9ebb1 | ||
|
|
1c28505ec0 | ||
|
|
5531e21c76 |
+21
-11
@@ -1,12 +1,22 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"chainId": "1",
|
"chainId": "1",
|
||||||
"tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
"tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
||||||
"name": "Ethereum"
|
"name": "Ethereum"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"chainId": "5",
|
"chainId": "5",
|
||||||
"tokenAddress": "0x07865c6E87B9F70255377e024ace6630C1Eaa37F",
|
"tokenAddress": "0x07865c6E87B9F70255377e024ace6630C1Eaa37F",
|
||||||
"name": "Ethereum Goerli"
|
"name": "Ethereum Goerli"
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"chainId": "43114",
|
||||||
|
"tokenAddress": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
||||||
|
"name": "Avalanche"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"chainId": "10",
|
||||||
|
"tokenAddress": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
||||||
|
"name": "optimism"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@@ -33,4 +33,9 @@ TagStory.argTypes = {
|
|||||||
control: { type: 'select' },
|
control: { type: 'select' },
|
||||||
defaultValue: undefined,
|
defaultValue: undefined,
|
||||||
},
|
},
|
||||||
|
isHighlighted: {
|
||||||
|
options: [true, false],
|
||||||
|
control: { type: 'select' },
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,5 +76,6 @@ export const Tag = styled.span<StyleProps>`
|
|||||||
isHighlighted &&
|
isHighlighted &&
|
||||||
css`
|
css`
|
||||||
background-color: var(--color-accent);
|
background-color: var(--color-accent);
|
||||||
|
color: var(--color-text-button);
|
||||||
`}
|
`}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -22,4 +22,5 @@ export enum NumberSign {
|
|||||||
|
|
||||||
// Deposit/Withdraw
|
// Deposit/Withdraw
|
||||||
export const MAX_CCTP_TRANSFER_AMOUNT = 1_000_000;
|
export const MAX_CCTP_TRANSFER_AMOUNT = 1_000_000;
|
||||||
|
export const MIN_CCTP_TRANSFER_AMOUNT = 10;
|
||||||
export const MAX_PRICE_IMPACT = 0.02; // 2%
|
export const MAX_PRICE_IMPACT = 0.02; // 2%
|
||||||
|
|||||||
@@ -27,19 +27,26 @@ export const useChartMarketAndResolution = ({
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const currentMarketId: string = useSelector(getCurrentMarketId) || DEFAULT_MARKETID;
|
const currentMarketId: string = useSelector(getCurrentMarketId) || DEFAULT_MARKETID;
|
||||||
|
|
||||||
const selectedResolution: string =
|
const selectedResolution: string =
|
||||||
useSelector(getSelectedResolutionForMarket(currentMarketId)) || DEFAULT_RESOLUTION;
|
useSelector(getSelectedResolutionForMarket(currentMarketId)) || DEFAULT_RESOLUTION;
|
||||||
|
|
||||||
const chart = isWidgetReady ? tvWidget?.chart() : undefined;
|
const chart = isWidgetReady ? tvWidget?.chart() : undefined;
|
||||||
const chartResolution = chart?.resolution?.();
|
const chartResolution = chart?.resolution?.();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Hook to handle changing markets - intentionally should avoid triggering on change of resolutions.
|
||||||
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (currentMarketId && isWidgetReady) {
|
if (currentMarketId && isWidgetReady) {
|
||||||
const resolution = savedResolution || selectedResolution;
|
const resolution = savedResolution || selectedResolution;
|
||||||
tvWidget?.setSymbol(currentMarketId, resolution as ResolutionString, () => {});
|
tvWidget?.setSymbol(currentMarketId, resolution as ResolutionString, () => {});
|
||||||
}
|
}
|
||||||
}, [currentMarketId, isWidgetReady, savedResolution, selectedResolution]);
|
}, [currentMarketId, isWidgetReady]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Hook to handle changing chart resolution
|
||||||
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (chartResolution) {
|
if (chartResolution) {
|
||||||
if (chartResolution !== selectedResolution) {
|
if (chartResolution !== selectedResolution) {
|
||||||
|
|||||||
+3
-3
@@ -31,13 +31,13 @@ export const fetchSquidStatus = async (
|
|||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
"x-integrator-id": integratorId || 'dYdX-api'
|
'x-integrator-id': integratorId || 'dYdX-api',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const error = await response.json();
|
const error = await response.json();
|
||||||
throw new Error(error);
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
@@ -45,4 +45,4 @@ export const fetchSquidStatus = async (
|
|||||||
|
|
||||||
export const getNobleChainId = () => {
|
export const getNobleChainId = () => {
|
||||||
return isMainnet ? 'noble-1' : 'grand-1';
|
return isMainnet ? 'noble-1' : 'grand-1';
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -11,7 +11,12 @@ import { ButtonSize } from '@/constants/buttons';
|
|||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { isMainnet } from '@/constants/networks';
|
import { isMainnet } from '@/constants/networks';
|
||||||
import { TransferNotificationTypes } from '@/constants/notifications';
|
import { TransferNotificationTypes } from '@/constants/notifications';
|
||||||
import { MAX_CCTP_TRANSFER_AMOUNT, MAX_PRICE_IMPACT, NumberSign } from '@/constants/numbers';
|
import {
|
||||||
|
MAX_CCTP_TRANSFER_AMOUNT,
|
||||||
|
MAX_PRICE_IMPACT,
|
||||||
|
MIN_CCTP_TRANSFER_AMOUNT,
|
||||||
|
NumberSign,
|
||||||
|
} from '@/constants/numbers';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useAccounts,
|
useAccounts,
|
||||||
@@ -328,6 +333,12 @@ export const WithdrawForm = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
!debouncedAmountBN.isZero() &&
|
||||||
|
MustBigNumber(debouncedAmountBN).lte(MIN_CCTP_TRANSFER_AMOUNT)
|
||||||
|
) {
|
||||||
|
return 'Amount must be greater than 10 USDC';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMainnet && MustBigNumber(summary?.aggregatePriceImpact).gte(MAX_PRICE_IMPACT)) {
|
if (isMainnet && MustBigNumber(summary?.aggregatePriceImpact).gte(MAX_PRICE_IMPACT)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user