chain -> chaintoken
This commit is contained in:
parent
ab04f262ab
commit
eceaea5235
@ -63,7 +63,7 @@ const Content = () => {
|
||||
const { isTablet, isNotTablet } = useBreakpoints();
|
||||
const isShowingHeader = isNotTablet;
|
||||
const isShowingFooter = useShouldShowFooter();
|
||||
const { chainLabel } = useTokenConfigs();
|
||||
const { chainTokenLabel } = useTokenConfigs();
|
||||
|
||||
return (
|
||||
<Styled.Content isShowingHeader={isShowingHeader} isShowingFooter={isShowingFooter}>
|
||||
@ -78,7 +78,7 @@ const Content = () => {
|
||||
</Route>
|
||||
|
||||
<Route path={AppRoute.Markets} element={<MarketsPage />} />
|
||||
<Route path={`/${chainLabel}`} element={<RewardsPage />} />
|
||||
<Route path={`/${chainTokenLabel}`} element={<RewardsPage />} />
|
||||
{isTablet && (
|
||||
<>
|
||||
<Route path={AppRoute.Alerts} element={<AlertsPage />} />
|
||||
|
||||
@ -352,5 +352,5 @@ export const DYDX_CHAIN_INFO: Parameters<typeof suggestChain>[0] = {
|
||||
// TODO: export this type from abacus instead
|
||||
export enum DydxChainAsset {
|
||||
USDC = 'usdc',
|
||||
CHAIN = 'chain',
|
||||
CHAINTOKEN = 'chain',
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ export const useAccountBalance = ({
|
||||
|
||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||
const balances = useSelector(getBalances, shallowEqual);
|
||||
const { chainDenom, usdcDenom } = useTokenConfigs();
|
||||
const { chainTokenDenom, usdcDenom } = useTokenConfigs();
|
||||
const evmChainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
||||
const stakingBalances = useSelector(getStakingBalances, shallowEqual);
|
||||
|
||||
@ -93,7 +93,7 @@ export const useAccountBalance = ({
|
||||
const { formatted: evmBalance } = evmQuery.data || {};
|
||||
const balance = !assetSymbol ? '0' : isCosmosChain ? cosmosQuery.data : evmBalance;
|
||||
|
||||
const nativeTokenCoinBalance = balances?.[chainDenom];
|
||||
const nativeTokenCoinBalance = balances?.[chainTokenDenom];
|
||||
const nativeTokenBalance = MustBigNumber(nativeTokenCoinBalance?.amount)
|
||||
.div(QUANTUM_MULTIPLIER)
|
||||
.toNumber();
|
||||
@ -101,7 +101,7 @@ export const useAccountBalance = ({
|
||||
const usdcCoinBalance = balances?.[usdcDenom];
|
||||
const usdcBalance = MustBigNumber(usdcCoinBalance?.amount).div(QUANTUM_MULTIPLIER).toNumber();
|
||||
|
||||
const nativeStakingCoinBalanace = stakingBalances?.[chainDenom];
|
||||
const nativeStakingCoinBalanace = stakingBalances?.[chainTokenDenom];
|
||||
const nativeStakingBalance = MustBigNumber(nativeStakingCoinBalanace?.amount)
|
||||
.div(QUANTUM_MULTIPLIER)
|
||||
.toNumber();
|
||||
|
||||
@ -5,12 +5,12 @@ import { useSelectedNetwork } from '@/hooks';
|
||||
|
||||
export const useTokenConfigs = (): {
|
||||
tokensConfigs: {
|
||||
['usdc']: {
|
||||
[DydxChainAsset.USDC]: {
|
||||
denom: string;
|
||||
name: string;
|
||||
decimals: number;
|
||||
},
|
||||
['chain']: {
|
||||
[DydxChainAsset.CHAINTOKEN]: {
|
||||
denom: string;
|
||||
name: string;
|
||||
decimals: number;
|
||||
@ -18,8 +18,8 @@ export const useTokenConfigs = (): {
|
||||
};
|
||||
usdcDenom: string;
|
||||
usdcLabel: string;
|
||||
chainDenom: string;
|
||||
chainLabel: string;
|
||||
chainTokenDenom: string;
|
||||
chainTokenLabel: string;
|
||||
} => {
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const tokensConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].tokens;
|
||||
@ -28,7 +28,7 @@ export const useTokenConfigs = (): {
|
||||
tokensConfigs,
|
||||
usdcDenom: tokensConfigs[DydxChainAsset.USDC].denom,
|
||||
usdcLabel: tokensConfigs[DydxChainAsset.USDC].name,
|
||||
chainDenom: tokensConfigs[DydxChainAsset.CHAIN].denom,
|
||||
chainLabel: tokensConfigs[DydxChainAsset.CHAIN].name,
|
||||
chainTokenDenom: tokensConfigs[DydxChainAsset.CHAINTOKEN].denom,
|
||||
chainTokenLabel: tokensConfigs[DydxChainAsset.CHAINTOKEN].name,
|
||||
};
|
||||
};
|
||||
|
||||
@ -28,7 +28,7 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
||||
export const HeaderDesktop = () => {
|
||||
const stringGetter = useStringGetter();
|
||||
const dispatch = useDispatch();
|
||||
const { chainLabel } = useTokenConfigs();
|
||||
const { chainTokenLabel } = useTokenConfigs();
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
@ -45,9 +45,9 @@ export const HeaderDesktop = () => {
|
||||
href: AppRoute.Trade,
|
||||
},
|
||||
{
|
||||
value: chainLabel,
|
||||
label: chainLabel,
|
||||
href: `/${chainLabel}`,
|
||||
value: chainTokenLabel,
|
||||
label: chainTokenLabel,
|
||||
href: `/${chainTokenLabel}`,
|
||||
},
|
||||
{
|
||||
value: 'PORTFOLIO',
|
||||
|
||||
@ -30,7 +30,7 @@ export const DYDXBalancePanel = () => {
|
||||
const { walletType } = useAccounts();
|
||||
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
||||
const { nativeTokenBalance, nativeStakingBalance } = useAccountBalance();
|
||||
const { chainLabel } = useTokenConfigs();
|
||||
const { chainTokenLabel } = useTokenConfigs();
|
||||
|
||||
return (
|
||||
<Panel
|
||||
@ -38,7 +38,7 @@ export const DYDXBalancePanel = () => {
|
||||
<Styled.Header>
|
||||
<Styled.Title>
|
||||
{/* <AssetIcon symbol="DYDX" /> */}
|
||||
{chainLabel}
|
||||
{chainTokenLabel}
|
||||
</Styled.Title>
|
||||
<Styled.ReceiveAndTransferButtons>
|
||||
{!canAccountTrade ? (
|
||||
@ -111,7 +111,7 @@ export const DYDXBalancePanel = () => {
|
||||
<Output
|
||||
type={OutputType.Asset}
|
||||
value={nativeTokenBalance + nativeStakingBalance}
|
||||
tag={chainLabel}
|
||||
tag={chainTokenLabel}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
||||
@ -24,10 +24,10 @@ type ElementProps = {
|
||||
setIsOpen: (open: boolean) => void;
|
||||
};
|
||||
|
||||
export const ReceiveDialog = ({ selectedAsset = DydxChainAsset.CHAIN, setIsOpen }: ElementProps) => {
|
||||
export const ReceiveDialog = ({ selectedAsset = DydxChainAsset.CHAINTOKEN, setIsOpen }: ElementProps) => {
|
||||
const stringGetter = useStringGetter();
|
||||
const { dydxAddress } = useAccounts();
|
||||
const { chainLabel, usdcLabel } = useTokenConfigs();
|
||||
const { chainTokenLabel, usdcLabel } = useTokenConfigs();
|
||||
|
||||
const [asset, setAsset] = useState(selectedAsset);
|
||||
|
||||
@ -41,11 +41,11 @@ export const ReceiveDialog = ({ selectedAsset = DydxChainAsset.CHAIN, setIsOpen
|
||||
),
|
||||
},
|
||||
{
|
||||
value: DydxChainAsset.CHAIN,
|
||||
value: DydxChainAsset.CHAINTOKEN,
|
||||
label: (
|
||||
<Styled.InlineRow>
|
||||
{/* <AssetIcon symbol="DYDX" /> */}
|
||||
{chainLabel}
|
||||
{chainTokenLabel}
|
||||
</Styled.InlineRow>
|
||||
),
|
||||
},
|
||||
|
||||
@ -54,7 +54,7 @@ type TransferFormProps = {
|
||||
};
|
||||
|
||||
export const TransferForm = ({
|
||||
selectedAsset = DydxChainAsset.CHAIN,
|
||||
selectedAsset = DydxChainAsset.CHAINTOKEN,
|
||||
onDone,
|
||||
className,
|
||||
}: TransferFormProps) => {
|
||||
@ -69,7 +69,7 @@ export const TransferForm = ({
|
||||
const { transfer } = useSubaccount();
|
||||
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
||||
const { selectedNetwork } = useSelectedNetwork();
|
||||
const { tokensConfigs, usdcLabel, chainLabel } = useTokenConfigs();
|
||||
const { tokensConfigs, usdcLabel, chainTokenLabel } = useTokenConfigs();
|
||||
|
||||
// User Input
|
||||
const [asset, setAsset] = useState<DydxChainAsset>(selectedAsset);
|
||||
@ -136,7 +136,7 @@ export const TransferForm = ({
|
||||
try {
|
||||
// Subtract fees from amount if sending native tokens
|
||||
const amountToTransfer = (
|
||||
asset === DydxChainAsset.CHAIN ? amountBN.minus(fee) : amountBN
|
||||
asset === DydxChainAsset.CHAINTOKEN ? amountBN.minus(fee) : amountBN
|
||||
).toNumber();
|
||||
|
||||
const screenResults = await screenAddresses({
|
||||
@ -223,11 +223,11 @@ export const TransferForm = ({
|
||||
),
|
||||
},
|
||||
{
|
||||
value: DydxChainAsset.CHAIN,
|
||||
value: DydxChainAsset.CHAINTOKEN,
|
||||
label: (
|
||||
<Styled.InlineRow>
|
||||
{/* <AssetIcon symbol="DYDX" /> */}
|
||||
{chainLabel}
|
||||
{chainTokenLabel}
|
||||
</Styled.InlineRow>
|
||||
),
|
||||
},
|
||||
|
||||
@ -24,7 +24,6 @@ import { DropdownMenu } from '@/components/DropdownMenu';
|
||||
import { Output, OutputType } from '@/components/Output';
|
||||
import { Icon, IconName } from '@/components/Icon';
|
||||
import { IconButton } from '@/components/IconButton';
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { WithTooltip } from '@/components/WithTooltip';
|
||||
|
||||
import { openDialog } from '@/state/dialogs';
|
||||
@ -46,7 +45,7 @@ export const AccountMenu = () => {
|
||||
const onboardingState = useSelector(getOnboardingState);
|
||||
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
||||
const { nativeTokenBalance } = useAccountBalance();
|
||||
const { usdcLabel, chainLabel } = useTokenConfigs();
|
||||
const { usdcLabel, chainTokenLabel } = useTokenConfigs();
|
||||
|
||||
const { evmAddress, walletType, dydxAddress, hdKey } = useAccounts();
|
||||
|
||||
@ -117,13 +116,13 @@ export const AccountMenu = () => {
|
||||
<Styled.label>
|
||||
{stringGetter({
|
||||
key: STRING_KEYS.ASSET_BALANCE,
|
||||
params: { ASSET: chainLabel },
|
||||
params: { ASSET: chainTokenLabel },
|
||||
})}
|
||||
{/* <AssetIcon symbol="DYDX" /> */}
|
||||
</Styled.label>
|
||||
<Styled.BalanceOutput type={OutputType.Asset} value={nativeTokenBalance} />
|
||||
</div>
|
||||
<AssetActions asset={DydxChainAsset.CHAIN} dispatch={dispatch} />
|
||||
<AssetActions asset={DydxChainAsset.CHAINTOKEN} dispatch={dispatch} />
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user