diff --git a/src/api/accountBalances.ts b/src/api/accountBalances.ts index 59cfc181..d12549f7 100644 --- a/src/api/accountBalances.ts +++ b/src/api/accountBalances.ts @@ -4,8 +4,12 @@ import { useQuery } from "@tanstack/react-query" import { QUERY_KEYS } from "utils/queryKeys" import { ApiPromise } from "@polkadot/api" import { Maybe, undefinedNoop } from "utils/helpers" -import { u32 } from "@polkadot/types" +import { u32, u128 } from "@polkadot/types" +import { PalletBalancesAccountData } from "@polkadot/types/lookup" import { BN } from "@polkadot/util" +interface PalletBalancesAccountDataCustom extends PalletBalancesAccountData { + frozen: u128 +} export const useAccountBalances = (id: Maybe) => { const api = useApiPromise() @@ -65,10 +69,14 @@ const getTokenAccountBalancesList = const [, assetId] = pairs[idx] if (assetId.toString() === NATIVE_ASSET_ID) { - let {data} = natives[nativeIdx] - const frozen = data.feeFrozen ? data.feeFrozen.add( - data.miscFrozen, - ) : data.frozen + //@ts-ignore + let { data }: { data: PalletBalancesAccountDataCustom } = + natives[nativeIdx] + + const frozen = data.feeFrozen + ? data.feeFrozen.add(data.miscFrozen) + : data.frozen + values.push({ free: data.free, reserved: data.reserved, diff --git a/src/api/balances.ts b/src/api/balances.ts index 6e60d5e2..791448a1 100644 --- a/src/api/balances.ts +++ b/src/api/balances.ts @@ -14,10 +14,18 @@ export const getTokenBalance = (api: ApiPromise, account: AccountId32 | string, id: string | u32) => async () => { if (id.toString() === NATIVE_ASSET_ID) { - const res = await api.query.system.account(account) + const res = (await api.query.system.account(account)) as any const freeBalance = new BigNumber(res.data.free.toHex()) - const miscFrozenBalance = new BigNumber(res.data.miscFrozen ? res.data.miscFrozen.toHex() : res.data.frozen.toHex()) - const feeFrozenBalance = new BigNumber(res.data.feeFrozen ? res.data.feeFrozen.toHex() : res.data.frozen.toHex()) + const miscFrozenBalance = new BigNumber( + res.data.miscFrozen + ? res.data.miscFrozen.toHex() + : res.data.frozen.toHex(), + ) + const feeFrozenBalance = new BigNumber( + res.data.feeFrozen + ? res.data.feeFrozen.toHex() + : res.data.frozen.toHex(), + ) const reservedBalance = new BigNumber(res.data.reserved.toHex()) const balance = new BigNumber( diff --git a/src/api/farms.ts b/src/api/farms.ts index c8ceac72..7d900c19 100644 --- a/src/api/farms.ts +++ b/src/api/farms.ts @@ -221,7 +221,7 @@ export const getGlobalFarm = (api: ApiPromise, id: u32) => async () => { } export interface FarmIds { - poolId: AccountId32 + poolId: AccountId32 | string globalFarmId: u32 yieldFarmId: u32 } diff --git a/src/i18n/locales/en/translations.json b/src/i18n/locales/en/translations.json index d1151dfa..d9f366c1 100644 --- a/src/i18n/locales/en/translations.json +++ b/src/i18n/locales/en/translations.json @@ -364,7 +364,7 @@ "fund.modal.crypto.buy": "Use cross-chain", "fund.button": "Fund wallet", "depeg.modal.title": "Important Notice", - "depeg.modal.desx": "Tether have dropped support for native USDT on Kusama - herefore USDT pools are currently not priced at $1", + "depeg.modal.desx": "Tether have dropped support for native USDT on Kusama - thefore USDT pools are currently not priced at $1", "depeg.modal.desx.crossChain": "Cross chain transfers in Kusama are temporarily suspended, please do not try to send tokens", "depeg.modal.icon": "More info" } diff --git a/src/sections/pools/pool/modals/myPositions/MyPositionsList.tsx b/src/sections/pools/pool/modals/myPositions/MyPositionsList.tsx index 86b4f74b..67368585 100644 --- a/src/sections/pools/pool/modals/myPositions/MyPositionsList.tsx +++ b/src/sections/pools/pool/modals/myPositions/MyPositionsList.tsx @@ -27,6 +27,6 @@ export const MyPositionsList = ({ pool, onClose }: Props) => { onClose={onClose} /> )) - }, [depositNftList, pool]) + }, [depositNftList, onClose, pool]) return
{positionsList}
} diff --git a/src/sections/wallet/assets/table/data/WalletAssetsTableData.utils.ts b/src/sections/wallet/assets/table/data/WalletAssetsTableData.utils.ts index 0f6a24f0..8906ac4e 100644 --- a/src/sections/wallet/assets/table/data/WalletAssetsTableData.utils.ts +++ b/src/sections/wallet/assets/table/data/WalletAssetsTableData.utils.ts @@ -278,8 +278,16 @@ const getNativeBalances = ( const dp = BN_10.pow(decimals) const free = balance.free.toBigNumber() const reservedBN = balance.reserved.toBigNumber() - const feeFrozen = balance.feeFrozen ? balance.feeFrozen.toBigNumber() : balance.frozen.toBigNumber() - const miscFrozen = balance.miscFrozen ? balance.miscFrozen.toBigNumber() : balance.frozen.toBigNumber() + + const feeFrozen = balance.feeFrozen + ? balance.feeFrozen.toBigNumber() + : //@ts-ignore + balance.frozen.toBigNumber() + + const miscFrozen = balance.miscFrozen + ? balance.miscFrozen.toBigNumber() + : //@ts-ignore + balance.frozen.toBigNumber() const total = free.plus(reservedBN).div(dp) const totalUSD = total.times(spotPrice) diff --git a/src/utils/farms/apr.ts b/src/utils/farms/apr.ts index d2ed95b5..9687eb36 100644 --- a/src/utils/farms/apr.ts +++ b/src/utils/farms/apr.ts @@ -71,7 +71,7 @@ export const useAPR = (poolId: AccountId32 | string) => { // all of the APR calculations are using only half of the position - // this is correct in terms of inputs but for the user, // they are not depositing only half of the position, they are depositing 2 assets - apr = globalFarm.id.toString() === '5'? BN_0: apr.div(2) + apr = globalFarm.id.toString() === "5" ? BN_0 : apr.div(2) const minApr = apr.times(loyaltyFactor) // max distribution of rewards diff --git a/src/utils/farms/positions.ts b/src/utils/farms/positions.ts index bf41a102..752d41b4 100644 --- a/src/utils/farms/positions.ts +++ b/src/utils/farms/positions.ts @@ -22,12 +22,14 @@ export const useTotalInPositions = () => { ({ position: { yieldFarmId, globalFarmId }, poolId }) => ({ yieldFarmId: yieldFarmId, globalFarmId: globalFarmId, - poolId, + poolId: poolId.toString(), }), ) ?? [], ) const shareTokens = usePoolShareTokens( - deposits.data?.deposits?.map(({ deposit }) => deposit.ammPoolId) ?? [], + deposits.data?.deposits?.map(({ deposit }) => + deposit.ammPoolId.toString(), + ) ?? [], ) const totalIssuances = useTotalIssuances( shareTokens.map((st) => st.data?.token),