Mp 2267 rewrite mutations (#137)
* remove react-query
* ➖ remove unused packages
This commit is contained in:
parent
94175d6181
commit
f1ff3e88d4
@ -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",
|
||||
|
@ -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 (
|
||||
<div className='flex w-full flex-wrap overflow-hidden py-2'>
|
||||
|
@ -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 }[] = [
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
@ -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,
|
||||
])
|
||||
}
|
@ -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,
|
||||
])
|
||||
}
|
@ -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
|
||||
}
|
@ -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<UseMutationOptions, 'onError'>,
|
||||
) => {
|
||||
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,
|
||||
},
|
||||
)
|
||||
}
|
@ -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<UseMutationOptions, 'onError'>,
|
||||
) => {
|
||||
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,
|
||||
},
|
||||
)
|
||||
}
|
@ -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<UseMutationOptions, 'onError'>,
|
||||
) => {
|
||||
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,
|
||||
},
|
||||
)
|
||||
}
|
@ -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 },
|
||||
})
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
@ -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<UserBalanceData>(
|
||||
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]),
|
||||
}
|
||||
}
|
@ -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<Result>(
|
||||
queryKeys.allowedCoins(),
|
||||
async () => client?.queryContractSmart(creditManagerAddress || '', queryMsg),
|
||||
{
|
||||
enabled: !!client,
|
||||
staleTime: Infinity,
|
||||
},
|
||||
)
|
||||
|
||||
return {
|
||||
...result,
|
||||
data: result?.data,
|
||||
}
|
||||
}
|
@ -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,
|
||||
},
|
||||
)
|
||||
}
|
@ -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<Result>(
|
||||
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]),
|
||||
}
|
||||
}
|
@ -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<Result>(
|
||||
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]),
|
||||
}
|
||||
}
|
@ -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,
|
||||
},
|
||||
)
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
export const useMarkets = () => {
|
||||
const result = useQuery<MarketResult>(
|
||||
['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]),
|
||||
}
|
||||
}
|
@ -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<Result>(
|
||||
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]),
|
||||
}
|
||||
}
|
@ -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<TokenPricesResult> => {
|
||||
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<TokenPricesResult>(
|
||||
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]),
|
||||
}
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
nextId: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'next_id', args }] as const,
|
||||
ownerOf: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'owner_of', args }] as const,
|
||||
approval: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approval', args }] as const,
|
||||
approvals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approvals', args },
|
||||
] as const,
|
||||
allOperators: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_operators', args },
|
||||
] as const,
|
||||
numTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'num_tokens', args },
|
||||
] as const,
|
||||
contractInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'contract_info', args },
|
||||
] as const,
|
||||
nftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'nft_info', args }] as const,
|
||||
allNftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_nft_info', args },
|
||||
] as const,
|
||||
tokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'tokens', args }] as const,
|
||||
allTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_tokens', args },
|
||||
] as const,
|
||||
minter: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'minter', args }] as const,
|
||||
}
|
||||
export interface MarsAccountNftReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsAccountNftQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsAccountNftMinterQuery<TData>
|
||||
extends MarsAccountNftReactQuery<MinterResponse, TData> {}
|
||||
export function useMarsAccountNftMinterQuery<TData = MinterResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftMinterQuery<TData>) {
|
||||
return useQuery<MinterResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<TokensResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftAllTokensQuery<TData = TokensResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftAllTokensQuery<TData>) {
|
||||
return useQuery<TokensResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<TokensResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftTokensQuery<TData = TokensResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftTokensQuery<TData>) {
|
||||
return useQuery<TokensResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<AllNftInfoResponseForEmpty, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftAllNftInfoQuery<TData = AllNftInfoResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftAllNftInfoQuery<TData>) {
|
||||
return useQuery<AllNftInfoResponseForEmpty, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<NftInfoResponseForEmpty, TData> {
|
||||
args: {
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftNftInfoQuery<TData = NftInfoResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftNftInfoQuery<TData>) {
|
||||
return useQuery<NftInfoResponseForEmpty, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<ContractInfoResponse, TData> {}
|
||||
export function useMarsAccountNftContractInfoQuery<TData = ContractInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftContractInfoQuery<TData>) {
|
||||
return useQuery<ContractInfoResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<NumTokensResponse, TData> {}
|
||||
export function useMarsAccountNftNumTokensQuery<TData = NumTokensResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftNumTokensQuery<TData>) {
|
||||
return useQuery<NumTokensResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<OperatorsResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftAllOperatorsQuery<TData = OperatorsResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftAllOperatorsQuery<TData>) {
|
||||
return useQuery<OperatorsResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<ApprovalsResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftApprovalsQuery<TData = ApprovalsResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftApprovalsQuery<TData>) {
|
||||
return useQuery<ApprovalsResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<ApprovalResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftApprovalQuery<TData = ApprovalResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftApprovalQuery<TData>) {
|
||||
return useQuery<ApprovalResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<OwnerOfResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftOwnerOfQuery<TData = OwnerOfResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftOwnerOfQuery<TData>) {
|
||||
return useQuery<OwnerOfResponse, Error, TData>(
|
||||
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<TData> extends MarsAccountNftReactQuery<Uint64, TData> {}
|
||||
export function useMarsAccountNftNextIdQuery<TData = Uint64>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftNextIdQuery<TData>) {
|
||||
return useQuery<Uint64, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsAccountNftReactQuery<NftConfigBaseForString, TData> {}
|
||||
export function useMarsAccountNftConfigQuery<TData = NftConfigBaseForString>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftConfigQuery<TData>) {
|
||||
return useQuery<NftConfigBaseForString, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsAccountNftRevokeAllMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftRevokeAllMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftApproveAllMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftApproveAllMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftRevokeMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftRevokeMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftApproveMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftApproveMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftSendNftMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftSendNftMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftTransferNftMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftTransferNftMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftBurnMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftBurnMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftMintMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftMintMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftAcceptMinterRoleMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftAcceptMinterRoleMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsAccountNftUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
vaultInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'vault_info', args },
|
||||
] as const,
|
||||
vaultsInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'vaults_info', args },
|
||||
] as const,
|
||||
allowedCoins: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_coins', args },
|
||||
] as const,
|
||||
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args },
|
||||
] as const,
|
||||
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_vault_positions',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_vault_coin_balance',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalVaultCoinBalances: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_vault_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_provide_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateWithdrawLiquidity: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_withdraw_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
vaultPositionValue: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_position_value',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsCreditManagerReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsCreditManagerQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsCreditManagerVaultPositionValueQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<VaultPositionValue, TData> {
|
||||
args: {
|
||||
vaultPosition: VaultPosition
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerVaultPositionValueQuery<TData = VaultPositionValue>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerVaultPositionValueQuery<TData>) {
|
||||
return useQuery<VaultPositionValue, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
lpToken: Coin
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerEstimateWithdrawLiquidityQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
coinsIn: Coin[]
|
||||
lpTokenOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerEstimateProvideLiquidityQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfVaultWithBalance, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllTotalVaultCoinBalancesQuery<
|
||||
TData = ArrayOfVaultWithBalance,
|
||||
>({ client, args, options }: MarsCreditManagerAllTotalVaultCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultWithBalance, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerTotalVaultCoinBalanceQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerTotalVaultCoinBalanceQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllVaultPositionsQuery<
|
||||
TData = ArrayOfVaultPositionResponseItem,
|
||||
>({ client, args, options }: MarsCreditManagerAllVaultPositionsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfLentShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllTotalLentSharesQuery<TData = ArrayOfLentShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllTotalLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfLentShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<LentShares, TData> {}
|
||||
export function useMarsCreditManagerTotalLentSharesQuery<TData = LentShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsCreditManagerTotalLentSharesQuery<TData>) {
|
||||
return useQuery<LentShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllLentSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfDebtShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfDebtShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<DebtShares, TData> {}
|
||||
export function useMarsCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsCreditManagerTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<DebtShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllCoinBalancesQuery<TData = ArrayOfCoinBalanceResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<Positions, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerPositionsQuery<TData = Positions>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerPositionsQuery<TData>) {
|
||||
return useQuery<Positions, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfString, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllowedCoinsQuery<TData = ArrayOfString>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllowedCoinsQuery<TData>) {
|
||||
return useQuery<ArrayOfString, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfVaultInfoResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerVaultsInfoQuery<TData = ArrayOfVaultInfoResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerVaultsInfoQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultInfoResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<VaultInfoResponse, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerVaultInfoQuery<TData = VaultInfoResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerVaultInfoQuery<TData>) {
|
||||
return useQuery<VaultInfoResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsCreditManagerReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsCreditManagerConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsCreditManagerConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsCreditManagerCallbackMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerCallbackMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsCreditManagerUpdateNftConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateNftConfigMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsCreditManagerUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateOwnerMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsCreditManagerUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateConfigMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsCreditManagerUpdateCreditAccountMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateCreditAccountMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsCreditManagerCreateCreditAccountMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerCreateCreditAccountMutation>(
|
||||
({ client, args: { fee, memo, funds } = {} }) => client.createCreditAccount(fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
vaultInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'vault_info', args },
|
||||
] as const,
|
||||
vaultsInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vaults_info',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allowedCoins: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'allowed_coins',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args },
|
||||
] as const,
|
||||
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_vault_positions',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_vault_coin_balance',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalVaultCoinBalances: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_vault_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_provide_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateWithdrawLiquidity: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_withdraw_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
vaultPositionValue: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_position_value',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsMockCreditManagerReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockCreditManagerQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockCreditManagerVaultPositionValueQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<VaultPositionValue, TData> {
|
||||
args: {
|
||||
vaultPosition: VaultPosition
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerVaultPositionValueQuery<TData = VaultPositionValue>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerVaultPositionValueQuery<TData>) {
|
||||
return useQuery<VaultPositionValue, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
lpToken: Coin
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
coinsIn: Coin[]
|
||||
lpTokenOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerEstimateProvideLiquidityQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfVaultWithBalance, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllTotalVaultCoinBalancesQuery<
|
||||
TData = ArrayOfVaultWithBalance,
|
||||
>({ client, args, options }: MarsMockCreditManagerAllTotalVaultCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultWithBalance, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerTotalVaultCoinBalanceQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerTotalVaultCoinBalanceQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllVaultPositionsQuery<
|
||||
TData = ArrayOfVaultPositionResponseItem,
|
||||
>({ client, args, options }: MarsMockCreditManagerAllVaultPositionsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfLentShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllTotalLentSharesQuery<TData = ArrayOfLentShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllTotalLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfLentShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<LentShares, TData> {}
|
||||
export function useMarsMockCreditManagerTotalLentSharesQuery<TData = LentShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockCreditManagerTotalLentSharesQuery<TData>) {
|
||||
return useQuery<LentShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllLentSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfDebtShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfDebtShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<DebtShares, TData> {}
|
||||
export function useMarsMockCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockCreditManagerTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<DebtShares, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllCoinBalancesQuery<
|
||||
TData = ArrayOfCoinBalanceResponseItem,
|
||||
>({ client, args, options }: MarsMockCreditManagerAllCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<Positions, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerPositionsQuery<TData = Positions>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerPositionsQuery<TData>) {
|
||||
return useQuery<Positions, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfString, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllowedCoinsQuery<TData = ArrayOfString>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllowedCoinsQuery<TData>) {
|
||||
return useQuery<ArrayOfString, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfVaultInfoResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerVaultsInfoQuery<TData = ArrayOfVaultInfoResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerVaultsInfoQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultInfoResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<VaultInfoResponse, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerVaultInfoQuery<TData = VaultInfoResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerVaultInfoQuery<TData>) {
|
||||
return useQuery<VaultInfoResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsMockCreditManagerConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockCreditManagerConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsMockCreditManagerSetVaultConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockCreditManagerSetVaultConfigMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockCreditManagerSetAllowedCoinsMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockCreditManagerSetAllowedCoinsMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockCreditManagerSetPositionsResponseMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockCreditManagerSetPositionsResponseMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.setPositionsResponse(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[{ ...marsMockOracleQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
||||
}
|
||||
export interface MarsMockOracleReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockOracleQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockOraclePriceQuery<TData>
|
||||
extends MarsMockOracleReactQuery<PriceResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockOraclePriceQuery<TData = PriceResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockOraclePriceQuery<TData>) {
|
||||
return useQuery<PriceResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsMockOracleChangePriceMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockOracleChangePriceMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.changePrice(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
market: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const,
|
||||
markets: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'markets', args }] as const,
|
||||
uncollateralizedLoanLimit: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'uncollateralized_loan_limit',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
uncollateralizedLoanLimits: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'uncollateralized_loan_limits',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
userDebt: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_debt', args },
|
||||
] as const,
|
||||
userDebts: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_debts', args },
|
||||
] as const,
|
||||
userCollateral: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collateral', args },
|
||||
] as const,
|
||||
userCollaterals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args },
|
||||
] as const,
|
||||
userPosition: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args },
|
||||
] as const,
|
||||
scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'scaled_liquidity_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
scaledDebtAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'scaled_debt_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
underlyingLiquidityAmount: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'underlying_liquidity_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
underlyingDebtAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'underlying_debt_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsMockRedBankReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockRedBankQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockRedBankUnderlyingDebtAmountQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amountScaled: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUnderlyingDebtAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUnderlyingDebtAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amountScaled: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUnderlyingLiquidityAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUnderlyingLiquidityAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankScaledDebtAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankScaledDebtAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankScaledLiquidityAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankScaledLiquidityAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<UserPositionResponse, TData> {
|
||||
args: {
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserPositionQuery<TData = UserPositionResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserPositionQuery<TData>) {
|
||||
return useQuery<UserPositionResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfUserCollateralResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserCollateralsQuery<TData = ArrayOfUserCollateralResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserCollateralsQuery<TData>) {
|
||||
return useQuery<ArrayOfUserCollateralResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<UserCollateralResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserCollateralQuery<TData = UserCollateralResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserCollateralQuery<TData>) {
|
||||
return useQuery<UserCollateralResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfUserDebtResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserDebtsQuery<TData = ArrayOfUserDebtResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserDebtsQuery<TData>) {
|
||||
return useQuery<ArrayOfUserDebtResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<UserDebtResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserDebtQuery<TData = UserDebtResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserDebtQuery<TData>) {
|
||||
return useQuery<UserDebtResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfUncollateralizedLoanLimitResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUncollateralizedLoanLimitsQuery<
|
||||
TData = ArrayOfUncollateralizedLoanLimitResponse,
|
||||
>({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitsQuery<TData>) {
|
||||
return useQuery<ArrayOfUncollateralizedLoanLimitResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<UncollateralizedLoanLimitResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUncollateralizedLoanLimitQuery<
|
||||
TData = UncollateralizedLoanLimitResponse,
|
||||
>({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitQuery<TData>) {
|
||||
return useQuery<UncollateralizedLoanLimitResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfMarket, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankMarketsQuery<TData = ArrayOfMarket>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankMarketsQuery<TData>) {
|
||||
return useQuery<ArrayOfMarket, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<Market, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankMarketQuery<TData = Market>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankMarketQuery<TData>) {
|
||||
return useQuery<Market, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockRedBankReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsMockRedBankConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockRedBankConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsMockRedBankUpdateAssetCollateralStatusMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateAssetCollateralStatusMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankLiquidateMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankLiquidateMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankRepayMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankRepayMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankBorrowMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankBorrowMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankWithdrawMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankWithdrawMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankDepositMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankDepositMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankUpdateUncollateralizedLoanLimitMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankUpdateAssetMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateAssetMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankInitAssetMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankInitAssetMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateConfigMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankUpdateEmergencyOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateEmergencyOwnerMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockRedBankUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockVaultQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_standard_info',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
info: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'info', args }] as const,
|
||||
previewDeposit: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'preview_deposit', args },
|
||||
] as const,
|
||||
previewRedeem: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'preview_redeem', args },
|
||||
] as const,
|
||||
totalAssets: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'total_assets', args },
|
||||
] as const,
|
||||
totalVaultTokenSupply: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockVaultQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_vault_token_supply',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
convertToShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'convert_to_shares', args },
|
||||
] as const,
|
||||
convertToAssets: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'convert_to_assets', args },
|
||||
] as const,
|
||||
vaultExtension: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'vault_extension', args },
|
||||
] as const,
|
||||
}
|
||||
export interface MarsMockVaultReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockVaultQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockVaultVaultExtensionQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Empty, TData> {}
|
||||
export function useMarsMockVaultVaultExtensionQuery<TData = Empty>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultVaultExtensionQuery<TData>) {
|
||||
return useQuery<Empty, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultConvertToAssetsQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultConvertToAssetsQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultConvertToSharesQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultConvertToSharesQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {}
|
||||
export function useMarsMockVaultTotalVaultTokenSupplyQuery<TData = Uint128>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultTotalVaultTokenSupplyQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {}
|
||||
export function useMarsMockVaultTotalAssetsQuery<TData = Uint128>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultTotalAssetsQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultPreviewRedeemQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultPreviewRedeemQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultPreviewDepositQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultPreviewDepositQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<VaultInfoResponse, TData> {}
|
||||
export function useMarsMockVaultInfoQuery<TData = VaultInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultInfoQuery<TData>) {
|
||||
return useQuery<VaultInfoResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsMockVaultReactQuery<VaultStandardInfoResponse, TData> {}
|
||||
export function useMarsMockVaultVaultStandardInfoQuery<TData = VaultStandardInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultVaultStandardInfoQuery<TData>) {
|
||||
return useQuery<VaultStandardInfoResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsMockVaultVaultExtensionMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockVaultVaultExtensionMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockVaultRedeemMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockVaultRedeemMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsMockVaultDepositMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockVaultDepositMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.deposit(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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'
|
@ -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<string, unknown>) =>
|
||||
[
|
||||
{ ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'health', args },
|
||||
] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
}
|
||||
export interface MarsRoverHealthTypesReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsRoverHealthTypesQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsRoverHealthTypesConfigQuery<TData>
|
||||
extends MarsRoverHealthTypesReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsRoverHealthTypesConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsRoverHealthTypesConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsRoverHealthTypesReactQuery<HealthResponse, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthTypesHealthQuery<TData = HealthResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsRoverHealthTypesHealthQuery<TData>) {
|
||||
return useQuery<HealthResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsRoverHealthTypesUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsRoverHealthTypesUpdateConfigMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsRoverHealthTypesUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsRoverHealthTypesUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
|
||||
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
|
||||
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsSwapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_exact_in_swap',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsSwapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsSwapperBaseQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsSwapperBaseEstimateExactInSwapQuery<TData>
|
||||
extends MarsSwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
|
||||
args: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperBaseEstimateExactInSwapQuery<TData>) {
|
||||
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsSwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperBaseRoutesQuery<TData>) {
|
||||
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsSwapperBaseReactQuery<RouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperBaseRouteQuery<TData>) {
|
||||
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsSwapperBaseReactQuery<OwnerResponse, TData> {}
|
||||
export function useMarsSwapperBaseOwnerQuery<TData = OwnerResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsSwapperBaseOwnerQuery<TData>) {
|
||||
return useQuery<OwnerResponse, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -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<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsZapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_provide_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateWithdrawLiquidity: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsZapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_withdraw_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsZapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsZapperBaseQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsZapperBaseEstimateWithdrawLiquidityQuery<TData>
|
||||
extends MarsZapperBaseReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
coinIn: Coin
|
||||
}
|
||||
}
|
||||
export function useMarsZapperBaseEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsZapperBaseEstimateWithdrawLiquidityQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
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<TData>
|
||||
extends MarsZapperBaseReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
coinsIn: Coin[]
|
||||
lpTokenOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsZapperBaseEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsZapperBaseEstimateProvideLiquidityQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
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<ExecuteResult, Error, MarsZapperBaseCallbackMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsZapperBaseCallbackMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsZapperBaseWithdrawLiquidityMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsZapperBaseWithdrawLiquidityMutation>(
|
||||
({ 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<ExecuteResult, Error, MarsZapperBaseProvideLiquidityMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsZapperBaseProvideLiquidityMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.provideLiquidity(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
189
yarn.lock
189
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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user