From f1ff3e88d4470430e9a3d928ded1a3a8d41d0825 Mon Sep 17 00:00:00 2001 From: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:44:55 +0100 Subject: [PATCH] Mp 2267 rewrite mutations (#137) * remove react-query * :heavy_minus_sign: remove unused packages --- package.json | 4 - src/components/Account/RiskChart.tsx | 5 +- .../Navigation/DesktopNavigation.tsx | 2 +- src/components/Settings.tsx | 2 +- src/hooks/data/useAccountStats.tsx | 255 ------ .../data/useCalculateMaxBorrowAmount.tsx | 104 --- src/hooks/data/useCalculateMaxTradeAmount.tsx | 145 ---- .../data/useCalculateMaxWithdrawAmount.tsx | 137 ---- src/hooks/mutations/useBorrowFunds.tsx | 68 -- src/hooks/mutations/useRepayFunds.tsx | 63 -- src/hooks/mutations/useTradeAsset.tsx | 79 -- src/hooks/mutations/useWithdrawFunds.tsx | 68 -- src/hooks/queries/useAllBalances.tsx | 48 -- src/hooks/queries/useAllowedCoins.tsx | 30 - src/hooks/queries/useBroadcast.tsx | 49 -- .../queries/useCreditAccountPositions.tsx | 55 -- src/hooks/queries/useCreditAccounts.tsx | 53 -- src/hooks/queries/useEstimateFee.tsx | 53 -- src/hooks/queries/useMarkets.tsx | 91 --- src/hooks/queries/useRedbankBalances.tsx | 47 -- src/hooks/queries/useTokenPrices.tsx | 60 -- src/hooks/{data => }/useAnimations.tsx | 0 src/hooks/{useParams.ts => useParams.tsx} | 0 .../MarsAccountNft.react-query.ts | 574 -------------- .../MarsCreditManager.react-query.ts | 724 ----------------- .../MarsMockCreditManager.react-query.ts | 659 ---------------- .../MarsMockOracle.react-query.ts | 85 -- .../MarsMockRedBank.react-query.ts | 735 ------------------ .../MarsMockVault.react-query.ts | 302 ------- .../MarsRoverHealthComputer.react-query.ts | 33 - .../MarsRoverHealthTypes.react-query.ts | 128 --- .../MarsSwapperBase.react-query.ts | 235 ------ .../MarsZapperBase.react-query.ts | 172 ---- yarn.lock | 189 +++-- 34 files changed, 92 insertions(+), 5162 deletions(-) delete mode 100644 src/hooks/data/useAccountStats.tsx delete mode 100644 src/hooks/data/useCalculateMaxBorrowAmount.tsx delete mode 100644 src/hooks/data/useCalculateMaxTradeAmount.tsx delete mode 100644 src/hooks/data/useCalculateMaxWithdrawAmount.tsx delete mode 100644 src/hooks/mutations/useBorrowFunds.tsx delete mode 100644 src/hooks/mutations/useRepayFunds.tsx delete mode 100644 src/hooks/mutations/useTradeAsset.tsx delete mode 100644 src/hooks/mutations/useWithdrawFunds.tsx delete mode 100644 src/hooks/queries/useAllBalances.tsx delete mode 100644 src/hooks/queries/useAllowedCoins.tsx delete mode 100644 src/hooks/queries/useBroadcast.tsx delete mode 100644 src/hooks/queries/useCreditAccountPositions.tsx delete mode 100644 src/hooks/queries/useCreditAccounts.tsx delete mode 100644 src/hooks/queries/useEstimateFee.tsx delete mode 100644 src/hooks/queries/useMarkets.tsx delete mode 100644 src/hooks/queries/useRedbankBalances.tsx delete mode 100644 src/hooks/queries/useTokenPrices.tsx rename src/hooks/{data => }/useAnimations.tsx (100%) rename src/hooks/{useParams.ts => useParams.tsx} (100%) delete mode 100644 src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts delete mode 100644 src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts delete mode 100644 src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts delete mode 100644 src/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts delete mode 100644 src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts delete mode 100644 src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts delete mode 100644 src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts delete mode 100644 src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts delete mode 100644 src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts delete mode 100644 src/types/generated/mars-zapper-base/MarsZapperBase.react-query.ts diff --git a/package.json b/package.json index 67d41701..71478211 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,11 @@ "@cosmjs/cosmwasm-stargate": "^0.30.1", "@cosmjs/stargate": "^0.30.1", "@marsprotocol/wallet-connector": "^1.5.2", - "@radix-ui/react-slider": "^1.1.1", "@sentry/nextjs": "^7.44.2", - "@tanstack/react-query": "^4.28.0", "@tanstack/react-table": "^8.7.9", "@tippyjs/react": "^4.2.6", "bignumber.js": "^9.1.1", "classnames": "^2.3.2", - "graphql": "^16.6.0", "graphql-request": "^5.2.0", "moment": "^2.29.4", "next": "^13.2.4", @@ -29,7 +26,6 @@ "react-device-detect": "^2.2.3", "react-dom": "^18.2.0", "react-draggable": "^4.4.5", - "react-number-format": "^5.1.4", "react-spring": "^9.7.1", "react-toastify": "^9.1.2", "react-use-clipboard": "^1.0.9", diff --git a/src/components/Account/RiskChart.tsx b/src/components/Account/RiskChart.tsx index 89007d4e..a6b77e93 100644 --- a/src/components/Account/RiskChart.tsx +++ b/src/components/Account/RiskChart.tsx @@ -12,13 +12,12 @@ import { import { formatValue } from 'utils/formatters' import { FormattedNumber } from 'components/FormattedNumber' import { Text } from 'components/Text' -import { useAccountStats } from 'hooks/data/useAccountStats' import useStore from 'store' export const RiskChart = ({ data }: RiskChartProps) => { const enableAnimations = useStore((s) => s.enableAnimations) - const accountStats = useAccountStats() - const currentRisk = accountStats?.risk ?? 0 + const accountStats = null + const currentRisk = 0 return (
diff --git a/src/components/Navigation/DesktopNavigation.tsx b/src/components/Navigation/DesktopNavigation.tsx index 402884d9..8d2ba2b9 100644 --- a/src/components/Navigation/DesktopNavigation.tsx +++ b/src/components/Navigation/DesktopNavigation.tsx @@ -9,7 +9,7 @@ import { Logo } from 'components/Icons' import { NavLink } from 'components/Navigation/NavLink' import Settings from 'components/Settings' import Wallet from 'components/Wallet/Wallet' -import { useAnimations } from 'hooks/data/useAnimations' +import { useAnimations } from 'hooks/useAnimations' import { getRoute } from 'utils/route' export const menuTree: { href: RouteSegment; label: string }[] = [ diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 0f27cdf9..5f70a54f 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -9,7 +9,7 @@ import Switch from 'components/Switch' import { Text } from 'components/Text' import { Tooltip } from 'components/Tooltip' import { ENABLE_ANIMATIONS_KEY } from 'constants/localStore' -import { useAnimations } from 'hooks/data/useAnimations' +import { useAnimations } from 'hooks/useAnimations' import useStore from 'store' export default function Settings() { diff --git a/src/hooks/data/useAccountStats.tsx b/src/hooks/data/useAccountStats.tsx deleted file mode 100644 index 5a4b763f..00000000 --- a/src/hooks/data/useAccountStats.tsx +++ /dev/null @@ -1,255 +0,0 @@ -import BigNumber from 'bignumber.js' -import { useMemo } from 'react' - -import { useCreditAccountPositions } from 'hooks/queries/useCreditAccountPositions' -import { useMarkets } from 'hooks/queries/useMarkets' -import { useTokenPrices } from 'hooks/queries/useTokenPrices' -import useStore from 'store' - -// displaying 3 levels of risk based on the weighted average of liquidation LTVs -// 0.85 -> 25% risk -// 0.65 - 0.85 -> 50% risk -// < 0.65 -> 100% risk -const getRiskFromAverageLiquidationLTVs = (value: number) => { - if (value >= 0.85) return 0.25 - if (value > 0.65) return 0.5 - return 1 -} - -type Asset = { - amount: string - denom: string - liquidationThreshold: string - basePrice: number -} - -type Debt = { - amount: string - denom: string - basePrice: number -} - -const calculateStatsFromAccountPositions = (assets: Asset[], debts: Debt[]) => { - const totalPosition = assets.reduce((acc, asset) => { - const tokenTotalValue = BigNumber(asset.amount).times(asset.basePrice) - - return BigNumber(tokenTotalValue).plus(acc).toNumber() - }, 0) - - const totalDebt = debts.reduce((acc, debt) => { - const tokenTotalValue = BigNumber(debt.amount).times(debt.basePrice) - - return BigNumber(tokenTotalValue).plus(acc).toNumber() - }, 0) - - const totalWeightedPositions = assets.reduce((acc, asset) => { - const assetWeightedValue = BigNumber(asset.amount) - .times(asset.basePrice) - .times(asset.liquidationThreshold) - - return assetWeightedValue.plus(acc).toNumber() - }, 0) - - const netWorth = BigNumber(totalPosition).minus(totalDebt).toNumber() - - const liquidationLTVsWeightedAverage = - totalWeightedPositions === 0 - ? 0 - : BigNumber(totalWeightedPositions).div(totalPosition).toNumber() - - const maxLeverage = BigNumber(1) - .div(BigNumber(1).minus(liquidationLTVsWeightedAverage)) - .toNumber() - const currentLeverage = netWorth === 0 ? 0 : BigNumber(totalPosition).div(netWorth).toNumber() - const health = - maxLeverage === 0 - ? 1 - : BigNumber(1).minus(BigNumber(currentLeverage).div(maxLeverage)).toNumber() || 1 - - const risk = liquidationLTVsWeightedAverage - ? getRiskFromAverageLiquidationLTVs(liquidationLTVsWeightedAverage) - : 0 - - return { - health, - maxLeverage, - currentLeverage, - netWorth, - risk, - totalPosition, - totalDebt, - } -} - -export const useAccountStats = (actions?: AccountStatsAction[]) => { - const selectedAccount = useStore((s) => s.selectedAccount) - - const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') - const { data: marketsData } = useMarkets() - const { data: tokenPrices } = useTokenPrices() - - const currentStats = useMemo(() => { - if (!marketsData || !tokenPrices || !positionsData) return null - - const assets = positionsData.coins.map((coin) => { - const market = marketsData[coin.denom] - - return { - amount: coin.amount, - denom: coin.denom, - liquidationThreshold: market.liquidation_threshold, - basePrice: tokenPrices[coin.denom], - } - }) - - const debts = positionsData.debts.map((debt) => { - return { - amount: debt.amount, - denom: debt.denom, - basePrice: tokenPrices[debt.denom], - } - }) - - const { health, maxLeverage, currentLeverage, netWorth, risk, totalPosition, totalDebt } = - calculateStatsFromAccountPositions(assets, debts) - - return { - health, - maxLeverage, - currentLeverage, - netWorth, - risk, - totalPosition, - totalDebt, - assets, - debts, - } - }, [marketsData, positionsData, tokenPrices]) - - const actionResultStats = useMemo(() => { - if (!actions) return null - if (!tokenPrices || !marketsData || !positionsData) return null - - let resultPositionsCoins = positionsData.coins.map((coin) => ({ ...coin })) - let resultPositionsDebts = positionsData.debts.map((debt) => { - const { shares, ...otherProps } = debt - return { ...otherProps } - }) - - actions.forEach((action) => { - if (action.amount === 0) return - - if (action.type === 'deposit') { - const index = resultPositionsCoins.findIndex((coin) => coin.denom === action.denom) - - if (index !== -1) { - resultPositionsCoins[index].amount = BigNumber(resultPositionsCoins[index].amount) - .plus(action.amount) - .toFixed() - } else { - resultPositionsCoins.push({ - amount: action.amount.toString(), - denom: action.denom, - }) - } - - return - } - - if (action.type === 'withdraw') { - const index = resultPositionsCoins.findIndex((coin) => coin.denom === action.denom) - - if (index !== -1) { - resultPositionsCoins[index].amount = BigNumber(resultPositionsCoins[index].amount) - .minus(action.amount) - .toFixed() - } else { - throw new Error('Cannot withdraw more than you have') - } - - return - } - - if (action.type === 'borrow') { - const indexDebts = resultPositionsDebts.findIndex((coin) => coin.denom === action.denom) - const indexPositions = resultPositionsCoins.findIndex((coin) => coin.denom === action.denom) - - if (indexDebts !== -1) { - resultPositionsDebts[indexDebts].amount = BigNumber( - resultPositionsDebts[indexDebts].amount, - ) - .plus(action.amount) - .toFixed() - } else { - resultPositionsDebts.push({ - amount: action.amount.toString(), - denom: action.denom, - }) - } - - if (indexPositions !== -1) { - resultPositionsCoins[indexPositions].amount = BigNumber( - resultPositionsCoins[indexPositions].amount, - ) - .plus(action.amount) - .toFixed() - } else { - resultPositionsCoins.push({ - amount: action.amount.toString(), - denom: action.denom, - }) - } - - return - } - - // TODO: repay - if (action.type === 'repay') { - const index = resultPositionsDebts.findIndex((coin) => coin.denom === action.denom) - resultPositionsDebts[index].amount = BigNumber(resultPositionsDebts[index].amount) - .minus(action.amount) - .toFixed() - - return - } - }) - - const assets = resultPositionsCoins - .filter((coin) => coin.amount !== '0') - .map((coin) => { - const market = marketsData[coin.denom] - - return { - amount: coin.amount, - denom: coin.denom, - liquidationThreshold: market.liquidation_threshold, - basePrice: tokenPrices[coin.denom], - } - }) - - const debts = resultPositionsDebts.map((debt) => { - return { - amount: debt.amount, - denom: debt.denom, - basePrice: tokenPrices[debt.denom], - } - }) - - const { health, maxLeverage, currentLeverage, netWorth, risk, totalPosition, totalDebt } = - calculateStatsFromAccountPositions(assets, debts) - - return { - health, - maxLeverage, - currentLeverage, - netWorth, - risk, - totalPosition, - totalDebt, - assets, - debts, - } - }, [actions, marketsData, positionsData, tokenPrices]) - - return actionResultStats || currentStats -} diff --git a/src/hooks/data/useCalculateMaxBorrowAmount.tsx b/src/hooks/data/useCalculateMaxBorrowAmount.tsx deleted file mode 100644 index 2086d054..00000000 --- a/src/hooks/data/useCalculateMaxBorrowAmount.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import BigNumber from 'bignumber.js' -import { useCallback, useMemo } from 'react' - -import { useCreditAccountPositions } from 'hooks/queries/useCreditAccountPositions' -import { useMarkets } from 'hooks/queries/useMarkets' -import { useRedbankBalances } from 'hooks/queries/useRedbankBalances' -import { useTokenPrices } from 'hooks/queries/useTokenPrices' -import { getTokenDecimals } from 'utils/tokens' -import useStore from 'store' -import { getMarketAssets } from 'utils/assets' - -const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { - const hourlyAPY = BigNumber(borrowAPY).div(24 * 365) - - return hourlyAPY.times(amount).toNumber() -} - -export const useCalculateMaxBorrowAmount = (denom: string, isUnderCollateralized: boolean) => { - const selectedAccount = useStore((s) => s.selectedAccount) - const marketAssets = getMarketAssets() - - const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') - const { data: marketsData } = useMarkets() - const { data: tokenPrices } = useTokenPrices() - const { data: redbankBalances } = useRedbankBalances() - - const getTokenValue = useCallback( - (amount: string, denom: string) => { - if (!tokenPrices) return 0 - - return BigNumber(amount).times(tokenPrices[denom]).toNumber() - }, - [tokenPrices], - ) - - return useMemo(() => { - if (!marketsData || !tokenPrices || !positionsData || !redbankBalances) return 0 - - // max ltv adjusted collateral - const totalWeightedPositions = positionsData?.coins.reduce((acc, coin) => { - const tokenWeightedValue = BigNumber(getTokenValue(coin.amount, coin.denom)).times( - Number(marketsData[coin.denom].max_loan_to_value), - ) - - return tokenWeightedValue.plus(acc).toNumber() - }, 0) - - // approximate debt value in an hour timespan to avoid throwing on smart contract level - // due to debt interest being applied - const totalLiabilitiesValue = positionsData?.debts.reduce((acc, coin) => { - const estimatedInterestAmount = getApproximateHourlyInterest( - coin.amount, - marketsData[coin.denom].borrow_rate, - ) - - const tokenDebtValue = BigNumber(getTokenValue(coin.amount, coin.denom)).plus( - estimatedInterestAmount, - ) - - return tokenDebtValue.plus(acc).toNumber() - }, 0) - - const borrowTokenPrice = tokenPrices[denom] - const tokenDecimals = getTokenDecimals(denom, marketAssets) - - let maxAmountCapacity - if (isUnderCollateralized) { - // MAX TO CREDIT ACCOUNT - maxAmountCapacity = BigNumber(totalLiabilitiesValue) - .minus(totalWeightedPositions) - .div(borrowTokenPrice * Number(marketsData[denom].max_loan_to_value) - borrowTokenPrice) - } else { - // MAX TO WALLET - maxAmountCapacity = BigNumber(totalWeightedPositions) - .minus(totalLiabilitiesValue) - .div(borrowTokenPrice) - } - - const marketLiquidity = BigNumber( - redbankBalances?.find((asset) => asset.denom.toLowerCase() === denom.toLowerCase())?.amount || - 0, - ) - - const maxBorrowAmount = maxAmountCapacity.gt(marketLiquidity) - ? marketLiquidity - : maxAmountCapacity.gt(0) - ? maxAmountCapacity - : 0 - - return BigNumber(maxBorrowAmount) - .dividedBy(10 ** tokenDecimals) - .decimalPlaces(tokenDecimals) - .toNumber() - }, [ - denom, - getTokenValue, - isUnderCollateralized, - marketsData, - positionsData, - redbankBalances, - tokenPrices, - marketAssets, - ]) -} diff --git a/src/hooks/data/useCalculateMaxTradeAmount.tsx b/src/hooks/data/useCalculateMaxTradeAmount.tsx deleted file mode 100644 index caf8fce3..00000000 --- a/src/hooks/data/useCalculateMaxTradeAmount.tsx +++ /dev/null @@ -1,145 +0,0 @@ -import BigNumber from 'bignumber.js' -import { useCallback, useMemo } from 'react' - -import { useCreditAccountPositions } from 'hooks/queries/useCreditAccountPositions' -import { useMarkets } from 'hooks/queries/useMarkets' -import { useRedbankBalances } from 'hooks/queries/useRedbankBalances' -import { useTokenPrices } from 'hooks/queries/useTokenPrices' -import useStore from 'store' - -const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { - const hourlyAPY = BigNumber(borrowAPY).div(24 * 365) - - return hourlyAPY.times(amount).toNumber() -} - -// max trade amount doesnt consider wallet balance as its not relevant -// the entire token balance within the wallet will always be able to be fully swapped -export const useCalculateMaxTradeAmount = ( - tokenIn: string, - tokenOut: string, - isMargin: boolean, -) => { - const selectedAccount = useStore((s) => s.selectedAccount) - - const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') - const { data: marketsData } = useMarkets() - const { data: tokenPrices } = useTokenPrices() - const { data: redbankBalances } = useRedbankBalances() - - const accountAmount = useMemo(() => { - return BigNumber( - positionsData?.coins?.find((coin) => coin.denom === tokenIn)?.amount ?? 0, - ).toNumber() - }, [positionsData, tokenIn]) - - const getTokenValue = useCallback( - (amount: string, denom: string) => { - if (!tokenPrices) return 0 - - return BigNumber(amount).times(tokenPrices[denom]).toNumber() - }, - [tokenPrices], - ) - - return useMemo(() => { - if (!marketsData || !tokenPrices || !positionsData || !redbankBalances || !tokenIn || !tokenOut) - return 0 - - const totalWeightedPositions = positionsData.coins.reduce((acc, coin) => { - const tokenWeightedValue = BigNumber(getTokenValue(coin.amount, coin.denom)).times( - Number(marketsData[coin.denom].max_loan_to_value), - ) - - return tokenWeightedValue.plus(acc).toNumber() - }, 0) - - // approximate debt value in an hour timespan to avoid throwing on smart contract level - // due to debt interest being applied - const totalLiabilitiesValue = positionsData.debts.reduce((acc, coin) => { - const estimatedInterestAmount = getApproximateHourlyInterest( - coin.amount, - marketsData[coin.denom].borrow_rate, - ) - - const tokenDebtValue = BigNumber(getTokenValue(coin.amount, coin.denom)).plus( - estimatedInterestAmount, - ) - - return tokenDebtValue.plus(acc).toNumber() - }, 0) - - const tokenOutLTV = Number(marketsData[tokenOut].max_loan_to_value) - const tokenInLTV = Number(marketsData[tokenIn].max_loan_to_value) - - // if the target token ltv higher, the full amount will always be able to be swapped - if (tokenOutLTV < tokenInLTV) { - // in theory, the most you can swap from x to y while keeping an health factor of 1 - const maxSwapValue = BigNumber(totalLiabilitiesValue) - .minus(totalWeightedPositions) - .dividedBy(tokenOutLTV - tokenInLTV) - - const maxSwapAmount = maxSwapValue.div(tokenPrices[tokenIn]).decimalPlaces(0) - - // if the swappable amount is lower than the account amount, any further calculations are irrelevant - if (maxSwapAmount.isLessThanOrEqualTo(accountAmount)) return maxSwapAmount.toNumber() - } - - // if margin is disabled, the max swap amount is capped at the account amount - if (!isMargin) { - return accountAmount - } - - const estimatedTokenOutAmount = BigNumber(accountAmount).times( - tokenPrices[tokenIn] / tokenPrices[tokenOut], - ) - - let positionsCoins = [...positionsData.coins] - - // if the target token is not in the account, add it to the positions - if (!positionsCoins.find((coin) => coin.denom === tokenOut)) { - positionsCoins.push({ - amount: '0', - denom: tokenOut, - }) - } - - // calculate weighted positions assuming the initial swap is made - const totalWeightedPositionsAfterSwap = positionsCoins - .filter((coin) => coin.denom !== tokenIn) - .reduce((acc, coin) => { - const coinAmount = - coin.denom === tokenOut - ? BigNumber(coin.amount).plus(estimatedTokenOutAmount).toString() - : coin.amount - - const tokenWeightedValue = BigNumber(getTokenValue(coinAmount, coin.denom)).times( - Number(marketsData[coin.denom].max_loan_to_value), - ) - - return tokenWeightedValue.plus(acc).toNumber() - }, 0) - - const maxBorrowValue = - totalWeightedPositionsAfterSwap === 0 - ? 0 - : BigNumber(totalWeightedPositionsAfterSwap) - .minus(totalLiabilitiesValue) - .dividedBy(1 - tokenOutLTV) - .toNumber() - - const maxBorrowAmount = BigNumber(maxBorrowValue).dividedBy(tokenPrices[tokenIn]).toNumber() - - return BigNumber(accountAmount).plus(maxBorrowAmount).decimalPlaces(0).toNumber() - }, [ - accountAmount, - getTokenValue, - isMargin, - marketsData, - positionsData, - redbankBalances, - tokenIn, - tokenOut, - tokenPrices, - ]) -} diff --git a/src/hooks/data/useCalculateMaxWithdrawAmount.tsx b/src/hooks/data/useCalculateMaxWithdrawAmount.tsx deleted file mode 100644 index bb9d05dd..00000000 --- a/src/hooks/data/useCalculateMaxWithdrawAmount.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import BigNumber from 'bignumber.js' -import { useCallback, useMemo } from 'react' - -import { useCreditAccountPositions } from 'hooks/queries/useCreditAccountPositions' -import { useMarkets } from 'hooks/queries/useMarkets' -import { useRedbankBalances } from 'hooks/queries/useRedbankBalances' -import { useTokenPrices } from 'hooks/queries/useTokenPrices' -import { getTokenDecimals } from 'utils/tokens' -import useStore from 'store' -import { getMarketAssets } from 'utils/assets' - -const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { - const hourlyAPY = BigNumber(borrowAPY).div(24 * 365) - - return hourlyAPY.times(amount).toNumber() -} - -export const useCalculateMaxWithdrawAmount = (denom: string, borrow: boolean) => { - const selectedAccount = useStore((s) => s.selectedAccount) - const marketAssets = getMarketAssets() - - const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') - const { data: marketsData } = useMarkets() - const { data: tokenPrices } = useTokenPrices() - const { data: redbankBalances } = useRedbankBalances() - - const tokenDecimals = getTokenDecimals(denom, marketAssets) - - const getTokenValue = useCallback( - (amount: string, denom: string) => { - if (!tokenPrices) return 0 - - return BigNumber(amount).times(tokenPrices[denom]).toNumber() - }, - [tokenPrices], - ) - - const tokenAmountInCreditAccount = useMemo(() => { - return positionsData?.coins.find((coin) => coin.denom === denom)?.amount ?? 0 - }, [denom, positionsData]) - - const maxAmount = useMemo(() => { - if (!marketsData || !tokenPrices || !positionsData || !redbankBalances || !denom) return 0 - - const hasDebt = positionsData.debts.length > 0 - - const borrowTokenPrice = tokenPrices[denom] - const borrowTokenMaxLTV = Number(marketsData[denom].max_loan_to_value) - - // approximate debt value in an hour timespan to avoid throwing on smart contract level - // due to debt interest being applied - const totalLiabilitiesValue = positionsData?.debts.reduce((acc, coin) => { - const estimatedInterestAmount = getApproximateHourlyInterest( - coin.amount, - marketsData[coin.denom].borrow_rate, - ) - const tokenDebtValue = BigNumber(getTokenValue(coin.amount, coin.denom)).plus( - estimatedInterestAmount, - ) - - return tokenDebtValue.plus(acc).toNumber() - }, 0) - - const positionsWeightedAverageWithoutAsset = positionsData?.coins.reduce((acc, coin) => { - if (coin.denom === denom) return acc - - const tokenWeightedValue = BigNumber(getTokenValue(coin.amount, coin.denom)).times( - Number(marketsData[coin.denom].max_loan_to_value), - ) - - return tokenWeightedValue.plus(acc).toNumber() - }, 0) - - const isHealthyAfterFullWithdraw = !hasDebt - ? true - : positionsWeightedAverageWithoutAsset / totalLiabilitiesValue > 1 - - let maxAmountCapacity = 0 - - if (isHealthyAfterFullWithdraw) { - const maxBorrow = BigNumber(positionsWeightedAverageWithoutAsset) - .minus(totalLiabilitiesValue) - .div(borrowTokenPrice) - - maxAmountCapacity = maxBorrow - .plus(tokenAmountInCreditAccount) - .decimalPlaces(tokenDecimals) - .toNumber() - } else { - const requiredCollateral = BigNumber(totalLiabilitiesValue) - .minus(positionsWeightedAverageWithoutAsset) - .dividedBy(borrowTokenPrice * borrowTokenMaxLTV) - - maxAmountCapacity = BigNumber(tokenAmountInCreditAccount) - .minus(requiredCollateral) - .decimalPlaces(tokenDecimals) - .toNumber() - - // required collateral might be greater than the amount in the credit account which will result - // in a negative max amount capacity - maxAmountCapacity = maxAmountCapacity < 0 ? 0 : maxAmountCapacity - } - - const marketLiquidity = BigNumber( - redbankBalances?.find((asset) => asset.denom.toLowerCase() === denom.toLowerCase())?.amount || - 0, - ) - - const maxWithdrawAmount = BigNumber(maxAmountCapacity).gt(marketLiquidity) - ? marketLiquidity - : maxAmountCapacity - const isMaxAmountHigherThanBalance = BigNumber(maxWithdrawAmount).gt(tokenAmountInCreditAccount) - - if (!borrow && isMaxAmountHigherThanBalance) { - return BigNumber(tokenAmountInCreditAccount) - .div(10 ** tokenDecimals) - .toNumber() - } - - return BigNumber(maxWithdrawAmount) - .div(10 ** tokenDecimals) - .decimalPlaces(tokenDecimals) - .toNumber() - }, [ - borrow, - denom, - getTokenValue, - marketsData, - positionsData, - redbankBalances, - tokenAmountInCreditAccount, - tokenDecimals, - tokenPrices, - ]) - - return maxAmount -} diff --git a/src/hooks/mutations/useBorrowFunds.tsx b/src/hooks/mutations/useBorrowFunds.tsx deleted file mode 100644 index 05db265e..00000000 --- a/src/hooks/mutations/useBorrowFunds.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' -import { useMemo } from 'react' - -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' -import { hardcodedFee } from 'utils/contants' - -export const useBorrowFunds = ( - amount: number, - denom: string, - withdraw = false, - options: Omit, -) => { - const creditManagerClient = useStore((s) => s.clients.creditManager) - const selectedAccount = useStore((s) => s.selectedAccount ?? '') - const address = useStore((s) => s.address) - const queryClient = useQueryClient() - const actions = useMemo(() => { - if (!withdraw) { - return [ - { - borrow: { - denom: denom, - amount: String(amount), - }, - }, - ] - } - return [ - { - borrow: { - denom: denom, - amount: String(amount), - }, - }, - { - withdraw: { - denom: denom, - amount: String(amount), - }, - }, - ] - }, [withdraw, denom, amount]) - return useMutation( - async () => - await creditManagerClient?.updateCreditAccount( - { accountId: selectedAccount, actions }, - hardcodedFee, - ), - { - onSettled: () => { - queryClient.invalidateQueries(queryKeys.creditAccountsPositions(selectedAccount)) - queryClient.invalidateQueries(queryKeys.redbankBalances()) - // if withdrawing to wallet, need to explicility invalidate balances queries - if (withdraw) { - queryClient.invalidateQueries(queryKeys.tokenBalance(address ?? '', denom)) - queryClient.invalidateQueries(queryKeys.allBalances(address ?? '')) - } - }, - onError: (err: Error) => { - useStore.setState({ - toast: { message: err.message, isError: true }, - }) - }, - ...options, - }, - ) -} diff --git a/src/hooks/mutations/useRepayFunds.tsx b/src/hooks/mutations/useRepayFunds.tsx deleted file mode 100644 index a42b0489..00000000 --- a/src/hooks/mutations/useRepayFunds.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' -import { useMemo } from 'react' - -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' -import { hardcodedFee } from 'utils/contants' - -export const useRepayFunds = ( - amount: number, - denom: string, - options: Omit, -) => { - const creditManagerClient = useStore((s) => s.clients.creditManager) - const selectedAccount = useStore((s) => s.selectedAccount ?? '') - const address = useStore((s) => s.address) - const queryClient = useQueryClient() - const actions = useMemo(() => { - return [ - { - deposit: { - denom: denom, - amount: String(amount), - }, - }, - { - repay: { - denom: denom, - amount: { - exact: String(amount), - }, - }, - }, - ] - }, [amount, denom]) - return useMutation( - async () => - await creditManagerClient?.updateCreditAccount( - { accountId: selectedAccount, actions }, - hardcodedFee, - undefined, - [ - { - denom, - amount: String(amount), - }, - ], - ), - { - onSettled: () => { - queryClient.invalidateQueries(queryKeys.creditAccountsPositions(selectedAccount)) - queryClient.invalidateQueries(queryKeys.tokenBalance(address ?? '', denom)) - queryClient.invalidateQueries(queryKeys.allBalances(address ?? '')) - queryClient.invalidateQueries(queryKeys.redbankBalances()) - }, - onError: (err: Error) => { - useStore.setState({ - toast: { message: err.message, isError: true }, - }) - }, - ...options, - }, - ) -} diff --git a/src/hooks/mutations/useTradeAsset.tsx b/src/hooks/mutations/useTradeAsset.tsx deleted file mode 100644 index 97cd2bc5..00000000 --- a/src/hooks/mutations/useTradeAsset.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' -import { useMemo } from 'react' - -import useStore from 'store' -import { Action } from 'types/generated/mars-credit-manager/MarsCreditManager.types' -import { queryKeys } from 'types/query-keys-factory' -import { hardcodedFee } from 'utils/contants' - -export const useTradeAsset = ( - amount: number, - borrowAmount: number, - depositAmount: number, - tokenIn: string, - tokenOut: string, - slippage: number, - options?: Omit, -) => { - const creditManagerClient = useStore((s) => s.clients.creditManager) - const selectedAccount = useStore((s) => s.selectedAccount ?? '') - const queryClient = useQueryClient() - // actions need to be executed in order deposit -> borrow -> swap - // first two are optional - const actions = useMemo(() => { - const actionsBase = [ - { - swap_exact_in: { - coin_in: { amount: String(amount), denom: tokenIn }, - denom_out: tokenOut, - slippage: String(slippage), - }, - }, - ] as Action[] - if (borrowAmount > 0) { - actionsBase.unshift({ - borrow: { - denom: tokenIn, - amount: String(borrowAmount), - }, - }) - } - if (depositAmount > 0) { - actionsBase.unshift({ - deposit: { - denom: tokenIn, - amount: String(depositAmount), - }, - }) - } - return actionsBase - }, [amount, tokenIn, tokenOut, slippage, borrowAmount, depositAmount]) - return useMutation( - async () => - await creditManagerClient?.updateCreditAccount( - { accountId: selectedAccount, actions }, - hardcodedFee, - undefined, - depositAmount > 0 - ? [ - { - denom: tokenIn, - amount: String(depositAmount), - }, - ] - : undefined, - ), - { - onSettled: () => { - queryClient.invalidateQueries(queryKeys.creditAccountsPositions(selectedAccount)) - queryClient.invalidateQueries(queryKeys.redbankBalances()) - }, - onError: (err: Error) => { - useStore.setState({ - toast: { message: err.message, isError: true }, - }) - }, - ...options, - }, - ) -} diff --git a/src/hooks/mutations/useWithdrawFunds.tsx b/src/hooks/mutations/useWithdrawFunds.tsx deleted file mode 100644 index f41679fa..00000000 --- a/src/hooks/mutations/useWithdrawFunds.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { useMutation, useQueryClient } from '@tanstack/react-query' -import { useMemo } from 'react' - -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' -import { hardcodedFee } from 'utils/contants' - -export const useWithdrawFunds = ( - amount: number, - borrowAmount: number, - denom: string, - options?: { - onSuccess?: () => void - }, -) => { - const selectedAccount = useStore((s) => s.selectedAccount ?? '') - const address = useStore((s) => s.address) - const creditManagerClient = useStore((s) => s.clients.creditManager) - const queryClient = useQueryClient() - const actions = useMemo(() => { - if (borrowAmount > 0) { - return [ - { - borrow: { - denom, - amount: String(borrowAmount), - }, - }, - { - withdraw: { - denom, - amount: String(amount), - }, - }, - ] - } - return [ - { - withdraw: { - denom, - amount: String(amount), - }, - }, - ] - }, [amount, borrowAmount, denom]) - const { onSuccess } = { ...options } - return useMutation( - async () => - creditManagerClient?.updateCreditAccount( - { accountId: selectedAccount, actions }, - hardcodedFee, - ), - { - onSuccess: () => { - queryClient.invalidateQueries(queryKeys.creditAccountsPositions(selectedAccount)) - queryClient.invalidateQueries(queryKeys.tokenBalance(address ?? '', denom)) - queryClient.invalidateQueries(queryKeys.allBalances(address ?? '')) - queryClient.invalidateQueries(queryKeys.redbankBalances()) - onSuccess && onSuccess() - }, - onError: (err: Error) => { - useStore.setState({ - toast: { message: err.message, isError: true }, - }) - }, - }, - ) -} diff --git a/src/hooks/queries/useAllBalances.tsx b/src/hooks/queries/useAllBalances.tsx deleted file mode 100644 index b6c7b72b..00000000 --- a/src/hooks/queries/useAllBalances.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { Coin } from '@cosmjs/stargate' -import { useQuery } from '@tanstack/react-query' -import request, { gql } from 'graphql-request' -import { useMemo } from 'react' - -import { ENV } from 'constants/env' -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' - -interface UserBalanceData { - balance: { - balance: Coin[] - } -} - -export const useAllBalances = () => { - const address = useStore((s) => s.address) - - const result = useQuery( - queryKeys.allBalances(address ?? ''), - async () => { - return await request( - ENV.URL_GQL!, - gql` - query UserBalanceQuery { - balance: bank { - balance( - address: "${address}" - ) { - amount - denom - } - } - } - `, - ) - }, - { - enabled: !!address, - staleTime: 30000, - refetchInterval: 30000, - }, - ) - return { - ...result, - data: useMemo(() => result.data && result.data.balance.balance, [result.data]), - } -} diff --git a/src/hooks/queries/useAllowedCoins.tsx b/src/hooks/queries/useAllowedCoins.tsx deleted file mode 100644 index 971a39fb..00000000 --- a/src/hooks/queries/useAllowedCoins.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useQuery } from '@tanstack/react-query' - -import { ENV } from 'constants/env' -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' - -type Result = string[] - -const queryMsg = { - allowed_coins: {}, -} - -export const useAllowedCoins = () => { - const client = useStore((s) => s.signingClient) - const creditManagerAddress = ENV.ADDRESS_CREDIT_MANAGER - - const result = useQuery( - queryKeys.allowedCoins(), - async () => client?.queryContractSmart(creditManagerAddress || '', queryMsg), - { - enabled: !!client, - staleTime: Infinity, - }, - ) - - return { - ...result, - data: result?.data, - } -} diff --git a/src/hooks/queries/useBroadcast.tsx b/src/hooks/queries/useBroadcast.tsx deleted file mode 100644 index 4ae3603e..00000000 --- a/src/hooks/queries/useBroadcast.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { MsgExecuteContract } from '@marsprotocol/wallet-connector' -import { useQuery } from '@tanstack/react-query' -import { isMobile } from 'react-device-detect' - -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' - -export const useBroadcast = (props: UseBroadcast) => { - const client = useStore((s) => s.client) - const userWalletAddress = useStore((s) => s.client?.recentWallet.account?.address) - const sender = props.sender ?? userWalletAddress - - return useQuery( - [queryKeys.broadcastMessages(), props.msg], - async () => { - if (!client || !props.contract || !props.msg || !props.fee || !sender) return - - try { - const broadcastOptions = { - messages: [ - new MsgExecuteContract({ - sender: sender, - contract: props.contract, - msg: props.msg, - funds: props.funds, - }), - ], - feeAmount: props.fee.amount[0].amount, - gasLimit: props.fee.gas, - memo: undefined, - wallet: client.recentWallet, - mobile: isMobile, - } - - const result = await client.broadcast(broadcastOptions) - - if (result.hash) { - return result - } - throw result.rawLogs - } catch (e) { - throw e - } - }, - { - enabled: !!sender && !!client && !!props.msg && !!props.contract && !!props.fee, - }, - ) -} diff --git a/src/hooks/queries/useCreditAccountPositions.tsx b/src/hooks/queries/useCreditAccountPositions.tsx deleted file mode 100644 index 9a0720dc..00000000 --- a/src/hooks/queries/useCreditAccountPositions.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { Coin } from '@cosmjs/stargate' -import { useQuery } from '@tanstack/react-query' -import { useMemo } from 'react' - -import { ENV } from 'constants/env' -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' - -interface DebtAmount { - amount: string - denom: string - shares: string -} - -interface VaultPosition { - locked: string - unlocked: string -} - -interface Result { - account_id: string - coins: Coin[] - debts: DebtAmount[] - vaults: VaultPosition[] -} - -export const useCreditAccountPositions = (accountId: string) => { - const address = useStore((s) => s.address) - const client = useStore((s) => s.signingClient) - const creditManagerAddress = ENV.ADDRESS_CREDIT_MANAGER - - const result = useQuery( - queryKeys.creditAccountsPositions(accountId), - async () => - client?.queryContractSmart(creditManagerAddress || '', { - positions: { - account_id: accountId, - }, - }), - { - enabled: !!address && !!client, - refetchInterval: 30000, - staleTime: Infinity, - }, - ) - - return { - ...result, - data: useMemo(() => { - if (!address) return - - return result?.data && { ...result.data } - }, [result.data, address]), - } -} diff --git a/src/hooks/queries/useCreditAccounts.tsx b/src/hooks/queries/useCreditAccounts.tsx deleted file mode 100644 index 0580e1b2..00000000 --- a/src/hooks/queries/useCreditAccounts.tsx +++ /dev/null @@ -1,53 +0,0 @@ -'use client' - -import { useQuery } from '@tanstack/react-query' -import { useMemo } from 'react' - -import { ENV } from 'constants/env' -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' - -type Result = { - tokens: string[] -} - -export const useCreditAccounts = () => { - const address = useStore((s) => s.address) - const client = useStore((s) => s.signingClient) - const selectedAccount = useStore((s) => s.selectedAccount) - const accountNftAddress = ENV.ADDRESS_ACCOUNT_NFT - const setSelectedAccount = (account: string) => { - useStore.setState({ selectedAccount: account }) - } - - const queryMsg = useMemo(() => { - return { - tokens: { - owner: address, - }, - } - }, [address]) - - const result = useQuery( - queryKeys.creditAccounts(address ?? ''), - async () => client?.queryContractSmart(accountNftAddress || '', queryMsg), - { - staleTime: Infinity, - enabled: !!address && !!client, - onSuccess: (data) => { - if (!data.tokens.includes(selectedAccount || '') && data.tokens.length > 0) { - setSelectedAccount(data.tokens[0]) - } - }, - }, - ) - - return { - ...result, - data: useMemo(() => { - if (!address) return [] - - return result?.data && result.data.tokens - }, [address, result?.data]), - } -} diff --git a/src/hooks/queries/useEstimateFee.tsx b/src/hooks/queries/useEstimateFee.tsx deleted file mode 100644 index fb242a05..00000000 --- a/src/hooks/queries/useEstimateFee.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { MsgExecuteContract } from '@marsprotocol/wallet-connector' -import { useQuery } from '@tanstack/react-query' -import BigNumber from 'bignumber.js' - -import { GAS_ADJUSTMENT } from 'constants/gas' -import useStore from 'store' -import { queryKeys } from 'types/query-keys-factory' - -export const useEstimateFee = (props: UseEstimateFee) => { - const client = useStore((s) => s.client) - const userWalletAddress = useStore((s) => s.client?.recentWallet.account?.address) - const sender = props.sender ?? userWalletAddress - - return useQuery( - [queryKeys.estimateFee(), props.msg], - async () => { - const gasAdjustment = GAS_ADJUSTMENT - - if (!client || !props.contract || !props.msg || !sender) return - - try { - const simulateOptions = { - messages: [ - new MsgExecuteContract({ - sender: sender, - contract: props.contract, - msg: props.msg, - funds: props.funds, - }), - ], - wallet: client.recentWallet, - } - - const result = await client.simulate(simulateOptions) - - if (result.success) { - return { - amount: result.fee ? result.fee.amount : [], - gas: new BigNumber(result.fee ? result.fee.gas : 0) - .multipliedBy(gasAdjustment) - .toFixed(0), - } - } - throw result.error - } catch (e) { - throw e - } - }, - { - enabled: !!sender && !!client && !!props.msg && !!props.contract, - }, - ) -} diff --git a/src/hooks/queries/useMarkets.tsx b/src/hooks/queries/useMarkets.tsx deleted file mode 100644 index 1d5b65b0..00000000 --- a/src/hooks/queries/useMarkets.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { useQuery } from '@tanstack/react-query' -import { useMemo } from 'react' - -export const useMarkets = () => { - const result = useQuery( - ['marketInfo'], - () => ({ - wasm: { - uosmo: { - denom: 'uosmo', - max_loan_to_value: '0.55', - liquidation_threshold: '0.65', - liquidation_bonus: '0.1', - reserve_factor: '0.2', - interest_rate_model: { - optimal_utilization_rate: '0.7', - base: '0.3', - slope_1: '0.25', - slope_2: '0.3', - }, - borrow_index: '1.009983590233269535', - liquidity_index: '1.002073497939302451', - borrow_rate: '0.350254719559196173', - liquidity_rate: '0.039428374060840366', - indexes_last_updated: 1668271634, - collateral_total_scaled: '8275583285688290', - debt_total_scaled: '1155363812346122', - deposit_enabled: true, - borrow_enabled: true, - deposit_cap: '15000000000000', - }, - 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': { - denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2', - max_loan_to_value: '0.65', - liquidation_threshold: '0.7', - liquidation_bonus: '0.1', - reserve_factor: '0.2', - interest_rate_model: { - optimal_utilization_rate: '0.1', - base: '0.3', - slope_1: '0.25', - slope_2: '0.3', - }, - borrow_index: '1.015550607619308095', - liquidity_index: '1.003284932040106733', - borrow_rate: '0.75632500115230499', - liquidity_rate: '0.435023016254423759', - indexes_last_updated: 1668273756, - collateral_total_scaled: '3309105730887721', - debt_total_scaled: '2350429206911653', - deposit_enabled: true, - borrow_enabled: true, - deposit_cap: '15000000000000', - }, - 'ibc/E6931F78057F7CC5DA0FD6CEF82FF39373A6E0452BF1FD76910B93292CF356C1': { - denom: 'ibc/E6931F78057F7CC5DA0FD6CEF82FF39373A6E0452BF1FD76910B93292CF356C1', - max_loan_to_value: '0.65', - liquidation_threshold: '0.7', - liquidation_bonus: '0.1', - reserve_factor: '0.2', - interest_rate_model: { - optimal_utilization_rate: '0.1', - base: '0.3', - slope_1: '0.25', - slope_2: '0.3', - }, - borrow_index: '1.001519837645865043', - liquidity_index: '1', - borrow_rate: '0.3', - liquidity_rate: '0', - indexes_last_updated: 1667995650, - collateral_total_scaled: '1000000000000000', - debt_total_scaled: '0', - deposit_enabled: true, - borrow_enabled: true, - deposit_cap: '15000000000000', - }, - }, - }), - { - staleTime: Infinity, - }, - ) - - return { - ...result, - data: useMemo(() => { - return result?.data && result.data.wasm - }, [result.data]), - } -} diff --git a/src/hooks/queries/useRedbankBalances.tsx b/src/hooks/queries/useRedbankBalances.tsx deleted file mode 100644 index b1c809e0..00000000 --- a/src/hooks/queries/useRedbankBalances.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { Coin } from '@cosmjs/stargate' -import { useQuery } from '@tanstack/react-query' -import request, { gql } from 'graphql-request' -import { useMemo } from 'react' - -import { ENV } from 'constants/env' -import { queryKeys } from 'types/query-keys-factory' - -interface Result { - bank: { - balance: Coin[] - } -} - -export const useRedbankBalances = () => { - const redBankAddress = ENV.ADDRESS_RED_BANK - const result = useQuery( - queryKeys.redbankBalances(), - async () => { - return await request( - ENV.URL_GQL!, - gql` - query RedbankBalances { - bank { - balance( - address: "${redBankAddress}" - ) { - amount - denom - } - } - } - `, - ) - }, - { - enabled: !!redBankAddress, - staleTime: 30000, - refetchInterval: 30000, - }, - ) - - return { - ...result, - data: useMemo(() => result.data && result.data.bank.balance, [result.data]), - } -} diff --git a/src/hooks/queries/useTokenPrices.tsx b/src/hooks/queries/useTokenPrices.tsx deleted file mode 100644 index 6129fa99..00000000 --- a/src/hooks/queries/useTokenPrices.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { useQuery } from '@tanstack/react-query' -import { gql, request } from 'graphql-request' -import { useMemo } from 'react' - -import { ENV } from 'constants/env' -import { queryKeys } from 'types/query-keys-factory' -import { getMarketAssets } from 'utils/assets' - -const fetchTokenPrices = async ( - hiveUrl: string, - marketAssets: Asset[], - oracleAddress: string, -): Promise => { - return request( - hiveUrl, - gql` - query PriceOracle { - prices: wasm { - ${marketAssets.map((token) => { - return `${token.symbol}: contractQuery( - contractAddress: "${oracleAddress}" - query: { - price: { - denom: "${token.denom}" - } - } - )` - })} - } - } - `, - ) -} - -export const useTokenPrices = () => { - const marketAssets = getMarketAssets() - const result = useQuery( - queryKeys.tokenPrices(), - async () => await fetchTokenPrices(ENV.URL_GQL!, marketAssets, ENV.ADDRESS_ORACLE || ''), - { - refetchInterval: 30000, - staleTime: Infinity, - }, - ) - - return { - ...result, - data: useMemo(() => { - if (!result.data) return - - return Object.values(result.data?.prices).reduce( - (acc, entry) => ({ - ...acc, - [entry.denom]: Number(entry.price), - }), - {}, - ) as { [key in string]: number } - }, [result.data]), - } -} diff --git a/src/hooks/data/useAnimations.tsx b/src/hooks/useAnimations.tsx similarity index 100% rename from src/hooks/data/useAnimations.tsx rename to src/hooks/useAnimations.tsx diff --git a/src/hooks/useParams.ts b/src/hooks/useParams.tsx similarity index 100% rename from src/hooks/useParams.ts rename to src/hooks/useParams.tsx diff --git a/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts b/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts deleted file mode 100644 index 2d9f8b27..00000000 --- a/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts +++ /dev/null @@ -1,574 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { Coin, StdFee } from '@cosmjs/amino' - -import { - AllNftInfoResponseForEmpty, - Approval, - ApprovalResponse, - ApprovalsResponse, - Binary, - ContractInfoResponse, - Empty, - ExecuteMsg, - Expiration, - InstantiateMsg, - MinterResponse, - NftConfigBaseForString, - NftConfigUpdates, - NftInfoResponseForEmpty, - NumTokensResponse, - OperatorsResponse, - OwnerOfResponse, - QueryMsg, - Timestamp, - TokensResponse, - Uint128, - Uint64, -} from './MarsAccountNft.types' -import { MarsAccountNftClient, MarsAccountNftQueryClient } from './MarsAccountNft.client' -export const marsAccountNftQueryKeys = { - contract: [ - { - contract: 'marsAccountNft', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsAccountNftQueryKeys.contract[0], address: contractAddress }] as const, - config: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'config', args }] as const, - nextId: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'next_id', args }] as const, - ownerOf: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'owner_of', args }] as const, - approval: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approval', args }] as const, - approvals: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approvals', args }, - ] as const, - allOperators: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_operators', args }, - ] as const, - numTokens: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'num_tokens', args }, - ] as const, - contractInfo: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'contract_info', args }, - ] as const, - nftInfo: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'nft_info', args }] as const, - allNftInfo: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_nft_info', args }, - ] as const, - tokens: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'tokens', args }] as const, - allTokens: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_tokens', args }, - ] as const, - minter: (contractAddress: string | undefined, args?: Record) => - [{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'minter', args }] as const, -} -export interface MarsAccountNftReactQuery { - client: MarsAccountNftQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsAccountNftMinterQuery - extends MarsAccountNftReactQuery {} -export function useMarsAccountNftMinterQuery({ - client, - options, -}: MarsAccountNftMinterQuery) { - return useQuery( - marsAccountNftQueryKeys.minter(client?.contractAddress), - () => (client ? client.minter() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftAllTokensQuery - extends MarsAccountNftReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsAccountNftAllTokensQuery({ - client, - args, - options, -}: MarsAccountNftAllTokensQuery) { - return useQuery( - marsAccountNftQueryKeys.allTokens(client?.contractAddress, args), - () => - client - ? client.allTokens({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftTokensQuery - extends MarsAccountNftReactQuery { - args: { - limit?: number - owner: string - startAfter?: string - } -} -export function useMarsAccountNftTokensQuery({ - client, - args, - options, -}: MarsAccountNftTokensQuery) { - return useQuery( - marsAccountNftQueryKeys.tokens(client?.contractAddress, args), - () => - client - ? client.tokens({ - limit: args.limit, - owner: args.owner, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftAllNftInfoQuery - extends MarsAccountNftReactQuery { - args: { - includeExpired?: boolean - tokenId: string - } -} -export function useMarsAccountNftAllNftInfoQuery({ - client, - args, - options, -}: MarsAccountNftAllNftInfoQuery) { - return useQuery( - marsAccountNftQueryKeys.allNftInfo(client?.contractAddress, args), - () => - client - ? client.allNftInfo({ - includeExpired: args.includeExpired, - tokenId: args.tokenId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftNftInfoQuery - extends MarsAccountNftReactQuery { - args: { - tokenId: string - } -} -export function useMarsAccountNftNftInfoQuery({ - client, - args, - options, -}: MarsAccountNftNftInfoQuery) { - return useQuery( - marsAccountNftQueryKeys.nftInfo(client?.contractAddress, args), - () => - client - ? client.nftInfo({ - tokenId: args.tokenId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftContractInfoQuery - extends MarsAccountNftReactQuery {} -export function useMarsAccountNftContractInfoQuery({ - client, - options, -}: MarsAccountNftContractInfoQuery) { - return useQuery( - marsAccountNftQueryKeys.contractInfo(client?.contractAddress), - () => (client ? client.contractInfo() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftNumTokensQuery - extends MarsAccountNftReactQuery {} -export function useMarsAccountNftNumTokensQuery({ - client, - options, -}: MarsAccountNftNumTokensQuery) { - return useQuery( - marsAccountNftQueryKeys.numTokens(client?.contractAddress), - () => (client ? client.numTokens() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftAllOperatorsQuery - extends MarsAccountNftReactQuery { - args: { - includeExpired?: boolean - limit?: number - owner: string - startAfter?: string - } -} -export function useMarsAccountNftAllOperatorsQuery({ - client, - args, - options, -}: MarsAccountNftAllOperatorsQuery) { - return useQuery( - marsAccountNftQueryKeys.allOperators(client?.contractAddress, args), - () => - client - ? client.allOperators({ - includeExpired: args.includeExpired, - limit: args.limit, - owner: args.owner, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftApprovalsQuery - extends MarsAccountNftReactQuery { - args: { - includeExpired?: boolean - tokenId: string - } -} -export function useMarsAccountNftApprovalsQuery({ - client, - args, - options, -}: MarsAccountNftApprovalsQuery) { - return useQuery( - marsAccountNftQueryKeys.approvals(client?.contractAddress, args), - () => - client - ? client.approvals({ - includeExpired: args.includeExpired, - tokenId: args.tokenId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftApprovalQuery - extends MarsAccountNftReactQuery { - args: { - includeExpired?: boolean - spender: string - tokenId: string - } -} -export function useMarsAccountNftApprovalQuery({ - client, - args, - options, -}: MarsAccountNftApprovalQuery) { - return useQuery( - marsAccountNftQueryKeys.approval(client?.contractAddress, args), - () => - client - ? client.approval({ - includeExpired: args.includeExpired, - spender: args.spender, - tokenId: args.tokenId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftOwnerOfQuery - extends MarsAccountNftReactQuery { - args: { - includeExpired?: boolean - tokenId: string - } -} -export function useMarsAccountNftOwnerOfQuery({ - client, - args, - options, -}: MarsAccountNftOwnerOfQuery) { - return useQuery( - marsAccountNftQueryKeys.ownerOf(client?.contractAddress, args), - () => - client - ? client.ownerOf({ - includeExpired: args.includeExpired, - tokenId: args.tokenId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftNextIdQuery extends MarsAccountNftReactQuery {} -export function useMarsAccountNftNextIdQuery({ - client, - options, -}: MarsAccountNftNextIdQuery) { - return useQuery( - marsAccountNftQueryKeys.nextId(client?.contractAddress), - () => (client ? client.nextId() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftConfigQuery - extends MarsAccountNftReactQuery {} -export function useMarsAccountNftConfigQuery({ - client, - options, -}: MarsAccountNftConfigQuery) { - return useQuery( - marsAccountNftQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsAccountNftRevokeAllMutation { - client: MarsAccountNftClient - msg: { - operator: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftRevokeAllMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.revokeAll(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftApproveAllMutation { - client: MarsAccountNftClient - msg: { - expires?: Expiration - operator: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftApproveAllMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.approveAll(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftRevokeMutation { - client: MarsAccountNftClient - msg: { - spender: string - tokenId: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftRevokeMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.revoke(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftApproveMutation { - client: MarsAccountNftClient - msg: { - expires?: Expiration - spender: string - tokenId: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftApproveMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.approve(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftSendNftMutation { - client: MarsAccountNftClient - msg: { - contract: string - msg: Binary - tokenId: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftSendNftMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.sendNft(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftTransferNftMutation { - client: MarsAccountNftClient - msg: { - recipient: string - tokenId: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftTransferNftMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.transferNft(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftBurnMutation { - client: MarsAccountNftClient - msg: { - tokenId: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftBurnMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.burn(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftMintMutation { - client: MarsAccountNftClient - msg: { - user: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftMintMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.mint(msg, fee, memo, funds), - options, - ) -} -export interface MarsAccountNftAcceptMinterRoleMutation { - client: MarsAccountNftClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftAcceptMinterRoleMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, args: { fee, memo, funds } = {} }) => client.acceptMinterRole(fee, memo, funds), - options, - ) -} -export interface MarsAccountNftUpdateConfigMutation { - client: MarsAccountNftClient - msg: { - updates: NftConfigUpdates - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsAccountNftUpdateConfigMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateConfig(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts deleted file mode 100644 index 907f8a1d..00000000 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts +++ /dev/null @@ -1,724 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { StdFee } from '@cosmjs/amino' - -import { - Action, - ActionAmount, - ActionCoin, - Addr, - ArrayOfCoin, - ArrayOfCoinBalanceResponseItem, - ArrayOfDebtShares, - ArrayOfLentShares, - ArrayOfSharesResponseItem, - ArrayOfString, - ArrayOfVaultInfoResponse, - ArrayOfVaultPositionResponseItem, - ArrayOfVaultWithBalance, - CallbackMsg, - Coin, - CoinBalanceResponseItem, - CoinValue, - ConfigResponse, - ConfigUpdates, - DebtAmount, - DebtShares, - Decimal, - ExecuteMsg, - HealthContractBaseForString, - InstantiateMsg, - LentAmount, - LentShares, - LockingVaultAmount, - NftConfigUpdates, - OracleBaseForString, - OwnerUpdate, - Positions, - QueryMsg, - RedBankBaseForString, - SharesResponseItem, - SwapperBaseForString, - Uint128, - UnlockingPositions, - VaultAmount, - VaultAmount1, - VaultBaseForAddr, - VaultBaseForString, - VaultConfig, - VaultInfoResponse, - VaultInstantiateConfig, - VaultPosition, - VaultPositionAmount, - VaultPositionResponseItem, - VaultPositionType, - VaultPositionValue, - VaultUnlockingPosition, - VaultWithBalance, - ZapperBaseForString, -} from './MarsCreditManager.types' -import { MarsCreditManagerClient, MarsCreditManagerQueryClient } from './MarsCreditManager.client' -export const marsCreditManagerQueryKeys = { - contract: [ - { - contract: 'marsCreditManager', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsCreditManagerQueryKeys.contract[0], address: contractAddress }] as const, - config: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }, - ] as const, - vaultInfo: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'vault_info', args }, - ] as const, - vaultsInfo: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'vaults_info', args }, - ] as const, - allowedCoins: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_coins', args }, - ] as const, - positions: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args }, - ] as const, - allCoinBalances: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_coin_balances', - args, - }, - ] as const, - allDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_debt_shares', - args, - }, - ] as const, - totalDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_debt_shares', - args, - }, - ] as const, - allTotalDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_debt_shares', - args, - }, - ] as const, - allLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_lent_shares', - args, - }, - ] as const, - totalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_lent_shares', - args, - }, - ] as const, - allTotalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_lent_shares', - args, - }, - ] as const, - allVaultPositions: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_vault_positions', - args, - }, - ] as const, - totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_vault_coin_balance', - args, - }, - ] as const, - allTotalVaultCoinBalances: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_vault_coin_balances', - args, - }, - ] as const, - estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'estimate_provide_liquidity', - args, - }, - ] as const, - estimateWithdrawLiquidity: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'estimate_withdraw_liquidity', - args, - }, - ] as const, - vaultPositionValue: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'vault_position_value', - args, - }, - ] as const, -} -export interface MarsCreditManagerReactQuery { - client: MarsCreditManagerQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsCreditManagerVaultPositionValueQuery - extends MarsCreditManagerReactQuery { - args: { - vaultPosition: VaultPosition - } -} -export function useMarsCreditManagerVaultPositionValueQuery({ - client, - args, - options, -}: MarsCreditManagerVaultPositionValueQuery) { - return useQuery( - marsCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args), - () => - client - ? client.vaultPositionValue({ - vaultPosition: args.vaultPosition, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerEstimateWithdrawLiquidityQuery - extends MarsCreditManagerReactQuery { - args: { - lpToken: Coin - } -} -export function useMarsCreditManagerEstimateWithdrawLiquidityQuery({ - client, - args, - options, -}: MarsCreditManagerEstimateWithdrawLiquidityQuery) { - return useQuery( - marsCreditManagerQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateWithdrawLiquidity({ - lpToken: args.lpToken, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerEstimateProvideLiquidityQuery - extends MarsCreditManagerReactQuery { - args: { - coinsIn: Coin[] - lpTokenOut: string - } -} -export function useMarsCreditManagerEstimateProvideLiquidityQuery({ - client, - args, - options, -}: MarsCreditManagerEstimateProvideLiquidityQuery) { - return useQuery( - marsCreditManagerQueryKeys.estimateProvideLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateProvideLiquidity({ - coinsIn: args.coinsIn, - lpTokenOut: args.lpTokenOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllTotalVaultCoinBalancesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: VaultBaseForString - } -} -export function useMarsCreditManagerAllTotalVaultCoinBalancesQuery< - TData = ArrayOfVaultWithBalance, ->({ client, args, options }: MarsCreditManagerAllTotalVaultCoinBalancesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allTotalVaultCoinBalances(client?.contractAddress, args), - () => - client - ? client.allTotalVaultCoinBalances({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerTotalVaultCoinBalanceQuery - extends MarsCreditManagerReactQuery { - args: { - vault: VaultBaseForString - } -} -export function useMarsCreditManagerTotalVaultCoinBalanceQuery({ - client, - args, - options, -}: MarsCreditManagerTotalVaultCoinBalanceQuery) { - return useQuery( - marsCreditManagerQueryKeys.totalVaultCoinBalance(client?.contractAddress, args), - () => - client - ? client.totalVaultCoinBalance({ - vault: args.vault, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllVaultPositionsQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsCreditManagerAllVaultPositionsQuery< - TData = ArrayOfVaultPositionResponseItem, ->({ client, args, options }: MarsCreditManagerAllVaultPositionsQuery) { - return useQuery( - marsCreditManagerQueryKeys.allVaultPositions(client?.contractAddress, args), - () => - client - ? client.allVaultPositions({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllTotalLentSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsCreditManagerAllTotalLentSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllTotalLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args), - () => - client - ? client.allTotalLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerTotalLentSharesQuery - extends MarsCreditManagerReactQuery {} -export function useMarsCreditManagerTotalLentSharesQuery({ - client, - options, -}: MarsCreditManagerTotalLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.totalLentShares(client?.contractAddress), - () => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllLentSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsCreditManagerAllLentSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allLentShares(client?.contractAddress, args), - () => - client - ? client.allLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllTotalDebtSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsCreditManagerAllTotalDebtSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllTotalDebtSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args), - () => - client - ? client.allTotalDebtShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerTotalDebtSharesQuery - extends MarsCreditManagerReactQuery {} -export function useMarsCreditManagerTotalDebtSharesQuery({ - client, - options, -}: MarsCreditManagerTotalDebtSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.totalDebtShares(client?.contractAddress), - () => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllDebtSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsCreditManagerAllDebtSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllDebtSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allDebtShares(client?.contractAddress, args), - () => - client - ? client.allDebtShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllCoinBalancesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsCreditManagerAllCoinBalancesQuery({ - client, - args, - options, -}: MarsCreditManagerAllCoinBalancesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allCoinBalances(client?.contractAddress, args), - () => - client - ? client.allCoinBalances({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerPositionsQuery - extends MarsCreditManagerReactQuery { - args: { - accountId: string - } -} -export function useMarsCreditManagerPositionsQuery({ - client, - args, - options, -}: MarsCreditManagerPositionsQuery) { - return useQuery( - marsCreditManagerQueryKeys.positions(client?.contractAddress, args), - () => - client - ? client.positions({ - accountId: args.accountId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllowedCoinsQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsCreditManagerAllowedCoinsQuery({ - client, - args, - options, -}: MarsCreditManagerAllowedCoinsQuery) { - return useQuery( - marsCreditManagerQueryKeys.allowedCoins(client?.contractAddress, args), - () => - client - ? client.allowedCoins({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerVaultsInfoQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: VaultBaseForString - } -} -export function useMarsCreditManagerVaultsInfoQuery({ - client, - args, - options, -}: MarsCreditManagerVaultsInfoQuery) { - return useQuery( - marsCreditManagerQueryKeys.vaultsInfo(client?.contractAddress, args), - () => - client - ? client.vaultsInfo({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerVaultInfoQuery - extends MarsCreditManagerReactQuery { - args: { - vault: VaultBaseForString - } -} -export function useMarsCreditManagerVaultInfoQuery({ - client, - args, - options, -}: MarsCreditManagerVaultInfoQuery) { - return useQuery( - marsCreditManagerQueryKeys.vaultInfo(client?.contractAddress, args), - () => - client - ? client.vaultInfo({ - vault: args.vault, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerConfigQuery - extends MarsCreditManagerReactQuery {} -export function useMarsCreditManagerConfigQuery({ - client, - options, -}: MarsCreditManagerConfigQuery) { - return useQuery( - marsCreditManagerQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerCallbackMutation { - client: MarsCreditManagerClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsCreditManagerCallbackMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds), - options, - ) -} -export interface MarsCreditManagerUpdateNftConfigMutation { - client: MarsCreditManagerClient - msg: { - updates: NftConfigUpdates - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsCreditManagerUpdateNftConfigMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateNftConfig(msg, fee, memo, funds), - options, - ) -} -export interface MarsCreditManagerUpdateOwnerMutation { - client: MarsCreditManagerClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsCreditManagerUpdateOwnerMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} -export interface MarsCreditManagerUpdateConfigMutation { - client: MarsCreditManagerClient - msg: { - updates: ConfigUpdates - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsCreditManagerUpdateConfigMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateConfig(msg, fee, memo, funds), - options, - ) -} -export interface MarsCreditManagerUpdateCreditAccountMutation { - client: MarsCreditManagerClient - msg: { - accountId: string - actions: Action[] - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsCreditManagerUpdateCreditAccountMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateCreditAccount(msg, fee, memo, funds), - options, - ) -} -export interface MarsCreditManagerCreateCreditAccountMutation { - client: MarsCreditManagerClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsCreditManagerCreateCreditAccountMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, args: { fee, memo, funds } = {} }) => client.createCreditAccount(fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts b/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts deleted file mode 100644 index 7a80faca..00000000 --- a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts +++ /dev/null @@ -1,659 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { StdFee } from '@cosmjs/amino' - -import { - Addr, - ArrayOfCoin, - ArrayOfCoinBalanceResponseItem, - ArrayOfDebtShares, - ArrayOfLentShares, - ArrayOfSharesResponseItem, - ArrayOfString, - ArrayOfVaultInfoResponse, - ArrayOfVaultPositionResponseItem, - ArrayOfVaultWithBalance, - Coin, - CoinBalanceResponseItem, - CoinValue, - ConfigResponse, - DebtAmount, - DebtShares, - Decimal, - ExecuteMsg, - InstantiateMsg, - LentAmount, - LentShares, - LockingVaultAmount, - Positions, - QueryMsg, - SharesResponseItem, - Uint128, - UnlockingPositions, - VaultAmount, - VaultAmount1, - VaultBaseForAddr, - VaultBaseForString, - VaultConfig, - VaultInfoResponse, - VaultPosition, - VaultPositionAmount, - VaultPositionResponseItem, - VaultPositionValue, - VaultUnlockingPosition, - VaultWithBalance, -} from './MarsMockCreditManager.types' -import { - MarsMockCreditManagerClient, - MarsMockCreditManagerQueryClient, -} from './MarsMockCreditManager.client' -export const marsMockCreditManagerQueryKeys = { - contract: [ - { - contract: 'marsMockCreditManager', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsMockCreditManagerQueryKeys.contract[0], address: contractAddress }] as const, - config: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }, - ] as const, - vaultInfo: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'vault_info', args }, - ] as const, - vaultsInfo: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'vaults_info', - args, - }, - ] as const, - allowedCoins: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'allowed_coins', - args, - }, - ] as const, - positions: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args }, - ] as const, - allCoinBalances: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_coin_balances', - args, - }, - ] as const, - allDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_debt_shares', - args, - }, - ] as const, - totalDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_debt_shares', - args, - }, - ] as const, - allTotalDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_debt_shares', - args, - }, - ] as const, - allLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_lent_shares', - args, - }, - ] as const, - totalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_lent_shares', - args, - }, - ] as const, - allTotalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_lent_shares', - args, - }, - ] as const, - allVaultPositions: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_vault_positions', - args, - }, - ] as const, - totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_vault_coin_balance', - args, - }, - ] as const, - allTotalVaultCoinBalances: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_vault_coin_balances', - args, - }, - ] as const, - estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'estimate_provide_liquidity', - args, - }, - ] as const, - estimateWithdrawLiquidity: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'estimate_withdraw_liquidity', - args, - }, - ] as const, - vaultPositionValue: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'vault_position_value', - args, - }, - ] as const, -} -export interface MarsMockCreditManagerReactQuery { - client: MarsMockCreditManagerQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsMockCreditManagerVaultPositionValueQuery - extends MarsMockCreditManagerReactQuery { - args: { - vaultPosition: VaultPosition - } -} -export function useMarsMockCreditManagerVaultPositionValueQuery({ - client, - args, - options, -}: MarsMockCreditManagerVaultPositionValueQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args), - () => - client - ? client.vaultPositionValue({ - vaultPosition: args.vaultPosition, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerEstimateWithdrawLiquidityQuery - extends MarsMockCreditManagerReactQuery { - args: { - lpToken: Coin - } -} -export function useMarsMockCreditManagerEstimateWithdrawLiquidityQuery({ - client, - args, - options, -}: MarsMockCreditManagerEstimateWithdrawLiquidityQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateWithdrawLiquidity({ - lpToken: args.lpToken, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerEstimateProvideLiquidityQuery - extends MarsMockCreditManagerReactQuery { - args: { - coinsIn: Coin[] - lpTokenOut: string - } -} -export function useMarsMockCreditManagerEstimateProvideLiquidityQuery({ - client, - args, - options, -}: MarsMockCreditManagerEstimateProvideLiquidityQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.estimateProvideLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateProvideLiquidity({ - coinsIn: args.coinsIn, - lpTokenOut: args.lpTokenOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllTotalVaultCoinBalancesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: VaultBaseForString - } -} -export function useMarsMockCreditManagerAllTotalVaultCoinBalancesQuery< - TData = ArrayOfVaultWithBalance, ->({ client, args, options }: MarsMockCreditManagerAllTotalVaultCoinBalancesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allTotalVaultCoinBalances(client?.contractAddress, args), - () => - client - ? client.allTotalVaultCoinBalances({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerTotalVaultCoinBalanceQuery - extends MarsMockCreditManagerReactQuery { - args: { - vault: VaultBaseForString - } -} -export function useMarsMockCreditManagerTotalVaultCoinBalanceQuery({ - client, - args, - options, -}: MarsMockCreditManagerTotalVaultCoinBalanceQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.totalVaultCoinBalance(client?.contractAddress, args), - () => - client - ? client.totalVaultCoinBalance({ - vault: args.vault, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllVaultPositionsQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllVaultPositionsQuery< - TData = ArrayOfVaultPositionResponseItem, ->({ client, args, options }: MarsMockCreditManagerAllVaultPositionsQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allVaultPositions(client?.contractAddress, args), - () => - client - ? client.allVaultPositions({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllTotalLentSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsMockCreditManagerAllTotalLentSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllTotalLentSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args), - () => - client - ? client.allTotalLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerTotalLentSharesQuery - extends MarsMockCreditManagerReactQuery {} -export function useMarsMockCreditManagerTotalLentSharesQuery({ - client, - options, -}: MarsMockCreditManagerTotalLentSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.totalLentShares(client?.contractAddress), - () => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllLentSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllLentSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllLentSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allLentShares(client?.contractAddress, args), - () => - client - ? client.allLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllTotalDebtSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsMockCreditManagerAllTotalDebtSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllTotalDebtSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args), - () => - client - ? client.allTotalDebtShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerTotalDebtSharesQuery - extends MarsMockCreditManagerReactQuery {} -export function useMarsMockCreditManagerTotalDebtSharesQuery({ - client, - options, -}: MarsMockCreditManagerTotalDebtSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.totalDebtShares(client?.contractAddress), - () => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllDebtSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllDebtSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllDebtSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allDebtShares(client?.contractAddress, args), - () => - client - ? client.allDebtShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllCoinBalancesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllCoinBalancesQuery< - TData = ArrayOfCoinBalanceResponseItem, ->({ client, args, options }: MarsMockCreditManagerAllCoinBalancesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allCoinBalances(client?.contractAddress, args), - () => - client - ? client.allCoinBalances({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerPositionsQuery - extends MarsMockCreditManagerReactQuery { - args: { - accountId: string - } -} -export function useMarsMockCreditManagerPositionsQuery({ - client, - args, - options, -}: MarsMockCreditManagerPositionsQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.positions(client?.contractAddress, args), - () => - client - ? client.positions({ - accountId: args.accountId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllowedCoinsQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsMockCreditManagerAllowedCoinsQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllowedCoinsQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allowedCoins(client?.contractAddress, args), - () => - client - ? client.allowedCoins({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerVaultsInfoQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: VaultBaseForString - } -} -export function useMarsMockCreditManagerVaultsInfoQuery({ - client, - args, - options, -}: MarsMockCreditManagerVaultsInfoQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.vaultsInfo(client?.contractAddress, args), - () => - client - ? client.vaultsInfo({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerVaultInfoQuery - extends MarsMockCreditManagerReactQuery { - args: { - vault: VaultBaseForString - } -} -export function useMarsMockCreditManagerVaultInfoQuery({ - client, - args, - options, -}: MarsMockCreditManagerVaultInfoQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.vaultInfo(client?.contractAddress, args), - () => - client - ? client.vaultInfo({ - vault: args.vault, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerConfigQuery - extends MarsMockCreditManagerReactQuery {} -export function useMarsMockCreditManagerConfigQuery({ - client, - options, -}: MarsMockCreditManagerConfigQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerSetVaultConfigMutation { - client: MarsMockCreditManagerClient - msg: { - address: string - config: VaultConfig - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockCreditManagerSetVaultConfigMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.setVaultConfig(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockCreditManagerSetAllowedCoinsMutation { - client: MarsMockCreditManagerClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockCreditManagerSetAllowedCoinsMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, args: { fee, memo, funds } = {} }) => client.setAllowedCoins(fee, memo, funds), - options, - ) -} -export interface MarsMockCreditManagerSetPositionsResponseMutation { - client: MarsMockCreditManagerClient - msg: { - accountId: string - positions: Positions - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockCreditManagerSetPositionsResponseMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.setPositionsResponse(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts b/src/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts deleted file mode 100644 index e8ce1fa9..00000000 --- a/src/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts +++ /dev/null @@ -1,85 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { Coin, StdFee } from '@cosmjs/amino' - -import { - CoinPrice, - Decimal, - ExecuteMsg, - InstantiateMsg, - PriceResponse, - QueryMsg, -} from './MarsMockOracle.types' -import { MarsMockOracleClient, MarsMockOracleQueryClient } from './MarsMockOracle.client' -export const marsMockOracleQueryKeys = { - contract: [ - { - contract: 'marsMockOracle', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsMockOracleQueryKeys.contract[0], address: contractAddress }] as const, - price: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockOracleQueryKeys.address(contractAddress)[0], method: 'price', args }] as const, -} -export interface MarsMockOracleReactQuery { - client: MarsMockOracleQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsMockOraclePriceQuery - extends MarsMockOracleReactQuery { - args: { - denom: string - } -} -export function useMarsMockOraclePriceQuery({ - client, - args, - options, -}: MarsMockOraclePriceQuery) { - return useQuery( - marsMockOracleQueryKeys.price(client?.contractAddress, args), - () => - client - ? client.price({ - denom: args.denom, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockOracleChangePriceMutation { - client: MarsMockOracleClient - msg: { - denom: string - price: Decimal - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockOracleChangePriceMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.changePrice(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts b/src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts deleted file mode 100644 index 31e76458..00000000 --- a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts +++ /dev/null @@ -1,735 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { Coin, StdFee } from '@cosmjs/amino' - -import { - ArrayOfMarket, - ArrayOfUncollateralizedLoanLimitResponse, - ArrayOfUserCollateralResponse, - ArrayOfUserDebtResponse, - CoinMarketInfo, - ConfigResponse, - CreateOrUpdateConfig, - Decimal, - ExecuteMsg, - InitOrUpdateAssetParams, - InstantiateMsg, - InterestRateModel, - Market, - OwnerUpdate, - QueryMsg, - Uint128, - UncollateralizedLoanLimitResponse, - UserCollateralResponse, - UserDebtResponse, - UserHealthStatus, - UserPositionResponse, -} from './MarsMockRedBank.types' -import { MarsMockRedBankClient, MarsMockRedBankQueryClient } from './MarsMockRedBank.client' -export const marsMockRedBankQueryKeys = { - contract: [ - { - contract: 'marsMockRedBank', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsMockRedBankQueryKeys.contract[0], address: contractAddress }] as const, - config: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'config', args }] as const, - market: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const, - markets: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'markets', args }] as const, - uncollateralizedLoanLimit: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'uncollateralized_loan_limit', - args, - }, - ] as const, - uncollateralizedLoanLimits: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'uncollateralized_loan_limits', - args, - }, - ] as const, - userDebt: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_debt', args }, - ] as const, - userDebts: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_debts', args }, - ] as const, - userCollateral: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collateral', args }, - ] as const, - userCollaterals: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args }, - ] as const, - userPosition: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args }, - ] as const, - scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'scaled_liquidity_amount', - args, - }, - ] as const, - scaledDebtAmount: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'scaled_debt_amount', - args, - }, - ] as const, - underlyingLiquidityAmount: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'underlying_liquidity_amount', - args, - }, - ] as const, - underlyingDebtAmount: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'underlying_debt_amount', - args, - }, - ] as const, -} -export interface MarsMockRedBankReactQuery { - client: MarsMockRedBankQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsMockRedBankUnderlyingDebtAmountQuery - extends MarsMockRedBankReactQuery { - args: { - amountScaled: Uint128 - denom: string - } -} -export function useMarsMockRedBankUnderlyingDebtAmountQuery({ - client, - args, - options, -}: MarsMockRedBankUnderlyingDebtAmountQuery) { - return useQuery( - marsMockRedBankQueryKeys.underlyingDebtAmount(client?.contractAddress, args), - () => - client - ? client.underlyingDebtAmount({ - amountScaled: args.amountScaled, - denom: args.denom, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUnderlyingLiquidityAmountQuery - extends MarsMockRedBankReactQuery { - args: { - amountScaled: Uint128 - denom: string - } -} -export function useMarsMockRedBankUnderlyingLiquidityAmountQuery({ - client, - args, - options, -}: MarsMockRedBankUnderlyingLiquidityAmountQuery) { - return useQuery( - marsMockRedBankQueryKeys.underlyingLiquidityAmount(client?.contractAddress, args), - () => - client - ? client.underlyingLiquidityAmount({ - amountScaled: args.amountScaled, - denom: args.denom, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankScaledDebtAmountQuery - extends MarsMockRedBankReactQuery { - args: { - amount: Uint128 - denom: string - } -} -export function useMarsMockRedBankScaledDebtAmountQuery({ - client, - args, - options, -}: MarsMockRedBankScaledDebtAmountQuery) { - return useQuery( - marsMockRedBankQueryKeys.scaledDebtAmount(client?.contractAddress, args), - () => - client - ? client.scaledDebtAmount({ - amount: args.amount, - denom: args.denom, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankScaledLiquidityAmountQuery - extends MarsMockRedBankReactQuery { - args: { - amount: Uint128 - denom: string - } -} -export function useMarsMockRedBankScaledLiquidityAmountQuery({ - client, - args, - options, -}: MarsMockRedBankScaledLiquidityAmountQuery) { - return useQuery( - marsMockRedBankQueryKeys.scaledLiquidityAmount(client?.contractAddress, args), - () => - client - ? client.scaledLiquidityAmount({ - amount: args.amount, - denom: args.denom, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUserPositionQuery - extends MarsMockRedBankReactQuery { - args: { - user: string - } -} -export function useMarsMockRedBankUserPositionQuery({ - client, - args, - options, -}: MarsMockRedBankUserPositionQuery) { - return useQuery( - marsMockRedBankQueryKeys.userPosition(client?.contractAddress, args), - () => - client - ? client.userPosition({ - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUserCollateralsQuery - extends MarsMockRedBankReactQuery { - args: { - limit?: number - startAfter?: string - user: string - } -} -export function useMarsMockRedBankUserCollateralsQuery({ - client, - args, - options, -}: MarsMockRedBankUserCollateralsQuery) { - return useQuery( - marsMockRedBankQueryKeys.userCollaterals(client?.contractAddress, args), - () => - client - ? client.userCollaterals({ - limit: args.limit, - startAfter: args.startAfter, - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUserCollateralQuery - extends MarsMockRedBankReactQuery { - args: { - denom: string - user: string - } -} -export function useMarsMockRedBankUserCollateralQuery({ - client, - args, - options, -}: MarsMockRedBankUserCollateralQuery) { - return useQuery( - marsMockRedBankQueryKeys.userCollateral(client?.contractAddress, args), - () => - client - ? client.userCollateral({ - denom: args.denom, - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUserDebtsQuery - extends MarsMockRedBankReactQuery { - args: { - limit?: number - startAfter?: string - user: string - } -} -export function useMarsMockRedBankUserDebtsQuery({ - client, - args, - options, -}: MarsMockRedBankUserDebtsQuery) { - return useQuery( - marsMockRedBankQueryKeys.userDebts(client?.contractAddress, args), - () => - client - ? client.userDebts({ - limit: args.limit, - startAfter: args.startAfter, - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUserDebtQuery - extends MarsMockRedBankReactQuery { - args: { - denom: string - user: string - } -} -export function useMarsMockRedBankUserDebtQuery({ - client, - args, - options, -}: MarsMockRedBankUserDebtQuery) { - return useQuery( - marsMockRedBankQueryKeys.userDebt(client?.contractAddress, args), - () => - client - ? client.userDebt({ - denom: args.denom, - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUncollateralizedLoanLimitsQuery - extends MarsMockRedBankReactQuery { - args: { - limit?: number - startAfter?: string - user: string - } -} -export function useMarsMockRedBankUncollateralizedLoanLimitsQuery< - TData = ArrayOfUncollateralizedLoanLimitResponse, ->({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitsQuery) { - return useQuery( - marsMockRedBankQueryKeys.uncollateralizedLoanLimits(client?.contractAddress, args), - () => - client - ? client.uncollateralizedLoanLimits({ - limit: args.limit, - startAfter: args.startAfter, - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUncollateralizedLoanLimitQuery - extends MarsMockRedBankReactQuery { - args: { - denom: string - user: string - } -} -export function useMarsMockRedBankUncollateralizedLoanLimitQuery< - TData = UncollateralizedLoanLimitResponse, ->({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitQuery) { - return useQuery( - marsMockRedBankQueryKeys.uncollateralizedLoanLimit(client?.contractAddress, args), - () => - client - ? client.uncollateralizedLoanLimit({ - denom: args.denom, - user: args.user, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankMarketsQuery - extends MarsMockRedBankReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsMockRedBankMarketsQuery({ - client, - args, - options, -}: MarsMockRedBankMarketsQuery) { - return useQuery( - marsMockRedBankQueryKeys.markets(client?.contractAddress, args), - () => - client - ? client.markets({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankMarketQuery - extends MarsMockRedBankReactQuery { - args: { - denom: string - } -} -export function useMarsMockRedBankMarketQuery({ - client, - args, - options, -}: MarsMockRedBankMarketQuery) { - return useQuery( - marsMockRedBankQueryKeys.market(client?.contractAddress, args), - () => - client - ? client.market({ - denom: args.denom, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankConfigQuery - extends MarsMockRedBankReactQuery {} -export function useMarsMockRedBankConfigQuery({ - client, - options, -}: MarsMockRedBankConfigQuery) { - return useQuery( - marsMockRedBankQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockRedBankUpdateAssetCollateralStatusMutation { - client: MarsMockRedBankClient - msg: { - denom: string - enable: boolean - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankUpdateAssetCollateralStatusMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateAssetCollateralStatus(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankLiquidateMutation { - client: MarsMockRedBankClient - msg: { - collateralDenom: string - recipient?: string - user: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankLiquidateMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.liquidate(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankRepayMutation { - client: MarsMockRedBankClient - msg: { - onBehalfOf?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankRepayMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.repay(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankBorrowMutation { - client: MarsMockRedBankClient - msg: { - amount: Uint128 - denom: string - recipient?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankBorrowMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.borrow(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankWithdrawMutation { - client: MarsMockRedBankClient - msg: { - amount?: Uint128 - denom: string - recipient?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankWithdrawMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.withdraw(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankDepositMutation { - client: MarsMockRedBankClient - msg: { - onBehalfOf?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankDepositMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.deposit(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankUpdateUncollateralizedLoanLimitMutation { - client: MarsMockRedBankClient - msg: { - denom: string - newLimit: Uint128 - user: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankUpdateUncollateralizedLoanLimitMutation( - options?: Omit< - UseMutationOptions< - ExecuteResult, - Error, - MarsMockRedBankUpdateUncollateralizedLoanLimitMutation - >, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateUncollateralizedLoanLimit(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankUpdateAssetMutation { - client: MarsMockRedBankClient - msg: { - denom: string - params: InitOrUpdateAssetParams - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankUpdateAssetMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateAsset(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankInitAssetMutation { - client: MarsMockRedBankClient - msg: { - denom: string - params: InitOrUpdateAssetParams - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankInitAssetMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.initAsset(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankUpdateConfigMutation { - client: MarsMockRedBankClient - msg: { - config: CreateOrUpdateConfig - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankUpdateConfigMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateConfig(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankUpdateEmergencyOwnerMutation { - client: MarsMockRedBankClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankUpdateEmergencyOwnerMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateEmergencyOwner(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockRedBankUpdateOwnerMutation { - client: MarsMockRedBankClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockRedBankUpdateOwnerMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts b/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts deleted file mode 100644 index b8cd52c5..00000000 --- a/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts +++ /dev/null @@ -1,302 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { Coin, StdFee } from '@cosmjs/amino' - -import { - Duration, - Empty, - ExecuteMsg, - ExtensionExecuteMsg, - ExtensionQueryMsg, - ForceUnlockExecuteMsg, - InstantiateMsg, - LockupExecuteMsg, - LockupQueryMsg, - OracleBaseForString, - QueryMsg, - Uint128, - VaultInfoResponse, - VaultStandardInfoResponse, -} from './MarsMockVault.types' -import { MarsMockVaultClient, MarsMockVaultQueryClient } from './MarsMockVault.client' -export const marsMockVaultQueryKeys = { - contract: [ - { - contract: 'marsMockVault', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsMockVaultQueryKeys.contract[0], address: contractAddress }] as const, - vaultStandardInfo: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockVaultQueryKeys.address(contractAddress)[0], - method: 'vault_standard_info', - args, - }, - ] as const, - info: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'info', args }] as const, - previewDeposit: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'preview_deposit', args }, - ] as const, - previewRedeem: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'preview_redeem', args }, - ] as const, - totalAssets: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'total_assets', args }, - ] as const, - totalVaultTokenSupply: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockVaultQueryKeys.address(contractAddress)[0], - method: 'total_vault_token_supply', - args, - }, - ] as const, - convertToShares: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'convert_to_shares', args }, - ] as const, - convertToAssets: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'convert_to_assets', args }, - ] as const, - vaultExtension: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'vault_extension', args }, - ] as const, -} -export interface MarsMockVaultReactQuery { - client: MarsMockVaultQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsMockVaultVaultExtensionQuery - extends MarsMockVaultReactQuery {} -export function useMarsMockVaultVaultExtensionQuery({ - client, - options, -}: MarsMockVaultVaultExtensionQuery) { - return useQuery( - marsMockVaultQueryKeys.vaultExtension(client?.contractAddress), - () => (client ? client.vaultExtension() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultConvertToAssetsQuery - extends MarsMockVaultReactQuery { - args: { - amount: Uint128 - } -} -export function useMarsMockVaultConvertToAssetsQuery({ - client, - args, - options, -}: MarsMockVaultConvertToAssetsQuery) { - return useQuery( - marsMockVaultQueryKeys.convertToAssets(client?.contractAddress, args), - () => - client - ? client.convertToAssets({ - amount: args.amount, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultConvertToSharesQuery - extends MarsMockVaultReactQuery { - args: { - amount: Uint128 - } -} -export function useMarsMockVaultConvertToSharesQuery({ - client, - args, - options, -}: MarsMockVaultConvertToSharesQuery) { - return useQuery( - marsMockVaultQueryKeys.convertToShares(client?.contractAddress, args), - () => - client - ? client.convertToShares({ - amount: args.amount, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultTotalVaultTokenSupplyQuery - extends MarsMockVaultReactQuery {} -export function useMarsMockVaultTotalVaultTokenSupplyQuery({ - client, - options, -}: MarsMockVaultTotalVaultTokenSupplyQuery) { - return useQuery( - marsMockVaultQueryKeys.totalVaultTokenSupply(client?.contractAddress), - () => (client ? client.totalVaultTokenSupply() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultTotalAssetsQuery - extends MarsMockVaultReactQuery {} -export function useMarsMockVaultTotalAssetsQuery({ - client, - options, -}: MarsMockVaultTotalAssetsQuery) { - return useQuery( - marsMockVaultQueryKeys.totalAssets(client?.contractAddress), - () => (client ? client.totalAssets() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultPreviewRedeemQuery - extends MarsMockVaultReactQuery { - args: { - amount: Uint128 - } -} -export function useMarsMockVaultPreviewRedeemQuery({ - client, - args, - options, -}: MarsMockVaultPreviewRedeemQuery) { - return useQuery( - marsMockVaultQueryKeys.previewRedeem(client?.contractAddress, args), - () => - client - ? client.previewRedeem({ - amount: args.amount, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultPreviewDepositQuery - extends MarsMockVaultReactQuery { - args: { - amount: Uint128 - } -} -export function useMarsMockVaultPreviewDepositQuery({ - client, - args, - options, -}: MarsMockVaultPreviewDepositQuery) { - return useQuery( - marsMockVaultQueryKeys.previewDeposit(client?.contractAddress, args), - () => - client - ? client.previewDeposit({ - amount: args.amount, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultInfoQuery - extends MarsMockVaultReactQuery {} -export function useMarsMockVaultInfoQuery({ - client, - options, -}: MarsMockVaultInfoQuery) { - return useQuery( - marsMockVaultQueryKeys.info(client?.contractAddress), - () => (client ? client.info() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultVaultStandardInfoQuery - extends MarsMockVaultReactQuery {} -export function useMarsMockVaultVaultStandardInfoQuery({ - client, - options, -}: MarsMockVaultVaultStandardInfoQuery) { - return useQuery( - marsMockVaultQueryKeys.vaultStandardInfo(client?.contractAddress), - () => (client ? client.vaultStandardInfo() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockVaultVaultExtensionMutation { - client: MarsMockVaultClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockVaultVaultExtensionMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.vaultExtension(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockVaultRedeemMutation { - client: MarsMockVaultClient - msg: { - amount: Uint128 - recipient?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockVaultRedeemMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.redeem(msg, fee, memo, funds), - options, - ) -} -export interface MarsMockVaultDepositMutation { - client: MarsMockVaultClient - msg: { - amount: Uint128 - recipient?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsMockVaultDepositMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.deposit(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts deleted file mode 100644 index abe25853..00000000 --- a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { - Addr, - Coin, - CoinValue, - DebtAmount, - Decimal, - DenomsData, - HealthComputer, - InterestRateModel, - LentAmount, - LockingVaultAmount, - Market, - Positions, - Uint128, - UnlockingPositions, - VaultAmount, - VaultAmount1, - VaultBaseForAddr, - VaultConfig, - VaultPosition, - VaultPositionAmount, - VaultPositionValue, - VaultsData, - VaultUnlockingPosition, -} from './MarsRoverHealthComputer.types' -import './MarsRoverHealthComputer.client' diff --git a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts b/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts deleted file mode 100644 index 80e6beec..00000000 --- a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts +++ /dev/null @@ -1,128 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { Coin, StdFee } from '@cosmjs/amino' - -import { - ConfigResponse, - Decimal, - ExecuteMsg, - HealthResponse, - InstantiateMsg, - OwnerResponse, - OwnerUpdate, - QueryMsg, - Uint128, -} from './MarsRoverHealthTypes.types' -import { - MarsRoverHealthTypesClient, - MarsRoverHealthTypesQueryClient, -} from './MarsRoverHealthTypes.client' -export const marsRoverHealthTypesQueryKeys = { - contract: [ - { - contract: 'marsRoverHealthTypes', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsRoverHealthTypesQueryKeys.contract[0], address: contractAddress }] as const, - health: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'health', args }, - ] as const, - config: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'config', args }, - ] as const, -} -export interface MarsRoverHealthTypesReactQuery { - client: MarsRoverHealthTypesQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsRoverHealthTypesConfigQuery - extends MarsRoverHealthTypesReactQuery {} -export function useMarsRoverHealthTypesConfigQuery({ - client, - options, -}: MarsRoverHealthTypesConfigQuery) { - return useQuery( - marsRoverHealthTypesQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsRoverHealthTypesHealthQuery - extends MarsRoverHealthTypesReactQuery { - args: { - accountId: string - } -} -export function useMarsRoverHealthTypesHealthQuery({ - client, - args, - options, -}: MarsRoverHealthTypesHealthQuery) { - return useQuery( - marsRoverHealthTypesQueryKeys.health(client?.contractAddress, args), - () => - client - ? client.health({ - accountId: args.accountId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsRoverHealthTypesUpdateConfigMutation { - client: MarsRoverHealthTypesClient - msg: { - creditManager: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsRoverHealthTypesUpdateConfigMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateConfig(msg, fee, memo, funds), - options, - ) -} -export interface MarsRoverHealthTypesUpdateOwnerMutation { - client: MarsRoverHealthTypesClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsRoverHealthTypesUpdateOwnerMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts deleted file mode 100644 index 8d9ceb1d..00000000 --- a/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts +++ /dev/null @@ -1,235 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { StdFee } from '@cosmjs/amino' - -import { - Addr, - ArrayOfRouteResponseForEmpty, - Coin, - Decimal, - Empty, - EstimateExactInSwapResponse, - ExecuteMsg, - InstantiateMsg, - OwnerResponse, - OwnerUpdate, - QueryMsg, - RouteResponseForEmpty, - Uint128, -} from './MarsSwapperBase.types' -import { MarsSwapperBaseClient, MarsSwapperBaseQueryClient } from './MarsSwapperBase.client' -export const marsSwapperBaseQueryKeys = { - contract: [ - { - contract: 'marsSwapperBase', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsSwapperBaseQueryKeys.contract[0], address: contractAddress }] as const, - owner: (contractAddress: string | undefined, args?: Record) => - [{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const, - route: (contractAddress: string | undefined, args?: Record) => - [{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const, - routes: (contractAddress: string | undefined, args?: Record) => - [{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const, - estimateExactInSwap: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsSwapperBaseQueryKeys.address(contractAddress)[0], - method: 'estimate_exact_in_swap', - args, - }, - ] as const, -} -export interface MarsSwapperBaseReactQuery { - client: MarsSwapperBaseQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsSwapperBaseEstimateExactInSwapQuery - extends MarsSwapperBaseReactQuery { - args: { - coinIn: Coin - denomOut: string - } -} -export function useMarsSwapperBaseEstimateExactInSwapQuery({ - client, - args, - options, -}: MarsSwapperBaseEstimateExactInSwapQuery) { - return useQuery( - marsSwapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args), - () => - client - ? client.estimateExactInSwap({ - coinIn: args.coinIn, - denomOut: args.denomOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseRoutesQuery - extends MarsSwapperBaseReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsSwapperBaseRoutesQuery({ - client, - args, - options, -}: MarsSwapperBaseRoutesQuery) { - return useQuery( - marsSwapperBaseQueryKeys.routes(client?.contractAddress, args), - () => - client - ? client.routes({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseRouteQuery - extends MarsSwapperBaseReactQuery { - args: { - denomIn: string - denomOut: string - } -} -export function useMarsSwapperBaseRouteQuery({ - client, - args, - options, -}: MarsSwapperBaseRouteQuery) { - return useQuery( - marsSwapperBaseQueryKeys.route(client?.contractAddress, args), - () => - client - ? client.route({ - denomIn: args.denomIn, - denomOut: args.denomOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseOwnerQuery - extends MarsSwapperBaseReactQuery {} -export function useMarsSwapperBaseOwnerQuery({ - client, - options, -}: MarsSwapperBaseOwnerQuery) { - return useQuery( - marsSwapperBaseQueryKeys.owner(client?.contractAddress), - () => (client ? client.owner() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseTransferResultMutation { - client: MarsSwapperBaseClient - msg: { - denomIn: string - denomOut: string - recipient: Addr - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseTransferResultMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.transferResult(msg, fee, memo, funds), - options, - ) -} -export interface MarsSwapperBaseSwapExactInMutation { - client: MarsSwapperBaseClient - msg: { - coinIn: Coin - denomOut: string - slippage: Decimal - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseSwapExactInMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds), - options, - ) -} -export interface MarsSwapperBaseSetRouteMutation { - client: MarsSwapperBaseClient - msg: { - denomIn: string - denomOut: string - route: Empty - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseSetRouteMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds), - options, - ) -} -export interface MarsSwapperBaseUpdateOwnerMutation { - client: MarsSwapperBaseClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseUpdateOwnerMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-zapper-base/MarsZapperBase.react-query.ts b/src/types/generated/mars-zapper-base/MarsZapperBase.react-query.ts deleted file mode 100644 index d4cd28ff..00000000 --- a/src/types/generated/mars-zapper-base/MarsZapperBase.react-query.ts +++ /dev/null @@ -1,172 +0,0 @@ -// @ts-nocheck -/** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ - -import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' -import { StdFee } from '@cosmjs/amino' - -import { - Addr, - ArrayOfCoin, - CallbackMsg, - Coin, - ExecuteMsg, - InstantiateMsg, - QueryMsg, - Uint128, -} from './MarsZapperBase.types' -import { MarsZapperBaseClient, MarsZapperBaseQueryClient } from './MarsZapperBase.client' -export const marsZapperBaseQueryKeys = { - contract: [ - { - contract: 'marsZapperBase', - }, - ] as const, - address: (contractAddress: string | undefined) => - [{ ...marsZapperBaseQueryKeys.contract[0], address: contractAddress }] as const, - estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsZapperBaseQueryKeys.address(contractAddress)[0], - method: 'estimate_provide_liquidity', - args, - }, - ] as const, - estimateWithdrawLiquidity: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsZapperBaseQueryKeys.address(contractAddress)[0], - method: 'estimate_withdraw_liquidity', - args, - }, - ] as const, -} -export interface MarsZapperBaseReactQuery { - client: MarsZapperBaseQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsZapperBaseEstimateWithdrawLiquidityQuery - extends MarsZapperBaseReactQuery { - args: { - coinIn: Coin - } -} -export function useMarsZapperBaseEstimateWithdrawLiquidityQuery({ - client, - args, - options, -}: MarsZapperBaseEstimateWithdrawLiquidityQuery) { - return useQuery( - marsZapperBaseQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateWithdrawLiquidity({ - coinIn: args.coinIn, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsZapperBaseEstimateProvideLiquidityQuery - extends MarsZapperBaseReactQuery { - args: { - coinsIn: Coin[] - lpTokenOut: string - } -} -export function useMarsZapperBaseEstimateProvideLiquidityQuery({ - client, - args, - options, -}: MarsZapperBaseEstimateProvideLiquidityQuery) { - return useQuery( - marsZapperBaseQueryKeys.estimateProvideLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateProvideLiquidity({ - coinsIn: args.coinsIn, - lpTokenOut: args.lpTokenOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsZapperBaseCallbackMutation { - client: MarsZapperBaseClient - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsZapperBaseCallbackMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds), - options, - ) -} -export interface MarsZapperBaseWithdrawLiquidityMutation { - client: MarsZapperBaseClient - msg: { - recipient?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsZapperBaseWithdrawLiquidityMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.withdrawLiquidity(msg, fee, memo, funds), - options, - ) -} -export interface MarsZapperBaseProvideLiquidityMutation { - client: MarsZapperBaseClient - msg: { - lpTokenOut: string - minimumReceive: Uint128 - recipient?: string - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsZapperBaseProvideLiquidityMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.provideLiquidity(msg, fee, memo, funds), - options, - ) -} diff --git a/yarn.lock b/yarn.lock index b6b7b340..d3c9e387 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1069,15 +1069,15 @@ "@cosmjs/math" "^0.29.5" "@cosmjs/utils" "^0.29.5" -"@cosmjs/amino@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.30.0.tgz#159b6b2f131e02292802f4c082efb726ca23890d" - integrity sha512-DFPu0dALghQj7A9b8SHnrpNiMsGi4lEs2ZM7XvO/baYgktn8iS5P9LQXmDch5UhKkjJy+uz5aAMD9iFlK6opCQ== +"@cosmjs/amino@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.30.1.tgz#7c18c14627361ba6c88e3495700ceea1f76baace" + integrity sha512-yNHnzmvAlkETDYIpeCTdVqgvrdt1qgkOXwuRVi8s27UKI5hfqyE9fJ/fuunXE6ZZPnKkjIecDznmuUOMrMvw4w== dependencies: - "@cosmjs/crypto" "^0.30.0" - "@cosmjs/encoding" "^0.30.0" - "@cosmjs/math" "^0.30.0" - "@cosmjs/utils" "^0.30.0" + "@cosmjs/crypto" "^0.30.1" + "@cosmjs/encoding" "^0.30.1" + "@cosmjs/math" "^0.30.1" + "@cosmjs/utils" "^0.30.1" "@cosmjs/cosmwasm-stargate@^0.29.5": version "0.29.5" @@ -1096,19 +1096,19 @@ long "^4.0.0" pako "^2.0.2" -"@cosmjs/cosmwasm-stargate@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.30.0.tgz#b03c6c1383ef658695fcb02e6e1f4df2ddbd4710" - integrity sha512-nPJWpwSGpc15K88/9uxZmolEbixkeGzmxpTv6IbMAH23LXeJs7P+tXtgPe41ZjUw8Lt9Zc7ZOaOAqVveqqRktQ== +"@cosmjs/cosmwasm-stargate@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.30.1.tgz#6f9ca310f75433a3e30d683bc6aa24eadb345d79" + integrity sha512-W/6SLUCJAJGBN+sJLXouLZikVgmqDd9LCdlMzQaxczcCHTWeJAmRvOiZGSZaSy3shw/JN1qc6g6PKpvTVgj10A== dependencies: - "@cosmjs/amino" "^0.30.0" - "@cosmjs/crypto" "^0.30.0" - "@cosmjs/encoding" "^0.30.0" - "@cosmjs/math" "^0.30.0" - "@cosmjs/proto-signing" "^0.30.0" - "@cosmjs/stargate" "^0.30.0" - "@cosmjs/tendermint-rpc" "^0.30.0" - "@cosmjs/utils" "^0.30.0" + "@cosmjs/amino" "^0.30.1" + "@cosmjs/crypto" "^0.30.1" + "@cosmjs/encoding" "^0.30.1" + "@cosmjs/math" "^0.30.1" + "@cosmjs/proto-signing" "^0.30.1" + "@cosmjs/stargate" "^0.30.1" + "@cosmjs/tendermint-rpc" "^0.30.1" + "@cosmjs/utils" "^0.30.1" cosmjs-types "^0.7.1" long "^4.0.0" pako "^2.0.2" @@ -1142,14 +1142,14 @@ elliptic "^6.5.4" libsodium-wrappers "^0.7.6" -"@cosmjs/crypto@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.30.0.tgz#eadcc98792ce2b3417e8dbc4e84bd250b842459f" - integrity sha512-qjR5vG7G2Hyc1oE5W1vm73Mf7723ooQXWvUBj5QTsNHI4EFJ52jCHhHb7Ynuh6WmBDpfisCios7AWTpA2PSmAQ== +"@cosmjs/crypto@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.30.1.tgz#21e94d5ca8f8ded16eee1389d2639cb5c43c3eb5" + integrity sha512-rAljUlake3MSXs9xAm87mu34GfBLN0h/1uPPV6jEwClWjNkAMotzjC0ab9MARy5FFAvYHL3lWb57bhkbt2GtzQ== dependencies: - "@cosmjs/encoding" "^0.30.0" - "@cosmjs/math" "^0.30.0" - "@cosmjs/utils" "^0.30.0" + "@cosmjs/encoding" "^0.30.1" + "@cosmjs/math" "^0.30.1" + "@cosmjs/utils" "^0.30.1" "@noble/hashes" "^1" bn.js "^5.2.0" elliptic "^6.5.4" @@ -1173,10 +1173,10 @@ bech32 "^1.1.4" readonly-date "^1.0.0" -"@cosmjs/encoding@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.30.0.tgz#a3ab019538f3550d2ee12964148cddfc11e1eeb2" - integrity sha512-b/ZAyAEaUstk6ctcF44ufEWKVMv6S732jUxTz3eGmGCKbZhlVPmk5P2Pc4IHl+IJPtCBoeCLG8KcskVtkNoPvQ== +"@cosmjs/encoding@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.30.1.tgz#b5c4e0ef7ceb1f2753688eb96400ed70f35c6058" + integrity sha512-rXmrTbgqwihORwJ3xYhIgQFfMSrwLu1s43RIK9I8EBudPx3KmnmyAKzMOVsRDo9edLFNuZ9GIvysUCwQfq3WlQ== dependencies: base64-js "^1.3.0" bech32 "^1.1.4" @@ -1190,12 +1190,12 @@ "@cosmjs/stream" "^0.29.5" xstream "^11.14.0" -"@cosmjs/json-rpc@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.30.0.tgz#a9bec5368bed5e9000b06aa489d121971b1894c3" - integrity sha512-zTPM+mPzq67wI/cphe8I3/4gsIe017c4l/BSiFD7jqjsOKyjhuKzNLuABPGNNRnPo6k9I1Lgb/Z/QPWp9rXuMA== +"@cosmjs/json-rpc@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.30.1.tgz#16f21305fc167598c8a23a45549b85106b2372bc" + integrity sha512-pitfC/2YN9t+kXZCbNuyrZ6M8abnCC2n62m+JtU9vQUfaEtVsgy+1Fk4TRQ175+pIWSdBMFi2wT8FWVEE4RhxQ== dependencies: - "@cosmjs/stream" "^0.30.0" + "@cosmjs/stream" "^0.30.1" xstream "^11.14.0" "@cosmjs/launchpad@^0.27.1": @@ -1225,10 +1225,10 @@ dependencies: bn.js "^5.2.0" -"@cosmjs/math@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.30.0.tgz#26058f971e89f45ae68598312527584735d3e41e" - integrity sha512-RfrRJe/p7Eu2/ulFQT9IUXA6CL43klcTJu+DRu/iI91LFf64L8Ycid5EQKkEUk4mpI+D2WGx5N0FT99h7pYuCw== +"@cosmjs/math@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.30.1.tgz#8b816ef4de5d3afa66cb9fdfb5df2357a7845b8a" + integrity sha512-yaoeI23pin9ZiPHIisa6qqLngfnBR/25tSaWpkTm8Cy10MX70UF5oN4+/t1heLaM6SSmRrhk3psRkV4+7mH51Q== dependencies: bn.js "^5.2.0" @@ -1245,16 +1245,16 @@ cosmjs-types "^0.5.2" long "^4.0.0" -"@cosmjs/proto-signing@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.30.0.tgz#de7dddec7fa8dc231c4b82142c4aefffe00673e5" - integrity sha512-+AKJa8xomn/qt73mu98yRQdiqb8wfrmwZGOCsUNRMSs5GIj8ltGNwTwElKY2VjK+O9buG7NSyVQBEGycC5Nj0A== +"@cosmjs/proto-signing@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.30.1.tgz#f0dda372488df9cd2677150b89b3e9c72b3cb713" + integrity sha512-tXh8pPYXV4aiJVhTKHGyeZekjj+K9s2KKojMB93Gcob2DxUjfKapFYBMJSgfKPuWUPEmyr8Q9km2hplI38ILgQ== dependencies: - "@cosmjs/amino" "^0.30.0" - "@cosmjs/crypto" "^0.30.0" - "@cosmjs/encoding" "^0.30.0" - "@cosmjs/math" "^0.30.0" - "@cosmjs/utils" "^0.30.0" + "@cosmjs/amino" "^0.30.1" + "@cosmjs/crypto" "^0.30.1" + "@cosmjs/encoding" "^0.30.1" + "@cosmjs/math" "^0.30.1" + "@cosmjs/utils" "^0.30.1" cosmjs-types "^0.7.1" long "^4.0.0" @@ -1268,12 +1268,12 @@ ws "^7" xstream "^11.14.0" -"@cosmjs/socket@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.30.0.tgz#bb45bc5c5a6a47009c7acd20c9b8320e8e733848" - integrity sha512-zEheZY292C0ec5jx1egOTVmDjBqHMciXpNNDAyo8QpZkVNq9Q4XGKvPOH67jSRQUTiy9NxKXW1Tqr84kqZ3C3A== +"@cosmjs/socket@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.30.1.tgz#00b22f4b5e2ab01f4d82ccdb7b2e59536bfe5ce0" + integrity sha512-r6MpDL+9N+qOS/D5VaxnPaMJ3flwQ36G+vPvYJsXArj93BjgyFB7BwWwXCQDzZ+23cfChPUfhbINOenr8N2Kow== dependencies: - "@cosmjs/stream" "^0.30.0" + "@cosmjs/stream" "^0.30.1" isomorphic-ws "^4.0.1" ws "^7" xstream "^11.14.0" @@ -1296,19 +1296,19 @@ protobufjs "~6.11.3" xstream "^11.14.0" -"@cosmjs/stargate@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.30.0.tgz#8a6192abc52376d428c124de7902659fd7a89281" - integrity sha512-BrE1iV7M0/oBSTM5doDS+qX4Na1sVtSYMQsGUV3wde49gVttVsoHTNufk4KESQ7lfGemSwgOMsgoKBs/M8TnlA== +"@cosmjs/stargate@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.30.1.tgz#e1b22e1226cffc6e93914a410755f1f61057ba04" + integrity sha512-RdbYKZCGOH8gWebO7r6WvNnQMxHrNXInY/gPHPzMjbQF6UatA6fNM2G2tdgS5j5u7FTqlCI10stNXrknaNdzog== dependencies: "@confio/ics23" "^0.6.8" - "@cosmjs/amino" "^0.30.0" - "@cosmjs/encoding" "^0.30.0" - "@cosmjs/math" "^0.30.0" - "@cosmjs/proto-signing" "^0.30.0" - "@cosmjs/stream" "^0.30.0" - "@cosmjs/tendermint-rpc" "^0.30.0" - "@cosmjs/utils" "^0.30.0" + "@cosmjs/amino" "^0.30.1" + "@cosmjs/encoding" "^0.30.1" + "@cosmjs/math" "^0.30.1" + "@cosmjs/proto-signing" "^0.30.1" + "@cosmjs/stream" "^0.30.1" + "@cosmjs/tendermint-rpc" "^0.30.1" + "@cosmjs/utils" "^0.30.1" cosmjs-types "^0.7.1" long "^4.0.0" protobufjs "~6.11.3" @@ -1321,10 +1321,10 @@ dependencies: xstream "^11.14.0" -"@cosmjs/stream@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.30.0.tgz#c6849e895b6a08ef3abcc97d309f467ef63ca05b" - integrity sha512-MkspvIDkZGZQcT8AOkCbG3vXzYED5jLJlki+FuNDWGOVCZVv89IF/v59f+Hg5pJUShRmGZ1cWfmpzYkGHxdEog== +"@cosmjs/stream@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.30.1.tgz#ba038a2aaf41343696b1e6e759d8e03a9516ec1a" + integrity sha512-Fg0pWz1zXQdoxQZpdHRMGvUH5RqS6tPv+j9Eh7Q953UjMlrwZVo0YFLC8OTf/HKVf10E4i0u6aM8D69Q6cNkgQ== dependencies: xstream "^11.14.0" @@ -1344,18 +1344,18 @@ readonly-date "^1.0.0" xstream "^11.14.0" -"@cosmjs/tendermint-rpc@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.30.0.tgz#5279434387a78cac17bc40f2541eaaf7b1081f03" - integrity sha512-QpNXwxfCPTHXrfq/LzXvwRxDjTV0R16kPISJ00zu3zSTtANCnBMZiNNFszrCdZKw81fNKo8/Rf2T0gCNvWfGog== +"@cosmjs/tendermint-rpc@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.30.1.tgz#c16378892ba1ac63f72803fdf7567eab9d4f0aa0" + integrity sha512-Z3nCwhXSbPZJ++v85zHObeUggrEHVfm1u18ZRwXxFE9ZMl5mXTybnwYhczuYOl7KRskgwlB+rID0WYACxj4wdQ== dependencies: - "@cosmjs/crypto" "^0.30.0" - "@cosmjs/encoding" "^0.30.0" - "@cosmjs/json-rpc" "^0.30.0" - "@cosmjs/math" "^0.30.0" - "@cosmjs/socket" "^0.30.0" - "@cosmjs/stream" "^0.30.0" - "@cosmjs/utils" "^0.30.0" + "@cosmjs/crypto" "^0.30.1" + "@cosmjs/encoding" "^0.30.1" + "@cosmjs/json-rpc" "^0.30.1" + "@cosmjs/math" "^0.30.1" + "@cosmjs/socket" "^0.30.1" + "@cosmjs/stream" "^0.30.1" + "@cosmjs/utils" "^0.30.1" axios "^0.21.2" readonly-date "^1.0.0" xstream "^11.14.0" @@ -1370,10 +1370,10 @@ resolved "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.29.5.tgz" integrity sha512-m7h+RXDUxOzEOGt4P+3OVPX7PuakZT3GBmaM/Y2u+abN3xZkziykD/NvedYFvvCCdQo714XcGl33bwifS9FZPQ== -"@cosmjs/utils@^0.30.0": - version "0.30.0" - resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.30.0.tgz#d493abd906ee72702d61a6bb8a45cef5203bec12" - integrity sha512-A0YaBUlAojyuygqXOjDZa6YT/NOeScq08CqMD5VfU0COlzJS2DKN0z0jfYDt3t3VEXT5ZV8OaLbN3jHah1cSlA== +"@cosmjs/utils@^0.30.1": + version "0.30.1" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.30.1.tgz#6d92582341be3c2ec8d82090253cfa4b7f959edb" + integrity sha512-KvvX58MGMWh7xA+N+deCfunkA/ZNDvFLw4YbOmX3f/XBIkqrVY7qlotfy2aNb1kgp6h4B6Yc8YawJPDTfvWX7g== "@delphi-labs/shuttle@^2.6.1": version "2.7.0" @@ -2835,19 +2835,6 @@ dependencies: tslib "^2.4.0" -"@tanstack/query-core@4.27.0": - version "4.27.0" - resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-4.27.0.tgz#96bcef499008ea080b66611d029655e3ffdf8bea" - integrity sha512-sm+QncWaPmM73IPwFlmWSKPqjdTXZeFf/7aEmWh00z7yl2FjqophPt0dE1EHW9P1giMC5rMviv7OUbSDmWzXXA== - -"@tanstack/react-query@^4.28.0": - version "4.28.0" - resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-4.28.0.tgz#01cb9969b15cbcbd5dcfcd4b264dc18ef0a35f86" - integrity sha512-8cGBV5300RHlvYdS4ea+G1JcZIt5CIuprXYFnsWggkmGoC0b5JaqG0fIX3qwDL9PTNkKvG76NGThIWbpXivMrQ== - dependencies: - "@tanstack/query-core" "4.27.0" - use-sync-external-store "^1.2.0" - "@tanstack/react-table@^8.7.9": version "8.7.9" resolved "https://registry.npmjs.org/@tanstack/react-table/-/react-table-8.7.9.tgz" @@ -7341,10 +7328,10 @@ svgo@^2.8.0: picocolors "^1.0.0" stable "^0.1.8" -swr@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/swr/-/swr-2.1.0.tgz" - integrity sha512-4hYl5p3/KalQ1MORealM79g/DtLohmud6yyfXw5l4wjtFksYUnocRFudvyaoUtgj3FrVNK9lS25Av9dsZYvz0g== +swr@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/swr/-/swr-2.1.1.tgz#9b9fd7f96236c9c0db8c96183b26661f857a64b8" + integrity sha512-OgwqZmpjOgxNbaez6qzTVqiRWn+Ti5Uzmktk2c01Afqwc50q6z15DeNC8m9G1aY+w2BwEAsKvk59iq6aHlhgyw== dependencies: use-sync-external-store "^1.2.0"