MP-1699: Trade on Margin Account (#52)
* update generated types * added CRO to token info * update contract addresses to match latest deployment * feat: token prices fetched from oracle contract * trade page initial commit * trade asset action hook * extract max swap amount logic into custom hook * trade component ui adjustments * trade container min-width and some styling improvements * trade success message and loading indicator * normalize naming conventions on trading * max swap amount formula adjustments * trade execute msg with borrow. code cleanup * fix: click max update tokenOut amount. remove wallet from fund denom * delay token amount decimal conversion. input formatting * increase hardcoded gas * renamed max swappable amount hook * display token prices and market information on landing page * reset trade amounts when selected account change * max trade amount cleanup and minor performance optimizations * fix: liabilities value with 1 hour interest buffer for trade action * add token symbol to wallet and account labels * swap trade pairs icon and basic functionality * remove unnecessary optional chaining. comment adjusted * refactor useTokenPrices to build query dynamically on tokens data * extracted trade container and respective functionality into separate file * fix: properly calculate positions after full swap * mp-1218: trading using wallet
This commit is contained in:
parent
56bfea8ed0
commit
1deba2059e
338
components/Trade/TradeActionModule.tsx
Normal file
338
components/Trade/TradeActionModule.tsx
Normal file
@ -0,0 +1,338 @@
|
|||||||
|
import React, { useEffect, useMemo, useState } from 'react'
|
||||||
|
import { Switch } from '@headlessui/react'
|
||||||
|
import BigNumber from 'bignumber.js'
|
||||||
|
import { toast } from 'react-toastify'
|
||||||
|
import { ArrowsUpDownIcon } from '@heroicons/react/24/solid'
|
||||||
|
|
||||||
|
import Button from 'components/Button'
|
||||||
|
import useAllowedCoins from 'hooks/useAllowedCoins'
|
||||||
|
import { getTokenDecimals, getTokenSymbol } from 'utils/tokens'
|
||||||
|
import Slider from 'components/Slider'
|
||||||
|
import useTradeAsset from 'hooks/mutations/useTradeAsset'
|
||||||
|
import useAllBalances from 'hooks/useAllBalances'
|
||||||
|
import useMarkets from 'hooks/useMarkets'
|
||||||
|
import useCreditManagerStore from 'stores/useCreditManagerStore'
|
||||||
|
import useCreditAccountPositions from 'hooks/useCreditAccountPositions'
|
||||||
|
import useTokenPrices from 'hooks/useTokenPrices'
|
||||||
|
import useCalculateMaxTradeAmount from 'hooks/useCalculateMaxTradeAmount'
|
||||||
|
import Spinner from 'components/Spinner'
|
||||||
|
|
||||||
|
enum FundingMode {
|
||||||
|
Account = 'Account',
|
||||||
|
WalletAndAccount = 'WalletAndAccount',
|
||||||
|
}
|
||||||
|
|
||||||
|
const TradeActionModule = () => {
|
||||||
|
const [selectedTokenIn, setSelectedTokenIn] = useState('')
|
||||||
|
const [selectedTokenOut, setSelectedTokenOut] = useState('')
|
||||||
|
const [amountIn, setAmountIn] = useState(0)
|
||||||
|
const [amountOut, setAmountOut] = useState(0)
|
||||||
|
const [fundingMode, setFundingMode] = useState<FundingMode>(FundingMode.WalletAndAccount)
|
||||||
|
|
||||||
|
const [isMarginEnabled, setIsMarginEnabled] = React.useState(false)
|
||||||
|
|
||||||
|
const selectedAccount = useCreditManagerStore((s) => s.selectedAccount)
|
||||||
|
|
||||||
|
const { data: allowedCoinsData } = useAllowedCoins()
|
||||||
|
const { data: balancesData } = useAllBalances()
|
||||||
|
const { data: marketsData } = useMarkets()
|
||||||
|
const { data: tokenPrices } = useTokenPrices()
|
||||||
|
const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '')
|
||||||
|
|
||||||
|
const resetAmounts = () => {
|
||||||
|
setAmountIn(0)
|
||||||
|
setAmountOut(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
resetAmounts()
|
||||||
|
}, [selectedAccount])
|
||||||
|
|
||||||
|
const accountAmount = useMemo(() => {
|
||||||
|
return Number(positionsData?.coins?.find((coin) => coin.denom === selectedTokenIn)?.amount ?? 0)
|
||||||
|
}, [positionsData, selectedTokenIn])
|
||||||
|
|
||||||
|
const walletAmount = useMemo(() => {
|
||||||
|
return Number(balancesData?.find((balance) => balance.denom === selectedTokenIn)?.amount ?? 0)
|
||||||
|
}, [balancesData, selectedTokenIn])
|
||||||
|
|
||||||
|
const { swapAmount, borrowAmount, depositAmount } = useMemo(() => {
|
||||||
|
const swapAmount = amountIn
|
||||||
|
|
||||||
|
let borrowAmount = 0
|
||||||
|
let depositAmount = 0
|
||||||
|
|
||||||
|
if (fundingMode === FundingMode.WalletAndAccount) {
|
||||||
|
const walletAndAccountAmount = walletAmount + accountAmount
|
||||||
|
|
||||||
|
borrowAmount =
|
||||||
|
amountIn > walletAndAccountAmount
|
||||||
|
? BigNumber(amountIn).minus(walletAndAccountAmount).toNumber()
|
||||||
|
: 0
|
||||||
|
|
||||||
|
depositAmount = amountIn > walletAmount ? walletAmount : amountIn
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fundingMode === FundingMode.Account) {
|
||||||
|
borrowAmount =
|
||||||
|
amountIn > accountAmount ? BigNumber(amountIn).minus(accountAmount).toNumber() : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return { swapAmount, borrowAmount, depositAmount }
|
||||||
|
}, [accountAmount, amountIn, fundingMode, walletAmount])
|
||||||
|
|
||||||
|
const { mutate, isLoading } = useTradeAsset(
|
||||||
|
swapAmount,
|
||||||
|
borrowAmount,
|
||||||
|
depositAmount,
|
||||||
|
selectedTokenIn,
|
||||||
|
selectedTokenOut,
|
||||||
|
0.1,
|
||||||
|
{
|
||||||
|
onSuccess: () => {
|
||||||
|
toast.success(
|
||||||
|
`${amountIn} ${getTokenSymbol(selectedTokenIn)} swapped for ${amountOut} ${getTokenSymbol(
|
||||||
|
selectedTokenOut,
|
||||||
|
)}`,
|
||||||
|
)
|
||||||
|
resetAmounts()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (allowedCoinsData && allowedCoinsData.length > 0) {
|
||||||
|
// initialize selected token when allowedCoins fetch data is available
|
||||||
|
setSelectedTokenIn(allowedCoinsData[0])
|
||||||
|
|
||||||
|
if (allowedCoinsData.length > 1) {
|
||||||
|
setSelectedTokenOut(allowedCoinsData[1])
|
||||||
|
} else {
|
||||||
|
setSelectedTokenOut(allowedCoinsData[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [allowedCoinsData])
|
||||||
|
|
||||||
|
const handleSelectedTokenInChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
|
setSelectedTokenIn(e.target.value)
|
||||||
|
resetAmounts()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSelectedTokenOutChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
|
setSelectedTokenOut(e.target.value)
|
||||||
|
resetAmounts()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleFundingModeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
|
setFundingMode(e.target.value as FundingMode)
|
||||||
|
resetAmounts()
|
||||||
|
}
|
||||||
|
|
||||||
|
// max amount that can be traded without considering wallet amount
|
||||||
|
// wallet amount should just be directly added to this amount in case user wants to include wallet as funding source
|
||||||
|
const maxTradeAmount = useCalculateMaxTradeAmount(
|
||||||
|
selectedTokenIn,
|
||||||
|
selectedTokenOut,
|
||||||
|
isMarginEnabled,
|
||||||
|
)
|
||||||
|
|
||||||
|
// if funding from wallet & account, add wallet amount to the max trade amount
|
||||||
|
const maxAmount = useMemo(() => {
|
||||||
|
if (fundingMode === FundingMode.WalletAndAccount) {
|
||||||
|
return walletAmount + maxTradeAmount
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxTradeAmount
|
||||||
|
}, [fundingMode, maxTradeAmount, walletAmount])
|
||||||
|
|
||||||
|
const percentageValue = useMemo(() => {
|
||||||
|
if (isNaN(amountIn) || amountIn === 0) return 0
|
||||||
|
|
||||||
|
return amountIn / maxAmount > 1 ? 100 : (amountIn / maxAmount) * 100
|
||||||
|
}, [amountIn, maxAmount])
|
||||||
|
|
||||||
|
const borrowRate = Number(marketsData?.[selectedTokenOut]?.borrow_rate)
|
||||||
|
|
||||||
|
const handleAmountChange = (value: number, mode: 'in' | 'out') => {
|
||||||
|
const tokenInPrice = tokenPrices?.[selectedTokenIn] ?? 1
|
||||||
|
const tokenOutPrice = tokenPrices?.[selectedTokenOut] ?? 1
|
||||||
|
|
||||||
|
const priceRatio = BigNumber(tokenInPrice).div(tokenOutPrice)
|
||||||
|
|
||||||
|
if (mode === 'in') {
|
||||||
|
setAmountIn(value)
|
||||||
|
setAmountOut(BigNumber(value).times(priceRatio).decimalPlaces(0).toNumber())
|
||||||
|
} else {
|
||||||
|
setAmountOut(value)
|
||||||
|
setAmountIn(BigNumber(value).div(BigNumber(1).times(priceRatio)).decimalPlaces(0).toNumber())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const submitDisabled = selectedTokenIn === selectedTokenOut || !amountIn || amountIn > maxAmount
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{isLoading && (
|
||||||
|
<div className='fixed inset-0 z-40 grid place-items-center bg-black/50'>
|
||||||
|
<Spinner />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className='border-b border-b-white/20 p-2'>
|
||||||
|
<div className='mb-2'>
|
||||||
|
<p className='mb-1'>From:</p>
|
||||||
|
<div className='flex gap-2'>
|
||||||
|
<select
|
||||||
|
className='h-8 w-20 text-black'
|
||||||
|
onChange={handleSelectedTokenInChange}
|
||||||
|
value={selectedTokenIn}
|
||||||
|
>
|
||||||
|
{allowedCoinsData?.map((entry) => (
|
||||||
|
<option key={entry} value={entry}>
|
||||||
|
{getTokenSymbol(entry)}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<input
|
||||||
|
type='number'
|
||||||
|
className='h-8 flex-1 px-2 text-black outline-0'
|
||||||
|
value={amountIn / 10 ** getTokenDecimals(selectedTokenIn)}
|
||||||
|
min='0'
|
||||||
|
placeholder='0.00'
|
||||||
|
onChange={(e) => {
|
||||||
|
const valueAsNumber = e.target.valueAsNumber
|
||||||
|
const valueWithDecimals = valueAsNumber * 10 ** getTokenDecimals(selectedTokenIn)
|
||||||
|
|
||||||
|
handleAmountChange(valueWithDecimals, 'in')
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ArrowsUpDownIcon
|
||||||
|
className='mx-auto h-5 cursor-pointer text-white/70 hover:text-white'
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedTokenIn(selectedTokenOut)
|
||||||
|
setSelectedTokenOut(selectedTokenIn)
|
||||||
|
resetAmounts()
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div className='mb-5'>
|
||||||
|
<p className='mb-1'>To:</p>
|
||||||
|
<div className='flex gap-2'>
|
||||||
|
<select
|
||||||
|
className='h-8 w-20 text-black'
|
||||||
|
onChange={handleSelectedTokenOutChange}
|
||||||
|
value={selectedTokenOut}
|
||||||
|
>
|
||||||
|
{allowedCoinsData?.map((entry) => (
|
||||||
|
<option key={entry} value={entry}>
|
||||||
|
{getTokenSymbol(entry)}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<input
|
||||||
|
type='number'
|
||||||
|
className='h-8 flex-1 px-2 text-black outline-0'
|
||||||
|
value={amountOut / 10 ** getTokenDecimals(selectedTokenOut)}
|
||||||
|
min='0'
|
||||||
|
placeholder='0.00'
|
||||||
|
onChange={(e) => {
|
||||||
|
const valueAsNumber = e.target.valueAsNumber
|
||||||
|
const valueWithDecimals = valueAsNumber * 10 ** getTokenDecimals(selectedTokenOut)
|
||||||
|
|
||||||
|
handleAmountChange(valueWithDecimals, 'out')
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='mb-1'>
|
||||||
|
In Wallet:{' '}
|
||||||
|
{BigNumber(walletAmount)
|
||||||
|
.dividedBy(10 ** getTokenDecimals(selectedTokenIn))
|
||||||
|
.toNumber()
|
||||||
|
.toLocaleString(undefined, {
|
||||||
|
maximumFractionDigits: getTokenDecimals(selectedTokenIn),
|
||||||
|
})}{' '}
|
||||||
|
<span>{getTokenSymbol(selectedTokenIn)}</span>
|
||||||
|
</div>
|
||||||
|
<div className='mb-4'>
|
||||||
|
In Account:{' '}
|
||||||
|
{BigNumber(accountAmount)
|
||||||
|
.dividedBy(10 ** getTokenDecimals(selectedTokenIn))
|
||||||
|
.toNumber()
|
||||||
|
.toLocaleString(undefined, {
|
||||||
|
maximumFractionDigits: getTokenDecimals(selectedTokenIn),
|
||||||
|
})}{' '}
|
||||||
|
<span>{getTokenSymbol(selectedTokenIn)}</span>
|
||||||
|
</div>
|
||||||
|
<Slider
|
||||||
|
className='mb-6'
|
||||||
|
value={percentageValue}
|
||||||
|
onChange={(value) => {
|
||||||
|
const decimal = value[0] / 100
|
||||||
|
const tokenDecimals = getTokenDecimals(selectedTokenIn)
|
||||||
|
// limit decimal precision based on token contract decimals
|
||||||
|
const newAmount = Number((decimal * maxAmount).toFixed(0))
|
||||||
|
|
||||||
|
handleAmountChange(newAmount, 'in')
|
||||||
|
}}
|
||||||
|
onMaxClick={() => handleAmountChange(maxAmount, 'in')}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className='border-b border-b-white/20 p-2'>
|
||||||
|
<div className='mb-4 flex items-center'>
|
||||||
|
<p className='mr-2'>Margin</p>
|
||||||
|
<Switch
|
||||||
|
checked={isMarginEnabled}
|
||||||
|
onChange={(value) => {
|
||||||
|
// reset amounts only if margin is turned off
|
||||||
|
if (!value) resetAmounts()
|
||||||
|
|
||||||
|
setIsMarginEnabled(value)
|
||||||
|
}}
|
||||||
|
className={`${
|
||||||
|
isMarginEnabled ? 'bg-[#524BB1]' : 'bg-gray-400'
|
||||||
|
} relative inline-flex h-4 w-8 items-center rounded-full`}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className={`${
|
||||||
|
isMarginEnabled ? 'translate-x-4' : ''
|
||||||
|
} inline-block h-4 w-4 transform rounded-full bg-white transition`}
|
||||||
|
/>
|
||||||
|
</Switch>
|
||||||
|
</div>
|
||||||
|
<div className='mb-1 flex justify-between'>
|
||||||
|
<p>Borrow</p>
|
||||||
|
<p>
|
||||||
|
{isMarginEnabled
|
||||||
|
? BigNumber(borrowAmount)
|
||||||
|
.dividedBy(10 ** getTokenDecimals(selectedTokenIn))
|
||||||
|
.toNumber()
|
||||||
|
.toLocaleString(undefined, {
|
||||||
|
maximumFractionDigits: getTokenDecimals(selectedTokenIn),
|
||||||
|
})
|
||||||
|
: '-'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className='flex justify-between'>
|
||||||
|
<p>Borrow Rate</p>
|
||||||
|
<p>{isMarginEnabled ? `${(borrowRate * 100).toFixed(2)}%` : '-'}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='h-[100px] p-2'>
|
||||||
|
<div className='mb-6'>OTHER INFO PLACEHOLDER</div>
|
||||||
|
<div className='flex justify-between'>
|
||||||
|
<p>Funded From</p>
|
||||||
|
<select value={fundingMode} className='text-black' onChange={handleFundingModeChange}>
|
||||||
|
<option value={FundingMode.Account}>Account</option>
|
||||||
|
<option value={FundingMode.WalletAndAccount}>Wallet & Account</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Button className='w-full' onClick={() => mutate()} disabled={submitDisabled}>
|
||||||
|
Create Order
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TradeActionModule
|
@ -1,13 +1,15 @@
|
|||||||
// https://github.com/mars-protocol/rover/blob/master/scripts/deploy/addresses/osmo-test-4.json
|
// https://github.com/mars-protocol/rover/blob/master/scripts/deploy/addresses/osmo-test-4.json
|
||||||
export const roverContracts = {
|
export const roverContracts = {
|
||||||
accountNft: 'osmo1dravtyd0425fkdmkysc3ns7zud05clf5uhj6qqsnkdtrpkewu73q9f3f02',
|
accountNft: 'osmo1xvne7u9svgy9vtqtqnaet4nvn8zcpp984zzrlezfzgk4798tps8srkf5wa',
|
||||||
mockVault: 'osmo1emcckulm2mkx36xeanhsn3z3zjeql6pgd8yf8a5cf03ccvy7a4dqjw9tl7',
|
mockVault: 'osmo1yqgjaehalz0pv5j22fdnaaekuprlggd7hth8m66jmdxe58ztqs4sjqtrlk',
|
||||||
marsOracleAdapter: 'osmo1cw6pv97g7fmhqykrn0gc9ngrx5tnky75rmlwkzxuqhsk58u0n8asz036g0',
|
marsOracleAdapter: 'osmo1tlad2hj9rm7az7atx2qq8pdpl2007hrhpzua42j8wgxr0kc0ct4sahuyh7',
|
||||||
swapper: 'osmo1w2552km2u9w4k2gjw4n8drmuz5yxw8x4qzy6dl3da824km5cjlys00x3qp',
|
swapper: 'osmo15kxcpvjaqlrj8ezecnghf2qs2x87veqx0fcemye0jpdr8jq7qkvsnyvuuf',
|
||||||
creditManager: 'osmo18dt5y0ecyd5qg8nqwzrgxuljfejglyh2fjd984s8cy7fcx8mxh9qfl3hwq',
|
mockZapper: 'osmo1axad429tgnvzvfax08s4ytmf7ndg0f9z4jy355zyh4m6nasgtnzs5aw8u7',
|
||||||
|
creditManager: 'osmo1krz37p6xkkyu0f240enyt4ccxk7ds69kfgc5pnldsmpmmuvn3vpsnmpjaf',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const contractAddresses = {
|
export const contractAddresses = {
|
||||||
...roverContracts,
|
...roverContracts,
|
||||||
redBank: 'osmo1w5rqrdhut890jplmsqnr8gj3uf0wq6lj5rfdnhrtl63lpf6e7v6qalrhhn',
|
redBank: 'osmo1g30recyv8pfy3qd4qn3dn7plc0rn5z68y5gn32j39e96tjhthzxsw3uvvu',
|
||||||
|
oracle: 'osmo1hkkx42777dyfz7wc8acjjhfdh9x2ugcjvdt7shtft6ha9cn420cquz3u3j',
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
type Token = {
|
type Token = {
|
||||||
|
denom: string
|
||||||
symbol: string
|
symbol: string
|
||||||
decimals: number
|
decimals: number
|
||||||
icon: string
|
icon: string
|
||||||
@ -7,17 +8,26 @@ type Token = {
|
|||||||
|
|
||||||
const tokenInfo: { [key in string]: Token } = {
|
const tokenInfo: { [key in string]: Token } = {
|
||||||
uosmo: {
|
uosmo: {
|
||||||
|
denom: 'uosmo',
|
||||||
symbol: 'OSMO',
|
symbol: 'OSMO',
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
icon: '/tokens/osmo.svg',
|
icon: '/tokens/osmo.svg',
|
||||||
chain: 'Osmosis',
|
chain: 'Osmosis',
|
||||||
},
|
},
|
||||||
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': {
|
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': {
|
||||||
|
denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
|
||||||
symbol: 'ATOM',
|
symbol: 'ATOM',
|
||||||
icon: '/tokens/atom.svg',
|
icon: '/tokens/atom.svg',
|
||||||
decimals: 6,
|
decimals: 6,
|
||||||
chain: 'Cosmos',
|
chain: 'Cosmos',
|
||||||
},
|
},
|
||||||
|
'ibc/E6931F78057F7CC5DA0FD6CEF82FF39373A6E0452BF1FD76910B93292CF356C1': {
|
||||||
|
denom: 'ibc/E6931F78057F7CC5DA0FD6CEF82FF39373A6E0452BF1FD76910B93292CF356C1',
|
||||||
|
symbol: 'CRO',
|
||||||
|
icon: '/tokens/cro.jpg',
|
||||||
|
decimals: 8,
|
||||||
|
chain: 'Crypto.org',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default tokenInfo
|
export default tokenInfo
|
||||||
|
78
hooks/mutations/useTradeAsset.tsx
Normal file
78
hooks/mutations/useTradeAsset.tsx
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'
|
||||||
|
import { useMemo } from 'react'
|
||||||
|
import { toast } from 'react-toastify'
|
||||||
|
|
||||||
|
import useCreditManagerStore from 'stores/useCreditManagerStore'
|
||||||
|
import useWalletStore from 'stores/useWalletStore'
|
||||||
|
import { queryKeys } from 'types/query-keys-factory'
|
||||||
|
import { hardcodedFee } from 'utils/contants'
|
||||||
|
import { Action } from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
||||||
|
|
||||||
|
const useTradeAsset = (
|
||||||
|
amount: number,
|
||||||
|
borrowAmount: number,
|
||||||
|
depositAmount: number,
|
||||||
|
tokenIn: string,
|
||||||
|
tokenOut: string,
|
||||||
|
slippage: number,
|
||||||
|
options?: Omit<UseMutationOptions, 'onError'>,
|
||||||
|
) => {
|
||||||
|
const creditManagerClient = useWalletStore((s) => s.clients.creditManager)
|
||||||
|
const selectedAccount = useCreditManagerStore((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,
|
||||||
|
),
|
||||||
|
{
|
||||||
|
onSettled: () => {
|
||||||
|
queryClient.invalidateQueries(queryKeys.creditAccountsPositions(selectedAccount))
|
||||||
|
queryClient.invalidateQueries(queryKeys.redbankBalances())
|
||||||
|
},
|
||||||
|
onError: (err: Error) => {
|
||||||
|
toast.error(err.message)
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default useTradeAsset
|
144
hooks/useCalculateMaxTradeAmount.tsx
Normal file
144
hooks/useCalculateMaxTradeAmount.tsx
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
import { useCallback, useMemo } from 'react'
|
||||||
|
import BigNumber from 'bignumber.js'
|
||||||
|
|
||||||
|
import useCreditManagerStore from 'stores/useCreditManagerStore'
|
||||||
|
|
||||||
|
import useCreditAccountPositions from './useCreditAccountPositions'
|
||||||
|
import useMarkets from './useMarkets'
|
||||||
|
import useRedbankBalances from './useRedbankBalances'
|
||||||
|
import useTokenPrices from './useTokenPrices'
|
||||||
|
|
||||||
|
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
|
||||||
|
const useCalculateMaxTradeAmount = (tokenIn: string, tokenOut: string, isMargin: boolean) => {
|
||||||
|
const selectedAccount = useCreditManagerStore((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,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
export default useCalculateMaxTradeAmount
|
@ -48,16 +48,16 @@ const useMarkets = () => {
|
|||||||
slope_1: '0.25',
|
slope_1: '0.25',
|
||||||
slope_2: '0.3',
|
slope_2: '0.3',
|
||||||
},
|
},
|
||||||
borrow_index: '1.002171957411401332',
|
borrow_index: '1.009983590233269535',
|
||||||
liquidity_index: '1.00055035491698614',
|
liquidity_index: '1.002073497939302451',
|
||||||
borrow_rate: '0.1',
|
borrow_rate: '0.350254719559196173',
|
||||||
liquidity_rate: '0',
|
liquidity_rate: '0.039428374060840366',
|
||||||
indexes_last_updated: 1664544343,
|
indexes_last_updated: 1668271634,
|
||||||
collateral_total_scaled: '89947659146708',
|
collateral_total_scaled: '8275583285688290',
|
||||||
debt_total_scaled: '0',
|
debt_total_scaled: '1155363812346122',
|
||||||
deposit_enabled: true,
|
deposit_enabled: true,
|
||||||
borrow_enabled: true,
|
borrow_enabled: true,
|
||||||
deposit_cap: '1000000000000',
|
deposit_cap: '15000000000000',
|
||||||
},
|
},
|
||||||
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': {
|
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': {
|
||||||
denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
|
denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
|
||||||
@ -71,16 +71,39 @@ const useMarkets = () => {
|
|||||||
slope_1: '0.25',
|
slope_1: '0.25',
|
||||||
slope_2: '0.3',
|
slope_2: '0.3',
|
||||||
},
|
},
|
||||||
borrow_index: '1.000000224611044228',
|
borrow_index: '1.015550607619308095',
|
||||||
liquidity_index: '1.000000023465246067',
|
liquidity_index: '1.003284932040106733',
|
||||||
borrow_rate: '0.25',
|
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',
|
liquidity_rate: '0',
|
||||||
indexes_last_updated: 1664367327,
|
indexes_last_updated: 1667995650,
|
||||||
collateral_total_scaled: '0',
|
collateral_total_scaled: '1000000000000000',
|
||||||
debt_total_scaled: '0',
|
debt_total_scaled: '0',
|
||||||
deposit_enabled: true,
|
deposit_enabled: true,
|
||||||
borrow_enabled: true,
|
borrow_enabled: true,
|
||||||
deposit_cap: '1000000000',
|
deposit_cap: '15000000000000',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
@ -1,16 +1,66 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
|
import { useMemo } from 'react'
|
||||||
|
import { gql, request } from 'graphql-request'
|
||||||
|
|
||||||
const useTokenPrices = () => {
|
import { contractAddresses } from 'config/contracts'
|
||||||
return useQuery<{ [key in string]: number }>(
|
import { queryKeys } from 'types/query-keys-factory'
|
||||||
['tokenPrices'],
|
import { chain } from 'utils/chains'
|
||||||
() => ({
|
import tokenInfo from 'config/tokenInfo'
|
||||||
uosmo: 1,
|
|
||||||
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': 1.5,
|
interface Result {
|
||||||
}),
|
prices: {
|
||||||
{
|
[key: string]: {
|
||||||
staleTime: Infinity,
|
denom: string
|
||||||
},
|
price: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tokenInfoList = Object.values(tokenInfo)
|
||||||
|
|
||||||
|
// TODO: build gql query dynamically on whitelisted tokens
|
||||||
|
const fetchTokenPrices = () => {
|
||||||
|
return request(
|
||||||
|
chain.hive,
|
||||||
|
gql`
|
||||||
|
query PriceOracle {
|
||||||
|
prices: wasm {
|
||||||
|
${tokenInfoList.map((token) => {
|
||||||
|
return `${token.symbol}: contractQuery(
|
||||||
|
contractAddress: "${contractAddresses.oracle}"
|
||||||
|
query: {
|
||||||
|
price: {
|
||||||
|
denom: "${token.denom}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)`
|
||||||
|
})}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const useTokenPrices = () => {
|
||||||
|
const result = useQuery<Result>(queryKeys.tokenPrices(), fetchTokenPrices, {
|
||||||
|
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]),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default useTokenPrices
|
export default useTokenPrices
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
"bech32": "^2.0.0",
|
"bech32": "^2.0.0",
|
||||||
"bignumber.js": "^9.1.0",
|
"bignumber.js": "^9.1.0",
|
||||||
"ethereumjs-util": "^7.1.5",
|
"ethereumjs-util": "^7.1.5",
|
||||||
|
"graphql": "^16.6.0",
|
||||||
|
"graphql-request": "^5.0.0",
|
||||||
"next": "12.3.1",
|
"next": "12.3.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
|
@ -18,6 +18,8 @@ import useWalletStore from 'stores/useWalletStore'
|
|||||||
import { queryKeys } from 'types/query-keys-factory'
|
import { queryKeys } from 'types/query-keys-factory'
|
||||||
import { chain } from 'utils/chains'
|
import { chain } from 'utils/chains'
|
||||||
import { hardcodedFee } from 'utils/contants'
|
import { hardcodedFee } from 'utils/contants'
|
||||||
|
import useMarkets from 'hooks/useMarkets'
|
||||||
|
import useTokenPrices from 'hooks/useTokenPrices'
|
||||||
|
|
||||||
const Home: NextPage = () => {
|
const Home: NextPage = () => {
|
||||||
const [sendAmount, setSendAmount] = useState('')
|
const [sendAmount, setSendAmount] = useState('')
|
||||||
@ -37,6 +39,9 @@ const Home: NextPage = () => {
|
|||||||
|
|
||||||
const [signingClient, setSigningClient] = useState<SigningCosmWasmClient>()
|
const [signingClient, setSigningClient] = useState<SigningCosmWasmClient>()
|
||||||
|
|
||||||
|
const { data: marketsData } = useMarkets()
|
||||||
|
const { data: tokenPrices } = useTokenPrices()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
if (!window.keplr) return
|
if (!window.keplr) return
|
||||||
@ -324,6 +329,20 @@ const Home: NextPage = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
{tokenPrices && (
|
||||||
|
<div className='mb-6'>
|
||||||
|
<h3 className='text-xl font-semibold'>Token Prices:</h3>
|
||||||
|
<pre>{JSON.stringify(tokenPrices, null, 2)}</pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{marketsData && (
|
||||||
|
<div>
|
||||||
|
<h3 className='text-xl font-semibold'>Markets Data:</h3>
|
||||||
|
<pre>{JSON.stringify(marketsData, null, 2)}</pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
{error && <div className='mt-8 bg-white p-4 text-red-500'>{error}</div>}
|
{error && <div className='mt-8 bg-white p-4 text-red-500'>{error}</div>}
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import Container from 'components/Container'
|
import Container from 'components/Container'
|
||||||
|
import TradeActionModule from 'components/Trade/TradeActionModule'
|
||||||
|
|
||||||
const Trade = () => {
|
const Trade = () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className='mb-4 flex gap-4'>
|
<div className='mb-4 flex gap-4'>
|
||||||
<Container className='flex-1'>Graph/Tradingview Module</Container>
|
<Container className='grid flex-1 place-items-center'>Graph/Tradingview Module</Container>
|
||||||
<div className='flex flex-col gap-4'>
|
<div className='flex flex-col gap-4'>
|
||||||
<Container>Buy/Sell module</Container>
|
<Container className='min-w-[350px] !p-2 text-sm'>
|
||||||
|
<TradeActionModule />
|
||||||
|
</Container>
|
||||||
<Container>Orderbook module (optional)</Container>
|
<Container>Orderbook module (optional)</Container>
|
||||||
</div>
|
</div>
|
||||||
<Container>Credit Account essential module</Container>
|
|
||||||
</div>
|
</div>
|
||||||
<Container>Trader order overview</Container>
|
<Container>Trader order overview</Container>
|
||||||
</div>
|
</div>
|
||||||
|
BIN
public/tokens/cro.jpg
Normal file
BIN
public/tokens/cro.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -4,8 +4,9 @@ import { persist } from 'zustand/middleware'
|
|||||||
|
|
||||||
import { contractAddresses } from 'config/contracts'
|
import { contractAddresses } from 'config/contracts'
|
||||||
import { Wallet } from 'types'
|
import { Wallet } from 'types'
|
||||||
import { AccountNftClient } from 'types/generated/account-nft/AccountNft.client'
|
import { MarsAccountNftClient } from 'types/generated/mars-account-nft/MarsAccountNft.client'
|
||||||
import { CreditManagerClient } from 'types/generated/credit-manager/CreditManager.client'
|
import { MarsCreditManagerClient } from 'types/generated/mars-credit-manager/MarsCreditManager.client'
|
||||||
|
import { MarsSwapperBaseClient } from 'types/generated/mars-swapper-base/MarsSwapperBase.client'
|
||||||
import { chain } from 'utils/chains'
|
import { chain } from 'utils/chains'
|
||||||
|
|
||||||
interface WalletStore {
|
interface WalletStore {
|
||||||
@ -15,8 +16,9 @@ interface WalletStore {
|
|||||||
client?: CosmWasmClient
|
client?: CosmWasmClient
|
||||||
signingClient?: SigningCosmWasmClient
|
signingClient?: SigningCosmWasmClient
|
||||||
clients: {
|
clients: {
|
||||||
accountNft: AccountNftClient | null
|
accountNft: MarsAccountNftClient | null
|
||||||
creditManager: CreditManagerClient | null
|
creditManager: MarsCreditManagerClient | null
|
||||||
|
swapperBase: MarsSwapperBaseClient | null
|
||||||
}
|
}
|
||||||
actions: {
|
actions: {
|
||||||
disconnect: () => void
|
disconnect: () => void
|
||||||
@ -36,27 +38,34 @@ const useWalletStore = create<WalletStore>()(
|
|||||||
clients: {
|
clients: {
|
||||||
accountNft: null,
|
accountNft: null,
|
||||||
creditManager: null,
|
creditManager: null,
|
||||||
|
swapperBase: null,
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
disconnect: () => {
|
disconnect: () => {
|
||||||
set(() => ({ address: '', wallet: null, signingClient: undefined }))
|
set(() => ({ address: '', wallet: null, signingClient: undefined }))
|
||||||
},
|
},
|
||||||
initClients: (address, signingClient) => {
|
initClients: (address, signingClient) => {
|
||||||
const accountNft = new AccountNftClient(
|
const accountNft = new MarsAccountNftClient(
|
||||||
signingClient,
|
signingClient,
|
||||||
address,
|
address,
|
||||||
contractAddresses.accountNft,
|
contractAddresses.accountNft,
|
||||||
)
|
)
|
||||||
const creditManager = new CreditManagerClient(
|
const creditManager = new MarsCreditManagerClient(
|
||||||
signingClient,
|
signingClient,
|
||||||
address,
|
address,
|
||||||
contractAddresses.creditManager,
|
contractAddresses.creditManager,
|
||||||
)
|
)
|
||||||
|
const swapperBase = new MarsSwapperBaseClient(
|
||||||
|
signingClient,
|
||||||
|
address,
|
||||||
|
contractAddresses.swapper,
|
||||||
|
)
|
||||||
|
|
||||||
set(() => ({
|
set(() => ({
|
||||||
clients: {
|
clients: {
|
||||||
accountNft,
|
accountNft,
|
||||||
creditManager,
|
creditManager,
|
||||||
|
swapperBase,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 * as _1 from './AccountNft.client'
|
|
||||||
import * as _2 from './AccountNft.react-query'
|
|
||||||
import * as _0 from './AccountNft.types'
|
|
||||||
export namespace contracts {
|
|
||||||
export const AccountNft = { ..._0, ..._1, ..._2 }
|
|
||||||
}
|
|
@ -1,470 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 { StdFee } from '@cosmjs/amino'
|
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
||||||
|
|
||||||
import { CreditManagerClient, CreditManagerQueryClient } from './CreditManager.client'
|
|
||||||
import {
|
|
||||||
Action,
|
|
||||||
Addr,
|
|
||||||
ArrayOfCoinBalanceResponseItem,
|
|
||||||
ArrayOfDebtShares,
|
|
||||||
ArrayOfSharesResponseItem,
|
|
||||||
ArrayOfString,
|
|
||||||
ArrayOfVaultBaseForString,
|
|
||||||
ArrayOfVaultPositionResponseItem,
|
|
||||||
ArrayOfVaultWithBalance,
|
|
||||||
CallbackMsg,
|
|
||||||
Coin,
|
|
||||||
CoinBalanceResponseItem,
|
|
||||||
ConfigResponse,
|
|
||||||
ConfigUpdates,
|
|
||||||
DebtAmount,
|
|
||||||
DebtShares,
|
|
||||||
Decimal,
|
|
||||||
ExecuteMsg,
|
|
||||||
HealthResponse,
|
|
||||||
InstantiateMsg,
|
|
||||||
OracleBaseForString,
|
|
||||||
Positions,
|
|
||||||
QueryMsg,
|
|
||||||
RedBankBaseForString,
|
|
||||||
SharesResponseItem,
|
|
||||||
SwapperBaseForString,
|
|
||||||
Uint128,
|
|
||||||
VaultBaseForAddr,
|
|
||||||
VaultBaseForString,
|
|
||||||
VaultPosition,
|
|
||||||
VaultPositionResponseItem,
|
|
||||||
VaultPositionState,
|
|
||||||
VaultWithBalance,
|
|
||||||
} from './CreditManager.types'
|
|
||||||
export const creditManagerQueryKeys = {
|
|
||||||
contract: [
|
|
||||||
{
|
|
||||||
contract: 'creditManager',
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
address: (contractAddress: string | undefined) =>
|
|
||||||
[{ ...creditManagerQueryKeys.contract[0], address: contractAddress }] as const,
|
|
||||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
|
||||||
allowedVaults: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_vaults', args },
|
|
||||||
] as const,
|
|
||||||
allowedCoins: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_coins', args },
|
|
||||||
] as const,
|
|
||||||
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args }] as const,
|
|
||||||
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'health', args }] as const,
|
|
||||||
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'all_coin_balances', args },
|
|
||||||
] as const,
|
|
||||||
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'all_debt_shares', args },
|
|
||||||
] as const,
|
|
||||||
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'total_debt_shares', args },
|
|
||||||
] as const,
|
|
||||||
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{
|
|
||||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
|
||||||
method: 'all_total_debt_shares',
|
|
||||||
args,
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{
|
|
||||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
|
||||||
method: 'all_vault_positions',
|
|
||||||
args,
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{
|
|
||||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
|
||||||
method: 'total_vault_coin_balance',
|
|
||||||
args,
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
allTotalVaultCoinBalances: (
|
|
||||||
contractAddress: string | undefined,
|
|
||||||
args?: Record<string, unknown>,
|
|
||||||
) =>
|
|
||||||
[
|
|
||||||
{
|
|
||||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
|
||||||
method: 'all_total_vault_coin_balances',
|
|
||||||
args,
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
}
|
|
||||||
export interface CreditManagerReactQuery<TResponse, TData = TResponse> {
|
|
||||||
client: CreditManagerQueryClient | undefined
|
|
||||||
options?: Omit<
|
|
||||||
UseQueryOptions<TResponse, Error, TData>,
|
|
||||||
"'queryKey' | 'queryFn' | 'initialData'"
|
|
||||||
> & {
|
|
||||||
initialData?: undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export interface CreditManagerAllTotalVaultCoinBalancesQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfVaultWithBalance, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: VaultBaseForString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllTotalVaultCoinBalancesQuery<TData = ArrayOfVaultWithBalance>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllTotalVaultCoinBalancesQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfVaultWithBalance, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerTotalVaultCoinBalanceQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<Uint128, TData> {
|
|
||||||
args: {
|
|
||||||
vault: VaultBaseForString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerTotalVaultCoinBalanceQuery<TData = Uint128>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerTotalVaultCoinBalanceQuery<TData>) {
|
|
||||||
return useQuery<Uint128, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerAllVaultPositionsQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: string[][]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllVaultPositionsQuery<TData = ArrayOfVaultPositionResponseItem>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllVaultPositionsQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerAllTotalDebtSharesQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfDebtShares, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllTotalDebtSharesQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfDebtShares, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerTotalDebtSharesQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<DebtShares, TData> {}
|
|
||||||
export function useCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
|
|
||||||
client,
|
|
||||||
options,
|
|
||||||
}: CreditManagerTotalDebtSharesQuery<TData>) {
|
|
||||||
return useQuery<DebtShares, Error, TData>(
|
|
||||||
creditManagerQueryKeys.totalDebtShares(client?.contractAddress),
|
|
||||||
() => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))),
|
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface CreditManagerAllDebtSharesQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: string[][]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllDebtSharesQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerAllCoinBalancesQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: string[][]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllCoinBalancesQuery<TData = ArrayOfCoinBalanceResponseItem>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllCoinBalancesQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerHealthQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<HealthResponse, TData> {
|
|
||||||
args: {
|
|
||||||
accountId: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerHealthQuery<TData = HealthResponse>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerHealthQuery<TData>) {
|
|
||||||
return useQuery<HealthResponse, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerPositionsQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<Positions, TData> {
|
|
||||||
args: {
|
|
||||||
accountId: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerPositionsQuery<TData = Positions>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerPositionsQuery<TData>) {
|
|
||||||
return useQuery<Positions, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerAllowedCoinsQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfString, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllowedCoinsQuery<TData = ArrayOfString>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllowedCoinsQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfString, Error, TData>(
|
|
||||||
creditManagerQueryKeys.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 CreditManagerAllowedVaultsQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ArrayOfVaultBaseForString, TData> {
|
|
||||||
args: {
|
|
||||||
limit?: number
|
|
||||||
startAfter?: VaultBaseForString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerAllowedVaultsQuery<TData = ArrayOfVaultBaseForString>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: CreditManagerAllowedVaultsQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfVaultBaseForString, Error, TData>(
|
|
||||||
creditManagerQueryKeys.allowedVaults(client?.contractAddress, args),
|
|
||||||
() =>
|
|
||||||
client
|
|
||||||
? client.allowedVaults({
|
|
||||||
limit: args.limit,
|
|
||||||
startAfter: args.startAfter,
|
|
||||||
})
|
|
||||||
: Promise.reject(new Error('Invalid client')),
|
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface CreditManagerConfigQuery<TData>
|
|
||||||
extends CreditManagerReactQuery<ConfigResponse, TData> {}
|
|
||||||
export function useCreditManagerConfigQuery<TData = ConfigResponse>({
|
|
||||||
client,
|
|
||||||
options,
|
|
||||||
}: CreditManagerConfigQuery<TData>) {
|
|
||||||
return useQuery<ConfigResponse, Error, TData>(
|
|
||||||
creditManagerQueryKeys.config(client?.contractAddress),
|
|
||||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface CreditManagerCallbackMutation {
|
|
||||||
client: CreditManagerClient
|
|
||||||
msg: CallbackMsg
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerCallbackMutation(
|
|
||||||
options?: Omit<
|
|
||||||
UseMutationOptions<ExecuteResult, Error, CreditManagerCallbackMutation>,
|
|
||||||
'mutationFn'
|
|
||||||
>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, CreditManagerCallbackMutation>(
|
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface CreditManagerUpdateConfigMutation {
|
|
||||||
client: CreditManagerClient
|
|
||||||
msg: {
|
|
||||||
newConfig: ConfigUpdates
|
|
||||||
}
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerUpdateConfigMutation(
|
|
||||||
options?: Omit<
|
|
||||||
UseMutationOptions<ExecuteResult, Error, CreditManagerUpdateConfigMutation>,
|
|
||||||
'mutationFn'
|
|
||||||
>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, CreditManagerUpdateConfigMutation>(
|
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
|
||||||
client.updateConfig(msg, fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface CreditManagerUpdateCreditAccountMutation {
|
|
||||||
client: CreditManagerClient
|
|
||||||
msg: {
|
|
||||||
accountId: string
|
|
||||||
actions: Action[]
|
|
||||||
}
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerUpdateCreditAccountMutation(
|
|
||||||
options?: Omit<
|
|
||||||
UseMutationOptions<ExecuteResult, Error, CreditManagerUpdateCreditAccountMutation>,
|
|
||||||
'mutationFn'
|
|
||||||
>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, CreditManagerUpdateCreditAccountMutation>(
|
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
|
||||||
client.updateCreditAccount(msg, fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface CreditManagerCreateCreditAccountMutation {
|
|
||||||
client: CreditManagerClient
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useCreditManagerCreateCreditAccountMutation(
|
|
||||||
options?: Omit<
|
|
||||||
UseMutationOptions<ExecuteResult, Error, CreditManagerCreateCreditAccountMutation>,
|
|
||||||
'mutationFn'
|
|
||||||
>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, CreditManagerCreateCreditAccountMutation>(
|
|
||||||
({ client, args: { fee, memo, funds } = {} }) => client.createCreditAccount(fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,36 +1,35 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { Coin, StdFee } from '@cosmjs/amino'
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Binary,
|
||||||
|
Expiration,
|
||||||
|
Timestamp,
|
||||||
|
Uint64,
|
||||||
|
QueryMsg,
|
||||||
AllNftInfoResponseForEmpty,
|
AllNftInfoResponseForEmpty,
|
||||||
|
OwnerOfResponse,
|
||||||
Approval,
|
Approval,
|
||||||
|
NftInfoResponseForEmpty,
|
||||||
|
Empty,
|
||||||
|
OperatorsResponse,
|
||||||
|
TokensResponse,
|
||||||
ApprovalResponse,
|
ApprovalResponse,
|
||||||
ApprovalsResponse,
|
ApprovalsResponse,
|
||||||
Binary,
|
|
||||||
ContractInfoResponse,
|
ContractInfoResponse,
|
||||||
Empty,
|
|
||||||
ExecuteMsg,
|
|
||||||
Expiration,
|
|
||||||
InstantiateMsg,
|
|
||||||
MinterResponse,
|
MinterResponse,
|
||||||
NftInfoResponseForEmpty,
|
|
||||||
NumTokensResponse,
|
NumTokensResponse,
|
||||||
OperatorsResponse,
|
|
||||||
OwnerOfResponse,
|
|
||||||
QueryMsg,
|
|
||||||
String,
|
String,
|
||||||
Timestamp,
|
} from './MarsAccountNft.types'
|
||||||
TokensResponse,
|
export interface MarsAccountNftReadOnlyInterface {
|
||||||
Uint64,
|
|
||||||
} from './AccountNft.types'
|
|
||||||
export interface AccountNftReadOnlyInterface {
|
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
proposedNewOwner: () => Promise<String>
|
proposedNewOwner: () => Promise<String>
|
||||||
ownerOf: ({
|
ownerOf: ({
|
||||||
@ -95,7 +94,7 @@ export interface AccountNftReadOnlyInterface {
|
|||||||
}) => Promise<TokensResponse>
|
}) => Promise<TokensResponse>
|
||||||
minter: () => Promise<MinterResponse>
|
minter: () => Promise<MinterResponse>
|
||||||
}
|
}
|
||||||
export class AccountNftQueryClient implements AccountNftReadOnlyInterface {
|
export class MarsAccountNftQueryClient implements MarsAccountNftReadOnlyInterface {
|
||||||
client: CosmWasmClient
|
client: CosmWasmClient
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
|
|
||||||
@ -254,7 +253,7 @@ export class AccountNftQueryClient implements AccountNftReadOnlyInterface {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface AccountNftInterface extends AccountNftReadOnlyInterface {
|
export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
sender: string
|
sender: string
|
||||||
proposeNewOwner: (
|
proposeNewOwner: (
|
||||||
@ -367,7 +366,10 @@ export interface AccountNftInterface extends AccountNftReadOnlyInterface {
|
|||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class AccountNftClient extends AccountNftQueryClient implements AccountNftInterface {
|
export class MarsAccountNftClient
|
||||||
|
extends MarsAccountNftQueryClient
|
||||||
|
implements MarsAccountNftInterface
|
||||||
|
{
|
||||||
client: SigningCosmWasmClient
|
client: SigningCosmWasmClient
|
||||||
sender: string
|
sender: string
|
||||||
contractAddress: string
|
contractAddress: string
|
@ -0,0 +1,396 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { Coin } from '@cosmjs/amino'
|
||||||
|
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Binary,
|
||||||
|
Expiration,
|
||||||
|
Timestamp,
|
||||||
|
Uint64,
|
||||||
|
QueryMsg,
|
||||||
|
AllNftInfoResponseForEmpty,
|
||||||
|
OwnerOfResponse,
|
||||||
|
Approval,
|
||||||
|
NftInfoResponseForEmpty,
|
||||||
|
Empty,
|
||||||
|
OperatorsResponse,
|
||||||
|
TokensResponse,
|
||||||
|
ApprovalResponse,
|
||||||
|
ApprovalsResponse,
|
||||||
|
ContractInfoResponse,
|
||||||
|
MinterResponse,
|
||||||
|
NumTokensResponse,
|
||||||
|
String,
|
||||||
|
} from './MarsAccountNft.types'
|
||||||
|
export interface MarsAccountNftMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
proposeNewOwner: (
|
||||||
|
{
|
||||||
|
newOwner,
|
||||||
|
}: {
|
||||||
|
newOwner: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
acceptOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||||
|
mint: (
|
||||||
|
{
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
transferNft: (
|
||||||
|
{
|
||||||
|
recipient,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
recipient: string
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
sendNft: (
|
||||||
|
{
|
||||||
|
contract,
|
||||||
|
msg,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
contract: string
|
||||||
|
msg: Binary
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
approve: (
|
||||||
|
{
|
||||||
|
expires,
|
||||||
|
spender,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
expires?: Expiration
|
||||||
|
spender: string
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
revoke: (
|
||||||
|
{
|
||||||
|
spender,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
spender: string
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
approveAll: (
|
||||||
|
{
|
||||||
|
expires,
|
||||||
|
operator,
|
||||||
|
}: {
|
||||||
|
expires?: Expiration
|
||||||
|
operator: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
revokeAll: (
|
||||||
|
{
|
||||||
|
operator,
|
||||||
|
}: {
|
||||||
|
operator: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
burn: (
|
||||||
|
{
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.proposeNewOwner = this.proposeNewOwner.bind(this)
|
||||||
|
this.acceptOwnership = this.acceptOwnership.bind(this)
|
||||||
|
this.mint = this.mint.bind(this)
|
||||||
|
this.transferNft = this.transferNft.bind(this)
|
||||||
|
this.sendNft = this.sendNft.bind(this)
|
||||||
|
this.approve = this.approve.bind(this)
|
||||||
|
this.revoke = this.revoke.bind(this)
|
||||||
|
this.approveAll = this.approveAll.bind(this)
|
||||||
|
this.revokeAll = this.revokeAll.bind(this)
|
||||||
|
this.burn = this.burn.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
proposeNewOwner = (
|
||||||
|
{
|
||||||
|
newOwner,
|
||||||
|
}: {
|
||||||
|
newOwner: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
propose_new_owner: {
|
||||||
|
new_owner: newOwner,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
acceptOwnership = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
accept_ownership: {},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mint = (
|
||||||
|
{
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
mint: {
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transferNft = (
|
||||||
|
{
|
||||||
|
recipient,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
recipient: string
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
transfer_nft: {
|
||||||
|
recipient,
|
||||||
|
token_id: tokenId,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sendNft = (
|
||||||
|
{
|
||||||
|
contract,
|
||||||
|
msg,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
contract: string
|
||||||
|
msg: Binary
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
send_nft: {
|
||||||
|
contract,
|
||||||
|
msg,
|
||||||
|
token_id: tokenId,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
approve = (
|
||||||
|
{
|
||||||
|
expires,
|
||||||
|
spender,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
expires?: Expiration
|
||||||
|
spender: string
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
approve: {
|
||||||
|
expires,
|
||||||
|
spender,
|
||||||
|
token_id: tokenId,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
revoke = (
|
||||||
|
{
|
||||||
|
spender,
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
spender: string
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
revoke: {
|
||||||
|
spender,
|
||||||
|
token_id: tokenId,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
approveAll = (
|
||||||
|
{
|
||||||
|
expires,
|
||||||
|
operator,
|
||||||
|
}: {
|
||||||
|
expires?: Expiration
|
||||||
|
operator: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
approve_all: {
|
||||||
|
expires,
|
||||||
|
operator,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
revokeAll = (
|
||||||
|
{
|
||||||
|
operator,
|
||||||
|
}: {
|
||||||
|
operator: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
revoke_all: {
|
||||||
|
operator,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
burn = (
|
||||||
|
{
|
||||||
|
tokenId,
|
||||||
|
}: {
|
||||||
|
tokenId: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
burn: {
|
||||||
|
token_id: tokenId,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,78 +1,89 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
import { StdFee, Coin } from '@cosmjs/amino'
|
||||||
|
|
||||||
import { AccountNftClient, AccountNftQueryClient } from './AccountNft.client'
|
|
||||||
import {
|
import {
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Binary,
|
||||||
|
Expiration,
|
||||||
|
Timestamp,
|
||||||
|
Uint64,
|
||||||
|
QueryMsg,
|
||||||
AllNftInfoResponseForEmpty,
|
AllNftInfoResponseForEmpty,
|
||||||
|
OwnerOfResponse,
|
||||||
Approval,
|
Approval,
|
||||||
|
NftInfoResponseForEmpty,
|
||||||
|
Empty,
|
||||||
|
OperatorsResponse,
|
||||||
|
TokensResponse,
|
||||||
ApprovalResponse,
|
ApprovalResponse,
|
||||||
ApprovalsResponse,
|
ApprovalsResponse,
|
||||||
Binary,
|
|
||||||
ContractInfoResponse,
|
ContractInfoResponse,
|
||||||
Empty,
|
|
||||||
ExecuteMsg,
|
|
||||||
Expiration,
|
|
||||||
InstantiateMsg,
|
|
||||||
MinterResponse,
|
MinterResponse,
|
||||||
NftInfoResponseForEmpty,
|
|
||||||
NumTokensResponse,
|
NumTokensResponse,
|
||||||
OperatorsResponse,
|
|
||||||
OwnerOfResponse,
|
|
||||||
QueryMsg,
|
|
||||||
String,
|
String,
|
||||||
Timestamp,
|
} from './MarsAccountNft.types'
|
||||||
TokensResponse,
|
import { MarsAccountNftQueryClient, MarsAccountNftClient } from './MarsAccountNft.client'
|
||||||
Uint64,
|
export const marsAccountNftQueryKeys = {
|
||||||
} from './AccountNft.types'
|
|
||||||
export const accountNftQueryKeys = {
|
|
||||||
contract: [
|
contract: [
|
||||||
{
|
{
|
||||||
contract: 'accountNft',
|
contract: 'marsAccountNft',
|
||||||
},
|
},
|
||||||
] as const,
|
] as const,
|
||||||
address: (contractAddress: string | undefined) =>
|
address: (contractAddress: string | undefined) =>
|
||||||
[{ ...accountNftQueryKeys.contract[0], address: contractAddress }] as const,
|
[{ ...marsAccountNftQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
proposedNewOwner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
proposedNewOwner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'proposed_new_owner', args },
|
{
|
||||||
|
...marsAccountNftQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'proposed_new_owner',
|
||||||
|
args,
|
||||||
|
},
|
||||||
] as const,
|
] as const,
|
||||||
ownerOf: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
ownerOf: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'owner_of', args }] as const,
|
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'owner_of', args }] as const,
|
||||||
approval: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
approval: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'approval', args }] as const,
|
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approval', args }] as const,
|
||||||
approvals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
approvals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'approvals', args }] as const,
|
[
|
||||||
|
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approvals', args },
|
||||||
|
] as const,
|
||||||
allOperators: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
allOperators: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'all_operators', args },
|
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_operators', args },
|
||||||
] as const,
|
] as const,
|
||||||
numTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
numTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'num_tokens', args }] as const,
|
[
|
||||||
|
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'num_tokens', args },
|
||||||
|
] as const,
|
||||||
contractInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
contractInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'contract_info', args },
|
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'contract_info', args },
|
||||||
] as const,
|
] as const,
|
||||||
nftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
nftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'nft_info', args }] as const,
|
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'nft_info', args }] as const,
|
||||||
allNftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
allNftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'all_nft_info', args }] as const,
|
[
|
||||||
|
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_nft_info', args },
|
||||||
|
] as const,
|
||||||
tokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
tokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'tokens', args }] as const,
|
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'tokens', args }] as const,
|
||||||
allTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
allTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'all_tokens', args }] as const,
|
[
|
||||||
|
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_tokens', args },
|
||||||
|
] as const,
|
||||||
minter: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
minter: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'minter', args }] as const,
|
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'minter', args }] as const,
|
||||||
}
|
}
|
||||||
export interface AccountNftReactQuery<TResponse, TData = TResponse> {
|
export interface MarsAccountNftReactQuery<TResponse, TData = TResponse> {
|
||||||
client: AccountNftQueryClient | undefined
|
client: MarsAccountNftQueryClient | undefined
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseQueryOptions<TResponse, Error, TData>,
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
"'queryKey' | 'queryFn' | 'initialData'"
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
@ -80,31 +91,32 @@ export interface AccountNftReactQuery<TResponse, TData = TResponse> {
|
|||||||
initialData?: undefined
|
initialData?: undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface AccountNftMinterQuery<TData> extends AccountNftReactQuery<MinterResponse, TData> {}
|
export interface MarsAccountNftMinterQuery<TData>
|
||||||
export function useAccountNftMinterQuery<TData = MinterResponse>({
|
extends MarsAccountNftReactQuery<MinterResponse, TData> {}
|
||||||
|
export function useMarsAccountNftMinterQuery<TData = MinterResponse>({
|
||||||
client,
|
client,
|
||||||
options,
|
options,
|
||||||
}: AccountNftMinterQuery<TData>) {
|
}: MarsAccountNftMinterQuery<TData>) {
|
||||||
return useQuery<MinterResponse, Error, TData>(
|
return useQuery<MinterResponse, Error, TData>(
|
||||||
accountNftQueryKeys.minter(client?.contractAddress),
|
marsAccountNftQueryKeys.minter(client?.contractAddress),
|
||||||
() => (client ? client.minter() : Promise.reject(new Error('Invalid client'))),
|
() => (client ? client.minter() : Promise.reject(new Error('Invalid client'))),
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftAllTokensQuery<TData>
|
export interface MarsAccountNftAllTokensQuery<TData>
|
||||||
extends AccountNftReactQuery<TokensResponse, TData> {
|
extends MarsAccountNftReactQuery<TokensResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftAllTokensQuery<TData = TokensResponse>({
|
export function useMarsAccountNftAllTokensQuery<TData = TokensResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftAllTokensQuery<TData>) {
|
}: MarsAccountNftAllTokensQuery<TData>) {
|
||||||
return useQuery<TokensResponse, Error, TData>(
|
return useQuery<TokensResponse, Error, TData>(
|
||||||
accountNftQueryKeys.allTokens(client?.contractAddress, args),
|
marsAccountNftQueryKeys.allTokens(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.allTokens({
|
? client.allTokens({
|
||||||
@ -115,20 +127,21 @@ export function useAccountNftAllTokensQuery<TData = TokensResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftTokensQuery<TData> extends AccountNftReactQuery<TokensResponse, TData> {
|
export interface MarsAccountNftTokensQuery<TData>
|
||||||
|
extends MarsAccountNftReactQuery<TokensResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
limit?: number
|
limit?: number
|
||||||
owner: string
|
owner: string
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftTokensQuery<TData = TokensResponse>({
|
export function useMarsAccountNftTokensQuery<TData = TokensResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftTokensQuery<TData>) {
|
}: MarsAccountNftTokensQuery<TData>) {
|
||||||
return useQuery<TokensResponse, Error, TData>(
|
return useQuery<TokensResponse, Error, TData>(
|
||||||
accountNftQueryKeys.tokens(client?.contractAddress, args),
|
marsAccountNftQueryKeys.tokens(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.tokens({
|
? client.tokens({
|
||||||
@ -140,20 +153,20 @@ export function useAccountNftTokensQuery<TData = TokensResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftAllNftInfoQuery<TData>
|
export interface MarsAccountNftAllNftInfoQuery<TData>
|
||||||
extends AccountNftReactQuery<AllNftInfoResponseForEmpty, TData> {
|
extends MarsAccountNftReactQuery<AllNftInfoResponseForEmpty, TData> {
|
||||||
args: {
|
args: {
|
||||||
includeExpired?: boolean
|
includeExpired?: boolean
|
||||||
tokenId: string
|
tokenId: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftAllNftInfoQuery<TData = AllNftInfoResponseForEmpty>({
|
export function useMarsAccountNftAllNftInfoQuery<TData = AllNftInfoResponseForEmpty>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftAllNftInfoQuery<TData>) {
|
}: MarsAccountNftAllNftInfoQuery<TData>) {
|
||||||
return useQuery<AllNftInfoResponseForEmpty, Error, TData>(
|
return useQuery<AllNftInfoResponseForEmpty, Error, TData>(
|
||||||
accountNftQueryKeys.allNftInfo(client?.contractAddress, args),
|
marsAccountNftQueryKeys.allNftInfo(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.allNftInfo({
|
? client.allNftInfo({
|
||||||
@ -164,19 +177,19 @@ export function useAccountNftAllNftInfoQuery<TData = AllNftInfoResponseForEmpty>
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftNftInfoQuery<TData>
|
export interface MarsAccountNftNftInfoQuery<TData>
|
||||||
extends AccountNftReactQuery<NftInfoResponseForEmpty, TData> {
|
extends MarsAccountNftReactQuery<NftInfoResponseForEmpty, TData> {
|
||||||
args: {
|
args: {
|
||||||
tokenId: string
|
tokenId: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftNftInfoQuery<TData = NftInfoResponseForEmpty>({
|
export function useMarsAccountNftNftInfoQuery<TData = NftInfoResponseForEmpty>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftNftInfoQuery<TData>) {
|
}: MarsAccountNftNftInfoQuery<TData>) {
|
||||||
return useQuery<NftInfoResponseForEmpty, Error, TData>(
|
return useQuery<NftInfoResponseForEmpty, Error, TData>(
|
||||||
accountNftQueryKeys.nftInfo(client?.contractAddress, args),
|
marsAccountNftQueryKeys.nftInfo(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.nftInfo({
|
? client.nftInfo({
|
||||||
@ -186,32 +199,32 @@ export function useAccountNftNftInfoQuery<TData = NftInfoResponseForEmpty>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftContractInfoQuery<TData>
|
export interface MarsAccountNftContractInfoQuery<TData>
|
||||||
extends AccountNftReactQuery<ContractInfoResponse, TData> {}
|
extends MarsAccountNftReactQuery<ContractInfoResponse, TData> {}
|
||||||
export function useAccountNftContractInfoQuery<TData = ContractInfoResponse>({
|
export function useMarsAccountNftContractInfoQuery<TData = ContractInfoResponse>({
|
||||||
client,
|
client,
|
||||||
options,
|
options,
|
||||||
}: AccountNftContractInfoQuery<TData>) {
|
}: MarsAccountNftContractInfoQuery<TData>) {
|
||||||
return useQuery<ContractInfoResponse, Error, TData>(
|
return useQuery<ContractInfoResponse, Error, TData>(
|
||||||
accountNftQueryKeys.contractInfo(client?.contractAddress),
|
marsAccountNftQueryKeys.contractInfo(client?.contractAddress),
|
||||||
() => (client ? client.contractInfo() : Promise.reject(new Error('Invalid client'))),
|
() => (client ? client.contractInfo() : Promise.reject(new Error('Invalid client'))),
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftNumTokensQuery<TData>
|
export interface MarsAccountNftNumTokensQuery<TData>
|
||||||
extends AccountNftReactQuery<NumTokensResponse, TData> {}
|
extends MarsAccountNftReactQuery<NumTokensResponse, TData> {}
|
||||||
export function useAccountNftNumTokensQuery<TData = NumTokensResponse>({
|
export function useMarsAccountNftNumTokensQuery<TData = NumTokensResponse>({
|
||||||
client,
|
client,
|
||||||
options,
|
options,
|
||||||
}: AccountNftNumTokensQuery<TData>) {
|
}: MarsAccountNftNumTokensQuery<TData>) {
|
||||||
return useQuery<NumTokensResponse, Error, TData>(
|
return useQuery<NumTokensResponse, Error, TData>(
|
||||||
accountNftQueryKeys.numTokens(client?.contractAddress),
|
marsAccountNftQueryKeys.numTokens(client?.contractAddress),
|
||||||
() => (client ? client.numTokens() : Promise.reject(new Error('Invalid client'))),
|
() => (client ? client.numTokens() : Promise.reject(new Error('Invalid client'))),
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftAllOperatorsQuery<TData>
|
export interface MarsAccountNftAllOperatorsQuery<TData>
|
||||||
extends AccountNftReactQuery<OperatorsResponse, TData> {
|
extends MarsAccountNftReactQuery<OperatorsResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
includeExpired?: boolean
|
includeExpired?: boolean
|
||||||
limit?: number
|
limit?: number
|
||||||
@ -219,13 +232,13 @@ export interface AccountNftAllOperatorsQuery<TData>
|
|||||||
startAfter?: string
|
startAfter?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftAllOperatorsQuery<TData = OperatorsResponse>({
|
export function useMarsAccountNftAllOperatorsQuery<TData = OperatorsResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftAllOperatorsQuery<TData>) {
|
}: MarsAccountNftAllOperatorsQuery<TData>) {
|
||||||
return useQuery<OperatorsResponse, Error, TData>(
|
return useQuery<OperatorsResponse, Error, TData>(
|
||||||
accountNftQueryKeys.allOperators(client?.contractAddress, args),
|
marsAccountNftQueryKeys.allOperators(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.allOperators({
|
? client.allOperators({
|
||||||
@ -238,20 +251,20 @@ export function useAccountNftAllOperatorsQuery<TData = OperatorsResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftApprovalsQuery<TData>
|
export interface MarsAccountNftApprovalsQuery<TData>
|
||||||
extends AccountNftReactQuery<ApprovalsResponse, TData> {
|
extends MarsAccountNftReactQuery<ApprovalsResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
includeExpired?: boolean
|
includeExpired?: boolean
|
||||||
tokenId: string
|
tokenId: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftApprovalsQuery<TData = ApprovalsResponse>({
|
export function useMarsAccountNftApprovalsQuery<TData = ApprovalsResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftApprovalsQuery<TData>) {
|
}: MarsAccountNftApprovalsQuery<TData>) {
|
||||||
return useQuery<ApprovalsResponse, Error, TData>(
|
return useQuery<ApprovalsResponse, Error, TData>(
|
||||||
accountNftQueryKeys.approvals(client?.contractAddress, args),
|
marsAccountNftQueryKeys.approvals(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.approvals({
|
? client.approvals({
|
||||||
@ -262,21 +275,21 @@ export function useAccountNftApprovalsQuery<TData = ApprovalsResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftApprovalQuery<TData>
|
export interface MarsAccountNftApprovalQuery<TData>
|
||||||
extends AccountNftReactQuery<ApprovalResponse, TData> {
|
extends MarsAccountNftReactQuery<ApprovalResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
includeExpired?: boolean
|
includeExpired?: boolean
|
||||||
spender: string
|
spender: string
|
||||||
tokenId: string
|
tokenId: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftApprovalQuery<TData = ApprovalResponse>({
|
export function useMarsAccountNftApprovalQuery<TData = ApprovalResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftApprovalQuery<TData>) {
|
}: MarsAccountNftApprovalQuery<TData>) {
|
||||||
return useQuery<ApprovalResponse, Error, TData>(
|
return useQuery<ApprovalResponse, Error, TData>(
|
||||||
accountNftQueryKeys.approval(client?.contractAddress, args),
|
marsAccountNftQueryKeys.approval(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.approval({
|
? client.approval({
|
||||||
@ -288,20 +301,20 @@ export function useAccountNftApprovalQuery<TData = ApprovalResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftOwnerOfQuery<TData>
|
export interface MarsAccountNftOwnerOfQuery<TData>
|
||||||
extends AccountNftReactQuery<OwnerOfResponse, TData> {
|
extends MarsAccountNftReactQuery<OwnerOfResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
includeExpired?: boolean
|
includeExpired?: boolean
|
||||||
tokenId: string
|
tokenId: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftOwnerOfQuery<TData = OwnerOfResponse>({
|
export function useMarsAccountNftOwnerOfQuery<TData = OwnerOfResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: AccountNftOwnerOfQuery<TData>) {
|
}: MarsAccountNftOwnerOfQuery<TData>) {
|
||||||
return useQuery<OwnerOfResponse, Error, TData>(
|
return useQuery<OwnerOfResponse, Error, TData>(
|
||||||
accountNftQueryKeys.ownerOf(client?.contractAddress, args),
|
marsAccountNftQueryKeys.ownerOf(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.ownerOf({
|
? client.ownerOf({
|
||||||
@ -312,20 +325,20 @@ export function useAccountNftOwnerOfQuery<TData = OwnerOfResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftProposedNewOwnerQuery<TData>
|
export interface MarsAccountNftProposedNewOwnerQuery<TData>
|
||||||
extends AccountNftReactQuery<String, TData> {}
|
extends MarsAccountNftReactQuery<String, TData> {}
|
||||||
export function useAccountNftProposedNewOwnerQuery<TData = String>({
|
export function useMarsAccountNftProposedNewOwnerQuery<TData = String>({
|
||||||
client,
|
client,
|
||||||
options,
|
options,
|
||||||
}: AccountNftProposedNewOwnerQuery<TData>) {
|
}: MarsAccountNftProposedNewOwnerQuery<TData>) {
|
||||||
return useQuery<String, Error, TData>(
|
return useQuery<String, Error, TData>(
|
||||||
accountNftQueryKeys.proposedNewOwner(client?.contractAddress),
|
marsAccountNftQueryKeys.proposedNewOwner(client?.contractAddress),
|
||||||
() => (client ? client.proposedNewOwner() : Promise.reject(new Error('Invalid client'))),
|
() => (client ? client.proposedNewOwner() : Promise.reject(new Error('Invalid client'))),
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftBurnMutation {
|
export interface MarsAccountNftBurnMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
tokenId: string
|
tokenId: string
|
||||||
}
|
}
|
||||||
@ -335,16 +348,19 @@ export interface AccountNftBurnMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftBurnMutation(
|
export function useMarsAccountNftBurnMutation(
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftBurnMutation>, 'mutationFn'>,
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftBurnMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftBurnMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftBurnMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.burn(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.burn(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftRevokeAllMutation {
|
export interface MarsAccountNftRevokeAllMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
operator: string
|
operator: string
|
||||||
}
|
}
|
||||||
@ -354,19 +370,19 @@ export interface AccountNftRevokeAllMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftRevokeAllMutation(
|
export function useMarsAccountNftRevokeAllMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, AccountNftRevokeAllMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftRevokeAllMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftRevokeAllMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftRevokeAllMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.revokeAll(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.revokeAll(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftApproveAllMutation {
|
export interface MarsAccountNftApproveAllMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
expires?: Expiration
|
expires?: Expiration
|
||||||
operator: string
|
operator: string
|
||||||
@ -377,19 +393,19 @@ export interface AccountNftApproveAllMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftApproveAllMutation(
|
export function useMarsAccountNftApproveAllMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, AccountNftApproveAllMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftApproveAllMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftApproveAllMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftApproveAllMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.approveAll(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.approveAll(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftRevokeMutation {
|
export interface MarsAccountNftRevokeMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
spender: string
|
spender: string
|
||||||
tokenId: string
|
tokenId: string
|
||||||
@ -400,16 +416,19 @@ export interface AccountNftRevokeMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftRevokeMutation(
|
export function useMarsAccountNftRevokeMutation(
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftRevokeMutation>, 'mutationFn'>,
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftRevokeMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftRevokeMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftRevokeMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.revoke(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.revoke(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftApproveMutation {
|
export interface MarsAccountNftApproveMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
expires?: Expiration
|
expires?: Expiration
|
||||||
spender: string
|
spender: string
|
||||||
@ -421,16 +440,19 @@ export interface AccountNftApproveMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftApproveMutation(
|
export function useMarsAccountNftApproveMutation(
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftApproveMutation>, 'mutationFn'>,
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftApproveMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftApproveMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftApproveMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.approve(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.approve(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftSendNftMutation {
|
export interface MarsAccountNftSendNftMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
contract: string
|
contract: string
|
||||||
msg: Binary
|
msg: Binary
|
||||||
@ -442,16 +464,19 @@ export interface AccountNftSendNftMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftSendNftMutation(
|
export function useMarsAccountNftSendNftMutation(
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftSendNftMutation>, 'mutationFn'>,
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftSendNftMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftSendNftMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftSendNftMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.sendNft(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.sendNft(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftTransferNftMutation {
|
export interface MarsAccountNftTransferNftMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
recipient: string
|
recipient: string
|
||||||
tokenId: string
|
tokenId: string
|
||||||
@ -462,19 +487,19 @@ export interface AccountNftTransferNftMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftTransferNftMutation(
|
export function useMarsAccountNftTransferNftMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, AccountNftTransferNftMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftTransferNftMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftTransferNftMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftTransferNftMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.transferNft(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.transferNft(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftMintMutation {
|
export interface MarsAccountNftMintMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
user: string
|
user: string
|
||||||
}
|
}
|
||||||
@ -484,35 +509,38 @@ export interface AccountNftMintMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftMintMutation(
|
export function useMarsAccountNftMintMutation(
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftMintMutation>, 'mutationFn'>,
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftMintMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftMintMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftMintMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.mint(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.mint(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftAcceptOwnershipMutation {
|
export interface MarsAccountNftAcceptOwnershipMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
args?: {
|
args?: {
|
||||||
fee?: number | StdFee | 'auto'
|
fee?: number | StdFee | 'auto'
|
||||||
memo?: string
|
memo?: string
|
||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftAcceptOwnershipMutation(
|
export function useMarsAccountNftAcceptOwnershipMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, AccountNftAcceptOwnershipMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftAcceptOwnershipMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftAcceptOwnershipMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftAcceptOwnershipMutation>(
|
||||||
({ client, args: { fee, memo, funds } = {} }) => client.acceptOwnership(fee, memo, funds),
|
({ client, args: { fee, memo, funds } = {} }) => client.acceptOwnership(fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface AccountNftProposeNewOwnerMutation {
|
export interface MarsAccountNftProposeNewOwnerMutation {
|
||||||
client: AccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
newOwner: string
|
newOwner: string
|
||||||
}
|
}
|
||||||
@ -522,13 +550,13 @@ export interface AccountNftProposeNewOwnerMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useAccountNftProposeNewOwnerMutation(
|
export function useMarsAccountNftProposeNewOwnerMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, AccountNftProposeNewOwnerMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftProposeNewOwnerMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, AccountNftProposeNewOwnerMutation>(
|
return useMutation<ExecuteResult, Error, MarsAccountNftProposeNewOwnerMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
client.proposeNewOwner(msg, fee, memo, funds),
|
client.proposeNewOwner(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
@ -1,13 +1,14 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _4 from './CreditManager.client'
|
import * as _0 from './MarsAccountNft.types'
|
||||||
import * as _5 from './CreditManager.react-query'
|
import * as _1 from './MarsAccountNft.client'
|
||||||
import * as _3 from './CreditManager.types'
|
import * as _2 from './MarsAccountNft.message-composer'
|
||||||
|
import * as _3 from './MarsAccountNft.react-query'
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const CreditManager = { ..._3, ..._4, ..._5 }
|
export const MarsAccountNft = { ..._0, ..._1, ..._2, ..._3 }
|
||||||
}
|
}
|
@ -1,58 +1,66 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { StdFee } from '@cosmjs/amino'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Action,
|
|
||||||
Addr,
|
|
||||||
ArrayOfCoinBalanceResponseItem,
|
|
||||||
ArrayOfDebtShares,
|
|
||||||
ArrayOfSharesResponseItem,
|
|
||||||
ArrayOfString,
|
|
||||||
ArrayOfVaultBaseForString,
|
|
||||||
ArrayOfVaultPositionResponseItem,
|
|
||||||
ArrayOfVaultWithBalance,
|
|
||||||
CallbackMsg,
|
|
||||||
Coin,
|
|
||||||
CoinBalanceResponseItem,
|
|
||||||
ConfigResponse,
|
|
||||||
ConfigUpdates,
|
|
||||||
DebtAmount,
|
|
||||||
DebtShares,
|
|
||||||
Decimal,
|
|
||||||
ExecuteMsg,
|
|
||||||
HealthResponse,
|
|
||||||
InstantiateMsg,
|
|
||||||
OracleBaseForString,
|
|
||||||
Positions,
|
|
||||||
QueryMsg,
|
|
||||||
RedBankBaseForString,
|
|
||||||
SharesResponseItem,
|
|
||||||
SwapperBaseForString,
|
|
||||||
Uint128,
|
Uint128,
|
||||||
VaultBaseForAddr,
|
Decimal,
|
||||||
|
OracleBaseForString,
|
||||||
|
RedBankBaseForString,
|
||||||
|
SwapperBaseForString,
|
||||||
|
ZapperBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
VaultInstantiateConfig,
|
||||||
|
VaultConfig,
|
||||||
|
Coin,
|
||||||
VaultBaseForString,
|
VaultBaseForString,
|
||||||
VaultPosition,
|
ExecuteMsg,
|
||||||
VaultPositionResponseItem,
|
Action,
|
||||||
VaultPositionState,
|
CallbackMsg,
|
||||||
|
Addr,
|
||||||
|
ConfigUpdates,
|
||||||
|
VaultBaseForAddr,
|
||||||
|
QueryMsg,
|
||||||
|
ArrayOfCoinBalanceResponseItem,
|
||||||
|
CoinBalanceResponseItem,
|
||||||
|
ArrayOfSharesResponseItem,
|
||||||
|
SharesResponseItem,
|
||||||
|
ArrayOfDebtShares,
|
||||||
|
DebtShares,
|
||||||
|
ArrayOfVaultWithBalance,
|
||||||
VaultWithBalance,
|
VaultWithBalance,
|
||||||
} from './CreditManager.types'
|
VaultPositionAmount,
|
||||||
export interface CreditManagerReadOnlyInterface {
|
VaultAmount,
|
||||||
|
VaultAmount1,
|
||||||
|
UnlockingPositions,
|
||||||
|
ArrayOfVaultPositionResponseItem,
|
||||||
|
VaultPositionResponseItem,
|
||||||
|
VaultPosition,
|
||||||
|
LockingVaultAmount,
|
||||||
|
VaultUnlockingPosition,
|
||||||
|
ArrayOfString,
|
||||||
|
ConfigResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
|
HealthResponse,
|
||||||
|
Positions,
|
||||||
|
DebtAmount,
|
||||||
|
ArrayOfVaultInstantiateConfig,
|
||||||
|
} from './MarsCreditManager.types'
|
||||||
|
export interface MarsCreditManagerReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
config: () => Promise<ConfigResponse>
|
config: () => Promise<ConfigResponse>
|
||||||
allowedVaults: ({
|
vaultConfigs: ({
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
}: {
|
}: {
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: VaultBaseForString
|
startAfter?: VaultBaseForString
|
||||||
}) => Promise<ArrayOfVaultBaseForString>
|
}) => Promise<ArrayOfVaultInstantiateConfig>
|
||||||
allowedCoins: ({
|
allowedCoins: ({
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
@ -99,8 +107,16 @@ export interface CreditManagerReadOnlyInterface {
|
|||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: VaultBaseForString
|
startAfter?: VaultBaseForString
|
||||||
}) => Promise<ArrayOfVaultWithBalance>
|
}) => Promise<ArrayOfVaultWithBalance>
|
||||||
|
estimateProvideLiquidity: ({
|
||||||
|
coinsIn,
|
||||||
|
lpTokenOut,
|
||||||
|
}: {
|
||||||
|
coinsIn: Coin[]
|
||||||
|
lpTokenOut: string
|
||||||
|
}) => Promise<Uint128>
|
||||||
|
estimateWithdrawLiquidity: ({ lpToken }: { lpToken: Coin }) => Promise<ArrayOfCoin>
|
||||||
}
|
}
|
||||||
export class CreditManagerQueryClient implements CreditManagerReadOnlyInterface {
|
export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyInterface {
|
||||||
client: CosmWasmClient
|
client: CosmWasmClient
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
|
|
||||||
@ -108,7 +124,7 @@ export class CreditManagerQueryClient implements CreditManagerReadOnlyInterface
|
|||||||
this.client = client
|
this.client = client
|
||||||
this.contractAddress = contractAddress
|
this.contractAddress = contractAddress
|
||||||
this.config = this.config.bind(this)
|
this.config = this.config.bind(this)
|
||||||
this.allowedVaults = this.allowedVaults.bind(this)
|
this.vaultConfigs = this.vaultConfigs.bind(this)
|
||||||
this.allowedCoins = this.allowedCoins.bind(this)
|
this.allowedCoins = this.allowedCoins.bind(this)
|
||||||
this.positions = this.positions.bind(this)
|
this.positions = this.positions.bind(this)
|
||||||
this.health = this.health.bind(this)
|
this.health = this.health.bind(this)
|
||||||
@ -119,6 +135,8 @@ export class CreditManagerQueryClient implements CreditManagerReadOnlyInterface
|
|||||||
this.allVaultPositions = this.allVaultPositions.bind(this)
|
this.allVaultPositions = this.allVaultPositions.bind(this)
|
||||||
this.totalVaultCoinBalance = this.totalVaultCoinBalance.bind(this)
|
this.totalVaultCoinBalance = this.totalVaultCoinBalance.bind(this)
|
||||||
this.allTotalVaultCoinBalances = this.allTotalVaultCoinBalances.bind(this)
|
this.allTotalVaultCoinBalances = this.allTotalVaultCoinBalances.bind(this)
|
||||||
|
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
|
||||||
|
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
config = async (): Promise<ConfigResponse> => {
|
config = async (): Promise<ConfigResponse> => {
|
||||||
@ -126,15 +144,15 @@ export class CreditManagerQueryClient implements CreditManagerReadOnlyInterface
|
|||||||
config: {},
|
config: {},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
allowedVaults = async ({
|
vaultConfigs = async ({
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
}: {
|
}: {
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: VaultBaseForString
|
startAfter?: VaultBaseForString
|
||||||
}): Promise<ArrayOfVaultBaseForString> => {
|
}): Promise<ArrayOfVaultInstantiateConfig> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
allowed_vaults: {
|
vault_configs: {
|
||||||
limit,
|
limit,
|
||||||
start_after: startAfter,
|
start_after: startAfter,
|
||||||
},
|
},
|
||||||
@ -250,8 +268,29 @@ export class CreditManagerQueryClient implements CreditManagerReadOnlyInterface
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
estimateProvideLiquidity = async ({
|
||||||
|
coinsIn,
|
||||||
|
lpTokenOut,
|
||||||
|
}: {
|
||||||
|
coinsIn: Coin[]
|
||||||
|
lpTokenOut: string
|
||||||
|
}): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
estimate_provide_liquidity: {
|
||||||
|
coins_in: coinsIn,
|
||||||
|
lp_token_out: lpTokenOut,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
estimateWithdrawLiquidity = async ({ lpToken }: { lpToken: Coin }): Promise<ArrayOfCoin> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
estimate_withdraw_liquidity: {
|
||||||
|
lp_token: lpToken,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export interface CreditManagerInterface extends CreditManagerReadOnlyInterface {
|
export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
sender: string
|
sender: string
|
||||||
createCreditAccount: (
|
createCreditAccount: (
|
||||||
@ -287,9 +326,9 @@ export interface CreditManagerInterface extends CreditManagerReadOnlyInterface {
|
|||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class CreditManagerClient
|
export class MarsCreditManagerClient
|
||||||
extends CreditManagerQueryClient
|
extends MarsCreditManagerQueryClient
|
||||||
implements CreditManagerInterface
|
implements MarsCreditManagerInterface
|
||||||
{
|
{
|
||||||
client: SigningCosmWasmClient
|
client: SigningCosmWasmClient
|
||||||
sender: string
|
sender: string
|
@ -0,0 +1,173 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
OracleBaseForString,
|
||||||
|
RedBankBaseForString,
|
||||||
|
SwapperBaseForString,
|
||||||
|
ZapperBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
VaultInstantiateConfig,
|
||||||
|
VaultConfig,
|
||||||
|
Coin,
|
||||||
|
VaultBaseForString,
|
||||||
|
ExecuteMsg,
|
||||||
|
Action,
|
||||||
|
CallbackMsg,
|
||||||
|
Addr,
|
||||||
|
ConfigUpdates,
|
||||||
|
VaultBaseForAddr,
|
||||||
|
QueryMsg,
|
||||||
|
ArrayOfCoinBalanceResponseItem,
|
||||||
|
CoinBalanceResponseItem,
|
||||||
|
ArrayOfSharesResponseItem,
|
||||||
|
SharesResponseItem,
|
||||||
|
ArrayOfDebtShares,
|
||||||
|
DebtShares,
|
||||||
|
ArrayOfVaultWithBalance,
|
||||||
|
VaultWithBalance,
|
||||||
|
VaultPositionAmount,
|
||||||
|
VaultAmount,
|
||||||
|
VaultAmount1,
|
||||||
|
UnlockingPositions,
|
||||||
|
ArrayOfVaultPositionResponseItem,
|
||||||
|
VaultPositionResponseItem,
|
||||||
|
VaultPosition,
|
||||||
|
LockingVaultAmount,
|
||||||
|
VaultUnlockingPosition,
|
||||||
|
ArrayOfString,
|
||||||
|
ConfigResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
|
HealthResponse,
|
||||||
|
Positions,
|
||||||
|
DebtAmount,
|
||||||
|
ArrayOfVaultInstantiateConfig,
|
||||||
|
} from './MarsCreditManager.types'
|
||||||
|
export interface MarsCreditManagerMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
createCreditAccount: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||||
|
updateCreditAccount: (
|
||||||
|
{
|
||||||
|
accountId,
|
||||||
|
actions,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
actions: Action[]
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
updateConfig: (
|
||||||
|
{
|
||||||
|
newConfig,
|
||||||
|
}: {
|
||||||
|
newConfig: ConfigUpdates
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
callback: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.createCreditAccount = this.createCreditAccount.bind(this)
|
||||||
|
this.updateCreditAccount = this.updateCreditAccount.bind(this)
|
||||||
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
|
this.callback = this.callback.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
createCreditAccount = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
create_credit_account: {},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateCreditAccount = (
|
||||||
|
{
|
||||||
|
accountId,
|
||||||
|
actions,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
actions: Action[]
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_credit_account: {
|
||||||
|
account_id: accountId,
|
||||||
|
actions,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateConfig = (
|
||||||
|
{
|
||||||
|
newConfig,
|
||||||
|
}: {
|
||||||
|
newConfig: ConfigUpdates
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_config: {
|
||||||
|
new_config: newConfig,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
callback: {},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,557 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
OracleBaseForString,
|
||||||
|
RedBankBaseForString,
|
||||||
|
SwapperBaseForString,
|
||||||
|
ZapperBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
VaultInstantiateConfig,
|
||||||
|
VaultConfig,
|
||||||
|
Coin,
|
||||||
|
VaultBaseForString,
|
||||||
|
ExecuteMsg,
|
||||||
|
Action,
|
||||||
|
CallbackMsg,
|
||||||
|
Addr,
|
||||||
|
ConfigUpdates,
|
||||||
|
VaultBaseForAddr,
|
||||||
|
QueryMsg,
|
||||||
|
ArrayOfCoinBalanceResponseItem,
|
||||||
|
CoinBalanceResponseItem,
|
||||||
|
ArrayOfSharesResponseItem,
|
||||||
|
SharesResponseItem,
|
||||||
|
ArrayOfDebtShares,
|
||||||
|
DebtShares,
|
||||||
|
ArrayOfVaultWithBalance,
|
||||||
|
VaultWithBalance,
|
||||||
|
VaultPositionAmount,
|
||||||
|
VaultAmount,
|
||||||
|
VaultAmount1,
|
||||||
|
UnlockingPositions,
|
||||||
|
ArrayOfVaultPositionResponseItem,
|
||||||
|
VaultPositionResponseItem,
|
||||||
|
VaultPosition,
|
||||||
|
LockingVaultAmount,
|
||||||
|
VaultUnlockingPosition,
|
||||||
|
ArrayOfString,
|
||||||
|
ConfigResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
|
HealthResponse,
|
||||||
|
Positions,
|
||||||
|
DebtAmount,
|
||||||
|
ArrayOfVaultInstantiateConfig,
|
||||||
|
} from './MarsCreditManager.types'
|
||||||
|
import { MarsCreditManagerQueryClient, MarsCreditManagerClient } 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,
|
||||||
|
vaultConfigs: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'vault_configs', 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,
|
||||||
|
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'health', 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,
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
export interface MarsCreditManagerReactQuery<TResponse, TData = TResponse> {
|
||||||
|
client: MarsCreditManagerQueryClient | undefined
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
|
> & {
|
||||||
|
initialData?: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 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 MarsCreditManagerHealthQuery<TData>
|
||||||
|
extends MarsCreditManagerReactQuery<HealthResponse, TData> {
|
||||||
|
args: {
|
||||||
|
accountId: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsCreditManagerHealthQuery<TData = HealthResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsCreditManagerHealthQuery<TData>) {
|
||||||
|
return useQuery<HealthResponse, Error, TData>(
|
||||||
|
marsCreditManagerQueryKeys.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 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 MarsCreditManagerVaultConfigsQuery<TData>
|
||||||
|
extends MarsCreditManagerReactQuery<ArrayOfVaultInstantiateConfig, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: VaultBaseForString
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsCreditManagerVaultConfigsQuery<TData = ArrayOfVaultInstantiateConfig>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsCreditManagerVaultConfigsQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfVaultInstantiateConfig, Error, TData>(
|
||||||
|
marsCreditManagerQueryKeys.vaultConfigs(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.vaultConfigs({
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
|
})
|
||||||
|
: 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
|
||||||
|
msg: CallbackMsg
|
||||||
|
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 MarsCreditManagerUpdateConfigMutation {
|
||||||
|
client: MarsCreditManagerClient
|
||||||
|
msg: {
|
||||||
|
newConfig: 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,23 +1,41 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export type Uint128 = string
|
||||||
export type Decimal = string
|
export type Decimal = string
|
||||||
export type OracleBaseForString = string
|
export type OracleBaseForString = string
|
||||||
export type RedBankBaseForString = string
|
export type RedBankBaseForString = string
|
||||||
export type SwapperBaseForString = string
|
export type SwapperBaseForString = string
|
||||||
|
export type ZapperBaseForString = string
|
||||||
export interface InstantiateMsg {
|
export interface InstantiateMsg {
|
||||||
allowed_coins: string[]
|
allowed_coins: string[]
|
||||||
allowed_vaults: VaultBaseForString[]
|
allowed_vaults: VaultInstantiateConfig[]
|
||||||
max_close_factor: Decimal
|
max_close_factor: Decimal
|
||||||
max_liquidation_bonus: Decimal
|
max_liquidation_bonus: Decimal
|
||||||
oracle: OracleBaseForString
|
oracle: OracleBaseForString
|
||||||
owner: string
|
owner: string
|
||||||
red_bank: RedBankBaseForString
|
red_bank: RedBankBaseForString
|
||||||
swapper: SwapperBaseForString
|
swapper: SwapperBaseForString
|
||||||
|
zapper: ZapperBaseForString
|
||||||
|
}
|
||||||
|
export interface VaultInstantiateConfig {
|
||||||
|
config: VaultConfig
|
||||||
|
vault: VaultBaseForString
|
||||||
|
}
|
||||||
|
export interface VaultConfig {
|
||||||
|
deposit_cap: Coin
|
||||||
|
liquidation_threshold: Decimal
|
||||||
|
max_ltv: Decimal
|
||||||
|
whitelisted: boolean
|
||||||
|
}
|
||||||
|
export interface Coin {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
[k: string]: unknown
|
||||||
}
|
}
|
||||||
export interface VaultBaseForString {
|
export interface VaultBaseForString {
|
||||||
address: string
|
address: string
|
||||||
@ -54,17 +72,30 @@ export type Action =
|
|||||||
repay: Coin
|
repay: Coin
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_deposit: {
|
enter_vault: {
|
||||||
coins: Coin[]
|
amount?: Uint128 | null
|
||||||
|
denom: string
|
||||||
vault: VaultBaseForString
|
vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_withdraw: {
|
exit_vault: {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForString
|
vault: VaultBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
request_vault_unlock: {
|
||||||
|
amount: Uint128
|
||||||
|
vault: VaultBaseForString
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
exit_vault_unlocked: {
|
||||||
|
id: number
|
||||||
|
vault: VaultBaseForString
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
liquidate_coin: {
|
liquidate_coin: {
|
||||||
debt_coin: Coin
|
debt_coin: Coin
|
||||||
@ -72,6 +103,13 @@ export type Action =
|
|||||||
request_coin_denom: string
|
request_coin_denom: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
liquidate_vault: {
|
||||||
|
debt_coin: Coin
|
||||||
|
liquidatee_account_id: string
|
||||||
|
request_vault: VaultBaseForString
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
swap_exact_in: {
|
swap_exact_in: {
|
||||||
coin_in: Coin
|
coin_in: Coin
|
||||||
@ -79,7 +117,21 @@ export type Action =
|
|||||||
slippage: Decimal
|
slippage: Decimal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type Uint128 = string
|
| {
|
||||||
|
provide_liquidity: {
|
||||||
|
coins_in: Coin[]
|
||||||
|
lp_token_out: string
|
||||||
|
minimum_receive: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
withdraw_liquidity: {
|
||||||
|
lp_token: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
refund_all_coin_balances: {}
|
||||||
|
}
|
||||||
export type CallbackMsg =
|
export type CallbackMsg =
|
||||||
| {
|
| {
|
||||||
withdraw: {
|
withdraw: {
|
||||||
@ -106,9 +158,17 @@ export type CallbackMsg =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_deposit: {
|
enter_vault: {
|
||||||
account_id: string
|
account_id: string
|
||||||
coins: Coin[]
|
amount?: Uint128 | null
|
||||||
|
denom: string
|
||||||
|
vault: VaultBaseForAddr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
exit_vault: {
|
||||||
|
account_id: string
|
||||||
|
amount: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,19 +180,26 @@ export type CallbackMsg =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_withdraw: {
|
force_exit_vault: {
|
||||||
account_id: string
|
account_id: string
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
vault_force_withdraw: {
|
request_vault_unlock: {
|
||||||
account_id: string
|
account_id: string
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
exit_vault_unlocked: {
|
||||||
|
account_id: string
|
||||||
|
position_id: number
|
||||||
|
vault: VaultBaseForAddr
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
liquidate_coin: {
|
liquidate_coin: {
|
||||||
debt_coin: Coin
|
debt_coin: Coin
|
||||||
@ -142,9 +209,11 @@ export type CallbackMsg =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
assert_health_factor_improved: {
|
liquidate_vault: {
|
||||||
account_id: string
|
debt_coin: Coin
|
||||||
previous_health_factor: Decimal
|
liquidatee_account_id: string
|
||||||
|
liquidator_account_id: string
|
||||||
|
request_vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@ -156,27 +225,47 @@ export type CallbackMsg =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
update_coin_balances: {
|
update_coin_balance: {
|
||||||
|
account_id: string
|
||||||
|
previous_balance: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
provide_liquidity: {
|
||||||
|
account_id: string
|
||||||
|
coins_in: Coin[]
|
||||||
|
lp_token_out: string
|
||||||
|
minimum_receive: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
withdraw_liquidity: {
|
||||||
|
account_id: string
|
||||||
|
lp_token: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
assert_one_vault_position_only: {
|
||||||
|
account_id: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
refund_all_coin_balances: {
|
||||||
account_id: string
|
account_id: string
|
||||||
previous_balances: Coin[]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type Addr = string
|
export type Addr = string
|
||||||
export interface Coin {
|
|
||||||
amount: Uint128
|
|
||||||
denom: string
|
|
||||||
[k: string]: unknown
|
|
||||||
}
|
|
||||||
export interface ConfigUpdates {
|
export interface ConfigUpdates {
|
||||||
account_nft?: string | null
|
account_nft?: string | null
|
||||||
allowed_coins?: string[] | null
|
allowed_coins?: string[] | null
|
||||||
allowed_vaults?: VaultBaseForString[] | null
|
|
||||||
max_close_factor?: Decimal | null
|
max_close_factor?: Decimal | null
|
||||||
max_liquidation_bonus?: Decimal | null
|
max_liquidation_bonus?: Decimal | null
|
||||||
oracle?: OracleBaseForString | null
|
oracle?: OracleBaseForString | null
|
||||||
owner?: string | null
|
owner?: string | null
|
||||||
red_bank?: RedBankBaseForString | null
|
red_bank?: RedBankBaseForString | null
|
||||||
swapper?: SwapperBaseForString | null
|
swapper?: SwapperBaseForString | null
|
||||||
|
vault_configs?: VaultInstantiateConfig[] | null
|
||||||
|
zapper?: ZapperBaseForString | null
|
||||||
}
|
}
|
||||||
export interface VaultBaseForAddr {
|
export interface VaultBaseForAddr {
|
||||||
address: Addr
|
address: Addr
|
||||||
@ -186,7 +275,7 @@ export type QueryMsg =
|
|||||||
config: {}
|
config: {}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
allowed_vaults: {
|
vault_configs: {
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: VaultBaseForString | null
|
start_after?: VaultBaseForString | null
|
||||||
}
|
}
|
||||||
@ -245,6 +334,17 @@ export type QueryMsg =
|
|||||||
start_after?: VaultBaseForString | null
|
start_after?: VaultBaseForString | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
estimate_provide_liquidity: {
|
||||||
|
coins_in: Coin[]
|
||||||
|
lp_token_out: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
estimate_withdraw_liquidity: {
|
||||||
|
lp_token: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[]
|
export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[]
|
||||||
export interface CoinBalanceResponseItem {
|
export interface CoinBalanceResponseItem {
|
||||||
account_id: string
|
account_id: string
|
||||||
@ -267,21 +367,34 @@ export interface VaultWithBalance {
|
|||||||
balance: Uint128
|
balance: Uint128
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
|
export type VaultPositionAmount =
|
||||||
|
| {
|
||||||
|
unlocked: VaultAmount
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
locking: LockingVaultAmount
|
||||||
|
}
|
||||||
|
export type VaultAmount = string
|
||||||
|
export type VaultAmount1 = string
|
||||||
|
export type UnlockingPositions = VaultUnlockingPosition[]
|
||||||
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
|
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
|
||||||
export interface VaultPositionResponseItem {
|
export interface VaultPositionResponseItem {
|
||||||
account_id: string
|
account_id: string
|
||||||
position: VaultPosition
|
position: VaultPosition
|
||||||
}
|
}
|
||||||
export interface VaultPosition {
|
export interface VaultPosition {
|
||||||
state: VaultPositionState
|
amount: VaultPositionAmount
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
}
|
}
|
||||||
export interface VaultPositionState {
|
export interface LockingVaultAmount {
|
||||||
locked: Uint128
|
locked: VaultAmount1
|
||||||
unlocked: Uint128
|
unlocking: UnlockingPositions
|
||||||
|
}
|
||||||
|
export interface VaultUnlockingPosition {
|
||||||
|
coin: Coin
|
||||||
|
id: number
|
||||||
}
|
}
|
||||||
export type ArrayOfString = string[]
|
export type ArrayOfString = string[]
|
||||||
export type ArrayOfVaultBaseForString = VaultBaseForString[]
|
|
||||||
export interface ConfigResponse {
|
export interface ConfigResponse {
|
||||||
account_nft?: string | null
|
account_nft?: string | null
|
||||||
max_close_factor: Decimal
|
max_close_factor: Decimal
|
||||||
@ -290,7 +403,9 @@ export interface ConfigResponse {
|
|||||||
owner: string
|
owner: string
|
||||||
red_bank: string
|
red_bank: string
|
||||||
swapper: string
|
swapper: string
|
||||||
|
zapper: string
|
||||||
}
|
}
|
||||||
|
export type ArrayOfCoin = Coin[]
|
||||||
export interface HealthResponse {
|
export interface HealthResponse {
|
||||||
above_max_ltv: boolean
|
above_max_ltv: boolean
|
||||||
liquidatable: boolean
|
liquidatable: boolean
|
||||||
@ -312,3 +427,4 @@ export interface DebtAmount {
|
|||||||
denom: string
|
denom: string
|
||||||
shares: Uint128
|
shares: Uint128
|
||||||
}
|
}
|
||||||
|
export type ArrayOfVaultInstantiateConfig = VaultInstantiateConfig[]
|
14
types/generated/mars-credit-manager/bundle.ts
Normal file
14
types/generated/mars-credit-manager/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 * as _4 from './MarsCreditManager.types'
|
||||||
|
import * as _5 from './MarsCreditManager.client'
|
||||||
|
import * as _6 from './MarsCreditManager.message-composer'
|
||||||
|
import * as _7 from './MarsCreditManager.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsCreditManager = { ..._4, ..._5, ..._6, ..._7 }
|
||||||
|
}
|
@ -1,26 +1,25 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { Coin, StdFee } from '@cosmjs/amino'
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CoinPrice,
|
|
||||||
Decimal,
|
Decimal,
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
PriceResponse,
|
CoinPrice,
|
||||||
|
ExecuteMsg,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
} from './MockOracle.types'
|
PriceResponse,
|
||||||
export interface MockOracleReadOnlyInterface {
|
} from './MarsMockOracle.types'
|
||||||
|
export interface MarsMockOracleReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
||||||
}
|
}
|
||||||
export class MockOracleQueryClient implements MockOracleReadOnlyInterface {
|
export class MarsMockOracleQueryClient implements MarsMockOracleReadOnlyInterface {
|
||||||
client: CosmWasmClient
|
client: CosmWasmClient
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ export class MockOracleQueryClient implements MockOracleReadOnlyInterface {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface MockOracleInterface extends MockOracleReadOnlyInterface {
|
export interface MarsMockOracleInterface extends MarsMockOracleReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
sender: string
|
sender: string
|
||||||
changePrice: (
|
changePrice: (
|
||||||
@ -54,7 +53,10 @@ export interface MockOracleInterface extends MockOracleReadOnlyInterface {
|
|||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class MockOracleClient extends MockOracleQueryClient implements MockOracleInterface {
|
export class MarsMockOracleClient
|
||||||
|
extends MarsMockOracleQueryClient
|
||||||
|
implements MarsMockOracleInterface
|
||||||
|
{
|
||||||
client: SigningCosmWasmClient
|
client: SigningCosmWasmClient
|
||||||
sender: string
|
sender: string
|
||||||
contractAddress: string
|
contractAddress: string
|
@ -0,0 +1,71 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { Coin } from '@cosmjs/amino'
|
||||||
|
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
Decimal,
|
||||||
|
InstantiateMsg,
|
||||||
|
CoinPrice,
|
||||||
|
ExecuteMsg,
|
||||||
|
QueryMsg,
|
||||||
|
PriceResponse,
|
||||||
|
} from './MarsMockOracle.types'
|
||||||
|
export interface MarsMockOracleMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
changePrice: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
price,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
price: Decimal
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsMockOracleMessageComposer implements MarsMockOracleMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.changePrice = this.changePrice.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
changePrice = (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
price,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
price: Decimal
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
change_price: {
|
||||||
|
denom,
|
||||||
|
price,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,36 +1,35 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
import { StdFee, Coin } from '@cosmjs/amino'
|
||||||
|
|
||||||
import { MockOracleClient, MockOracleQueryClient } from './MockOracle.client'
|
|
||||||
import {
|
import {
|
||||||
CoinPrice,
|
|
||||||
Decimal,
|
Decimal,
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
PriceResponse,
|
CoinPrice,
|
||||||
|
ExecuteMsg,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
} from './MockOracle.types'
|
PriceResponse,
|
||||||
export const mockOracleQueryKeys = {
|
} from './MarsMockOracle.types'
|
||||||
|
import { MarsMockOracleQueryClient, MarsMockOracleClient } from './MarsMockOracle.client'
|
||||||
|
export const marsMockOracleQueryKeys = {
|
||||||
contract: [
|
contract: [
|
||||||
{
|
{
|
||||||
contract: 'mockOracle',
|
contract: 'marsMockOracle',
|
||||||
},
|
},
|
||||||
] as const,
|
] as const,
|
||||||
address: (contractAddress: string | undefined) =>
|
address: (contractAddress: string | undefined) =>
|
||||||
[{ ...mockOracleQueryKeys.contract[0], address: contractAddress }] as const,
|
[{ ...marsMockOracleQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...mockOracleQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
[{ ...marsMockOracleQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
||||||
}
|
}
|
||||||
export interface MockOracleReactQuery<TResponse, TData = TResponse> {
|
export interface MarsMockOracleReactQuery<TResponse, TData = TResponse> {
|
||||||
client: MockOracleQueryClient | undefined
|
client: MarsMockOracleQueryClient | undefined
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseQueryOptions<TResponse, Error, TData>,
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
"'queryKey' | 'queryFn' | 'initialData'"
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
@ -38,18 +37,19 @@ export interface MockOracleReactQuery<TResponse, TData = TResponse> {
|
|||||||
initialData?: undefined
|
initialData?: undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface MockOraclePriceQuery<TData> extends MockOracleReactQuery<PriceResponse, TData> {
|
export interface MarsMockOraclePriceQuery<TData>
|
||||||
|
extends MarsMockOracleReactQuery<PriceResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
denom: string
|
denom: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useMockOraclePriceQuery<TData = PriceResponse>({
|
export function useMarsMockOraclePriceQuery<TData = PriceResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: MockOraclePriceQuery<TData>) {
|
}: MarsMockOraclePriceQuery<TData>) {
|
||||||
return useQuery<PriceResponse, Error, TData>(
|
return useQuery<PriceResponse, Error, TData>(
|
||||||
mockOracleQueryKeys.price(client?.contractAddress, args),
|
marsMockOracleQueryKeys.price(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.price({
|
? client.price({
|
||||||
@ -59,8 +59,8 @@ export function useMockOraclePriceQuery<TData = PriceResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface MockOracleChangePriceMutation {
|
export interface MarsMockOracleChangePriceMutation {
|
||||||
client: MockOracleClient
|
client: MarsMockOracleClient
|
||||||
msg: CoinPrice
|
msg: CoinPrice
|
||||||
args?: {
|
args?: {
|
||||||
fee?: number | StdFee | 'auto'
|
fee?: number | StdFee | 'auto'
|
||||||
@ -68,13 +68,13 @@ export interface MockOracleChangePriceMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useMockOracleChangePriceMutation(
|
export function useMarsMockOracleChangePriceMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, MockOracleChangePriceMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsMockOracleChangePriceMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, MockOracleChangePriceMutation>(
|
return useMutation<ExecuteResult, Error, MarsMockOracleChangePriceMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.changePrice(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.changePrice(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
@ -1,13 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type Decimal = string
|
export type Decimal = string
|
||||||
export interface InstantiateMsg {
|
export interface InstantiateMsg {
|
||||||
coins: CoinPrice[]
|
prices: CoinPrice[]
|
||||||
}
|
}
|
||||||
export interface CoinPrice {
|
export interface CoinPrice {
|
||||||
denom: string
|
denom: string
|
||||||
@ -24,5 +24,4 @@ export type QueryMsg = {
|
|||||||
export interface PriceResponse {
|
export interface PriceResponse {
|
||||||
denom: string
|
denom: string
|
||||||
price: Decimal
|
price: Decimal
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
14
types/generated/mars-mock-oracle/bundle.ts
Normal file
14
types/generated/mars-mock-oracle/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 * as _8 from './MarsMockOracle.types'
|
||||||
|
import * as _9 from './MarsMockOracle.client'
|
||||||
|
import * as _10 from './MarsMockOracle.message-composer'
|
||||||
|
import * as _11 from './MarsMockOracle.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsMockOracle = { ..._8, ..._9, ..._10, ..._11 }
|
||||||
|
}
|
723
types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts
Normal file
723
types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts
Normal file
@ -0,0 +1,723 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { Coin, StdFee } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
Decimal,
|
||||||
|
InstantiateMsg,
|
||||||
|
CoinMarketInfo,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
CreateOrUpdateConfig,
|
||||||
|
InitOrUpdateAssetParams,
|
||||||
|
InterestRateModel,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
Market,
|
||||||
|
ArrayOfMarket,
|
||||||
|
UncollateralizedLoanLimitResponse,
|
||||||
|
ArrayOfUncollateralizedLoanLimitResponse,
|
||||||
|
UserCollateralResponse,
|
||||||
|
ArrayOfUserCollateralResponse,
|
||||||
|
UserDebtResponse,
|
||||||
|
ArrayOfUserDebtResponse,
|
||||||
|
UserHealthStatus,
|
||||||
|
UserPositionResponse,
|
||||||
|
} from './MarsMockRedBank.types'
|
||||||
|
export interface MarsMockRedBankReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
config: () => Promise<ConfigForString>
|
||||||
|
market: ({ denom }: { denom: string }) => Promise<Market>
|
||||||
|
markets: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}) => Promise<ArrayOfMarket>
|
||||||
|
uncollateralizedLoanLimit: ({
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<UncollateralizedLoanLimitResponse>
|
||||||
|
uncollateralizedLoanLimits: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<ArrayOfUncollateralizedLoanLimitResponse>
|
||||||
|
userDebt: ({ denom, user }: { denom: string; user: string }) => Promise<UserDebtResponse>
|
||||||
|
userDebts: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<ArrayOfUserDebtResponse>
|
||||||
|
userCollateral: ({
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<UserCollateralResponse>
|
||||||
|
userCollaterals: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<ArrayOfUserCollateralResponse>
|
||||||
|
userPosition: ({ user }: { user: string }) => Promise<UserPositionResponse>
|
||||||
|
scaledLiquidityAmount: ({ amount, denom }: { amount: Uint128; denom: string }) => Promise<Uint128>
|
||||||
|
scaledDebtAmount: ({ amount, denom }: { amount: Uint128; denom: string }) => Promise<Uint128>
|
||||||
|
underlyingLiquidityAmount: ({
|
||||||
|
amountScaled,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
amountScaled: Uint128
|
||||||
|
denom: string
|
||||||
|
}) => Promise<Uint128>
|
||||||
|
underlyingDebtAmount: ({
|
||||||
|
amountScaled,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
amountScaled: Uint128
|
||||||
|
denom: string
|
||||||
|
}) => Promise<Uint128>
|
||||||
|
}
|
||||||
|
export class MarsMockRedBankQueryClient implements MarsMockRedBankReadOnlyInterface {
|
||||||
|
client: CosmWasmClient
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||||
|
this.client = client
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.config = this.config.bind(this)
|
||||||
|
this.market = this.market.bind(this)
|
||||||
|
this.markets = this.markets.bind(this)
|
||||||
|
this.uncollateralizedLoanLimit = this.uncollateralizedLoanLimit.bind(this)
|
||||||
|
this.uncollateralizedLoanLimits = this.uncollateralizedLoanLimits.bind(this)
|
||||||
|
this.userDebt = this.userDebt.bind(this)
|
||||||
|
this.userDebts = this.userDebts.bind(this)
|
||||||
|
this.userCollateral = this.userCollateral.bind(this)
|
||||||
|
this.userCollaterals = this.userCollaterals.bind(this)
|
||||||
|
this.userPosition = this.userPosition.bind(this)
|
||||||
|
this.scaledLiquidityAmount = this.scaledLiquidityAmount.bind(this)
|
||||||
|
this.scaledDebtAmount = this.scaledDebtAmount.bind(this)
|
||||||
|
this.underlyingLiquidityAmount = this.underlyingLiquidityAmount.bind(this)
|
||||||
|
this.underlyingDebtAmount = this.underlyingDebtAmount.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
config = async (): Promise<ConfigForString> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
config: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
market = async ({ denom }: { denom: string }): Promise<Market> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
market: {
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
markets = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}): Promise<ArrayOfMarket> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
markets: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
uncollateralizedLoanLimit = async ({
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}): Promise<UncollateralizedLoanLimitResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
uncollateralized_loan_limit: {
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
uncollateralizedLoanLimits = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}): Promise<ArrayOfUncollateralizedLoanLimitResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
uncollateralized_loan_limits: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userDebt = async ({
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}): Promise<UserDebtResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_debt: {
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userDebts = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}): Promise<ArrayOfUserDebtResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_debts: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userCollateral = async ({
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}): Promise<UserCollateralResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_collateral: {
|
||||||
|
denom,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userCollaterals = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}): Promise<ArrayOfUserCollateralResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_collaterals: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userPosition = async ({ user }: { user: string }): Promise<UserPositionResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_position: {
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
scaledLiquidityAmount = async ({
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
}): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
scaled_liquidity_amount: {
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
scaledDebtAmount = async ({
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
}): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
scaled_debt_amount: {
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
underlyingLiquidityAmount = async ({
|
||||||
|
amountScaled,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
amountScaled: Uint128
|
||||||
|
denom: string
|
||||||
|
}): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
underlying_liquidity_amount: {
|
||||||
|
amount_scaled: amountScaled,
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
underlyingDebtAmount = async ({
|
||||||
|
amountScaled,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
amountScaled: Uint128
|
||||||
|
denom: string
|
||||||
|
}): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
underlying_debt_amount: {
|
||||||
|
amount_scaled: amountScaled,
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateConfig: (
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
}: {
|
||||||
|
config: CreateOrUpdateConfig
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
initAsset: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
updateAsset: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
updateUncollateralizedLoanLimit: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
newLimit,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
newLimit: Uint128
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
deposit: (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
withdraw: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount?: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
borrow: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
repay: (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
liquidate: (
|
||||||
|
{
|
||||||
|
collateralDenom,
|
||||||
|
recipient,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
collateralDenom: string
|
||||||
|
recipient?: string
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
updateAssetCollateralStatus: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
enable,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
enable: boolean
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
}
|
||||||
|
export class MarsMockRedBankClient
|
||||||
|
extends MarsMockRedBankQueryClient
|
||||||
|
implements MarsMockRedBankInterface
|
||||||
|
{
|
||||||
|
client: SigningCosmWasmClient
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||||
|
super(client, contractAddress)
|
||||||
|
this.client = client
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
|
this.initAsset = this.initAsset.bind(this)
|
||||||
|
this.updateAsset = this.updateAsset.bind(this)
|
||||||
|
this.updateUncollateralizedLoanLimit = this.updateUncollateralizedLoanLimit.bind(this)
|
||||||
|
this.deposit = this.deposit.bind(this)
|
||||||
|
this.withdraw = this.withdraw.bind(this)
|
||||||
|
this.borrow = this.borrow.bind(this)
|
||||||
|
this.repay = this.repay.bind(this)
|
||||||
|
this.liquidate = this.liquidate.bind(this)
|
||||||
|
this.updateAssetCollateralStatus = this.updateAssetCollateralStatus.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConfig = async (
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
}: {
|
||||||
|
config: CreateOrUpdateConfig
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_config: {
|
||||||
|
config,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
initAsset = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
init_asset: {
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
updateAsset = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_asset: {
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
updateUncollateralizedLoanLimit = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
newLimit,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
newLimit: Uint128
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_uncollateralized_loan_limit: {
|
||||||
|
denom,
|
||||||
|
new_limit: newLimit,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
deposit = async (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
deposit: {
|
||||||
|
on_behalf_of: onBehalfOf,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
withdraw = async (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount?: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
withdraw: {
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
borrow = async (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
borrow: {
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
repay = async (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
repay: {
|
||||||
|
on_behalf_of: onBehalfOf,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
liquidate = async (
|
||||||
|
{
|
||||||
|
collateralDenom,
|
||||||
|
recipient,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
collateralDenom: string
|
||||||
|
recipient?: string
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
liquidate: {
|
||||||
|
collateral_denom: collateralDenom,
|
||||||
|
recipient,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
updateAssetCollateralStatus = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
enable,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
enable: boolean
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_asset_collateral_status: {
|
||||||
|
denom,
|
||||||
|
enable,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,432 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { Coin } from '@cosmjs/amino'
|
||||||
|
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
Decimal,
|
||||||
|
InstantiateMsg,
|
||||||
|
CoinMarketInfo,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
CreateOrUpdateConfig,
|
||||||
|
InitOrUpdateAssetParams,
|
||||||
|
InterestRateModel,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
Market,
|
||||||
|
ArrayOfMarket,
|
||||||
|
UncollateralizedLoanLimitResponse,
|
||||||
|
ArrayOfUncollateralizedLoanLimitResponse,
|
||||||
|
UserCollateralResponse,
|
||||||
|
ArrayOfUserCollateralResponse,
|
||||||
|
UserDebtResponse,
|
||||||
|
ArrayOfUserDebtResponse,
|
||||||
|
UserHealthStatus,
|
||||||
|
UserPositionResponse,
|
||||||
|
} from './MarsMockRedBank.types'
|
||||||
|
export interface MarsMockRedBankMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateConfig: (
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
}: {
|
||||||
|
config: CreateOrUpdateConfig
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
initAsset: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
updateAsset: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
updateUncollateralizedLoanLimit: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
newLimit,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
newLimit: Uint128
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
deposit: (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
withdraw: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount?: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
borrow: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
repay: (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
liquidate: (
|
||||||
|
{
|
||||||
|
collateralDenom,
|
||||||
|
recipient,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
collateralDenom: string
|
||||||
|
recipient?: string
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
updateAssetCollateralStatus: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
enable,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
enable: boolean
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
|
this.initAsset = this.initAsset.bind(this)
|
||||||
|
this.updateAsset = this.updateAsset.bind(this)
|
||||||
|
this.updateUncollateralizedLoanLimit = this.updateUncollateralizedLoanLimit.bind(this)
|
||||||
|
this.deposit = this.deposit.bind(this)
|
||||||
|
this.withdraw = this.withdraw.bind(this)
|
||||||
|
this.borrow = this.borrow.bind(this)
|
||||||
|
this.repay = this.repay.bind(this)
|
||||||
|
this.liquidate = this.liquidate.bind(this)
|
||||||
|
this.updateAssetCollateralStatus = this.updateAssetCollateralStatus.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConfig = (
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
}: {
|
||||||
|
config: CreateOrUpdateConfig
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_config: {
|
||||||
|
config,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initAsset = (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
init_asset: {
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateAsset = (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_asset: {
|
||||||
|
denom,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateUncollateralizedLoanLimit = (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
newLimit,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
newLimit: Uint128
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_uncollateralized_loan_limit: {
|
||||||
|
denom,
|
||||||
|
new_limit: newLimit,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deposit = (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
deposit: {
|
||||||
|
on_behalf_of: onBehalfOf,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
withdraw = (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount?: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
withdraw: {
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
borrow = (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
borrow: {
|
||||||
|
amount,
|
||||||
|
denom,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repay = (
|
||||||
|
{
|
||||||
|
onBehalfOf,
|
||||||
|
}: {
|
||||||
|
onBehalfOf?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
repay: {
|
||||||
|
on_behalf_of: onBehalfOf,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
liquidate = (
|
||||||
|
{
|
||||||
|
collateralDenom,
|
||||||
|
recipient,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
collateralDenom: string
|
||||||
|
recipient?: string
|
||||||
|
user: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
liquidate: {
|
||||||
|
collateral_denom: collateralDenom,
|
||||||
|
recipient,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateAssetCollateralStatus = (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
enable,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
enable: boolean
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_asset_collateral_status: {
|
||||||
|
denom,
|
||||||
|
enable,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,694 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { StdFee, Coin } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
Decimal,
|
||||||
|
InstantiateMsg,
|
||||||
|
CoinMarketInfo,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
CreateOrUpdateConfig,
|
||||||
|
InitOrUpdateAssetParams,
|
||||||
|
InterestRateModel,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
Market,
|
||||||
|
ArrayOfMarket,
|
||||||
|
UncollateralizedLoanLimitResponse,
|
||||||
|
ArrayOfUncollateralizedLoanLimitResponse,
|
||||||
|
UserCollateralResponse,
|
||||||
|
ArrayOfUserCollateralResponse,
|
||||||
|
UserDebtResponse,
|
||||||
|
ArrayOfUserDebtResponse,
|
||||||
|
UserHealthStatus,
|
||||||
|
UserPositionResponse,
|
||||||
|
} from './MarsMockRedBank.types'
|
||||||
|
import { MarsMockRedBankQueryClient, MarsMockRedBankClient } 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<ConfigForString, TData> {}
|
||||||
|
export function useMarsMockRedBankConfigQuery<TData = ConfigForString>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsMockRedBankConfigQuery<TData>) {
|
||||||
|
return useQuery<ConfigForString, 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,
|
||||||
|
)
|
||||||
|
}
|
242
types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts
Normal file
242
types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type Decimal = string
|
||||||
|
export interface InstantiateMsg {
|
||||||
|
coins: CoinMarketInfo[]
|
||||||
|
}
|
||||||
|
export interface CoinMarketInfo {
|
||||||
|
denom: string
|
||||||
|
liquidation_threshold: Decimal
|
||||||
|
max_ltv: Decimal
|
||||||
|
}
|
||||||
|
export type ExecuteMsg =
|
||||||
|
| {
|
||||||
|
update_config: {
|
||||||
|
config: CreateOrUpdateConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
init_asset: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
update_asset: {
|
||||||
|
denom: string
|
||||||
|
params: InitOrUpdateAssetParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
update_uncollateralized_loan_limit: {
|
||||||
|
denom: string
|
||||||
|
new_limit: Uint128
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
deposit: {
|
||||||
|
on_behalf_of?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
withdraw: {
|
||||||
|
amount?: Uint128 | null
|
||||||
|
denom: string
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
borrow: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
repay: {
|
||||||
|
on_behalf_of?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
liquidate: {
|
||||||
|
collateral_denom: string
|
||||||
|
recipient?: string | null
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
update_asset_collateral_status: {
|
||||||
|
denom: string
|
||||||
|
enable: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type Uint128 = string
|
||||||
|
export interface CreateOrUpdateConfig {
|
||||||
|
address_provider?: string | null
|
||||||
|
close_factor?: Decimal | null
|
||||||
|
owner?: string | null
|
||||||
|
}
|
||||||
|
export interface InitOrUpdateAssetParams {
|
||||||
|
borrow_enabled?: boolean | null
|
||||||
|
deposit_cap?: Uint128 | null
|
||||||
|
deposit_enabled?: boolean | null
|
||||||
|
initial_borrow_rate?: Decimal | null
|
||||||
|
interest_rate_model?: InterestRateModel | null
|
||||||
|
liquidation_bonus?: Decimal | null
|
||||||
|
liquidation_threshold?: Decimal | null
|
||||||
|
max_loan_to_value?: Decimal | null
|
||||||
|
reserve_factor?: Decimal | null
|
||||||
|
}
|
||||||
|
export interface InterestRateModel {
|
||||||
|
base: Decimal
|
||||||
|
optimal_utilization_rate: Decimal
|
||||||
|
slope_1: Decimal
|
||||||
|
slope_2: Decimal
|
||||||
|
}
|
||||||
|
export type QueryMsg =
|
||||||
|
| {
|
||||||
|
config: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
market: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
markets: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
uncollateralized_loan_limit: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
uncollateralized_loan_limits: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_debt: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_debts: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_collateral: {
|
||||||
|
denom: string
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_collaterals: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_position: {
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
scaled_liquidity_amount: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
scaled_debt_amount: {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
underlying_liquidity_amount: {
|
||||||
|
amount_scaled: Uint128
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
underlying_debt_amount: {
|
||||||
|
amount_scaled: Uint128
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface ConfigForString {
|
||||||
|
address_provider: string
|
||||||
|
close_factor: Decimal
|
||||||
|
owner: string
|
||||||
|
}
|
||||||
|
export interface Market {
|
||||||
|
borrow_enabled: boolean
|
||||||
|
borrow_index: Decimal
|
||||||
|
borrow_rate: Decimal
|
||||||
|
collateral_total_scaled: Uint128
|
||||||
|
debt_total_scaled: Uint128
|
||||||
|
denom: string
|
||||||
|
deposit_cap: Uint128
|
||||||
|
deposit_enabled: boolean
|
||||||
|
indexes_last_updated: number
|
||||||
|
interest_rate_model: InterestRateModel
|
||||||
|
liquidation_bonus: Decimal
|
||||||
|
liquidation_threshold: Decimal
|
||||||
|
liquidity_index: Decimal
|
||||||
|
liquidity_rate: Decimal
|
||||||
|
max_loan_to_value: Decimal
|
||||||
|
reserve_factor: Decimal
|
||||||
|
}
|
||||||
|
export type ArrayOfMarket = Market[]
|
||||||
|
export interface UncollateralizedLoanLimitResponse {
|
||||||
|
denom: string
|
||||||
|
limit: Uint128
|
||||||
|
}
|
||||||
|
export type ArrayOfUncollateralizedLoanLimitResponse = UncollateralizedLoanLimitResponse[]
|
||||||
|
export interface UserCollateralResponse {
|
||||||
|
amount: Uint128
|
||||||
|
amount_scaled: Uint128
|
||||||
|
denom: string
|
||||||
|
enabled: boolean
|
||||||
|
}
|
||||||
|
export type ArrayOfUserCollateralResponse = UserCollateralResponse[]
|
||||||
|
export interface UserDebtResponse {
|
||||||
|
amount: Uint128
|
||||||
|
amount_scaled: Uint128
|
||||||
|
denom: string
|
||||||
|
uncollateralized: boolean
|
||||||
|
}
|
||||||
|
export type ArrayOfUserDebtResponse = UserDebtResponse[]
|
||||||
|
export type UserHealthStatus =
|
||||||
|
| 'not_borrowing'
|
||||||
|
| {
|
||||||
|
borrowing: {
|
||||||
|
liq_threshold_hf: Decimal
|
||||||
|
max_ltv_hf: Decimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface UserPositionResponse {
|
||||||
|
health_status: UserHealthStatus
|
||||||
|
total_collateralized_debt: Decimal
|
||||||
|
total_enabled_collateral: Decimal
|
||||||
|
weighted_liquidation_threshold_collateral: Decimal
|
||||||
|
weighted_max_ltv_collateral: Decimal
|
||||||
|
}
|
14
types/generated/mars-mock-red-bank/bundle.ts
Normal file
14
types/generated/mars-mock-red-bank/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 * as _12 from './MarsMockRedBank.types'
|
||||||
|
import * as _13 from './MarsMockRedBank.client'
|
||||||
|
import * as _14 from './MarsMockRedBank.message-composer'
|
||||||
|
import * as _15 from './MarsMockRedBank.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsMockRedBank = { ..._12, ..._13, ..._14, ..._15 }
|
||||||
|
}
|
229
types/generated/mars-mock-vault/MarsMockVault.client.ts
Normal file
229
types/generated/mars-mock-vault/MarsMockVault.client.ts
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { Coin, StdFee } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
Duration,
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
ExtensionExecuteMsg,
|
||||||
|
LockupExecuteMsg,
|
||||||
|
ForceUnlockExecuteMsg,
|
||||||
|
QueryMsg,
|
||||||
|
ExtensionQueryMsg,
|
||||||
|
LockupQueryMsg,
|
||||||
|
VaultInfo,
|
||||||
|
Empty,
|
||||||
|
VaultStandardInfo,
|
||||||
|
} from './MarsMockVault.types'
|
||||||
|
export interface MarsMockVaultReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
vaultStandardInfo: () => Promise<VaultStandardInfo>
|
||||||
|
info: () => Promise<VaultInfo>
|
||||||
|
previewDeposit: ({ amount }: { amount: Uint128 }) => Promise<Uint128>
|
||||||
|
previewRedeem: ({ amount }: { amount: Uint128 }) => Promise<Uint128>
|
||||||
|
totalAssets: () => Promise<Uint128>
|
||||||
|
totalVaultTokenSupply: () => Promise<Uint128>
|
||||||
|
convertToShares: ({ amount }: { amount: Uint128 }) => Promise<Uint128>
|
||||||
|
convertToAssets: ({ amount }: { amount: Uint128 }) => Promise<Uint128>
|
||||||
|
vaultExtension: () => Promise<Empty>
|
||||||
|
}
|
||||||
|
export class MarsMockVaultQueryClient implements MarsMockVaultReadOnlyInterface {
|
||||||
|
client: CosmWasmClient
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||||
|
this.client = client
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.vaultStandardInfo = this.vaultStandardInfo.bind(this)
|
||||||
|
this.info = this.info.bind(this)
|
||||||
|
this.previewDeposit = this.previewDeposit.bind(this)
|
||||||
|
this.previewRedeem = this.previewRedeem.bind(this)
|
||||||
|
this.totalAssets = this.totalAssets.bind(this)
|
||||||
|
this.totalVaultTokenSupply = this.totalVaultTokenSupply.bind(this)
|
||||||
|
this.convertToShares = this.convertToShares.bind(this)
|
||||||
|
this.convertToAssets = this.convertToAssets.bind(this)
|
||||||
|
this.vaultExtension = this.vaultExtension.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
vaultStandardInfo = async (): Promise<VaultStandardInfo> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
vault_standard_info: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
info = async (): Promise<VaultInfo> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
info: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
previewDeposit = async ({ amount }: { amount: Uint128 }): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
preview_deposit: {
|
||||||
|
amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
previewRedeem = async ({ amount }: { amount: Uint128 }): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
preview_redeem: {
|
||||||
|
amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
totalAssets = async (): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
total_assets: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
totalVaultTokenSupply = async (): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
total_vault_token_supply: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
convertToShares = async ({ amount }: { amount: Uint128 }): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
convert_to_shares: {
|
||||||
|
amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
convertToAssets = async ({ amount }: { amount: Uint128 }): Promise<Uint128> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
convert_to_assets: {
|
||||||
|
amount,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
vaultExtension = async (): Promise<Empty> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
vault_extension: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsMockVaultInterface extends MarsMockVaultReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
deposit: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
redeem: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
vaultExtension: (
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
}
|
||||||
|
export class MarsMockVaultClient
|
||||||
|
extends MarsMockVaultQueryClient
|
||||||
|
implements MarsMockVaultInterface
|
||||||
|
{
|
||||||
|
client: SigningCosmWasmClient
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||||
|
super(client, contractAddress)
|
||||||
|
this.client = client
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.deposit = this.deposit.bind(this)
|
||||||
|
this.redeem = this.redeem.bind(this)
|
||||||
|
this.vaultExtension = this.vaultExtension.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
deposit = async (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
deposit: {
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
redeem = async (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
redeem: {
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
vaultExtension = async (
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
vault_extension: {},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,134 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { Coin } from '@cosmjs/amino'
|
||||||
|
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
Duration,
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
ExtensionExecuteMsg,
|
||||||
|
LockupExecuteMsg,
|
||||||
|
ForceUnlockExecuteMsg,
|
||||||
|
QueryMsg,
|
||||||
|
ExtensionQueryMsg,
|
||||||
|
LockupQueryMsg,
|
||||||
|
VaultInfo,
|
||||||
|
Empty,
|
||||||
|
VaultStandardInfo,
|
||||||
|
} from './MarsMockVault.types'
|
||||||
|
export interface MarsMockVaultMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
deposit: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
redeem: (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
vaultExtension: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.deposit = this.deposit.bind(this)
|
||||||
|
this.redeem = this.redeem.bind(this)
|
||||||
|
this.vaultExtension = this.vaultExtension.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
deposit = (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
deposit: {
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
redeem = (
|
||||||
|
{
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
redeem: {
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vaultExtension = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
vault_extension: {},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
301
types/generated/mars-mock-vault/MarsMockVault.react-query.ts
Normal file
301
types/generated/mars-mock-vault/MarsMockVault.react-query.ts
Normal file
@ -0,0 +1,301 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { StdFee, Coin } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
Duration,
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
ExtensionExecuteMsg,
|
||||||
|
LockupExecuteMsg,
|
||||||
|
ForceUnlockExecuteMsg,
|
||||||
|
QueryMsg,
|
||||||
|
ExtensionQueryMsg,
|
||||||
|
LockupQueryMsg,
|
||||||
|
VaultInfo,
|
||||||
|
Empty,
|
||||||
|
VaultStandardInfo,
|
||||||
|
} from './MarsMockVault.types'
|
||||||
|
import { MarsMockVaultQueryClient, MarsMockVaultClient } 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<VaultInfo, TData> {}
|
||||||
|
export function useMarsMockVaultInfoQuery<TData = VaultInfo>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsMockVaultInfoQuery<TData>) {
|
||||||
|
return useQuery<VaultInfo, 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<VaultStandardInfo, TData> {}
|
||||||
|
export function useMarsMockVaultVaultStandardInfoQuery<TData = VaultStandardInfo>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsMockVaultVaultStandardInfoQuery<TData>) {
|
||||||
|
return useQuery<VaultStandardInfo, 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
|
||||||
|
msg: ExtensionExecuteMsg
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
}
|
143
types/generated/mars-mock-vault/MarsMockVault.types.ts
Normal file
143
types/generated/mars-mock-vault/MarsMockVault.types.ts
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type Duration =
|
||||||
|
| {
|
||||||
|
height: number
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
time: number
|
||||||
|
}
|
||||||
|
export type OracleBaseForString = string
|
||||||
|
export interface InstantiateMsg {
|
||||||
|
base_token_denom: string
|
||||||
|
lockup?: Duration | null
|
||||||
|
oracle: OracleBaseForString
|
||||||
|
vault_token_denom: string
|
||||||
|
}
|
||||||
|
export type ExecuteMsg =
|
||||||
|
| {
|
||||||
|
deposit: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
redeem: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
vault_extension: ExtensionExecuteMsg
|
||||||
|
}
|
||||||
|
export type Uint128 = string
|
||||||
|
export type ExtensionExecuteMsg =
|
||||||
|
| {
|
||||||
|
lockup: LockupExecuteMsg
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
force_unlock: ForceUnlockExecuteMsg
|
||||||
|
}
|
||||||
|
export type LockupExecuteMsg =
|
||||||
|
| {
|
||||||
|
unlock: {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
withdraw_unlocked: {
|
||||||
|
lockup_id: number
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type ForceUnlockExecuteMsg =
|
||||||
|
| {
|
||||||
|
force_redeem: {
|
||||||
|
amount: Uint128
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
force_withdraw_unlocking: {
|
||||||
|
amount?: Uint128 | null
|
||||||
|
lockup_id: number
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
update_force_withdraw_whitelist: {
|
||||||
|
add_addresses: string[]
|
||||||
|
remove_addresses: string[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type QueryMsg =
|
||||||
|
| {
|
||||||
|
vault_standard_info: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
info: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
preview_deposit: {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
preview_redeem: {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
total_assets: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
total_vault_token_supply: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
convert_to_shares: {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
convert_to_assets: {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
vault_extension: ExtensionQueryMsg
|
||||||
|
}
|
||||||
|
export type ExtensionQueryMsg = {
|
||||||
|
lockup: LockupQueryMsg
|
||||||
|
}
|
||||||
|
export type LockupQueryMsg =
|
||||||
|
| {
|
||||||
|
lockups: {
|
||||||
|
limit?: number | null
|
||||||
|
owner: string
|
||||||
|
start_after?: number | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
lockup: {
|
||||||
|
lockup_id: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
lockup_duration: {}
|
||||||
|
}
|
||||||
|
export interface VaultInfo {
|
||||||
|
base_token: string
|
||||||
|
vault_token: string
|
||||||
|
}
|
||||||
|
export interface Empty {
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export interface VaultStandardInfo {
|
||||||
|
extensions: string[]
|
||||||
|
version: number
|
||||||
|
}
|
14
types/generated/mars-mock-vault/bundle.ts
Normal file
14
types/generated/mars-mock-vault/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 * as _16 from './MarsMockVault.types'
|
||||||
|
import * as _17 from './MarsMockVault.client'
|
||||||
|
import * as _18 from './MarsMockVault.message-composer'
|
||||||
|
import * as _19 from './MarsMockVault.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsMockVault = { ..._16, ..._17, ..._18, ..._19 }
|
||||||
|
}
|
@ -1,98 +1,98 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { StdFee } from '@cosmjs/amino'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Coin,
|
OracleBaseForString,
|
||||||
CoinMarketInfo,
|
|
||||||
Decimal,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
InterestRateModel,
|
LpConfig,
|
||||||
Market,
|
ExecuteMsg,
|
||||||
QueryMsg,
|
|
||||||
Uint128,
|
Uint128,
|
||||||
UserAssetDebtResponse,
|
QueryMsg,
|
||||||
} from './MockRedBank.types'
|
Coin,
|
||||||
export interface MockRedBankReadOnlyInterface {
|
ArrayOfCoin,
|
||||||
|
} from './MarsMockZapper.types'
|
||||||
|
export interface MarsMockZapperReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
userAssetDebt: ({
|
estimateProvideLiquidity: ({
|
||||||
denom,
|
coinsIn,
|
||||||
userAddress,
|
lpTokenOut,
|
||||||
}: {
|
}: {
|
||||||
denom: string
|
coinsIn: Coin[]
|
||||||
userAddress: string
|
lpTokenOut: string
|
||||||
}) => Promise<UserAssetDebtResponse>
|
}) => Promise<Uint128>
|
||||||
market: ({ denom }: { denom: string }) => Promise<Market>
|
estimateWithdrawLiquidity: ({ coinIn }: { coinIn: Coin }) => Promise<ArrayOfCoin>
|
||||||
}
|
}
|
||||||
export class MockRedBankQueryClient implements MockRedBankReadOnlyInterface {
|
export class MarsMockZapperQueryClient implements MarsMockZapperReadOnlyInterface {
|
||||||
client: CosmWasmClient
|
client: CosmWasmClient
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
|
|
||||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||||
this.client = client
|
this.client = client
|
||||||
this.contractAddress = contractAddress
|
this.contractAddress = contractAddress
|
||||||
this.userAssetDebt = this.userAssetDebt.bind(this)
|
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
|
||||||
this.market = this.market.bind(this)
|
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
userAssetDebt = async ({
|
estimateProvideLiquidity = async ({
|
||||||
denom,
|
coinsIn,
|
||||||
userAddress,
|
lpTokenOut,
|
||||||
}: {
|
}: {
|
||||||
denom: string
|
coinsIn: Coin[]
|
||||||
userAddress: string
|
lpTokenOut: string
|
||||||
}): Promise<UserAssetDebtResponse> => {
|
}): Promise<Uint128> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
user_asset_debt: {
|
estimate_provide_liquidity: {
|
||||||
denom,
|
coins_in: coinsIn,
|
||||||
user_address: userAddress,
|
lp_token_out: lpTokenOut,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
market = async ({ denom }: { denom: string }): Promise<Market> => {
|
estimateWithdrawLiquidity = async ({ coinIn }: { coinIn: Coin }): Promise<ArrayOfCoin> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
market: {
|
estimate_withdraw_liquidity: {
|
||||||
denom,
|
coin_in: coinIn,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface MockRedBankInterface extends MockRedBankReadOnlyInterface {
|
export interface MarsMockZapperInterface extends MarsMockZapperReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
sender: string
|
sender: string
|
||||||
borrow: (
|
provideLiquidity: (
|
||||||
{
|
{
|
||||||
coin,
|
lpTokenOut,
|
||||||
|
minimumReceive,
|
||||||
recipient,
|
recipient,
|
||||||
}: {
|
}: {
|
||||||
coin: Coin
|
lpTokenOut: string
|
||||||
|
minimumReceive: Uint128
|
||||||
recipient?: string
|
recipient?: string
|
||||||
},
|
},
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
repay: (
|
withdrawLiquidity: (
|
||||||
{
|
{
|
||||||
denom,
|
recipient,
|
||||||
onBehalfOf,
|
|
||||||
}: {
|
}: {
|
||||||
denom: string
|
recipient?: string
|
||||||
onBehalfOf?: string
|
|
||||||
},
|
},
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class MockRedBankClient extends MockRedBankQueryClient implements MockRedBankInterface {
|
export class MarsMockZapperClient
|
||||||
|
extends MarsMockZapperQueryClient
|
||||||
|
implements MarsMockZapperInterface
|
||||||
|
{
|
||||||
client: SigningCosmWasmClient
|
client: SigningCosmWasmClient
|
||||||
sender: string
|
sender: string
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
@ -102,16 +102,18 @@ export class MockRedBankClient extends MockRedBankQueryClient implements MockRed
|
|||||||
this.client = client
|
this.client = client
|
||||||
this.sender = sender
|
this.sender = sender
|
||||||
this.contractAddress = contractAddress
|
this.contractAddress = contractAddress
|
||||||
this.borrow = this.borrow.bind(this)
|
this.provideLiquidity = this.provideLiquidity.bind(this)
|
||||||
this.repay = this.repay.bind(this)
|
this.withdrawLiquidity = this.withdrawLiquidity.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
borrow = async (
|
provideLiquidity = async (
|
||||||
{
|
{
|
||||||
coin,
|
lpTokenOut,
|
||||||
|
minimumReceive,
|
||||||
recipient,
|
recipient,
|
||||||
}: {
|
}: {
|
||||||
coin: Coin
|
lpTokenOut: string
|
||||||
|
minimumReceive: Uint128
|
||||||
recipient?: string
|
recipient?: string
|
||||||
},
|
},
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
@ -122,8 +124,9 @@ export class MockRedBankClient extends MockRedBankQueryClient implements MockRed
|
|||||||
this.sender,
|
this.sender,
|
||||||
this.contractAddress,
|
this.contractAddress,
|
||||||
{
|
{
|
||||||
borrow: {
|
provide_liquidity: {
|
||||||
coin,
|
lp_token_out: lpTokenOut,
|
||||||
|
minimum_receive: minimumReceive,
|
||||||
recipient,
|
recipient,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -132,13 +135,11 @@ export class MockRedBankClient extends MockRedBankQueryClient implements MockRed
|
|||||||
funds,
|
funds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
repay = async (
|
withdrawLiquidity = async (
|
||||||
{
|
{
|
||||||
denom,
|
recipient,
|
||||||
onBehalfOf,
|
|
||||||
}: {
|
}: {
|
||||||
denom: string
|
recipient?: string
|
||||||
onBehalfOf?: string
|
|
||||||
},
|
},
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
@ -148,9 +149,8 @@ export class MockRedBankClient extends MockRedBankQueryClient implements MockRed
|
|||||||
this.sender,
|
this.sender,
|
||||||
this.contractAddress,
|
this.contractAddress,
|
||||||
{
|
{
|
||||||
repay: {
|
withdraw_liquidity: {
|
||||||
denom,
|
recipient,
|
||||||
on_behalf_of: onBehalfOf,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fee,
|
fee,
|
@ -0,0 +1,110 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
LpConfig,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
QueryMsg,
|
||||||
|
Coin,
|
||||||
|
ArrayOfCoin,
|
||||||
|
} from './MarsMockZapper.types'
|
||||||
|
export interface MarsMockZapperMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
provideLiquidity: (
|
||||||
|
{
|
||||||
|
lpTokenOut,
|
||||||
|
minimumReceive,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
lpTokenOut: string
|
||||||
|
minimumReceive: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
withdrawLiquidity: (
|
||||||
|
{
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsMockZapperMessageComposer implements MarsMockZapperMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.provideLiquidity = this.provideLiquidity.bind(this)
|
||||||
|
this.withdrawLiquidity = this.withdrawLiquidity.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
provideLiquidity = (
|
||||||
|
{
|
||||||
|
lpTokenOut,
|
||||||
|
minimumReceive,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
lpTokenOut: string
|
||||||
|
minimumReceive: Uint128
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
provide_liquidity: {
|
||||||
|
lp_token_out: lpTokenOut,
|
||||||
|
minimum_receive: minimumReceive,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
withdrawLiquidity = (
|
||||||
|
{
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
recipient?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
withdraw_liquidity: {
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
152
types/generated/mars-mock-zapper/MarsMockZapper.react-query.ts
Normal file
152
types/generated/mars-mock-zapper/MarsMockZapper.react-query.ts
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
LpConfig,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
QueryMsg,
|
||||||
|
Coin,
|
||||||
|
ArrayOfCoin,
|
||||||
|
} from './MarsMockZapper.types'
|
||||||
|
import { MarsMockZapperQueryClient, MarsMockZapperClient } from './MarsMockZapper.client'
|
||||||
|
export const marsMockZapperQueryKeys = {
|
||||||
|
contract: [
|
||||||
|
{
|
||||||
|
contract: 'marsMockZapper',
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
address: (contractAddress: string | undefined) =>
|
||||||
|
[{ ...marsMockZapperQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
|
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...marsMockZapperQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'estimate_provide_liquidity',
|
||||||
|
args,
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
estimateWithdrawLiquidity: (
|
||||||
|
contractAddress: string | undefined,
|
||||||
|
args?: Record<string, unknown>,
|
||||||
|
) =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...marsMockZapperQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'estimate_withdraw_liquidity',
|
||||||
|
args,
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
}
|
||||||
|
export interface MarsMockZapperReactQuery<TResponse, TData = TResponse> {
|
||||||
|
client: MarsMockZapperQueryClient | undefined
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
|
> & {
|
||||||
|
initialData?: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsMockZapperEstimateWithdrawLiquidityQuery<TData>
|
||||||
|
extends MarsMockZapperReactQuery<ArrayOfCoin, TData> {
|
||||||
|
args: {
|
||||||
|
coinIn: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsMockZapperEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsMockZapperEstimateWithdrawLiquidityQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfCoin, Error, TData>(
|
||||||
|
marsMockZapperQueryKeys.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 MarsMockZapperEstimateProvideLiquidityQuery<TData>
|
||||||
|
extends MarsMockZapperReactQuery<Uint128, TData> {
|
||||||
|
args: {
|
||||||
|
coinsIn: Coin[]
|
||||||
|
lpTokenOut: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsMockZapperEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsMockZapperEstimateProvideLiquidityQuery<TData>) {
|
||||||
|
return useQuery<Uint128, Error, TData>(
|
||||||
|
marsMockZapperQueryKeys.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 MarsMockZapperWithdrawLiquidityMutation {
|
||||||
|
client: MarsMockZapperClient
|
||||||
|
msg: {
|
||||||
|
recipient?: string
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsMockZapperWithdrawLiquidityMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsMockZapperWithdrawLiquidityMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsMockZapperWithdrawLiquidityMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.withdrawLiquidity(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsMockZapperProvideLiquidityMutation {
|
||||||
|
client: MarsMockZapperClient
|
||||||
|
msg: {
|
||||||
|
lpTokenOut: string
|
||||||
|
minimumReceive: Uint128
|
||||||
|
recipient?: string
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsMockZapperProvideLiquidityMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsMockZapperProvideLiquidityMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsMockZapperProvideLiquidityMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.provideLiquidity(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
@ -1,45 +1,45 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type OracleBaseForString = string
|
export type OracleBaseForString = string
|
||||||
export interface InstantiateMsg {
|
export interface InstantiateMsg {
|
||||||
asset_denoms: string[]
|
lp_configs: LpConfig[]
|
||||||
lockup?: number | null
|
|
||||||
lp_token_denom: string
|
|
||||||
oracle: OracleBaseForString
|
oracle: OracleBaseForString
|
||||||
}
|
}
|
||||||
|
export interface LpConfig {
|
||||||
|
lp_pair_denoms: [string, string]
|
||||||
|
lp_token_denom: string
|
||||||
|
}
|
||||||
export type ExecuteMsg =
|
export type ExecuteMsg =
|
||||||
| {
|
| {
|
||||||
deposit: {}
|
provide_liquidity: {
|
||||||
}
|
lp_token_out: string
|
||||||
| {
|
minimum_receive: Uint128
|
||||||
withdraw: {}
|
recipient?: string | null
|
||||||
}
|
|
||||||
| {
|
|
||||||
force_withdraw: {}
|
|
||||||
}
|
|
||||||
export type QueryMsg =
|
|
||||||
| {
|
|
||||||
info: {}
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
preview_redeem: {
|
|
||||||
amount: Uint128
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
total_vault_coins_issued: {}
|
withdraw_liquidity: {
|
||||||
|
recipient?: string | null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export type Uint128 = string
|
export type Uint128 = string
|
||||||
export interface VaultInfo {
|
export type QueryMsg =
|
||||||
coins: Coin[]
|
| {
|
||||||
lockup?: number | null
|
estimate_provide_liquidity: {
|
||||||
token_denom: string
|
coins_in: Coin[]
|
||||||
}
|
lp_token_out: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
estimate_withdraw_liquidity: {
|
||||||
|
coin_in: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
export interface Coin {
|
export interface Coin {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
denom: string
|
denom: string
|
14
types/generated/mars-mock-zapper/bundle.ts
Normal file
14
types/generated/mars-mock-zapper/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 * as _20 from './MarsMockZapper.types'
|
||||||
|
import * as _21 from './MarsMockZapper.client'
|
||||||
|
import * as _22 from './MarsMockZapper.message-composer'
|
||||||
|
import * as _23 from './MarsMockZapper.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsMockZapper = { ..._20, ..._21, ..._22, ..._23 }
|
||||||
|
}
|
@ -1,31 +1,34 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Addr,
|
|
||||||
ArrayOfVaultPricingInfo,
|
|
||||||
ConfigResponse,
|
|
||||||
ConfigUpdates,
|
|
||||||
Decimal,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
|
||||||
OracleBaseForAddr,
|
|
||||||
OracleBaseForString,
|
OracleBaseForString,
|
||||||
PriceResponse,
|
Addr,
|
||||||
PricingMethod,
|
PricingMethod,
|
||||||
QueryMsg,
|
InstantiateMsg,
|
||||||
VaultPricingInfo,
|
VaultPricingInfo,
|
||||||
|
ExecuteMsg,
|
||||||
|
ConfigUpdates,
|
||||||
|
QueryMsg,
|
||||||
|
Uint128,
|
||||||
|
Coin,
|
||||||
|
ArrayOfVaultPricingInfo,
|
||||||
|
OracleBaseForAddr,
|
||||||
|
ConfigResponse,
|
||||||
|
Decimal,
|
||||||
|
PriceResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
} from './MarsOracleAdapter.types'
|
} from './MarsOracleAdapter.types'
|
||||||
export interface MarsOracleAdapterReadOnlyInterface {
|
export interface MarsOracleAdapterReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
||||||
|
priceableUnderlying: ({ coin }: { coin: Coin }) => Promise<ArrayOfCoin>
|
||||||
config: () => Promise<ConfigResponse>
|
config: () => Promise<ConfigResponse>
|
||||||
pricingInfo: ({ denom }: { denom: string }) => Promise<VaultPricingInfo>
|
pricingInfo: ({ denom }: { denom: string }) => Promise<VaultPricingInfo>
|
||||||
allPricingInfo: ({
|
allPricingInfo: ({
|
||||||
@ -44,6 +47,7 @@ export class MarsOracleAdapterQueryClient implements MarsOracleAdapterReadOnlyIn
|
|||||||
this.client = client
|
this.client = client
|
||||||
this.contractAddress = contractAddress
|
this.contractAddress = contractAddress
|
||||||
this.price = this.price.bind(this)
|
this.price = this.price.bind(this)
|
||||||
|
this.priceableUnderlying = this.priceableUnderlying.bind(this)
|
||||||
this.config = this.config.bind(this)
|
this.config = this.config.bind(this)
|
||||||
this.pricingInfo = this.pricingInfo.bind(this)
|
this.pricingInfo = this.pricingInfo.bind(this)
|
||||||
this.allPricingInfo = this.allPricingInfo.bind(this)
|
this.allPricingInfo = this.allPricingInfo.bind(this)
|
||||||
@ -56,6 +60,13 @@ export class MarsOracleAdapterQueryClient implements MarsOracleAdapterReadOnlyIn
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
priceableUnderlying = async ({ coin }: { coin: Coin }): Promise<ArrayOfCoin> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
priceable_underlying: {
|
||||||
|
coin,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
config = async (): Promise<ConfigResponse> => {
|
config = async (): Promise<ConfigResponse> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
config: {},
|
config: {},
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
OracleBaseForString,
|
||||||
|
Addr,
|
||||||
|
PricingMethod,
|
||||||
|
InstantiateMsg,
|
||||||
|
VaultPricingInfo,
|
||||||
|
ExecuteMsg,
|
||||||
|
ConfigUpdates,
|
||||||
|
QueryMsg,
|
||||||
|
Uint128,
|
||||||
|
Coin,
|
||||||
|
ArrayOfVaultPricingInfo,
|
||||||
|
OracleBaseForAddr,
|
||||||
|
ConfigResponse,
|
||||||
|
Decimal,
|
||||||
|
PriceResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
|
} from './MarsOracleAdapter.types'
|
||||||
|
export interface MarsOracleAdapterMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateConfig: (
|
||||||
|
{
|
||||||
|
newConfig,
|
||||||
|
}: {
|
||||||
|
newConfig: ConfigUpdates
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsOracleAdapterMessageComposer implements MarsOracleAdapterMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConfig = (
|
||||||
|
{
|
||||||
|
newConfig,
|
||||||
|
}: {
|
||||||
|
newConfig: ConfigUpdates
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_config: {
|
||||||
|
new_config: newConfig,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,30 +1,32 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
|
||||||
import { MarsOracleAdapterClient, MarsOracleAdapterQueryClient } from './MarsOracleAdapter.client'
|
|
||||||
import {
|
import {
|
||||||
Addr,
|
|
||||||
ArrayOfVaultPricingInfo,
|
|
||||||
ConfigResponse,
|
|
||||||
ConfigUpdates,
|
|
||||||
Decimal,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
|
||||||
OracleBaseForAddr,
|
|
||||||
OracleBaseForString,
|
OracleBaseForString,
|
||||||
PriceResponse,
|
Addr,
|
||||||
PricingMethod,
|
PricingMethod,
|
||||||
QueryMsg,
|
InstantiateMsg,
|
||||||
VaultPricingInfo,
|
VaultPricingInfo,
|
||||||
|
ExecuteMsg,
|
||||||
|
ConfigUpdates,
|
||||||
|
QueryMsg,
|
||||||
|
Uint128,
|
||||||
|
Coin,
|
||||||
|
ArrayOfVaultPricingInfo,
|
||||||
|
OracleBaseForAddr,
|
||||||
|
ConfigResponse,
|
||||||
|
Decimal,
|
||||||
|
PriceResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
} from './MarsOracleAdapter.types'
|
} from './MarsOracleAdapter.types'
|
||||||
|
import { MarsOracleAdapterQueryClient, MarsOracleAdapterClient } from './MarsOracleAdapter.client'
|
||||||
export const marsOracleAdapterQueryKeys = {
|
export const marsOracleAdapterQueryKeys = {
|
||||||
contract: [
|
contract: [
|
||||||
{
|
{
|
||||||
@ -35,6 +37,14 @@ export const marsOracleAdapterQueryKeys = {
|
|||||||
[{ ...marsOracleAdapterQueryKeys.contract[0], address: contractAddress }] as const,
|
[{ ...marsOracleAdapterQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
[{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
||||||
|
priceableUnderlying: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...marsOracleAdapterQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'priceable_underlying',
|
||||||
|
args,
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'config', args },
|
{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||||
@ -119,6 +129,28 @@ export function useMarsOracleAdapterConfigQuery<TData = ConfigResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsOracleAdapterPriceableUnderlyingQuery<TData>
|
||||||
|
extends MarsOracleAdapterReactQuery<ArrayOfCoin, TData> {
|
||||||
|
args: {
|
||||||
|
coin: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsOracleAdapterPriceableUnderlyingQuery<TData = ArrayOfCoin>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsOracleAdapterPriceableUnderlyingQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfCoin, Error, TData>(
|
||||||
|
marsOracleAdapterQueryKeys.priceableUnderlying(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.priceableUnderlying({
|
||||||
|
coin: args.coin,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsOracleAdapterPriceQuery<TData>
|
export interface MarsOracleAdapterPriceQuery<TData>
|
||||||
extends MarsOracleAdapterReactQuery<PriceResponse, TData> {
|
extends MarsOracleAdapterReactQuery<PriceResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -15,8 +15,9 @@ export interface InstantiateMsg {
|
|||||||
}
|
}
|
||||||
export interface VaultPricingInfo {
|
export interface VaultPricingInfo {
|
||||||
addr: Addr
|
addr: Addr
|
||||||
denom: string
|
base_denom: string
|
||||||
method: PricingMethod
|
method: PricingMethod
|
||||||
|
vault_coin_denom: string
|
||||||
}
|
}
|
||||||
export type ExecuteMsg = {
|
export type ExecuteMsg = {
|
||||||
update_config: {
|
update_config: {
|
||||||
@ -34,6 +35,11 @@ export type QueryMsg =
|
|||||||
denom: string
|
denom: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
priceable_underlying: {
|
||||||
|
coin: Coin
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
config: {}
|
config: {}
|
||||||
}
|
}
|
||||||
@ -48,6 +54,12 @@ export type QueryMsg =
|
|||||||
start_after?: string | null
|
start_after?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export type Uint128 = string
|
||||||
|
export interface Coin {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
export type ArrayOfVaultPricingInfo = VaultPricingInfo[]
|
export type ArrayOfVaultPricingInfo = VaultPricingInfo[]
|
||||||
export type OracleBaseForAddr = string
|
export type OracleBaseForAddr = string
|
||||||
export interface ConfigResponse {
|
export interface ConfigResponse {
|
||||||
@ -58,5 +70,5 @@ export type Decimal = string
|
|||||||
export interface PriceResponse {
|
export interface PriceResponse {
|
||||||
denom: string
|
denom: string
|
||||||
price: Decimal
|
price: Decimal
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
|
export type ArrayOfCoin = Coin[]
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _7 from './MarsOracleAdapter.client'
|
import * as _24 from './MarsOracleAdapter.types'
|
||||||
import * as _8 from './MarsOracleAdapter.react-query'
|
import * as _25 from './MarsOracleAdapter.client'
|
||||||
import * as _6 from './MarsOracleAdapter.types'
|
import * as _26 from './MarsOracleAdapter.message-composer'
|
||||||
|
import * as _27 from './MarsOracleAdapter.react-query'
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsOracleAdapter = { ..._6, ..._7, ..._8 }
|
export const MarsOracleAdapter = { ..._24, ..._25, ..._26, ..._27 }
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,27 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { StdFee } from '@cosmjs/amino'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Addr,
|
|
||||||
ArrayOfRouteResponseForEmpty,
|
|
||||||
Coin,
|
|
||||||
ConfigForString,
|
|
||||||
Decimal,
|
|
||||||
Empty,
|
|
||||||
EstimateExactInSwapResponse,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
QueryMsg,
|
ExecuteMsg,
|
||||||
RouteResponseForEmpty,
|
|
||||||
Uint128,
|
Uint128,
|
||||||
} from './SwapperBase.types'
|
Decimal,
|
||||||
export interface SwapperBaseReadOnlyInterface {
|
Addr,
|
||||||
|
Empty,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperBase.types'
|
||||||
|
export interface MarsSwapperBaseReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
config: () => Promise<ConfigForString>
|
config: () => Promise<ConfigForString>
|
||||||
route: ({
|
route: ({
|
||||||
@ -47,7 +46,7 @@ export interface SwapperBaseReadOnlyInterface {
|
|||||||
denomOut: string
|
denomOut: string
|
||||||
}) => Promise<EstimateExactInSwapResponse>
|
}) => Promise<EstimateExactInSwapResponse>
|
||||||
}
|
}
|
||||||
export class SwapperBaseQueryClient implements SwapperBaseReadOnlyInterface {
|
export class MarsSwapperBaseQueryClient implements MarsSwapperBaseReadOnlyInterface {
|
||||||
client: CosmWasmClient
|
client: CosmWasmClient
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
|
|
||||||
@ -108,7 +107,7 @@ export class SwapperBaseQueryClient implements SwapperBaseReadOnlyInterface {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface SwapperBaseInterface extends SwapperBaseReadOnlyInterface {
|
export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
sender: string
|
sender: string
|
||||||
updateConfig: (
|
updateConfig: (
|
||||||
@ -164,7 +163,10 @@ export interface SwapperBaseInterface extends SwapperBaseReadOnlyInterface {
|
|||||||
funds?: Coin[],
|
funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class SwapperBaseClient extends SwapperBaseQueryClient implements SwapperBaseInterface {
|
export class MarsSwapperBaseClient
|
||||||
|
extends MarsSwapperBaseQueryClient
|
||||||
|
implements MarsSwapperBaseInterface
|
||||||
|
{
|
||||||
client: SigningCosmWasmClient
|
client: SigningCosmWasmClient
|
||||||
sender: string
|
sender: string
|
||||||
contractAddress: string
|
contractAddress: string
|
@ -0,0 +1,200 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||||
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||||
|
import { toUtf8 } from '@cosmjs/encoding'
|
||||||
|
import {
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
Addr,
|
||||||
|
Empty,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperBase.types'
|
||||||
|
export interface MarsSwapperBaseMessage {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateConfig: (
|
||||||
|
{
|
||||||
|
owner,
|
||||||
|
}: {
|
||||||
|
owner?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
setRoute: (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
route,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: Empty
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
swapExactIn: (
|
||||||
|
{
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
slippage,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
slippage: Decimal
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
transferResult: (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
recipient: Addr
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
) => MsgExecuteContractEncodeObject
|
||||||
|
}
|
||||||
|
export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(sender: string, contractAddress: string) {
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
|
this.setRoute = this.setRoute.bind(this)
|
||||||
|
this.swapExactIn = this.swapExactIn.bind(this)
|
||||||
|
this.transferResult = this.transferResult.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConfig = (
|
||||||
|
{
|
||||||
|
owner,
|
||||||
|
}: {
|
||||||
|
owner?: string
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
update_config: {
|
||||||
|
owner,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setRoute = (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
route,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: Empty
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
set_route: {
|
||||||
|
denom_in: denomIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
route,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swapExactIn = (
|
||||||
|
{
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
slippage,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
slippage: Decimal
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
swap_exact_in: {
|
||||||
|
coin_in: coinIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
slippage,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transferResult = (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
recipient: Addr
|
||||||
|
},
|
||||||
|
funds?: Coin[],
|
||||||
|
): MsgExecuteContractEncodeObject => {
|
||||||
|
return {
|
||||||
|
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||||
|
value: MsgExecuteContract.fromPartial({
|
||||||
|
sender: this.sender,
|
||||||
|
contract: this.contractAddress,
|
||||||
|
msg: toUtf8(
|
||||||
|
JSON.stringify({
|
||||||
|
transfer_result: {
|
||||||
|
denom_in: denomIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
funds,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,54 +1,53 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { StdFee } from '@cosmjs/amino'
|
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
|
||||||
import { SwapperBaseClient, SwapperBaseQueryClient } from './SwapperBase.client'
|
|
||||||
import {
|
import {
|
||||||
Addr,
|
|
||||||
ArrayOfRouteResponseForEmpty,
|
|
||||||
Coin,
|
|
||||||
ConfigForString,
|
|
||||||
Decimal,
|
|
||||||
Empty,
|
|
||||||
EstimateExactInSwapResponse,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
QueryMsg,
|
ExecuteMsg,
|
||||||
RouteResponseForEmpty,
|
|
||||||
Uint128,
|
Uint128,
|
||||||
} from './SwapperBase.types'
|
Decimal,
|
||||||
export const swapperBaseQueryKeys = {
|
Addr,
|
||||||
|
Empty,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperBase.types'
|
||||||
|
import { MarsSwapperBaseQueryClient, MarsSwapperBaseClient } from './MarsSwapperBase.client'
|
||||||
|
export const marsSwapperBaseQueryKeys = {
|
||||||
contract: [
|
contract: [
|
||||||
{
|
{
|
||||||
contract: 'swapperBase',
|
contract: 'marsSwapperBase',
|
||||||
},
|
},
|
||||||
] as const,
|
] as const,
|
||||||
address: (contractAddress: string | undefined) =>
|
address: (contractAddress: string | undefined) =>
|
||||||
[{ ...swapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
[{ ...marsSwapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...swapperBaseQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||||
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...swapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
|
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
|
||||||
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...swapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
|
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
|
||||||
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
...swapperBaseQueryKeys.address(contractAddress)[0],
|
...marsSwapperBaseQueryKeys.address(contractAddress)[0],
|
||||||
method: 'estimate_exact_in_swap',
|
method: 'estimate_exact_in_swap',
|
||||||
args,
|
args,
|
||||||
},
|
},
|
||||||
] as const,
|
] as const,
|
||||||
}
|
}
|
||||||
export interface SwapperBaseReactQuery<TResponse, TData = TResponse> {
|
export interface MarsSwapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||||
client: SwapperBaseQueryClient | undefined
|
client: MarsSwapperBaseQueryClient | undefined
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseQueryOptions<TResponse, Error, TData>,
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
"'queryKey' | 'queryFn' | 'initialData'"
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
@ -56,20 +55,20 @@ export interface SwapperBaseReactQuery<TResponse, TData = TResponse> {
|
|||||||
initialData?: undefined
|
initialData?: undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface SwapperBaseEstimateExactInSwapQuery<TData>
|
export interface MarsSwapperBaseEstimateExactInSwapQuery<TData>
|
||||||
extends SwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
|
extends MarsSwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
coinIn: Coin
|
coinIn: Coin
|
||||||
denomOut: string
|
denomOut: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
export function useMarsSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: SwapperBaseEstimateExactInSwapQuery<TData>) {
|
}: MarsSwapperBaseEstimateExactInSwapQuery<TData>) {
|
||||||
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||||
swapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args),
|
marsSwapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.estimateExactInSwap({
|
? client.estimateExactInSwap({
|
||||||
@ -80,20 +79,20 @@ export function useSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSw
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseRoutesQuery<TData>
|
export interface MarsSwapperBaseRoutesQuery<TData>
|
||||||
extends SwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
extends MarsSwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||||
args: {
|
args: {
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string[][]
|
startAfter?: string[][]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
export function useMarsSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: SwapperBaseRoutesQuery<TData>) {
|
}: MarsSwapperBaseRoutesQuery<TData>) {
|
||||||
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||||
swapperBaseQueryKeys.routes(client?.contractAddress, args),
|
marsSwapperBaseQueryKeys.routes(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.routes({
|
? client.routes({
|
||||||
@ -104,20 +103,20 @@ export function useSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>(
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseRouteQuery<TData>
|
export interface MarsSwapperBaseRouteQuery<TData>
|
||||||
extends SwapperBaseReactQuery<RouteResponseForEmpty, TData> {
|
extends MarsSwapperBaseReactQuery<RouteResponseForEmpty, TData> {
|
||||||
args: {
|
args: {
|
||||||
denomIn: string
|
denomIn: string
|
||||||
denomOut: string
|
denomOut: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
export function useMarsSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
||||||
client,
|
client,
|
||||||
args,
|
args,
|
||||||
options,
|
options,
|
||||||
}: SwapperBaseRouteQuery<TData>) {
|
}: MarsSwapperBaseRouteQuery<TData>) {
|
||||||
return useQuery<RouteResponseForEmpty, Error, TData>(
|
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||||
swapperBaseQueryKeys.route(client?.contractAddress, args),
|
marsSwapperBaseQueryKeys.route(client?.contractAddress, args),
|
||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.route({
|
? client.route({
|
||||||
@ -128,20 +127,20 @@ export function useSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseConfigQuery<TData>
|
export interface MarsSwapperBaseConfigQuery<TData>
|
||||||
extends SwapperBaseReactQuery<ConfigForString, TData> {}
|
extends MarsSwapperBaseReactQuery<ConfigForString, TData> {}
|
||||||
export function useSwapperBaseConfigQuery<TData = ConfigForString>({
|
export function useMarsSwapperBaseConfigQuery<TData = ConfigForString>({
|
||||||
client,
|
client,
|
||||||
options,
|
options,
|
||||||
}: SwapperBaseConfigQuery<TData>) {
|
}: MarsSwapperBaseConfigQuery<TData>) {
|
||||||
return useQuery<ConfigForString, Error, TData>(
|
return useQuery<ConfigForString, Error, TData>(
|
||||||
swapperBaseQueryKeys.config(client?.contractAddress),
|
marsSwapperBaseQueryKeys.config(client?.contractAddress),
|
||||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseTransferResultMutation {
|
export interface MarsSwapperBaseTransferResultMutation {
|
||||||
client: SwapperBaseClient
|
client: MarsSwapperBaseClient
|
||||||
msg: {
|
msg: {
|
||||||
denomIn: string
|
denomIn: string
|
||||||
denomOut: string
|
denomOut: string
|
||||||
@ -153,20 +152,20 @@ export interface SwapperBaseTransferResultMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseTransferResultMutation(
|
export function useMarsSwapperBaseTransferResultMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseTransferResultMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, SwapperBaseTransferResultMutation>(
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
client.transferResult(msg, fee, memo, funds),
|
client.transferResult(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseSwapExactInMutation {
|
export interface MarsSwapperBaseSwapExactInMutation {
|
||||||
client: SwapperBaseClient
|
client: MarsSwapperBaseClient
|
||||||
msg: {
|
msg: {
|
||||||
coinIn: Coin
|
coinIn: Coin
|
||||||
denomOut: string
|
denomOut: string
|
||||||
@ -178,19 +177,19 @@ export interface SwapperBaseSwapExactInMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseSwapExactInMutation(
|
export function useMarsSwapperBaseSwapExactInMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseSwapExactInMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, SwapperBaseSwapExactInMutation>(
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseSetRouteMutation {
|
export interface MarsSwapperBaseSetRouteMutation {
|
||||||
client: SwapperBaseClient
|
client: MarsSwapperBaseClient
|
||||||
msg: {
|
msg: {
|
||||||
denomIn: string
|
denomIn: string
|
||||||
denomOut: string
|
denomOut: string
|
||||||
@ -202,19 +201,19 @@ export interface SwapperBaseSetRouteMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseSetRouteMutation(
|
export function useMarsSwapperBaseSetRouteMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseSetRouteMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, SwapperBaseSetRouteMutation>(
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export interface SwapperBaseUpdateConfigMutation {
|
export interface MarsSwapperBaseUpdateConfigMutation {
|
||||||
client: SwapperBaseClient
|
client: MarsSwapperBaseClient
|
||||||
msg: {
|
msg: {
|
||||||
owner?: string
|
owner?: string
|
||||||
}
|
}
|
||||||
@ -224,13 +223,13 @@ export interface SwapperBaseUpdateConfigMutation {
|
|||||||
funds?: Coin[]
|
funds?: Coin[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useSwapperBaseUpdateConfigMutation(
|
export function useMarsSwapperBaseUpdateConfigMutation(
|
||||||
options?: Omit<
|
options?: Omit<
|
||||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseUpdateConfigMutation>,
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseUpdateConfigMutation>,
|
||||||
'mutationFn'
|
'mutationFn'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
return useMutation<ExecuteResult, Error, SwapperBaseUpdateConfigMutation>(
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseUpdateConfigMutation>(
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
client.updateConfig(msg, fee, memo, funds),
|
client.updateConfig(msg, fee, memo, funds),
|
||||||
options,
|
options,
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.0.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
14
types/generated/mars-swapper-base/bundle.ts
Normal file
14
types/generated/mars-swapper-base/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.20.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 * as _28 from './MarsSwapperBase.types'
|
||||||
|
import * as _29 from './MarsSwapperBase.client'
|
||||||
|
import * as _30 from './MarsSwapperBase.message-composer'
|
||||||
|
import * as _31 from './MarsSwapperBase.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsSwapperBase = { ..._28, ..._29, ..._30, ..._31 }
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 * as _10 from './MockOracle.client'
|
|
||||||
import * as _11 from './MockOracle.react-query'
|
|
||||||
import * as _9 from './MockOracle.types'
|
|
||||||
export namespace contracts {
|
|
||||||
export const MockOracle = { ..._9, ..._10, ..._11 }
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 { StdFee } from '@cosmjs/amino'
|
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
||||||
|
|
||||||
import { MockRedBankClient, MockRedBankQueryClient } from './MockRedBank.client'
|
|
||||||
import {
|
|
||||||
Coin,
|
|
||||||
CoinMarketInfo,
|
|
||||||
Decimal,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
|
||||||
InterestRateModel,
|
|
||||||
Market,
|
|
||||||
QueryMsg,
|
|
||||||
Uint128,
|
|
||||||
UserAssetDebtResponse,
|
|
||||||
} from './MockRedBank.types'
|
|
||||||
export const mockRedBankQueryKeys = {
|
|
||||||
contract: [
|
|
||||||
{
|
|
||||||
contract: 'mockRedBank',
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
address: (contractAddress: string | undefined) =>
|
|
||||||
[{ ...mockRedBankQueryKeys.contract[0], address: contractAddress }] as const,
|
|
||||||
userAssetDebt: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...mockRedBankQueryKeys.address(contractAddress)[0], method: 'user_asset_debt', args },
|
|
||||||
] as const,
|
|
||||||
market: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[{ ...mockRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const,
|
|
||||||
}
|
|
||||||
export interface MockRedBankReactQuery<TResponse, TData = TResponse> {
|
|
||||||
client: MockRedBankQueryClient | undefined
|
|
||||||
options?: Omit<
|
|
||||||
UseQueryOptions<TResponse, Error, TData>,
|
|
||||||
"'queryKey' | 'queryFn' | 'initialData'"
|
|
||||||
> & {
|
|
||||||
initialData?: undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export interface MockRedBankMarketQuery<TData> extends MockRedBankReactQuery<Market, TData> {
|
|
||||||
args: {
|
|
||||||
denom: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockRedBankMarketQuery<TData = Market>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: MockRedBankMarketQuery<TData>) {
|
|
||||||
return useQuery<Market, Error, TData>(
|
|
||||||
mockRedBankQueryKeys.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 MockRedBankUserAssetDebtQuery<TData>
|
|
||||||
extends MockRedBankReactQuery<UserAssetDebtResponse, TData> {
|
|
||||||
args: {
|
|
||||||
denom: string
|
|
||||||
userAddress: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockRedBankUserAssetDebtQuery<TData = UserAssetDebtResponse>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: MockRedBankUserAssetDebtQuery<TData>) {
|
|
||||||
return useQuery<UserAssetDebtResponse, Error, TData>(
|
|
||||||
mockRedBankQueryKeys.userAssetDebt(client?.contractAddress, args),
|
|
||||||
() =>
|
|
||||||
client
|
|
||||||
? client.userAssetDebt({
|
|
||||||
denom: args.denom,
|
|
||||||
userAddress: args.userAddress,
|
|
||||||
})
|
|
||||||
: Promise.reject(new Error('Invalid client')),
|
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface MockRedBankRepayMutation {
|
|
||||||
client: MockRedBankClient
|
|
||||||
msg: {
|
|
||||||
denom: string
|
|
||||||
onBehalfOf?: string
|
|
||||||
}
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockRedBankRepayMutation(
|
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockRedBankRepayMutation>, 'mutationFn'>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, MockRedBankRepayMutation>(
|
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.repay(msg, fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface MockRedBankBorrowMutation {
|
|
||||||
client: MockRedBankClient
|
|
||||||
msg: {
|
|
||||||
coin: Coin
|
|
||||||
recipient?: string
|
|
||||||
}
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockRedBankBorrowMutation(
|
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockRedBankBorrowMutation>, 'mutationFn'>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, MockRedBankBorrowMutation>(
|
|
||||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.borrow(msg, fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export type Decimal = string
|
|
||||||
export interface InstantiateMsg {
|
|
||||||
coins: CoinMarketInfo[]
|
|
||||||
}
|
|
||||||
export interface CoinMarketInfo {
|
|
||||||
denom: string
|
|
||||||
liquidation_threshold: Decimal
|
|
||||||
max_ltv: Decimal
|
|
||||||
}
|
|
||||||
export type ExecuteMsg =
|
|
||||||
| {
|
|
||||||
borrow: {
|
|
||||||
coin: Coin
|
|
||||||
recipient?: string | null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
repay: {
|
|
||||||
denom: string
|
|
||||||
on_behalf_of?: string | null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export type Uint128 = string
|
|
||||||
export interface Coin {
|
|
||||||
amount: Uint128
|
|
||||||
denom: string
|
|
||||||
[k: string]: unknown
|
|
||||||
}
|
|
||||||
export type QueryMsg =
|
|
||||||
| {
|
|
||||||
user_asset_debt: {
|
|
||||||
denom: string
|
|
||||||
user_address: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
market: {
|
|
||||||
denom: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export interface Market {
|
|
||||||
borrow_enabled: boolean
|
|
||||||
borrow_index: Decimal
|
|
||||||
borrow_rate: Decimal
|
|
||||||
collateral_total_scaled: Uint128
|
|
||||||
debt_total_scaled: Uint128
|
|
||||||
denom: string
|
|
||||||
deposit_cap: Uint128
|
|
||||||
deposit_enabled: boolean
|
|
||||||
indexes_last_updated: number
|
|
||||||
interest_rate_model: InterestRateModel
|
|
||||||
liquidation_bonus: Decimal
|
|
||||||
liquidation_threshold: Decimal
|
|
||||||
liquidity_index: Decimal
|
|
||||||
liquidity_rate: Decimal
|
|
||||||
max_loan_to_value: Decimal
|
|
||||||
reserve_factor: Decimal
|
|
||||||
[k: string]: unknown
|
|
||||||
}
|
|
||||||
export interface InterestRateModel {
|
|
||||||
base: Decimal
|
|
||||||
optimal_utilization_rate: Decimal
|
|
||||||
slope_1: Decimal
|
|
||||||
slope_2: Decimal
|
|
||||||
[k: string]: unknown
|
|
||||||
}
|
|
||||||
export interface UserAssetDebtResponse {
|
|
||||||
amount: Uint128
|
|
||||||
denom: string
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 * as _13 from './MockRedBank.client'
|
|
||||||
import * as _14 from './MockRedBank.react-query'
|
|
||||||
import * as _12 from './MockRedBank.types'
|
|
||||||
export namespace contracts {
|
|
||||||
export const MockRedBank = { ..._12, ..._13, ..._14 }
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 { StdFee } from '@cosmjs/amino'
|
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
|
|
||||||
import {
|
|
||||||
ArrayOfCoin,
|
|
||||||
Coin,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
|
||||||
OracleBaseForString,
|
|
||||||
QueryMsg,
|
|
||||||
Uint128,
|
|
||||||
VaultInfo,
|
|
||||||
} from './MockVault.types'
|
|
||||||
export interface MockVaultReadOnlyInterface {
|
|
||||||
contractAddress: string
|
|
||||||
info: () => Promise<VaultInfo>
|
|
||||||
previewRedeem: ({ amount }: { amount: Uint128 }) => Promise<ArrayOfCoin>
|
|
||||||
totalVaultCoinsIssued: () => Promise<Uint128>
|
|
||||||
}
|
|
||||||
export class MockVaultQueryClient implements MockVaultReadOnlyInterface {
|
|
||||||
client: CosmWasmClient
|
|
||||||
contractAddress: string
|
|
||||||
|
|
||||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
|
||||||
this.client = client
|
|
||||||
this.contractAddress = contractAddress
|
|
||||||
this.info = this.info.bind(this)
|
|
||||||
this.previewRedeem = this.previewRedeem.bind(this)
|
|
||||||
this.totalVaultCoinsIssued = this.totalVaultCoinsIssued.bind(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
info = async (): Promise<VaultInfo> => {
|
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
|
||||||
info: {},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
previewRedeem = async ({ amount }: { amount: Uint128 }): Promise<ArrayOfCoin> => {
|
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
|
||||||
preview_redeem: {
|
|
||||||
amount,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
totalVaultCoinsIssued = async (): Promise<Uint128> => {
|
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
|
||||||
total_vault_coins_issued: {},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export interface MockVaultInterface extends MockVaultReadOnlyInterface {
|
|
||||||
contractAddress: string
|
|
||||||
sender: string
|
|
||||||
deposit: (fee?: number | StdFee | 'auto', memo?: string, funds?: Coin[]) => Promise<ExecuteResult>
|
|
||||||
withdraw: (
|
|
||||||
fee?: number | StdFee | 'auto',
|
|
||||||
memo?: string,
|
|
||||||
funds?: Coin[],
|
|
||||||
) => Promise<ExecuteResult>
|
|
||||||
forceWithdraw: (
|
|
||||||
fee?: number | StdFee | 'auto',
|
|
||||||
memo?: string,
|
|
||||||
funds?: Coin[],
|
|
||||||
) => Promise<ExecuteResult>
|
|
||||||
}
|
|
||||||
export class MockVaultClient extends MockVaultQueryClient implements MockVaultInterface {
|
|
||||||
client: SigningCosmWasmClient
|
|
||||||
sender: string
|
|
||||||
contractAddress: string
|
|
||||||
|
|
||||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
|
||||||
super(client, contractAddress)
|
|
||||||
this.client = client
|
|
||||||
this.sender = sender
|
|
||||||
this.contractAddress = contractAddress
|
|
||||||
this.deposit = this.deposit.bind(this)
|
|
||||||
this.withdraw = this.withdraw.bind(this)
|
|
||||||
this.forceWithdraw = this.forceWithdraw.bind(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
deposit = async (
|
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
|
||||||
memo?: string,
|
|
||||||
funds?: Coin[],
|
|
||||||
): Promise<ExecuteResult> => {
|
|
||||||
return await this.client.execute(
|
|
||||||
this.sender,
|
|
||||||
this.contractAddress,
|
|
||||||
{
|
|
||||||
deposit: {},
|
|
||||||
},
|
|
||||||
fee,
|
|
||||||
memo,
|
|
||||||
funds,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
withdraw = async (
|
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
|
||||||
memo?: string,
|
|
||||||
funds?: Coin[],
|
|
||||||
): Promise<ExecuteResult> => {
|
|
||||||
return await this.client.execute(
|
|
||||||
this.sender,
|
|
||||||
this.contractAddress,
|
|
||||||
{
|
|
||||||
withdraw: {},
|
|
||||||
},
|
|
||||||
fee,
|
|
||||||
memo,
|
|
||||||
funds,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
forceWithdraw = async (
|
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
|
||||||
memo?: string,
|
|
||||||
funds?: Coin[],
|
|
||||||
): Promise<ExecuteResult> => {
|
|
||||||
return await this.client.execute(
|
|
||||||
this.sender,
|
|
||||||
this.contractAddress,
|
|
||||||
{
|
|
||||||
force_withdraw: {},
|
|
||||||
},
|
|
||||||
fee,
|
|
||||||
memo,
|
|
||||||
funds,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,150 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 { StdFee } from '@cosmjs/amino'
|
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
|
||||||
|
|
||||||
import { MockVaultClient, MockVaultQueryClient } from './MockVault.client'
|
|
||||||
import {
|
|
||||||
ArrayOfCoin,
|
|
||||||
Coin,
|
|
||||||
ExecuteMsg,
|
|
||||||
InstantiateMsg,
|
|
||||||
OracleBaseForString,
|
|
||||||
QueryMsg,
|
|
||||||
Uint128,
|
|
||||||
VaultInfo,
|
|
||||||
} from './MockVault.types'
|
|
||||||
export const mockVaultQueryKeys = {
|
|
||||||
contract: [
|
|
||||||
{
|
|
||||||
contract: 'mockVault',
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
address: (contractAddress: string | undefined) =>
|
|
||||||
[{ ...mockVaultQueryKeys.contract[0], address: contractAddress }] as const,
|
|
||||||
info: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[{ ...mockVaultQueryKeys.address(contractAddress)[0], method: 'info', args }] as const,
|
|
||||||
previewRedeem: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{ ...mockVaultQueryKeys.address(contractAddress)[0], method: 'preview_redeem', args },
|
|
||||||
] as const,
|
|
||||||
totalVaultCoinsIssued: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
|
||||||
[
|
|
||||||
{
|
|
||||||
...mockVaultQueryKeys.address(contractAddress)[0],
|
|
||||||
method: 'total_vault_coins_issued',
|
|
||||||
args,
|
|
||||||
},
|
|
||||||
] as const,
|
|
||||||
}
|
|
||||||
export interface MockVaultReactQuery<TResponse, TData = TResponse> {
|
|
||||||
client: MockVaultQueryClient | undefined
|
|
||||||
options?: Omit<
|
|
||||||
UseQueryOptions<TResponse, Error, TData>,
|
|
||||||
"'queryKey' | 'queryFn' | 'initialData'"
|
|
||||||
> & {
|
|
||||||
initialData?: undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export interface MockVaultTotalVaultCoinsIssuedQuery<TData>
|
|
||||||
extends MockVaultReactQuery<Uint128, TData> {}
|
|
||||||
export function useMockVaultTotalVaultCoinsIssuedQuery<TData = Uint128>({
|
|
||||||
client,
|
|
||||||
options,
|
|
||||||
}: MockVaultTotalVaultCoinsIssuedQuery<TData>) {
|
|
||||||
return useQuery<Uint128, Error, TData>(
|
|
||||||
mockVaultQueryKeys.totalVaultCoinsIssued(client?.contractAddress),
|
|
||||||
() => (client ? client.totalVaultCoinsIssued() : Promise.reject(new Error('Invalid client'))),
|
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface MockVaultPreviewRedeemQuery<TData>
|
|
||||||
extends MockVaultReactQuery<ArrayOfCoin, TData> {
|
|
||||||
args: {
|
|
||||||
amount: Uint128
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockVaultPreviewRedeemQuery<TData = ArrayOfCoin>({
|
|
||||||
client,
|
|
||||||
args,
|
|
||||||
options,
|
|
||||||
}: MockVaultPreviewRedeemQuery<TData>) {
|
|
||||||
return useQuery<ArrayOfCoin, Error, TData>(
|
|
||||||
mockVaultQueryKeys.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 MockVaultInfoQuery<TData> extends MockVaultReactQuery<VaultInfo, TData> {}
|
|
||||||
export function useMockVaultInfoQuery<TData = VaultInfo>({
|
|
||||||
client,
|
|
||||||
options,
|
|
||||||
}: MockVaultInfoQuery<TData>) {
|
|
||||||
return useQuery<VaultInfo, Error, TData>(
|
|
||||||
mockVaultQueryKeys.info(client?.contractAddress),
|
|
||||||
() => (client ? client.info() : Promise.reject(new Error('Invalid client'))),
|
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface MockVaultForceWithdrawMutation {
|
|
||||||
client: MockVaultClient
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockVaultForceWithdrawMutation(
|
|
||||||
options?: Omit<
|
|
||||||
UseMutationOptions<ExecuteResult, Error, MockVaultForceWithdrawMutation>,
|
|
||||||
'mutationFn'
|
|
||||||
>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, MockVaultForceWithdrawMutation>(
|
|
||||||
({ client, args: { fee, memo, funds } = {} }) => client.forceWithdraw(fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface MockVaultWithdrawMutation {
|
|
||||||
client: MockVaultClient
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockVaultWithdrawMutation(
|
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockVaultWithdrawMutation>, 'mutationFn'>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, MockVaultWithdrawMutation>(
|
|
||||||
({ client, args: { fee, memo, funds } = {} }) => client.withdraw(fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
export interface MockVaultDepositMutation {
|
|
||||||
client: MockVaultClient
|
|
||||||
args?: {
|
|
||||||
fee?: number | StdFee | 'auto'
|
|
||||||
memo?: string
|
|
||||||
funds?: Coin[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function useMockVaultDepositMutation(
|
|
||||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockVaultDepositMutation>, 'mutationFn'>,
|
|
||||||
) {
|
|
||||||
return useMutation<ExecuteResult, Error, MockVaultDepositMutation>(
|
|
||||||
({ client, args: { fee, memo, funds } = {} }) => client.deposit(fee, memo, funds),
|
|
||||||
options,
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 * as _16 from './MockVault.client'
|
|
||||||
import * as _17 from './MockVault.react-query'
|
|
||||||
import * as _15 from './MockVault.types'
|
|
||||||
export namespace contracts {
|
|
||||||
export const MockVault = { ..._15, ..._16, ..._17 }
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/**
|
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
|
||||||
* 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 * as _19 from './SwapperBase.client'
|
|
||||||
import * as _20 from './SwapperBase.react-query'
|
|
||||||
import * as _18 from './SwapperBase.types'
|
|
||||||
export namespace contracts {
|
|
||||||
export const SwapperBase = { ..._18, ..._19, ..._20 }
|
|
||||||
}
|
|
@ -5,4 +5,5 @@ export const queryKeys = {
|
|||||||
creditAccounts: (address: string) => ['creditAccounts', address],
|
creditAccounts: (address: string) => ['creditAccounts', address],
|
||||||
creditAccountsPositions: (accountId: string) => ['creditAccountPositions', accountId],
|
creditAccountsPositions: (accountId: string) => ['creditAccountPositions', accountId],
|
||||||
tokenBalance: (address: string, denom: string) => ['tokenBalance', address, denom],
|
tokenBalance: (address: string, denom: string) => ['tokenBalance', address, denom],
|
||||||
|
tokenPrices: () => ['tokenPrices'],
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,5 @@ export const hardcodedFee = {
|
|||||||
amount: '100000',
|
amount: '100000',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '1500000',
|
gas: '2000000',
|
||||||
}
|
}
|
||||||
|
43
yarn.lock
43
yarn.lock
@ -1422,6 +1422,11 @@
|
|||||||
"@ethersproject/bytes" "^5.7.0"
|
"@ethersproject/bytes" "^5.7.0"
|
||||||
"@ethersproject/logger" "^5.7.0"
|
"@ethersproject/logger" "^5.7.0"
|
||||||
|
|
||||||
|
"@graphql-typed-document-node/core@^3.1.1":
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052"
|
||||||
|
integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg==
|
||||||
|
|
||||||
"@headlessui/react@^1.7.0":
|
"@headlessui/react@^1.7.0":
|
||||||
version "1.7.0"
|
version "1.7.0"
|
||||||
resolved "https://registry.npmjs.org/@headlessui/react/-/react-1.7.0.tgz"
|
resolved "https://registry.npmjs.org/@headlessui/react/-/react-1.7.0.tgz"
|
||||||
@ -3083,6 +3088,13 @@ create-hmac@^1.1.4, create-hmac@^1.1.7:
|
|||||||
safe-buffer "^5.0.1"
|
safe-buffer "^5.0.1"
|
||||||
sha.js "^2.4.8"
|
sha.js "^2.4.8"
|
||||||
|
|
||||||
|
cross-fetch@^3.1.5:
|
||||||
|
version "3.1.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
|
||||||
|
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
|
||||||
|
dependencies:
|
||||||
|
node-fetch "2.6.7"
|
||||||
|
|
||||||
cross-spawn@^7.0.2:
|
cross-spawn@^7.0.2:
|
||||||
version "7.0.3"
|
version "7.0.3"
|
||||||
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
|
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz"
|
||||||
@ -3708,6 +3720,11 @@ extglob@^2.0.4:
|
|||||||
snapdragon "^0.8.1"
|
snapdragon "^0.8.1"
|
||||||
to-regex "^3.0.1"
|
to-regex "^3.0.1"
|
||||||
|
|
||||||
|
extract-files@^9.0.0:
|
||||||
|
version "9.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a"
|
||||||
|
integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==
|
||||||
|
|
||||||
fast-deep-equal@3.1.1:
|
fast-deep-equal@3.1.1:
|
||||||
version "3.1.1"
|
version "3.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
|
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
|
||||||
@ -3827,6 +3844,15 @@ for-in@^1.0.2:
|
|||||||
resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz"
|
||||||
integrity sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==
|
integrity sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==
|
||||||
|
|
||||||
|
form-data@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
|
||||||
|
integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
|
||||||
|
dependencies:
|
||||||
|
asynckit "^0.4.0"
|
||||||
|
combined-stream "^1.0.8"
|
||||||
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
form-data@^4.0.0:
|
form-data@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
|
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
|
||||||
@ -4015,6 +4041,21 @@ grapheme-splitter@^1.0.4:
|
|||||||
resolved "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz"
|
resolved "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz"
|
||||||
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==
|
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==
|
||||||
|
|
||||||
|
graphql-request@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-5.0.0.tgz#7504a807d0e11be11a3c448e900f0cc316aa18ef"
|
||||||
|
integrity sha512-SpVEnIo2J5k2+Zf76cUkdvIRaq5FMZvGQYnA4lUWYbc99m+fHh4CZYRRO/Ff4tCLQ613fzCm3SiDT64ubW5Gyw==
|
||||||
|
dependencies:
|
||||||
|
"@graphql-typed-document-node/core" "^3.1.1"
|
||||||
|
cross-fetch "^3.1.5"
|
||||||
|
extract-files "^9.0.0"
|
||||||
|
form-data "^3.0.0"
|
||||||
|
|
||||||
|
graphql@^16.6.0:
|
||||||
|
version "16.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.6.0.tgz#c2dcffa4649db149f6282af726c8c83f1c7c5fdb"
|
||||||
|
integrity sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==
|
||||||
|
|
||||||
has-bigints@^1.0.1, has-bigints@^1.0.2:
|
has-bigints@^1.0.1, has-bigints@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz"
|
||||||
@ -4919,7 +4960,7 @@ node-dir@^0.1.17:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minimatch "^3.0.2"
|
minimatch "^3.0.2"
|
||||||
|
|
||||||
node-fetch@^2.6.7:
|
node-fetch@2.6.7, node-fetch@^2.6.7:
|
||||||
version "2.6.7"
|
version "2.6.7"
|
||||||
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz"
|
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz"
|
||||||
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
|
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
|
||||||
|
Loading…
Reference in New Issue
Block a user