Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63f1b26852 | ||
|
|
9e28657c5f | ||
|
|
54db166862 | ||
|
|
0e29a67a9f | ||
|
|
fe46a4d927 |
+1
-1
@@ -39,7 +39,7 @@
|
||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||
"@dydxprotocol/v4-abacus": "^0.5.4",
|
||||
"@dydxprotocol/v4-client-js": "^0.36.1",
|
||||
"@dydxprotocol/v4-localization": "^0.1.11",
|
||||
"@dydxprotocol/v4-localization": "^0.1.12",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
"@js-joda/core": "^5.5.3",
|
||||
"@radix-ui/react-collapsible": "^1.0.3",
|
||||
|
||||
Generated
+4
-4
@@ -33,8 +33,8 @@ dependencies:
|
||||
specifier: ^0.36.1
|
||||
version: 0.36.1
|
||||
'@dydxprotocol/v4-localization':
|
||||
specifier: ^0.1.11
|
||||
version: 0.1.11
|
||||
specifier: ^0.1.12
|
||||
version: 0.1.12
|
||||
'@ethersproject/providers':
|
||||
specifier: ^5.7.2
|
||||
version: 5.7.2
|
||||
@@ -1010,8 +1010,8 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@dydxprotocol/v4-localization@0.1.11:
|
||||
resolution: {integrity: sha512-eW88t8KJuDT0fNEgaw615+n3gEYxDZYPeHhdBYquVDXjnkhLNznaH8ftmlLPVPyfu7o5aFeU/cw8ZiqRrf/Stw==}
|
||||
/@dydxprotocol/v4-localization@0.1.12:
|
||||
resolution: {integrity: sha512-EiP/8+6Nk9QBa6YSWsyzsZaXoVbz5o/KgUlMp1Cew6VWkXL6DkQY0oMIEEy21pv0zuu/woxhlbyXygpUIcpdMg==}
|
||||
dev: false
|
||||
|
||||
/@dydxprotocol/v4-proto@0.2.1:
|
||||
|
||||
@@ -94,6 +94,10 @@ export const tradeTooltips: TooltipStrings = {
|
||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAINTENANCE_MARGIN_FRACTION_TITLE }),
|
||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAINTENANCE_MARGIN_FRACTION_BODY }),
|
||||
}),
|
||||
'max-reward': ({ stringGetter }) => ({
|
||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_TITLE }),
|
||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_BODY }),
|
||||
}),
|
||||
'max-withdraw': ({ stringGetter }) => ({
|
||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_TITLE }),
|
||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_BODY }),
|
||||
|
||||
@@ -37,10 +37,10 @@ type UseAccountBalanceProps = {
|
||||
* 0xSquid uses this 0x address as the chain's default token.
|
||||
* @todo We will need to add additional logic here if we 'useAccountBalance' on non-Squid related forms.
|
||||
*/
|
||||
const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||
export const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||
|
||||
export const useAccountBalance = ({
|
||||
addressOrDenom = CHAIN_DEFAULT_TOKEN_ADDRESS,
|
||||
addressOrDenom,
|
||||
assetSymbol,
|
||||
bech32AddrPrefix,
|
||||
chainId,
|
||||
|
||||
@@ -403,6 +403,22 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
||||
const parsedAccountBalances = this.parseToPrimitives(accountBalances);
|
||||
callback(JSON.stringify(parsedAccountBalances));
|
||||
break;
|
||||
case QueryType.RewardsParams:
|
||||
const rewardsParams = await this.compositeClient?.validatorClient.get.getRewardsParams();
|
||||
const parsedRewardsParams = this.parseToPrimitives(rewardsParams);
|
||||
callback(JSON.stringify(parsedRewardsParams));
|
||||
break;
|
||||
case QueryType.GetMarketPrice:
|
||||
const price = await this.compositeClient?.validatorClient.get.getPrice(params.marketId);
|
||||
const parsedPrice = this.parseToPrimitives(price);
|
||||
callback(JSON.stringify(parsedPrice));
|
||||
break;
|
||||
case QueryType.GetDelegations:
|
||||
const delegations =
|
||||
await this.compositeClient?.validatorClient.get.getDelegatorDelegations(params.address);
|
||||
const parseDelegations = this.parseToPrimitives(delegations);
|
||||
callback(JSON.stringify(parseDelegations));
|
||||
break;
|
||||
// Do not implement Transfers (yet)
|
||||
case QueryType.Transfers:
|
||||
default:
|
||||
|
||||
@@ -14,7 +14,7 @@ import { NumberSign } from '@/constants/numbers';
|
||||
import type { EvmAddress } from '@/constants/wallets';
|
||||
|
||||
import { useAccounts, useDebounce, useStringGetter } from '@/hooks';
|
||||
import { useAccountBalance } from '@/hooks/useAccountBalance';
|
||||
import { useAccountBalance, CHAIN_DEFAULT_TOKEN_ADDRESS } from '@/hooks/useAccountBalance';
|
||||
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
||||
import { NATIVE_TOKEN_ADDRESS, useSquid } from '@/hooks/useSquid';
|
||||
import { useWalletConnection } from '@/hooks/useWalletConnection';
|
||||
@@ -86,7 +86,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
||||
|
||||
// Async Data
|
||||
const { balance, queryStatus, isQueryFetching } = useAccountBalance({
|
||||
addressOrDenom: sourceToken?.address || undefined,
|
||||
addressOrDenom: sourceToken?.address || CHAIN_DEFAULT_TOKEN_ADDRESS,
|
||||
assetSymbol: sourceToken?.symbol || undefined,
|
||||
chainId: chainId,
|
||||
decimals: sourceToken?.decimals || undefined,
|
||||
|
||||
@@ -9,6 +9,7 @@ import { TRADE_TYPE_STRINGS, MobilePlaceOrderSteps } from '@/constants/trade';
|
||||
|
||||
import { useStringGetter } from '@/hooks';
|
||||
|
||||
import { AssetIcon } from '@/components/AssetIcon';
|
||||
import { Button } from '@/components/Button';
|
||||
import { Output, OutputType, ShowSign } from '@/components/Output';
|
||||
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
||||
@@ -62,7 +63,7 @@ export const PlaceOrderButtonAndReceipt = ({
|
||||
const selectedTradeType = getSelectedTradeType(type);
|
||||
const selectedOrderSide = getSelectedOrderSide(side);
|
||||
|
||||
const { fee, price: expectedPrice, total } = summary || {};
|
||||
const { fee, price: expectedPrice, total, reward } = summary || {};
|
||||
|
||||
const items = [
|
||||
{
|
||||
@@ -79,6 +80,17 @@ export const PlaceOrderButtonAndReceipt = ({
|
||||
label: stringGetter({ key: STRING_KEYS.FEE }),
|
||||
value: <Output type={OutputType.Fiat} value={fee} useGrouping />,
|
||||
},
|
||||
{
|
||||
key: 'max-reward',
|
||||
label: (
|
||||
<>
|
||||
{stringGetter({ key: STRING_KEYS.MAXIMUM_REWARDS })}
|
||||
{/* <AssetIcon symbol="DYDX" /> */}
|
||||
</>
|
||||
),
|
||||
value: <Output type={OutputType.Asset} value={reward} useGrouping tag={reward ? "Dv4TNT" : ''} />,
|
||||
tooltip: 'max-reward',
|
||||
},
|
||||
{
|
||||
key: 'total',
|
||||
label: stringGetter({ key: STRING_KEYS.TOTAL }),
|
||||
|
||||
Reference in New Issue
Block a user