feat: update contracts (#307)

* feat: update contract addresses

* feat(contracts): generated types updated & incenvite changes

* feat(smart contract client update): made the app working with new smart contracts

* addressed to PR comments
This commit is contained in:
Yusuf Seyrek 2023-08-11 00:31:27 +03:00 committed by GitHub
parent d1db7ee6c1
commit 1af857fcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 1509 additions and 5784 deletions

View File

@ -5,14 +5,14 @@ NEXT_PUBLIC_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosi
NEXT_PUBLIC_REST=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-lcd-front/
NEXT_PUBLIC_SWAP=https://testnet.osmosis.zone
NEXT_PUBLIC_APOLLO_APR=https://api.apollo.farm/api/vault_infos/v2/osmo-test-5
NEXT_PUBLIC_ACCOUNT_NFT=osmo1gmpua5rkzg6cmju73fz5a9x454nz4vwlnkgs4g8wjlyeqtmzsuhq5funky
NEXT_PUBLIC_ORACLE=osmo1khe29uw3t85nmmp3mtr8dls7v2qwsfk3tndu5h4w5g2r5tzlz5qqarq2e2
NEXT_PUBLIC_RED_BANK=osmo1dl4rylasnd7mtfzlkdqn2gr0ss4gvyykpvr6d7t5ylzf6z535n9s5jjt8u
NEXT_PUBLIC_CREDIT_MANAGER=osmo1sp7hlk78xpw6aer9wvskpz5ryknafw5lgf7f4jku4zfxkmuee6nqswkr8f
NEXT_PUBLIC_INCENTIVES=osmo1zyz57xf82963mcsgqu3hq5y0h9mrltm4ttq2qe5mjth9ezp3375qe0sm7d
NEXT_PUBLIC_ZAPPER=osmo1dz3ysw5sl0rvvnvatv7nu6vyam687tentfuxfa22sxqqafdcnkdqht3uw5
NEXT_PUBLIC_SWAPPER=osmo1q3p82qtudu7f5edgvqyzf6hk8xanezlr0w7ntypnsea4jfpe37ps29eay3
NEXT_PUBLIC_PARAMS=osmo1xvg28lrr72662t9u0hntt76lyax9zvptdvdmff4k2q9dhjm8x6ws9zym4v
NEXT_PUBLIC_ACCOUNT_NFT=osmo1hdk6nps2l2tdfgly0tegcgwl239l45etuae7nsc6s93u0yrqk4rqv489kl
NEXT_PUBLIC_ORACLE=osmo1dxu93scjdnx42txdp9d4hm3snffvnzmkp4jpc9sml8xlu3ncgamsl2lx58
NEXT_PUBLIC_RED_BANK=osmo1hs4sm0fah9rk4mz8e56v4n76g0q9fffdkkjm3f8tjagkdx78pqcq75pk0a
NEXT_PUBLIC_CREDIT_MANAGER=osmo1zwugj8tz9nq63m3lxcfpunp0xr5lnlxdr0yyn4gpftx3ham09m4skn73ew
NEXT_PUBLIC_INCENTIVES=osmo1nu0k6g294jela67vyth6nwr3l42gutq2m07pg9927f7v7tuv0d4sre9fr7
NEXT_PUBLIC_ZAPPER=osmo1jwtmujld4ew2vt67qnmpdxr3fmmle2yg823de5ygvf47uvhpu76qlhf82q
NEXT_PUBLIC_SWAPPER=osmo1ee9cq8dcknmw43znznx6vuupx5ku0tt505agccgaz5gn48mhe45s3kwwfm
NEXT_PUBLIC_PARAMS=osmo1h334tvddn82m4apm08rm9k6kt32ws7vy0c4n30ngrvu6h6yxh8eq9l9jfh
NEXT_PUBLIC_API=http://localhost:3000/api
NEXT_PUBLIC_CANDLES_ENDPOINT="https://api.thegraph.com/subgraphs/name/{NAME}/{GRAPH_NAME}"
CHARTING_LIBRARY_USERNAME="username_with_access_to_charting_library"

View File

@ -5,7 +5,7 @@ import { MarsAccountNftQueryClient } from 'types/generated/mars-account-nft/Mars
import { MarsCreditManagerQueryClient } from 'types/generated/mars-credit-manager/MarsCreditManager.client'
import { MarsIncentivesQueryClient } from 'types/generated/mars-incentives/MarsIncentives.client'
import { MarsOracleOsmosisQueryClient } from 'types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client'
import { MarsMockRedBankQueryClient } from 'types/generated/mars-mock-red-bank/MarsMockRedBank.client'
import { MarsRedBankQueryClient } from 'types/generated/mars-red-bank/MarsRedBank.client'
import { MarsMockVaultQueryClient } from 'types/generated/mars-mock-vault/MarsMockVault.client'
import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client'
import { MarsSwapperOsmosisQueryClient } from 'types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client'
@ -14,7 +14,7 @@ let _cosmWasmClient: CosmWasmClient
let _accountNftQueryClient: MarsAccountNftQueryClient
let _creditManagerQueryClient: MarsCreditManagerQueryClient
let _oracleQueryClient: MarsOracleOsmosisQueryClient
let _redBankQueryClient: MarsMockRedBankQueryClient
let _redBankQueryClient: MarsRedBankQueryClient
let _paramsQueryClient: MarsParamsQueryClient
let _incentivesQueryClient: MarsIncentivesQueryClient
let _swapperOsmosisClient: MarsSwapperOsmosisQueryClient
@ -90,7 +90,7 @@ const getRedBankQueryClient = async () => {
try {
if (!_redBankQueryClient) {
const client = await getClient()
_redBankQueryClient = new MarsMockRedBankQueryClient(client, ENV.ADDRESS_RED_BANK)
_redBankQueryClient = new MarsRedBankQueryClient(client, ENV.ADDRESS_RED_BANK)
}
return _redBankQueryClient

View File

@ -4,9 +4,8 @@ import getUnderlyingLiquidityAmount from 'api/markets/getMarketUnderlyingLiquidi
import { BN } from 'utils/helpers'
import { SECONDS_IN_A_YEAR } from 'utils/constants'
import getPrice from 'api/prices/getPrice'
import getMarsPrice from 'api/prices/getMarsPrice'
import { ASSETS } from 'constants/assets'
import { byDenom, bySymbol } from 'utils/array'
import { byDenom } from 'utils/array'
export default async function calculateAssetIncentivesApy(
denom: string,
@ -16,24 +15,24 @@ export default async function calculateAssetIncentivesApy(
if (!assetIncentive) return null
const [marketLiquidityAmount, assetPrice, marsPrice] = await Promise.all([
const [marketLiquidityAmount, assetPrice, baseAssetPrice] = await Promise.all([
getUnderlyingLiquidityAmount(market),
getPrice(denom),
getMarsPrice(),
getPrice(assetIncentive.denom),
])
const assetDecimals = (ASSETS.find(byDenom(denom)) as Asset).decimals
const marsDecimals = (ASSETS.find(bySymbol('MARS')) as Asset).decimals
const baseDecimals = (ASSETS.find(byDenom(assetIncentive.denom)) as Asset).decimals
const marketLiquidityValue = BN(marketLiquidityAmount)
.shiftedBy(-assetDecimals)
.multipliedBy(assetPrice)
const marketReturns = BN(market.liquidityRate).multipliedBy(marketLiquidityValue)
const annualEmission = BN(assetIncentive.emission_per_second)
const annualEmission = BN(assetIncentive.emission_rate)
.multipliedBy(SECONDS_IN_A_YEAR)
.shiftedBy(-marsDecimals)
.multipliedBy(marsPrice)
.shiftedBy(-baseDecimals)
.multipliedBy(baseAssetPrice)
const totalAnnualReturnsValue = annualEmission.plus(marketReturns)
const incentivesApy = totalAnnualReturnsValue.dividedBy(marketLiquidityValue).multipliedBy(100)

View File

@ -1,27 +1,20 @@
import moment from 'moment'
import { getIncentivesQueryClient } from 'api/cosmwasm-client'
import { AssetIncentiveResponse } from 'types/generated/mars-incentives/MarsIncentives.types'
import { ActiveEmission } from 'types/generated/mars-incentives/MarsIncentives.types'
export default async function getAssetIncentive(
denom: string,
): Promise<AssetIncentiveResponse | null> {
export default async function getAssetIncentive(denom: string): Promise<ActiveEmission | null> {
try {
const client = await getIncentivesQueryClient()
const assetIncentive = await client.assetIncentive({
denom,
const activeEmissions = await client.activeEmissions({
collateralDenom: denom,
})
const { duration, start_time } = assetIncentive
const isValid = moment(start_time + duration).isBefore(moment.now())
if (!isValid) {
throw 'Asset incentive duration is end.'
if (activeEmissions.length === 0) {
throw 'Asset has no active incentive emission.'
}
return assetIncentive
// TODO: handle multiple emissions https://delphilabs.atlassian.net/browse/MP-3237
return activeEmissions[0]
} catch (ex) {
console.error(ex)
return null
}
}

View File

@ -1,12 +1,17 @@
import { resolveMarketResponse } from 'utils/resolvers'
import { getRedBankQueryClient } from 'api/cosmwasm-client'
import { getParamsQueryClient, getRedBankQueryClient } from 'api/cosmwasm-client'
export default async function getMarket(denom: string): Promise<Market> {
try {
const client = await getRedBankQueryClient()
const market = await client.market({ denom })
const redbankClient = await getRedBankQueryClient()
const paramsClient = await getParamsQueryClient()
return resolveMarketResponse(market)
const [market, assetParams] = await Promise.all([
redbankClient.market({ denom }),
paramsClient.assetParams({ denom }),
])
return resolveMarketResponse(market, assetParams)
} catch (ex) {
throw ex
}

View File

@ -1,19 +1,27 @@
import { getEnabledMarketAssets } from 'utils/assets'
import { getRedBankQueryClient } from 'api/cosmwasm-client'
import { getParamsQueryClient, getRedBankQueryClient } from 'api/cosmwasm-client'
import iterateContractQuery from 'utils/iterateContractQuery'
import { byDenom } from 'utils/array'
import { resolveMarketResponse } from 'utils/resolvers'
import { Market as RedBankMarket } from 'types/generated/mars-mock-red-bank/MarsMockRedBank.types'
import { Market as RedBankMarket } from 'types/generated/mars-red-bank/MarsRedBank.types'
import { AssetParamsBaseForAddr as AssetParams } from 'types/generated/mars-params/MarsParams.types'
export default async function getMarkets(): Promise<Market[]> {
try {
const client = await getRedBankQueryClient()
const enabledAssets = getEnabledMarketAssets()
const redbankClient = await getRedBankQueryClient()
const paramsClient = await getParamsQueryClient()
const markets = await iterateContractQuery(client.markets)
const enabledAssets = getEnabledMarketAssets()
const [markets, assetParams] = await Promise.all([
iterateContractQuery(redbankClient.markets),
iterateContractQuery(paramsClient.allAssetParams),
])
return enabledAssets.map((asset) =>
resolveMarketResponse(markets.find(byDenom(asset.denom)) as RedBankMarket),
resolveMarketResponse(
markets.find(byDenom(asset.denom)) as RedBankMarket,
assetParams.find(byDenom(asset.denom)) as AssetParams,
),
)
} catch (ex) {
throw ex

View File

@ -1,6 +1,6 @@
import { getCreditManagerQueryClient } from 'api/cosmwasm-client'
import { ENV } from 'constants/env'
import { VaultUtilizationResponse } from 'types/generated/mars-mock-credit-manager/MarsMockCreditManager.types'
import { VaultUtilizationResponse } from 'types/generated/mars-credit-manager/MarsCreditManager.types'
import { VaultConfigBaseForString } from 'types/generated/mars-params/MarsParams.types'
export const getVaultUtilizations = async (

View File

@ -22,40 +22,45 @@ import { BNCoin } from 'types/classes/BNCoin'
import { formatPercent, formatValue } from 'utils/formatters'
import { BN } from 'utils/helpers'
function getDebtAmount(modal: BorrowModal | null) {
return BN((modal?.marketData as BorrowMarketTableData)?.debt ?? 0).toString()
function getDebtAmount(modal: BorrowModal) {
return BN((modal.marketData as BorrowMarketTableData)?.debt ?? 0).toString()
}
function getAssetLogo(modal: BorrowModal | null) {
if (!modal?.asset) return null
function getAssetLogo(modal: BorrowModal) {
if (!modal.asset) return null
return <AssetImage asset={modal.asset} size={24} />
}
interface Props {
account: Account
modal: BorrowModal
}
export default function BorrowModalController() {
const account = useCurrentAccount()
if (!account) return null
const modal = useStore((s) => s.borrowModal)
return <BorrowModal account={account} />
if (account && modal) {
return <BorrowModal account={account} modal={modal} />
}
return null
}
function BorrowModal(props: Props) {
const { modal, account } = props
const [percentage, setPercentage] = useState(0)
const [amount, setAmount] = useState(BN_ZERO)
const [change, setChange] = useState<AccountChange | undefined>()
const [isConfirming, setIsConfirming] = useToggle()
const [borrowToWallet, setBorrowToWallet] = useToggle()
const modal = useStore((s) => s.borrowModal)
const borrow = useStore((s) => s.borrow)
const repay = useStore((s) => s.repay)
const asset = modal?.asset ?? ASSETS[0]
const isRepay = modal?.isRepay ?? false
const asset = modal.asset ?? ASSETS[0]
const isRepay = modal.isRepay ?? false
const [max, setMax] = useState(BN_ZERO)
const { computeMaxBorrowAmount } = useHealthComputer(props.account)
const { computeMaxBorrowAmount } = useHealthComputer(account)
function resetState() {
setAmount(BN_ZERO)
@ -64,18 +69,18 @@ function BorrowModal(props: Props) {
}
async function onConfirmClick() {
if (!modal?.asset) return
if (!modal.asset) return
setIsConfirming(true)
let result
if (isRepay) {
result = await repay({
accountId: props.account.id,
accountId: account.id,
coin: BNCoin.fromDenomAndBigNumber(modal.asset.denom, amount),
accountBalance: percentage === 100,
})
} else {
result = await borrow({
accountId: props.account.id,
accountId: account.id,
coin: { denom: modal.asset.denom, amount: amount.toString() },
borrowToWallet,
})
@ -93,12 +98,12 @@ function BorrowModal(props: Props) {
useStore.setState({ borrowModal: null })
}
const liquidityAmountString = formatValue(modal?.marketData?.liquidity?.amount.toString() || 0, {
const liquidityAmountString = formatValue(modal.marketData?.liquidity?.amount.toString() || 0, {
abbreviated: true,
decimals: 6,
})
const liquidityValueString = formatValue(modal?.marketData?.liquidity?.value.toString() || 0, {
const liquidityValueString = formatValue(modal.marketData?.liquidity?.value.toString() || 0, {
abbreviated: true,
decimals: 6,
})
@ -114,11 +119,11 @@ function BorrowModal(props: Props) {
borrowToWallet ? 'wallet' : 'deposit',
)
setMax(BigNumber.min(maxBorrowAmount, modal?.marketData?.liquidity?.amount || 0))
setMax(BigNumber.min(maxBorrowAmount, modal.marketData?.liquidity?.amount || 0))
}, [isRepay, modal, asset.denom, computeMaxBorrowAmount, borrowToWallet])
useEffect(() => {
if (!modal?.asset) return
if (!modal.asset) return
setChange({
deposits: [
@ -134,7 +139,7 @@ function BorrowModal(props: Props) {
},
],
})
}, [amount, modal?.asset, props.account, isRepay])
}, [amount, modal.asset, account, isRepay])
if (!modal) return null
return (
@ -153,7 +158,7 @@ function BorrowModal(props: Props) {
>
<div className='flex gap-3 px-6 py-4 border-b border-white/5 gradient-header'>
<TitleAndSubCell
title={formatPercent(modal?.marketData.borrowRate || '0')}
title={formatPercent(modal.marketData.borrowRate || '0')}
sub={'Borrow rate'}
/>
<div className='h-100 w-[1px] bg-white/10'></div>
@ -214,7 +219,7 @@ function BorrowModal(props: Props) {
rightIcon={<ArrowRight />}
/>
</Card>
<AccountSummary account={props.account} change={change} />
<AccountSummary account={account} change={change} />
</div>
</Modal>
)

View File

@ -108,45 +108,13 @@ export const ASSETS: Asset[] = [
logo: '/images/tokens/axlusdc.svg',
decimals: 6,
hasOraclePrice: true,
isEnabled: !IS_TESTNET,
isMarket: !IS_TESTNET,
isEnabled: true,
isMarket: true,
isDisplayCurrency: true,
isStable: true,
poolId: 678,
pythPriceFeedId: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
},
{
symbol: 'USDC.n',
name: 'Noble USDC',
id: 'nUSDC',
denom: IS_TESTNET
? 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4'
: 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4',
color: '#478edc',
logo: '/images/tokens/nusdc.svg',
decimals: 6,
hasOraclePrice: IS_TESTNET,
isEnabled: IS_TESTNET,
isMarket: IS_TESTNET,
isDisplayCurrency: IS_TESTNET,
isStable: true,
pythPriceFeedId: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
},
{
symbol: 'OSMO-USDC.n',
name: 'OSMO-USDC.n Pool Token',
id: 'OSMO-USDC.n',
denom: 'gamm/pool/6',
color: '',
logo: '',
decimals: 6,
hasOraclePrice: true,
isEnabled: true,
isMarket: false,
isDisplayCurrency: false,
isStable: false,
forceFetchPrice: true,
},
{
symbol: '$',
name: 'US Dollar',

View File

@ -148,7 +148,8 @@ export default function useHealthComputer(account?: Account) {
if (!healthComputer) return
setHealth(Number((await compute_health_js(healthComputer)).max_ltv_health_factor) || 0)
}
computeHealthWasm()
// TODO: Health computer throwing error. Should be aligned with new contracts: https://delphilabs.atlassian.net/browse/MP-3238
// computeHealthWasm()
}, [healthComputer])
const computeMaxBorrowAmount = useCallback(

View File

@ -313,7 +313,7 @@ export default function createBroadcastSlice(
account_id: options.accountId,
actions: [
{
lend: options.coin.toCoin(),
lend: options.coin.toActionCoin(options.isMax),
},
],
},

View File

@ -1,40 +1,39 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
Uint128,
InstantiateMsg,
ExecuteMsg,
Binary,
Expiration,
Timestamp,
Uint64,
Action,
Addr,
NftConfigUpdates,
QueryMsg,
AllNftInfoResponseForEmpty,
OwnerOfResponse,
Approval,
NftInfoResponseForEmpty,
Empty,
OperatorsResponse,
TokensResponse,
ApprovalResponse,
ApprovalsResponse,
Binary,
ContractInfoResponse,
Empty,
ExecuteMsg,
Expiration,
InstantiateMsg,
MinterResponse,
NftConfigBaseForString,
NftConfigUpdates,
NftInfoResponseForEmpty,
NumTokensResponse,
OperatorsResponse,
OwnerOfResponse,
OwnershipForAddr,
QueryMsg,
ContractInfoResponse,
MinterResponse,
String,
Timestamp,
TokensResponse,
Uint128,
Uint64,
NumTokensResponse,
Addr,
OwnershipForAddr,
} from './MarsAccountNft.types'
export interface MarsAccountNftReadOnlyInterface {
contractAddress: string

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/
@ -9,34 +9,33 @@ import { Coin } from '@cosmjs/amino'
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Uint128,
InstantiateMsg,
ExecuteMsg,
Binary,
Expiration,
Timestamp,
Uint64,
Action,
Addr,
NftConfigUpdates,
QueryMsg,
AllNftInfoResponseForEmpty,
OwnerOfResponse,
Approval,
NftInfoResponseForEmpty,
Empty,
OperatorsResponse,
TokensResponse,
ApprovalResponse,
ApprovalsResponse,
Binary,
ContractInfoResponse,
Empty,
ExecuteMsg,
Expiration,
InstantiateMsg,
MinterResponse,
NftConfigBaseForString,
NftConfigUpdates,
NftInfoResponseForEmpty,
NumTokensResponse,
OperatorsResponse,
OwnerOfResponse,
OwnershipForAddr,
QueryMsg,
ContractInfoResponse,
MinterResponse,
String,
Timestamp,
TokensResponse,
Uint128,
Uint64,
NumTokensResponse,
Addr,
OwnershipForAddr,
} from './MarsAccountNft.types'
export interface MarsAccountNftMessage {
contractAddress: string

View File

@ -1,43 +1,42 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import { StdFee, Coin } from '@cosmjs/amino'
import {
Uint128,
InstantiateMsg,
ExecuteMsg,
Binary,
Expiration,
Timestamp,
Uint64,
Action,
Addr,
NftConfigUpdates,
QueryMsg,
AllNftInfoResponseForEmpty,
OwnerOfResponse,
Approval,
NftInfoResponseForEmpty,
Empty,
OperatorsResponse,
TokensResponse,
ApprovalResponse,
ApprovalsResponse,
Binary,
ContractInfoResponse,
Empty,
ExecuteMsg,
Expiration,
InstantiateMsg,
MinterResponse,
NftConfigBaseForString,
NftConfigUpdates,
NftInfoResponseForEmpty,
NumTokensResponse,
OperatorsResponse,
OwnerOfResponse,
OwnershipForAddr,
QueryMsg,
ContractInfoResponse,
MinterResponse,
String,
Timestamp,
TokensResponse,
Uint128,
Uint64,
NumTokensResponse,
Addr,
OwnershipForAddr,
} from './MarsAccountNft.types'
import { MarsAccountNftClient, MarsAccountNftQueryClient } from './MarsAccountNft.client'
import { MarsAccountNftQueryClient, MarsAccountNftClient } from './MarsAccountNft.client'
export const marsAccountNftQueryKeys = {
contract: [
{

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/

View File

@ -1,71 +1,81 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
HealthContractBaseForString,
IncentivesUnchecked,
Uint128,
OracleBaseForString,
ParamsBaseForString,
RedBankUnchecked,
SwapperBaseForString,
ZapperBaseForString,
InstantiateMsg,
ExecuteMsg,
AccountKind,
AccountNftBaseForString,
Action,
ActionAmount,
ActionCoin,
Addr,
ArrayOfCoin,
ArrayOfCoinBalanceResponseItem,
ArrayOfDebtShares,
ArrayOfLentShares,
ArrayOfSharesResponseItem,
ArrayOfVaultPositionResponseItem,
CallbackMsg,
Coin,
CoinBalanceResponseItem,
CoinValue,
ConfigResponse,
ConfigUpdates,
DebtAmount,
DebtShares,
Decimal,
ExecuteMsg,
HealthContractBaseForString,
InstantiateMsg,
LentAmount,
LentShares,
LiquidateRequestForVaultBaseForAddr,
LiquidateRequestForVaultBaseForString,
LockingVaultAmount,
NftConfigUpdates,
OracleBaseForString,
OwnerResponse,
VaultPositionType,
Decimal,
AccountNftBaseForString,
OwnerUpdate,
ParamsBaseForString,
Positions,
CallbackMsg,
Addr,
HealthState,
LiquidateRequestForVaultBaseForAddr,
ChangeExpected,
Coin,
ActionCoin,
VaultBaseForString,
ConfigUpdates,
NftConfigUpdates,
VaultBaseForAddr,
QueryMsg,
RedBankBaseForString,
SharesResponseItem,
SwapperBaseForString,
Uint128,
UnlockingPositions,
VaultPositionAmount,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultBaseForString,
UnlockingPositions,
VaultPosition,
VaultPositionAmount,
VaultPositionResponseItem,
VaultPositionType,
VaultPositionValue,
LockingVaultAmount,
VaultUnlockingPosition,
ArrayOfAccount,
Account,
ArrayOfCoinBalanceResponseItem,
CoinBalanceResponseItem,
ArrayOfSharesResponseItem,
SharesResponseItem,
ArrayOfDebtShares,
DebtShares,
ArrayOfVaultPositionResponseItem,
VaultPositionResponseItem,
ConfigResponse,
OwnerResponse,
ArrayOfCoin,
Positions,
DebtAmount,
VaultPositionValue,
CoinValue,
VaultUtilizationResponse,
ZapperBaseForString,
} from './MarsCreditManager.types'
export interface MarsCreditManagerReadOnlyInterface {
contractAddress: string
accountKind: ({ accountId }: { accountId: string }) => Promise<AccountKind>
accounts: ({
limit,
owner,
startAfter,
}: {
limit?: number
owner: string
startAfter?: string
}) => Promise<ArrayOfAccount>
config: () => Promise<ConfigResponse>
vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise<VaultUtilizationResponse>
positions: ({ accountId }: { accountId: string }) => Promise<Positions>
@ -91,21 +101,6 @@ export interface MarsCreditManagerReadOnlyInterface {
limit?: number
startAfter?: string
}) => Promise<ArrayOfDebtShares>
allLentShares: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}) => Promise<ArrayOfSharesResponseItem>
totalLentShares: () => Promise<LentShares>
allTotalLentShares: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string
}) => Promise<ArrayOfLentShares>
allVaultPositions: ({
limit,
startAfter,
@ -135,6 +130,7 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
this.client = client
this.contractAddress = contractAddress
this.accountKind = this.accountKind.bind(this)
this.accounts = this.accounts.bind(this)
this.config = this.config.bind(this)
this.vaultUtilization = this.vaultUtilization.bind(this)
this.positions = this.positions.bind(this)
@ -142,9 +138,6 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
this.allDebtShares = this.allDebtShares.bind(this)
this.totalDebtShares = this.totalDebtShares.bind(this)
this.allTotalDebtShares = this.allTotalDebtShares.bind(this)
this.allLentShares = this.allLentShares.bind(this)
this.totalLentShares = this.totalLentShares.bind(this)
this.allTotalLentShares = this.allTotalLentShares.bind(this)
this.allVaultPositions = this.allVaultPositions.bind(this)
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
@ -158,6 +151,23 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
},
})
}
accounts = async ({
limit,
owner,
startAfter,
}: {
limit?: number
owner: string
startAfter?: string
}): Promise<ArrayOfAccount> => {
return this.client.queryContractSmart(this.contractAddress, {
accounts: {
limit,
owner,
start_after: startAfter,
},
})
}
config = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {},
@ -228,39 +238,6 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
},
})
}
allLentShares = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}): Promise<ArrayOfSharesResponseItem> => {
return this.client.queryContractSmart(this.contractAddress, {
all_lent_shares: {
limit,
start_after: startAfter,
},
})
}
totalLentShares = async (): Promise<LentShares> => {
return this.client.queryContractSmart(this.contractAddress, {
total_lent_shares: {},
})
}
allTotalLentShares = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string
}): Promise<ArrayOfLentShares> => {
return this.client.queryContractSmart(this.contractAddress, {
all_total_lent_shares: {
limit,
start_after: startAfter,
},
})
}
allVaultPositions = async ({
limit,
startAfter,

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/
@ -8,61 +8,62 @@
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
HealthContractBaseForString,
IncentivesUnchecked,
Uint128,
OracleBaseForString,
ParamsBaseForString,
RedBankUnchecked,
SwapperBaseForString,
ZapperBaseForString,
InstantiateMsg,
ExecuteMsg,
AccountKind,
AccountNftBaseForString,
Action,
ActionAmount,
ActionCoin,
Addr,
ArrayOfCoin,
ArrayOfCoinBalanceResponseItem,
ArrayOfDebtShares,
ArrayOfLentShares,
ArrayOfSharesResponseItem,
ArrayOfVaultPositionResponseItem,
CallbackMsg,
Coin,
CoinBalanceResponseItem,
CoinValue,
ConfigResponse,
ConfigUpdates,
DebtAmount,
DebtShares,
Decimal,
ExecuteMsg,
HealthContractBaseForString,
InstantiateMsg,
LentAmount,
LentShares,
LiquidateRequestForVaultBaseForAddr,
LiquidateRequestForVaultBaseForString,
LockingVaultAmount,
NftConfigUpdates,
OracleBaseForString,
OwnerResponse,
VaultPositionType,
Decimal,
AccountNftBaseForString,
OwnerUpdate,
ParamsBaseForString,
Positions,
CallbackMsg,
Addr,
HealthState,
LiquidateRequestForVaultBaseForAddr,
ChangeExpected,
Coin,
ActionCoin,
VaultBaseForString,
ConfigUpdates,
NftConfigUpdates,
VaultBaseForAddr,
QueryMsg,
RedBankBaseForString,
SharesResponseItem,
SwapperBaseForString,
Uint128,
UnlockingPositions,
VaultPositionAmount,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultBaseForString,
UnlockingPositions,
VaultPosition,
VaultPositionAmount,
VaultPositionResponseItem,
VaultPositionType,
VaultPositionValue,
LockingVaultAmount,
VaultUnlockingPosition,
ArrayOfAccount,
Account,
ArrayOfCoinBalanceResponseItem,
CoinBalanceResponseItem,
ArrayOfSharesResponseItem,
SharesResponseItem,
ArrayOfDebtShares,
DebtShares,
ArrayOfVaultPositionResponseItem,
VaultPositionResponseItem,
ConfigResponse,
OwnerResponse,
ArrayOfCoin,
Positions,
DebtAmount,
VaultPositionValue,
CoinValue,
VaultUtilizationResponse,
ZapperBaseForString,
} from './MarsCreditManager.types'
export interface MarsCreditManagerMessage {
contractAddress: string

View File

@ -1,70 +1,71 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
HealthContractBaseForString,
IncentivesUnchecked,
Uint128,
OracleBaseForString,
ParamsBaseForString,
RedBankUnchecked,
SwapperBaseForString,
ZapperBaseForString,
InstantiateMsg,
ExecuteMsg,
AccountKind,
AccountNftBaseForString,
Action,
ActionAmount,
ActionCoin,
Addr,
ArrayOfCoin,
ArrayOfCoinBalanceResponseItem,
ArrayOfDebtShares,
ArrayOfLentShares,
ArrayOfSharesResponseItem,
ArrayOfVaultPositionResponseItem,
CallbackMsg,
Coin,
CoinBalanceResponseItem,
CoinValue,
ConfigResponse,
ConfigUpdates,
DebtAmount,
DebtShares,
Decimal,
ExecuteMsg,
HealthContractBaseForString,
InstantiateMsg,
LentAmount,
LentShares,
LiquidateRequestForVaultBaseForAddr,
LiquidateRequestForVaultBaseForString,
LockingVaultAmount,
NftConfigUpdates,
OracleBaseForString,
OwnerResponse,
VaultPositionType,
Decimal,
AccountNftBaseForString,
OwnerUpdate,
ParamsBaseForString,
Positions,
CallbackMsg,
Addr,
HealthState,
LiquidateRequestForVaultBaseForAddr,
ChangeExpected,
Coin,
ActionCoin,
VaultBaseForString,
ConfigUpdates,
NftConfigUpdates,
VaultBaseForAddr,
QueryMsg,
RedBankBaseForString,
SharesResponseItem,
SwapperBaseForString,
Uint128,
UnlockingPositions,
VaultPositionAmount,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultBaseForString,
UnlockingPositions,
VaultPosition,
VaultPositionAmount,
VaultPositionResponseItem,
VaultPositionType,
VaultPositionValue,
LockingVaultAmount,
VaultUnlockingPosition,
ArrayOfAccount,
Account,
ArrayOfCoinBalanceResponseItem,
CoinBalanceResponseItem,
ArrayOfSharesResponseItem,
SharesResponseItem,
ArrayOfDebtShares,
DebtShares,
ArrayOfVaultPositionResponseItem,
VaultPositionResponseItem,
ConfigResponse,
OwnerResponse,
ArrayOfCoin,
Positions,
DebtAmount,
VaultPositionValue,
CoinValue,
VaultUtilizationResponse,
ZapperBaseForString,
} from './MarsCreditManager.types'
import { MarsCreditManagerClient, MarsCreditManagerQueryClient } from './MarsCreditManager.client'
import { MarsCreditManagerQueryClient, MarsCreditManagerClient } from './MarsCreditManager.client'
export const marsCreditManagerQueryKeys = {
contract: [
{
@ -77,6 +78,10 @@ export const marsCreditManagerQueryKeys = {
[
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'account_kind', args },
] as const,
accounts: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'accounts', args },
] as const,
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args },
@ -125,30 +130,6 @@ export const marsCreditManagerQueryKeys = {
args,
},
] as const,
allLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_lent_shares',
args,
},
] as const,
totalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsCreditManagerQueryKeys.address(contractAddress)[0],
method: 'total_lent_shares',
args,
},
] as const,
allTotalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_total_lent_shares',
args,
},
] as const,
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
@ -284,66 +265,6 @@ export function useMarsCreditManagerAllVaultPositionsQuery<
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsCreditManagerAllTotalLentSharesQuery<TData>
extends MarsCreditManagerReactQuery<ArrayOfLentShares, TData> {
args: {
limit?: number
startAfter?: string
}
}
export function useMarsCreditManagerAllTotalLentSharesQuery<TData = ArrayOfLentShares>({
client,
args,
options,
}: MarsCreditManagerAllTotalLentSharesQuery<TData>) {
return useQuery<ArrayOfLentShares, Error, TData>(
marsCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args),
() =>
client
? client.allTotalLentShares({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsCreditManagerTotalLentSharesQuery<TData>
extends MarsCreditManagerReactQuery<LentShares, TData> {}
export function useMarsCreditManagerTotalLentSharesQuery<TData = LentShares>({
client,
options,
}: MarsCreditManagerTotalLentSharesQuery<TData>) {
return useQuery<LentShares, Error, TData>(
marsCreditManagerQueryKeys.totalLentShares(client?.contractAddress),
() => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsCreditManagerAllLentSharesQuery<TData>
extends MarsCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
args: {
limit?: number
startAfter?: string[][]
}
}
export function useMarsCreditManagerAllLentSharesQuery<TData = ArrayOfSharesResponseItem>({
client,
args,
options,
}: MarsCreditManagerAllLentSharesQuery<TData>) {
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
marsCreditManagerQueryKeys.allLentShares(client?.contractAddress, args),
() =>
client
? client.allLentShares({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsCreditManagerAllTotalDebtSharesQuery<TData>
extends MarsCreditManagerReactQuery<ArrayOfDebtShares, TData> {
args: {
@ -484,6 +405,32 @@ export function useMarsCreditManagerConfigQuery<TData = ConfigResponse>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsCreditManagerAccountsQuery<TData>
extends MarsCreditManagerReactQuery<ArrayOfAccount, TData> {
args: {
limit?: number
owner: string
startAfter?: string
}
}
export function useMarsCreditManagerAccountsQuery<TData = ArrayOfAccount>({
client,
args,
options,
}: MarsCreditManagerAccountsQuery<TData>) {
return useQuery<ArrayOfAccount, Error, TData>(
marsCreditManagerQueryKeys.accounts(client?.contractAddress, args),
() =>
client
? client.accounts({
limit: args.limit,
owner: args.owner,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsCreditManagerAccountKindQuery<TData>
extends MarsCreditManagerReactQuery<AccountKind, TData> {
args: {

View File

@ -1,24 +1,26 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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 HealthContractBaseForString = string
export type IncentivesUnchecked = string
export type Uint128 = string
export type OracleBaseForString = string
export type ParamsBaseForString = string
export type RedBankBaseForString = string
export type RedBankUnchecked = string
export type SwapperBaseForString = string
export type ZapperBaseForString = string
export interface InstantiateMsg {
health_contract: HealthContractBaseForString
incentives: IncentivesUnchecked
max_unlocking_positions: Uint128
oracle: OracleBaseForString
owner: string
params: ParamsBaseForString
red_bank: RedBankBaseForString
red_bank: RedBankUnchecked
swapper: SwapperBaseForString
zapper: ZapperBaseForString
}
@ -66,11 +68,14 @@ export type Action =
borrow: Coin
}
| {
lend: Coin
lend: ActionCoin
}
| {
reclaim: ActionCoin
}
| {
claim_rewards: {}
}
| {
repay: {
coin: ActionCoin
@ -197,7 +202,7 @@ export type CallbackMsg =
| {
lend: {
account_id: string
coin: Coin
coin: ActionCoin
}
}
| {
@ -206,10 +211,20 @@ export type CallbackMsg =
coin: ActionCoin
}
}
| {
claim_rewards: {
account_id: string
}
}
| {
assert_max_ltv: {
account_id: string
prev_max_ltv_health_factor?: Decimal | null
prev_health_state: HealthState
}
}
| {
assert_deposit_caps: {
denoms: string[]
}
}
| {
@ -266,9 +281,17 @@ export type CallbackMsg =
| {
update_coin_balance: {
account_id: string
change: ChangeExpected
previous_balance: Coin
}
}
| {
update_coin_balance_after_vault_liquidation: {
account_id: string
previous_balance: Coin
protocol_fee: Decimal
}
}
| {
provide_liquidity: {
account_id: string
@ -294,7 +317,17 @@ export type CallbackMsg =
account_id: string
}
}
| {
remove_reentrancy_guard: {}
}
export type Addr = string
export type HealthState =
| 'healthy'
| {
unhealthy: {
max_ltv_health_factor: Decimal
}
}
export type LiquidateRequestForVaultBaseForAddr =
| {
deposit: string
@ -308,6 +341,7 @@ export type LiquidateRequestForVaultBaseForAddr =
request_vault: VaultBaseForAddr
}
}
export type ChangeExpected = 'increase' | 'decrease'
export interface Coin {
amount: Uint128
denom: string
@ -323,9 +357,11 @@ export interface VaultBaseForString {
export interface ConfigUpdates {
account_nft?: AccountNftBaseForString | null
health_contract?: HealthContractBaseForString | null
incentives?: IncentivesUnchecked | null
max_unlocking_positions?: Uint128 | null
oracle?: OracleBaseForString | null
red_bank?: RedBankBaseForString | null
red_bank?: RedBankUnchecked | null
rewards_collector?: string | null
swapper?: SwapperBaseForString | null
zapper?: ZapperBaseForString | null
}
@ -342,6 +378,13 @@ export type QueryMsg =
account_id: string
}
}
| {
accounts: {
limit?: number | null
owner: string
start_after?: string | null
}
}
| {
config: {}
}
@ -376,21 +419,6 @@ export type QueryMsg =
start_after?: string | null
}
}
| {
all_lent_shares: {
limit?: number | null
start_after?: [string, string] | null
}
}
| {
total_lent_shares: string
}
| {
all_total_lent_shares: {
limit?: number | null
start_after?: string | null
}
}
| {
all_vault_positions: {
limit?: number | null
@ -435,6 +463,11 @@ export interface VaultUnlockingPosition {
coin: Coin
id: number
}
export type ArrayOfAccount = Account[]
export interface Account {
id: string
kind: AccountKind
}
export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[]
export interface CoinBalanceResponseItem {
account_id: string
@ -452,11 +485,6 @@ export interface DebtShares {
denom: string
shares: Uint128
}
export type ArrayOfLentShares = LentShares[]
export interface LentShares {
denom: string
shares: Uint128
}
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
export interface VaultPositionResponseItem {
account_id: string
@ -465,11 +493,13 @@ export interface VaultPositionResponseItem {
export interface ConfigResponse {
account_nft?: string | null
health_contract: string
incentives: string
max_unlocking_positions: Uint128
oracle: string
ownership: OwnerResponse
params: string
red_bank: string
rewards_collector?: string | null
swapper: string
zapper: string
}
@ -485,7 +515,7 @@ export interface Positions {
account_id: string
debts: DebtAmount[]
deposits: Coin[]
lends: LentAmount[]
lends: Coin[]
vaults: VaultPosition[]
}
export interface DebtAmount {
@ -493,11 +523,6 @@ export interface DebtAmount {
denom: string
shares: Uint128
}
export interface LentAmount {
amount: Uint128
denom: string
shares: Uint128
}
export interface VaultPositionValue {
base_coin: CoinValue
vault_coin: CoinValue

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/

View File

@ -1,37 +1,88 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfAssetIncentiveResponse,
AssetIncentiveResponse,
ConfigResponse,
Decimal,
ExecuteMsg,
InstantiateMsg,
OwnerUpdate,
QueryMsg,
ExecuteMsg,
Uint128,
Addr,
OwnerUpdate,
WhitelistEntry,
QueryMsg,
ArrayOfActiveEmission,
ActiveEmission,
ConfigResponse,
ArrayOfEmissionResponse,
EmissionResponse,
Decimal,
IncentiveStateResponse,
ArrayOfIncentiveStateResponse,
ArrayOfCoin,
Coin,
ArrayOfWhitelistEntry,
} from './MarsIncentives.types'
export interface MarsIncentivesReadOnlyInterface {
contractAddress: string
activeEmissions: ({
collateralDenom,
}: {
collateralDenom: string
}) => Promise<ArrayOfActiveEmission>
config: () => Promise<ConfigResponse>
assetIncentive: ({ denom }: { denom: string }) => Promise<AssetIncentiveResponse>
assetIncentives: ({
incentiveState: ({
collateralDenom,
incentiveDenom,
}: {
collateralDenom: string
incentiveDenom: string
}) => Promise<IncentiveStateResponse>
incentiveStates: ({
limit,
startAfter,
startAfterCollateralDenom,
startAfterIncentiveDenom,
}: {
limit?: number
startAfter?: string
}) => Promise<ArrayOfAssetIncentiveResponse>
userUnclaimedRewards: ({ user }: { user: string }) => Promise<Uint128>
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
}) => Promise<ArrayOfIncentiveStateResponse>
emission: ({
collateralDenom,
incentiveDenom,
timestamp,
}: {
collateralDenom: string
incentiveDenom: string
timestamp: number
}) => Promise<Uint128>
emissions: ({
collateralDenom,
incentiveDenom,
limit,
startAfterTimestamp,
}: {
collateralDenom: string
incentiveDenom: string
limit?: number
startAfterTimestamp?: number
}) => Promise<ArrayOfEmissionResponse>
userUnclaimedRewards: ({
limit,
startAfterCollateralDenom,
startAfterIncentiveDenom,
user,
}: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
user: string
}) => Promise<ArrayOfCoin>
whitelist: () => Promise<ArrayOfWhitelistEntry>
}
export class MarsIncentivesQueryClient implements MarsIncentivesReadOnlyInterface {
client: CosmWasmClient
@ -40,60 +91,154 @@ export class MarsIncentivesQueryClient implements MarsIncentivesReadOnlyInterfac
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.activeEmissions = this.activeEmissions.bind(this)
this.config = this.config.bind(this)
this.assetIncentive = this.assetIncentive.bind(this)
this.assetIncentives = this.assetIncentives.bind(this)
this.incentiveState = this.incentiveState.bind(this)
this.incentiveStates = this.incentiveStates.bind(this)
this.emission = this.emission.bind(this)
this.emissions = this.emissions.bind(this)
this.userUnclaimedRewards = this.userUnclaimedRewards.bind(this)
this.whitelist = this.whitelist.bind(this)
}
activeEmissions = async ({
collateralDenom,
}: {
collateralDenom: string
}): Promise<ArrayOfActiveEmission> => {
return this.client.queryContractSmart(this.contractAddress, {
active_emissions: {
collateral_denom: collateralDenom,
},
})
}
config = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {},
})
}
assetIncentive = async ({ denom }: { denom: string }): Promise<AssetIncentiveResponse> => {
incentiveState = async ({
collateralDenom,
incentiveDenom,
}: {
collateralDenom: string
incentiveDenom: string
}): Promise<IncentiveStateResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
asset_incentive: {
denom,
incentive_state: {
collateral_denom: collateralDenom,
incentive_denom: incentiveDenom,
},
})
}
assetIncentives = async ({
incentiveStates = async ({
limit,
startAfter,
startAfterCollateralDenom,
startAfterIncentiveDenom,
}: {
limit?: number
startAfter?: string
}): Promise<ArrayOfAssetIncentiveResponse> => {
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
}): Promise<ArrayOfIncentiveStateResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
asset_incentives: {
incentive_states: {
limit,
start_after: startAfter,
start_after_collateral_denom: startAfterCollateralDenom,
start_after_incentive_denom: startAfterIncentiveDenom,
},
})
}
userUnclaimedRewards = async ({ user }: { user: string }): Promise<Uint128> => {
emission = async ({
collateralDenom,
incentiveDenom,
timestamp,
}: {
collateralDenom: string
incentiveDenom: string
timestamp: number
}): Promise<Uint128> => {
return this.client.queryContractSmart(this.contractAddress, {
emission: {
collateral_denom: collateralDenom,
incentive_denom: incentiveDenom,
timestamp,
},
})
}
emissions = async ({
collateralDenom,
incentiveDenom,
limit,
startAfterTimestamp,
}: {
collateralDenom: string
incentiveDenom: string
limit?: number
startAfterTimestamp?: number
}): Promise<ArrayOfEmissionResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
emissions: {
collateral_denom: collateralDenom,
incentive_denom: incentiveDenom,
limit,
start_after_timestamp: startAfterTimestamp,
},
})
}
userUnclaimedRewards = async ({
limit,
startAfterCollateralDenom,
startAfterIncentiveDenom,
user,
}: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
user: string
}): Promise<ArrayOfCoin> => {
return this.client.queryContractSmart(this.contractAddress, {
user_unclaimed_rewards: {
limit,
start_after_collateral_denom: startAfterCollateralDenom,
start_after_incentive_denom: startAfterIncentiveDenom,
user,
},
})
}
whitelist = async (): Promise<ArrayOfWhitelistEntry> => {
return this.client.queryContractSmart(this.contractAddress, {
whitelist: {},
})
}
}
export interface MarsIncentivesInterface extends MarsIncentivesReadOnlyInterface {
contractAddress: string
sender: string
updateWhitelist: (
{
addDenoms,
removeDenoms,
}: {
addDenoms: WhitelistEntry[]
removeDenoms: string[]
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
setAssetIncentive: (
{
denom,
collateralDenom,
duration,
emissionPerSecond,
incentiveDenom,
startTime,
}: {
denom: string
duration?: number
emissionPerSecond?: Uint128
startTime?: number
collateralDenom: string
duration: number
emissionPerSecond: Uint128
incentiveDenom: string
startTime: number
},
fee?: number | StdFee | 'auto',
memo?: string,
@ -116,6 +261,15 @@ export interface MarsIncentivesInterface extends MarsIncentivesReadOnlyInterface
_funds?: Coin[],
) => Promise<ExecuteResult>
claimRewards: (
{
limit,
startAfterCollateralDenom,
startAfterIncentiveDenom,
}: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
@ -123,10 +277,10 @@ export interface MarsIncentivesInterface extends MarsIncentivesReadOnlyInterface
updateConfig: (
{
addressProvider,
marsDenom,
maxWhitelistedDenoms,
}: {
addressProvider?: string
marsDenom?: string
maxWhitelistedDenoms?: number
},
fee?: number | StdFee | 'auto',
memo?: string,
@ -152,6 +306,7 @@ export class MarsIncentivesClient
this.client = client
this.sender = sender
this.contractAddress = contractAddress
this.updateWhitelist = this.updateWhitelist.bind(this)
this.setAssetIncentive = this.setAssetIncentive.bind(this)
this.balanceChange = this.balanceChange.bind(this)
this.claimRewards = this.claimRewards.bind(this)
@ -159,17 +314,45 @@ export class MarsIncentivesClient
this.updateOwner = this.updateOwner.bind(this)
}
updateWhitelist = async (
{
addDenoms,
removeDenoms,
}: {
addDenoms: WhitelistEntry[]
removeDenoms: string[]
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_whitelist: {
add_denoms: addDenoms,
remove_denoms: removeDenoms,
},
},
fee,
memo,
_funds,
)
}
setAssetIncentive = async (
{
denom,
collateralDenom,
duration,
emissionPerSecond,
incentiveDenom,
startTime,
}: {
denom: string
duration?: number
emissionPerSecond?: Uint128
startTime?: number
collateralDenom: string
duration: number
emissionPerSecond: Uint128
incentiveDenom: string
startTime: number
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
@ -180,9 +363,10 @@ export class MarsIncentivesClient
this.contractAddress,
{
set_asset_incentive: {
denom,
collateral_denom: collateralDenom,
duration,
emission_per_second: emissionPerSecond,
incentive_denom: incentiveDenom,
start_time: startTime,
},
},
@ -224,6 +408,15 @@ export class MarsIncentivesClient
)
}
claimRewards = async (
{
limit,
startAfterCollateralDenom,
startAfterIncentiveDenom,
}: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
@ -232,7 +425,11 @@ export class MarsIncentivesClient
this.sender,
this.contractAddress,
{
claim_rewards: {},
claim_rewards: {
limit,
start_after_collateral_denom: startAfterCollateralDenom,
start_after_incentive_denom: startAfterIncentiveDenom,
},
},
fee,
memo,
@ -242,10 +439,10 @@ export class MarsIncentivesClient
updateConfig = async (
{
addressProvider,
marsDenom,
maxWhitelistedDenoms,
}: {
addressProvider?: string
marsDenom?: string
maxWhitelistedDenoms?: number
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
@ -257,7 +454,7 @@ export class MarsIncentivesClient
{
update_config: {
address_provider: addressProvider,
mars_denom: marsDenom,
max_whitelisted_denoms: maxWhitelistedDenoms,
},
},
fee,

View File

@ -1,27 +1,34 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfAssetIncentiveResponse,
AssetIncentiveResponse,
ConfigResponse,
Decimal,
ExecuteMsg,
InstantiateMsg,
OwnerUpdate,
QueryMsg,
ExecuteMsg,
Uint128,
Addr,
OwnerUpdate,
WhitelistEntry,
QueryMsg,
ArrayOfActiveEmission,
ActiveEmission,
ConfigResponse,
ArrayOfEmissionResponse,
EmissionResponse,
Decimal,
IncentiveStateResponse,
ArrayOfIncentiveStateResponse,
ArrayOfCoin,
Coin,
ArrayOfWhitelistEntry,
} from './MarsIncentives.types'
import { MarsIncentivesClient, MarsIncentivesQueryClient } from './MarsIncentives.client'
import { MarsIncentivesQueryClient, MarsIncentivesClient } from './MarsIncentives.client'
export const marsIncentivesQueryKeys = {
contract: [
{
@ -30,15 +37,25 @@ export const marsIncentivesQueryKeys = {
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsIncentivesQueryKeys.contract[0], address: contractAddress }] as const,
activeEmissions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'active_emissions', args },
] as const,
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
assetIncentive: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
incentiveState: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'asset_incentive', args },
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'incentive_state', args },
] as const,
assetIncentives: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
incentiveStates: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'asset_incentives', args },
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'incentive_states', args },
] as const,
emission: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'emission', args }] as const,
emissions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'emissions', args },
] as const,
userUnclaimedRewards: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
@ -48,6 +65,10 @@ export const marsIncentivesQueryKeys = {
args,
},
] as const,
whitelist: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'whitelist', args },
] as const,
}
export interface MarsIncentivesReactQuery<TResponse, TData = TResponse> {
client: MarsIncentivesQueryClient | undefined
@ -58,69 +79,145 @@ export interface MarsIncentivesReactQuery<TResponse, TData = TResponse> {
initialData?: undefined
}
}
export interface MarsIncentivesWhitelistQuery<TData>
extends MarsIncentivesReactQuery<ArrayOfWhitelistEntry, TData> {}
export function useMarsIncentivesWhitelistQuery<TData = ArrayOfWhitelistEntry>({
client,
options,
}: MarsIncentivesWhitelistQuery<TData>) {
return useQuery<ArrayOfWhitelistEntry, Error, TData>(
marsIncentivesQueryKeys.whitelist(client?.contractAddress),
() => (client ? client.whitelist() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesUserUnclaimedRewardsQuery<TData>
extends MarsIncentivesReactQuery<Uint128, TData> {
extends MarsIncentivesReactQuery<ArrayOfCoin, TData> {
args: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
user: string
}
}
export function useMarsIncentivesUserUnclaimedRewardsQuery<TData = Uint128>({
export function useMarsIncentivesUserUnclaimedRewardsQuery<TData = ArrayOfCoin>({
client,
args,
options,
}: MarsIncentivesUserUnclaimedRewardsQuery<TData>) {
return useQuery<Uint128, Error, TData>(
return useQuery<ArrayOfCoin, Error, TData>(
marsIncentivesQueryKeys.userUnclaimedRewards(client?.contractAddress, args),
() =>
client
? client.userUnclaimedRewards({
limit: args.limit,
startAfterCollateralDenom: args.startAfterCollateralDenom,
startAfterIncentiveDenom: args.startAfterIncentiveDenom,
user: args.user,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesAssetIncentivesQuery<TData>
extends MarsIncentivesReactQuery<ArrayOfAssetIncentiveResponse, TData> {
export interface MarsIncentivesEmissionsQuery<TData>
extends MarsIncentivesReactQuery<ArrayOfEmissionResponse, TData> {
args: {
collateralDenom: string
incentiveDenom: string
limit?: number
startAfter?: string
startAfterTimestamp?: number
}
}
export function useMarsIncentivesAssetIncentivesQuery<TData = ArrayOfAssetIncentiveResponse>({
export function useMarsIncentivesEmissionsQuery<TData = ArrayOfEmissionResponse>({
client,
args,
options,
}: MarsIncentivesAssetIncentivesQuery<TData>) {
return useQuery<ArrayOfAssetIncentiveResponse, Error, TData>(
marsIncentivesQueryKeys.assetIncentives(client?.contractAddress, args),
}: MarsIncentivesEmissionsQuery<TData>) {
return useQuery<ArrayOfEmissionResponse, Error, TData>(
marsIncentivesQueryKeys.emissions(client?.contractAddress, args),
() =>
client
? client.assetIncentives({
? client.emissions({
collateralDenom: args.collateralDenom,
incentiveDenom: args.incentiveDenom,
limit: args.limit,
startAfter: args.startAfter,
startAfterTimestamp: args.startAfterTimestamp,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesAssetIncentiveQuery<TData>
extends MarsIncentivesReactQuery<AssetIncentiveResponse, TData> {
export interface MarsIncentivesEmissionQuery<TData>
extends MarsIncentivesReactQuery<Uint128, TData> {
args: {
denom: string
collateralDenom: string
incentiveDenom: string
timestamp: number
}
}
export function useMarsIncentivesAssetIncentiveQuery<TData = AssetIncentiveResponse>({
export function useMarsIncentivesEmissionQuery<TData = Uint128>({
client,
args,
options,
}: MarsIncentivesAssetIncentiveQuery<TData>) {
return useQuery<AssetIncentiveResponse, Error, TData>(
marsIncentivesQueryKeys.assetIncentive(client?.contractAddress, args),
}: MarsIncentivesEmissionQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsIncentivesQueryKeys.emission(client?.contractAddress, args),
() =>
client
? client.assetIncentive({
denom: args.denom,
? client.emission({
collateralDenom: args.collateralDenom,
incentiveDenom: args.incentiveDenom,
timestamp: args.timestamp,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesIncentiveStatesQuery<TData>
extends MarsIncentivesReactQuery<ArrayOfIncentiveStateResponse, TData> {
args: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
}
}
export function useMarsIncentivesIncentiveStatesQuery<TData = ArrayOfIncentiveStateResponse>({
client,
args,
options,
}: MarsIncentivesIncentiveStatesQuery<TData>) {
return useQuery<ArrayOfIncentiveStateResponse, Error, TData>(
marsIncentivesQueryKeys.incentiveStates(client?.contractAddress, args),
() =>
client
? client.incentiveStates({
limit: args.limit,
startAfterCollateralDenom: args.startAfterCollateralDenom,
startAfterIncentiveDenom: args.startAfterIncentiveDenom,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesIncentiveStateQuery<TData>
extends MarsIncentivesReactQuery<IncentiveStateResponse, TData> {
args: {
collateralDenom: string
incentiveDenom: string
}
}
export function useMarsIncentivesIncentiveStateQuery<TData = IncentiveStateResponse>({
client,
args,
options,
}: MarsIncentivesIncentiveStateQuery<TData>) {
return useQuery<IncentiveStateResponse, Error, TData>(
marsIncentivesQueryKeys.incentiveState(client?.contractAddress, args),
() =>
client
? client.incentiveState({
collateralDenom: args.collateralDenom,
incentiveDenom: args.incentiveDenom,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
@ -138,6 +235,28 @@ export function useMarsIncentivesConfigQuery<TData = ConfigResponse>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesActiveEmissionsQuery<TData>
extends MarsIncentivesReactQuery<ArrayOfActiveEmission, TData> {
args: {
collateralDenom: string
}
}
export function useMarsIncentivesActiveEmissionsQuery<TData = ArrayOfActiveEmission>({
client,
args,
options,
}: MarsIncentivesActiveEmissionsQuery<TData>) {
return useQuery<ArrayOfActiveEmission, Error, TData>(
marsIncentivesQueryKeys.activeEmissions(client?.contractAddress, args),
() =>
client
? client.activeEmissions({
collateralDenom: args.collateralDenom,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsIncentivesUpdateOwnerMutation {
client: MarsIncentivesClient
msg: OwnerUpdate
@ -162,7 +281,7 @@ export interface MarsIncentivesUpdateConfigMutation {
client: MarsIncentivesClient
msg: {
addressProvider?: string
marsDenom?: string
maxWhitelistedDenoms?: number
}
args?: {
fee?: number | StdFee | 'auto'
@ -184,6 +303,11 @@ export function useMarsIncentivesUpdateConfigMutation(
}
export interface MarsIncentivesClaimRewardsMutation {
client: MarsIncentivesClient
msg: {
limit?: number
startAfterCollateralDenom?: string
startAfterIncentiveDenom?: string
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
@ -197,7 +321,8 @@ export function useMarsIncentivesClaimRewardsMutation(
>,
) {
return useMutation<ExecuteResult, Error, MarsIncentivesClaimRewardsMutation>(
({ client, args: { fee, memo, funds } = {} }) => client.claimRewards(fee, memo, funds),
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.claimRewards(msg, fee, memo, funds),
options,
)
}
@ -230,10 +355,11 @@ export function useMarsIncentivesBalanceChangeMutation(
export interface MarsIncentivesSetAssetIncentiveMutation {
client: MarsIncentivesClient
msg: {
denom: string
duration?: number
emissionPerSecond?: Uint128
startTime?: number
collateralDenom: string
duration: number
emissionPerSecond: Uint128
incentiveDenom: string
startTime: number
}
args?: {
fee?: number | StdFee | 'auto'
@ -253,3 +379,27 @@ export function useMarsIncentivesSetAssetIncentiveMutation(
options,
)
}
export interface MarsIncentivesUpdateWhitelistMutation {
client: MarsIncentivesClient
msg: {
addDenoms: WhitelistEntry[]
removeDenoms: string[]
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsIncentivesUpdateWhitelistMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsIncentivesUpdateWhitelistMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsIncentivesUpdateWhitelistMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateWhitelist(msg, fee, memo, funds),
options,
)
}

View File

@ -1,22 +1,30 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
address_provider: string
mars_denom: string
epoch_duration: number
max_whitelisted_denoms: number
owner: string
}
export type ExecuteMsg =
| {
update_whitelist: {
add_denoms: WhitelistEntry[]
remove_denoms: string[]
}
}
| {
set_asset_incentive: {
denom: string
duration?: number | null
emission_per_second?: Uint128 | null
start_time?: number | null
collateral_denom: string
duration: number
emission_per_second: Uint128
incentive_denom: string
start_time: number
}
}
| {
@ -28,12 +36,16 @@ export type ExecuteMsg =
}
}
| {
claim_rewards: {}
claim_rewards: {
limit?: number | null
start_after_collateral_denom?: string | null
start_after_incentive_denom?: string | null
}
}
| {
update_config: {
address_provider?: string | null
mars_denom?: string | null
max_whitelisted_denoms?: number | null
}
}
| {
@ -56,39 +68,87 @@ export type OwnerUpdate =
}
}
| 'clear_emergency_owner'
export interface WhitelistEntry {
denom: string
min_emission_rate: Uint128
}
export type QueryMsg =
| {
active_emissions: {
collateral_denom: string
}
}
| {
config: {}
}
| {
asset_incentive: {
denom: string
incentive_state: {
collateral_denom: string
incentive_denom: string
}
}
| {
asset_incentives: {
incentive_states: {
limit?: number | null
start_after?: string | null
start_after_collateral_denom?: string | null
start_after_incentive_denom?: string | null
}
}
| {
emission: {
collateral_denom: string
incentive_denom: string
timestamp: number
}
}
| {
emissions: {
collateral_denom: string
incentive_denom: string
limit?: number | null
start_after_timestamp?: number | null
}
}
| {
user_unclaimed_rewards: {
limit?: number | null
start_after_collateral_denom?: string | null
start_after_incentive_denom?: string | null
user: string
}
}
export type Decimal = string
export interface AssetIncentiveResponse {
| {
whitelist: {}
}
export type ArrayOfActiveEmission = ActiveEmission[]
export interface ActiveEmission {
denom: string
duration: number
emission_per_second: Uint128
index: Decimal
last_updated: number
start_time: number
emission_rate: Uint128
}
export type ArrayOfAssetIncentiveResponse = AssetIncentiveResponse[]
export interface ConfigResponse {
address_provider: Addr
mars_denom: string
epoch_duration: number
max_whitelisted_denoms: number
owner?: string | null
proposed_new_owner?: string | null
}
export type ArrayOfEmissionResponse = EmissionResponse[]
export interface EmissionResponse {
emission_rate: Uint128
epoch_start: number
}
export type Decimal = string
export interface IncentiveStateResponse {
collateral_denom: string
incentive_denom: string
index: Decimal
last_updated: number
}
export type ArrayOfIncentiveStateResponse = IncentiveStateResponse[]
export type ArrayOfCoin = Coin[]
export interface Coin {
amount: Uint128
denom: string
[k: string]: unknown
}
export type ArrayOfWhitelistEntry = WhitelistEntry[]

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

View File

@ -1,351 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
AccountKind,
Addr,
ArrayOfCoin,
ArrayOfCoinBalanceResponseItem,
ArrayOfDebtShares,
ArrayOfLentShares,
ArrayOfSharesResponseItem,
ArrayOfVaultPositionResponseItem,
Coin,
CoinBalanceResponseItem,
CoinValue,
ConfigResponse,
DebtAmount,
DebtShares,
ExecuteMsg,
InstantiateMsg,
LentAmount,
LentShares,
LockingVaultAmount,
OwnerResponse,
Positions,
QueryMsg,
SharesResponseItem,
Uint128,
UnlockingPositions,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultBaseForString,
VaultPosition,
VaultPositionAmount,
VaultPositionResponseItem,
VaultPositionValue,
VaultUnlockingPosition,
VaultUtilizationResponse,
} from './MarsMockCreditManager.types'
export interface MarsMockCreditManagerReadOnlyInterface {
contractAddress: string
accountKind: ({ accountId }: { accountId: string }) => Promise<AccountKind>
config: () => Promise<ConfigResponse>
vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise<VaultUtilizationResponse>
positions: ({ accountId }: { accountId: string }) => Promise<Positions>
allCoinBalances: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}) => Promise<ArrayOfCoinBalanceResponseItem>
allDebtShares: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}) => Promise<ArrayOfSharesResponseItem>
totalDebtShares: () => Promise<DebtShares>
allTotalDebtShares: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string
}) => Promise<ArrayOfDebtShares>
allLentShares: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}) => Promise<ArrayOfSharesResponseItem>
totalLentShares: () => Promise<LentShares>
allTotalLentShares: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string
}) => Promise<ArrayOfLentShares>
allVaultPositions: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}) => Promise<ArrayOfVaultPositionResponseItem>
estimateProvideLiquidity: ({
coinsIn,
lpTokenOut,
}: {
coinsIn: Coin[]
lpTokenOut: string
}) => Promise<Uint128>
estimateWithdrawLiquidity: ({ lpToken }: { lpToken: Coin }) => Promise<ArrayOfCoin>
vaultPositionValue: ({
vaultPosition,
}: {
vaultPosition: VaultPosition
}) => Promise<VaultPositionValue>
}
export class MarsMockCreditManagerQueryClient implements MarsMockCreditManagerReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.accountKind = this.accountKind.bind(this)
this.config = this.config.bind(this)
this.vaultUtilization = this.vaultUtilization.bind(this)
this.positions = this.positions.bind(this)
this.allCoinBalances = this.allCoinBalances.bind(this)
this.allDebtShares = this.allDebtShares.bind(this)
this.totalDebtShares = this.totalDebtShares.bind(this)
this.allTotalDebtShares = this.allTotalDebtShares.bind(this)
this.allLentShares = this.allLentShares.bind(this)
this.totalLentShares = this.totalLentShares.bind(this)
this.allTotalLentShares = this.allTotalLentShares.bind(this)
this.allVaultPositions = this.allVaultPositions.bind(this)
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
this.vaultPositionValue = this.vaultPositionValue.bind(this)
}
accountKind = async ({ accountId }: { accountId: string }): Promise<AccountKind> => {
return this.client.queryContractSmart(this.contractAddress, {
account_kind: {
account_id: accountId,
},
})
}
config = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {},
})
}
vaultUtilization = async ({
vault,
}: {
vault: VaultBaseForString
}): Promise<VaultUtilizationResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
vault_utilization: {
vault,
},
})
}
positions = async ({ accountId }: { accountId: string }): Promise<Positions> => {
return this.client.queryContractSmart(this.contractAddress, {
positions: {
account_id: accountId,
},
})
}
allCoinBalances = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}): Promise<ArrayOfCoinBalanceResponseItem> => {
return this.client.queryContractSmart(this.contractAddress, {
all_coin_balances: {
limit,
start_after: startAfter,
},
})
}
allDebtShares = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}): Promise<ArrayOfSharesResponseItem> => {
return this.client.queryContractSmart(this.contractAddress, {
all_debt_shares: {
limit,
start_after: startAfter,
},
})
}
totalDebtShares = async (): Promise<DebtShares> => {
return this.client.queryContractSmart(this.contractAddress, {
total_debt_shares: {},
})
}
allTotalDebtShares = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string
}): Promise<ArrayOfDebtShares> => {
return this.client.queryContractSmart(this.contractAddress, {
all_total_debt_shares: {
limit,
start_after: startAfter,
},
})
}
allLentShares = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}): Promise<ArrayOfSharesResponseItem> => {
return this.client.queryContractSmart(this.contractAddress, {
all_lent_shares: {
limit,
start_after: startAfter,
},
})
}
totalLentShares = async (): Promise<LentShares> => {
return this.client.queryContractSmart(this.contractAddress, {
total_lent_shares: {},
})
}
allTotalLentShares = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string
}): Promise<ArrayOfLentShares> => {
return this.client.queryContractSmart(this.contractAddress, {
all_total_lent_shares: {
limit,
start_after: startAfter,
},
})
}
allVaultPositions = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}): Promise<ArrayOfVaultPositionResponseItem> => {
return this.client.queryContractSmart(this.contractAddress, {
all_vault_positions: {
limit,
start_after: startAfter,
},
})
}
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,
},
})
}
vaultPositionValue = async ({
vaultPosition,
}: {
vaultPosition: VaultPosition
}): Promise<VaultPositionValue> => {
return this.client.queryContractSmart(this.contractAddress, {
vault_position_value: {
vault_position: vaultPosition,
},
})
}
}
export interface MarsMockCreditManagerInterface extends MarsMockCreditManagerReadOnlyInterface {
contractAddress: string
sender: string
setPositionsResponse: (
{
accountId,
positions,
}: {
accountId: string
positions: Positions
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsMockCreditManagerClient
extends MarsMockCreditManagerQueryClient
implements MarsMockCreditManagerInterface
{
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.setPositionsResponse = this.setPositionsResponse.bind(this)
}
setPositionsResponse = async (
{
accountId,
positions,
}: {
accountId: string
positions: Positions
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
set_positions_response: {
account_id: accountId,
positions,
},
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,100 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
AccountKind,
Addr,
ArrayOfCoin,
ArrayOfCoinBalanceResponseItem,
ArrayOfDebtShares,
ArrayOfLentShares,
ArrayOfSharesResponseItem,
ArrayOfVaultPositionResponseItem,
Coin,
CoinBalanceResponseItem,
CoinValue,
ConfigResponse,
DebtAmount,
DebtShares,
ExecuteMsg,
InstantiateMsg,
LentAmount,
LentShares,
LockingVaultAmount,
OwnerResponse,
Positions,
QueryMsg,
SharesResponseItem,
Uint128,
UnlockingPositions,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultBaseForString,
VaultPosition,
VaultPositionAmount,
VaultPositionResponseItem,
VaultPositionValue,
VaultUnlockingPosition,
VaultUtilizationResponse,
} from './MarsMockCreditManager.types'
export interface MarsMockCreditManagerMessage {
contractAddress: string
sender: string
setPositionsResponse: (
{
accountId,
positions,
}: {
accountId: string
positions: Positions
},
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
}
export class MarsMockCreditManagerMessageComposer implements MarsMockCreditManagerMessage {
sender: string
contractAddress: string
constructor(sender: string, contractAddress: string) {
this.sender = sender
this.contractAddress = contractAddress
this.setPositionsResponse = this.setPositionsResponse.bind(this)
}
setPositionsResponse = (
{
accountId,
positions,
}: {
accountId: string
positions: Positions
},
_funds?: Coin[],
): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
set_positions_response: {
account_id: accountId,
positions,
},
}),
),
funds: _funds,
}),
}
}
}

View File

@ -1,519 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
AccountKind,
Addr,
ArrayOfCoin,
ArrayOfCoinBalanceResponseItem,
ArrayOfDebtShares,
ArrayOfLentShares,
ArrayOfSharesResponseItem,
ArrayOfVaultPositionResponseItem,
Coin,
CoinBalanceResponseItem,
CoinValue,
ConfigResponse,
DebtAmount,
DebtShares,
ExecuteMsg,
InstantiateMsg,
LentAmount,
LentShares,
LockingVaultAmount,
OwnerResponse,
Positions,
QueryMsg,
SharesResponseItem,
Uint128,
UnlockingPositions,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultBaseForString,
VaultPosition,
VaultPositionAmount,
VaultPositionResponseItem,
VaultPositionValue,
VaultUnlockingPosition,
VaultUtilizationResponse,
} from './MarsMockCreditManager.types'
import {
MarsMockCreditManagerClient,
MarsMockCreditManagerQueryClient,
} from './MarsMockCreditManager.client'
export const marsMockCreditManagerQueryKeys = {
contract: [
{
contract: 'marsMockCreditManager',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsMockCreditManagerQueryKeys.contract[0], address: contractAddress }] as const,
accountKind: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'account_kind',
args,
},
] as const,
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args },
] as const,
vaultUtilization: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'vault_utilization',
args,
},
] as const,
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args },
] as const,
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_coin_balances',
args,
},
] as const,
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_debt_shares',
args,
},
] as const,
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'total_debt_shares',
args,
},
] as const,
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_total_debt_shares',
args,
},
] as const,
allLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_lent_shares',
args,
},
] as const,
totalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'total_lent_shares',
args,
},
] as const,
allTotalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_total_lent_shares',
args,
},
] as const,
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'all_vault_positions',
args,
},
] as const,
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'estimate_provide_liquidity',
args,
},
] as const,
estimateWithdrawLiquidity: (
contractAddress: string | undefined,
args?: Record<string, unknown>,
) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'estimate_withdraw_liquidity',
args,
},
] as const,
vaultPositionValue: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
method: 'vault_position_value',
args,
},
] as const,
}
export interface MarsMockCreditManagerReactQuery<TResponse, TData = TResponse> {
client: MarsMockCreditManagerQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
> & {
initialData?: undefined
}
}
export interface MarsMockCreditManagerVaultPositionValueQuery<TData>
extends MarsMockCreditManagerReactQuery<VaultPositionValue, TData> {
args: {
vaultPosition: VaultPosition
}
}
export function useMarsMockCreditManagerVaultPositionValueQuery<TData = VaultPositionValue>({
client,
args,
options,
}: MarsMockCreditManagerVaultPositionValueQuery<TData>) {
return useQuery<VaultPositionValue, Error, TData>(
marsMockCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args),
() =>
client
? client.vaultPositionValue({
vaultPosition: args.vaultPosition,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfCoin, TData> {
args: {
lpToken: Coin
}
}
export function useMarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
client,
args,
options,
}: MarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData>) {
return useQuery<ArrayOfCoin, Error, TData>(
marsMockCreditManagerQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args),
() =>
client
? client.estimateWithdrawLiquidity({
lpToken: args.lpToken,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerEstimateProvideLiquidityQuery<TData>
extends MarsMockCreditManagerReactQuery<Uint128, TData> {
args: {
coinsIn: Coin[]
lpTokenOut: string
}
}
export function useMarsMockCreditManagerEstimateProvideLiquidityQuery<TData = Uint128>({
client,
args,
options,
}: MarsMockCreditManagerEstimateProvideLiquidityQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsMockCreditManagerQueryKeys.estimateProvideLiquidity(client?.contractAddress, args),
() =>
client
? client.estimateProvideLiquidity({
coinsIn: args.coinsIn,
lpTokenOut: args.lpTokenOut,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAllVaultPositionsQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
args: {
limit?: number
startAfter?: string[][]
}
}
export function useMarsMockCreditManagerAllVaultPositionsQuery<
TData = ArrayOfVaultPositionResponseItem,
>({ client, args, options }: MarsMockCreditManagerAllVaultPositionsQuery<TData>) {
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
marsMockCreditManagerQueryKeys.allVaultPositions(client?.contractAddress, args),
() =>
client
? client.allVaultPositions({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAllTotalLentSharesQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfLentShares, TData> {
args: {
limit?: number
startAfter?: string
}
}
export function useMarsMockCreditManagerAllTotalLentSharesQuery<TData = ArrayOfLentShares>({
client,
args,
options,
}: MarsMockCreditManagerAllTotalLentSharesQuery<TData>) {
return useQuery<ArrayOfLentShares, Error, TData>(
marsMockCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args),
() =>
client
? client.allTotalLentShares({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerTotalLentSharesQuery<TData>
extends MarsMockCreditManagerReactQuery<LentShares, TData> {}
export function useMarsMockCreditManagerTotalLentSharesQuery<TData = LentShares>({
client,
options,
}: MarsMockCreditManagerTotalLentSharesQuery<TData>) {
return useQuery<LentShares, Error, TData>(
marsMockCreditManagerQueryKeys.totalLentShares(client?.contractAddress),
() => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAllLentSharesQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
args: {
limit?: number
startAfter?: string[][]
}
}
export function useMarsMockCreditManagerAllLentSharesQuery<TData = ArrayOfSharesResponseItem>({
client,
args,
options,
}: MarsMockCreditManagerAllLentSharesQuery<TData>) {
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
marsMockCreditManagerQueryKeys.allLentShares(client?.contractAddress, args),
() =>
client
? client.allLentShares({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAllTotalDebtSharesQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfDebtShares, TData> {
args: {
limit?: number
startAfter?: string
}
}
export function useMarsMockCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
client,
args,
options,
}: MarsMockCreditManagerAllTotalDebtSharesQuery<TData>) {
return useQuery<ArrayOfDebtShares, Error, TData>(
marsMockCreditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args),
() =>
client
? client.allTotalDebtShares({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerTotalDebtSharesQuery<TData>
extends MarsMockCreditManagerReactQuery<DebtShares, TData> {}
export function useMarsMockCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
client,
options,
}: MarsMockCreditManagerTotalDebtSharesQuery<TData>) {
return useQuery<DebtShares, Error, TData>(
marsMockCreditManagerQueryKeys.totalDebtShares(client?.contractAddress),
() => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAllDebtSharesQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
args: {
limit?: number
startAfter?: string[][]
}
}
export function useMarsMockCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
client,
args,
options,
}: MarsMockCreditManagerAllDebtSharesQuery<TData>) {
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
marsMockCreditManagerQueryKeys.allDebtShares(client?.contractAddress, args),
() =>
client
? client.allDebtShares({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAllCoinBalancesQuery<TData>
extends MarsMockCreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
args: {
limit?: number
startAfter?: string[][]
}
}
export function useMarsMockCreditManagerAllCoinBalancesQuery<
TData = ArrayOfCoinBalanceResponseItem,
>({ client, args, options }: MarsMockCreditManagerAllCoinBalancesQuery<TData>) {
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
marsMockCreditManagerQueryKeys.allCoinBalances(client?.contractAddress, args),
() =>
client
? client.allCoinBalances({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerPositionsQuery<TData>
extends MarsMockCreditManagerReactQuery<Positions, TData> {
args: {
accountId: string
}
}
export function useMarsMockCreditManagerPositionsQuery<TData = Positions>({
client,
args,
options,
}: MarsMockCreditManagerPositionsQuery<TData>) {
return useQuery<Positions, Error, TData>(
marsMockCreditManagerQueryKeys.positions(client?.contractAddress, args),
() =>
client
? client.positions({
accountId: args.accountId,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerVaultUtilizationQuery<TData>
extends MarsMockCreditManagerReactQuery<VaultUtilizationResponse, TData> {
args: {
vault: VaultBaseForString
}
}
export function useMarsMockCreditManagerVaultUtilizationQuery<TData = VaultUtilizationResponse>({
client,
args,
options,
}: MarsMockCreditManagerVaultUtilizationQuery<TData>) {
return useQuery<VaultUtilizationResponse, Error, TData>(
marsMockCreditManagerQueryKeys.vaultUtilization(client?.contractAddress, args),
() =>
client
? client.vaultUtilization({
vault: args.vault,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerConfigQuery<TData>
extends MarsMockCreditManagerReactQuery<ConfigResponse, TData> {}
export function useMarsMockCreditManagerConfigQuery<TData = ConfigResponse>({
client,
options,
}: MarsMockCreditManagerConfigQuery<TData>) {
return useQuery<ConfigResponse, Error, TData>(
marsMockCreditManagerQueryKeys.config(client?.contractAddress),
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerAccountKindQuery<TData>
extends MarsMockCreditManagerReactQuery<AccountKind, TData> {
args: {
accountId: string
}
}
export function useMarsMockCreditManagerAccountKindQuery<TData = AccountKind>({
client,
args,
options,
}: MarsMockCreditManagerAccountKindQuery<TData>) {
return useQuery<AccountKind, Error, TData>(
marsMockCreditManagerQueryKeys.accountKind(client?.contractAddress, args),
() =>
client
? client.accountKind({
accountId: args.accountId,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockCreditManagerSetPositionsResponseMutation {
client: MarsMockCreditManagerClient
msg: {
accountId: string
positions: Positions
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsMockCreditManagerSetPositionsResponseMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockCreditManagerSetPositionsResponseMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockCreditManagerSetPositionsResponseMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.setPositionsResponse(msg, fee, memo, funds),
options,
)
}

View File

@ -1,205 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
[k: string]: unknown
}
export type ExecuteMsg = {
set_positions_response: {
account_id: string
positions: Positions
}
}
export type Uint128 = string
export type VaultPositionAmount =
| {
unlocked: VaultAmount
}
| {
locking: LockingVaultAmount
}
export type VaultAmount = string
export type VaultAmount1 = string
export type UnlockingPositions = VaultUnlockingPosition[]
export type Addr = string
export interface Positions {
account_id: string
debts: DebtAmount[]
deposits: Coin[]
lends: LentAmount[]
vaults: VaultPosition[]
}
export interface DebtAmount {
amount: Uint128
denom: string
shares: Uint128
}
export interface Coin {
amount: Uint128
denom: string
[k: string]: unknown
}
export interface LentAmount {
amount: Uint128
denom: string
shares: Uint128
}
export interface VaultPosition {
amount: VaultPositionAmount
vault: VaultBaseForAddr
}
export interface LockingVaultAmount {
locked: VaultAmount1
unlocking: UnlockingPositions
}
export interface VaultUnlockingPosition {
coin: Coin
id: number
}
export interface VaultBaseForAddr {
address: Addr
}
export type QueryMsg =
| {
account_kind: {
account_id: string
}
}
| {
config: {}
}
| {
vault_utilization: {
vault: VaultBaseForString
}
}
| {
positions: {
account_id: string
}
}
| {
all_coin_balances: {
limit?: number | null
start_after?: [string, string] | null
}
}
| {
all_debt_shares: {
limit?: number | null
start_after?: [string, string] | null
}
}
| {
total_debt_shares: string
}
| {
all_total_debt_shares: {
limit?: number | null
start_after?: string | null
}
}
| {
all_lent_shares: {
limit?: number | null
start_after?: [string, string] | null
}
}
| {
total_lent_shares: string
}
| {
all_total_lent_shares: {
limit?: number | null
start_after?: string | null
}
}
| {
all_vault_positions: {
limit?: number | null
start_after?: [string, string] | null
}
}
| {
estimate_provide_liquidity: {
coins_in: Coin[]
lp_token_out: string
}
}
| {
estimate_withdraw_liquidity: {
lp_token: Coin
}
}
| {
vault_position_value: {
vault_position: VaultPosition
}
}
export interface VaultBaseForString {
address: string
}
export type AccountKind = 'default' | 'high_levered_strategy'
export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[]
export interface CoinBalanceResponseItem {
account_id: string
amount: Uint128
denom: string
}
export type ArrayOfSharesResponseItem = SharesResponseItem[]
export interface SharesResponseItem {
account_id: string
denom: string
shares: Uint128
}
export type ArrayOfDebtShares = DebtShares[]
export interface DebtShares {
denom: string
shares: Uint128
}
export type ArrayOfLentShares = LentShares[]
export interface LentShares {
denom: string
shares: Uint128
}
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
export interface VaultPositionResponseItem {
account_id: string
position: VaultPosition
}
export interface ConfigResponse {
account_nft?: string | null
health_contract: string
max_unlocking_positions: Uint128
oracle: string
ownership: OwnerResponse
params: string
red_bank: string
swapper: string
zapper: string
}
export interface OwnerResponse {
abolished: boolean
emergency_owner?: string | null
initialized: boolean
owner?: string | null
proposed?: string | null
}
export type ArrayOfCoin = Coin[]
export interface VaultPositionValue {
base_coin: CoinValue
vault_coin: CoinValue
}
export interface CoinValue {
amount: Uint128
denom: string
value: Uint128
}
export interface VaultUtilizationResponse {
utilization: Coin
vault: VaultBaseForString
}

View File

@ -1,14 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 './MarsMockCreditManager.types'
import * as _9 from './MarsMockCreditManager.client'
import * as _10 from './MarsMockCreditManager.message-composer'
import * as _11 from './MarsMockCreditManager.react-query'
export namespace contracts {
export const MarsMockCreditManager = { ..._8, ..._9, ..._10, ..._11 }
}

View File

@ -1,473 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
ArrayOfMarket,
ArrayOfUncollateralizedLoanLimitResponse,
ArrayOfUserCollateralResponse,
ArrayOfUserDebtResponse,
ConfigResponse,
CreateOrUpdateConfig,
Decimal,
ExecuteMsg,
InitOrUpdateAssetParams,
InstantiateMsg,
InterestRateModel,
Market,
OwnerUpdate,
QueryMsg,
Uint128,
UncollateralizedLoanLimitResponse,
UserCollateralResponse,
UserDebtResponse,
UserHealthStatus,
UserPositionResponse,
} from './MarsMockRedBank.types'
export interface MarsMockRedBankMessage {
contractAddress: string
sender: string
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
updateEmergencyOwner: (
ownerUpdate: OwnerUpdate,
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
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.updateOwner = this.updateOwner.bind(this)
this.updateEmergencyOwner = this.updateEmergencyOwner.bind(this)
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)
}
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_owner: ownerUpdate,
}),
),
funds: _funds,
}),
}
}
updateEmergencyOwner = (
ownerUpdate: OwnerUpdate,
_funds?: Coin[],
): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_emergency_owner: ownerUpdate,
}),
),
funds: _funds,
}),
}
}
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: _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: _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: _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: _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: _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: _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: _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: _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: _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: _funds,
}),
}
}
}

View File

@ -1,14 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 './MarsMockRedBank.types'
import * as _17 from './MarsMockRedBank.client'
import * as _18 from './MarsMockRedBank.message-composer'
import * as _19 from './MarsMockRedBank.react-query'
export namespace contracts {
export const MarsMockRedBank = { ..._16, ..._17, ..._18, ..._19 }
}

View File

@ -1,27 +1,26 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
Duration,
Empty,
ExecuteMsg,
ExtensionExecuteMsg,
ExtensionQueryMsg,
ForceUnlockExecuteMsg,
InstantiateMsg,
LockupExecuteMsg,
LockupQueryMsg,
OracleBaseForString,
QueryMsg,
InstantiateMsg,
ExecuteMsg,
Uint128,
ExtensionExecuteMsg,
LockupExecuteMsg,
ForceUnlockExecuteMsg,
QueryMsg,
ExtensionQueryMsg,
LockupQueryMsg,
VaultInfoResponse,
Empty,
VaultStandardInfoResponse,
} from './MarsMockVault.types'
export interface MarsMockVaultReadOnlyInterface {

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/
@ -9,21 +9,20 @@ import { Coin } from '@cosmjs/amino'
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Duration,
Empty,
ExecuteMsg,
ExtensionExecuteMsg,
ExtensionQueryMsg,
ForceUnlockExecuteMsg,
InstantiateMsg,
LockupExecuteMsg,
LockupQueryMsg,
OracleBaseForString,
QueryMsg,
InstantiateMsg,
ExecuteMsg,
Uint128,
ExtensionExecuteMsg,
LockupExecuteMsg,
ForceUnlockExecuteMsg,
QueryMsg,
ExtensionQueryMsg,
LockupQueryMsg,
VaultInfoResponse,
Empty,
VaultStandardInfoResponse,
} from './MarsMockVault.types'
export interface MarsMockVaultMessage {

View File

@ -1,31 +1,30 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import { StdFee, Coin } from '@cosmjs/amino'
import {
Duration,
Empty,
ExecuteMsg,
ExtensionExecuteMsg,
ExtensionQueryMsg,
ForceUnlockExecuteMsg,
InstantiateMsg,
LockupExecuteMsg,
LockupQueryMsg,
OracleBaseForString,
QueryMsg,
InstantiateMsg,
ExecuteMsg,
Uint128,
ExtensionExecuteMsg,
LockupExecuteMsg,
ForceUnlockExecuteMsg,
QueryMsg,
ExtensionQueryMsg,
LockupQueryMsg,
VaultInfoResponse,
Empty,
VaultStandardInfoResponse,
} from './MarsMockVault.types'
import { MarsMockVaultClient, MarsMockVaultQueryClient } from './MarsMockVault.client'
import { MarsMockVaultQueryClient, MarsMockVaultClient } from './MarsMockVault.client'
export const marsMockVaultQueryKeys = {
contract: [
{

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/
@ -15,6 +15,7 @@ export type Duration =
export type OracleBaseForString = string
export interface InstantiateMsg {
base_token_denom: string
is_evil?: string | null
lockup?: Duration | null
oracle: OracleBaseForString
vault_token_denom: string

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/

View File

@ -1,30 +1,30 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
ArrayOfPriceResponse,
ArrayOfPriceSourceResponseForString,
ConfigResponse,
InstantiateMsg,
Empty,
ExecuteMsg,
OsmosisPriceSourceForString,
Decimal,
Downtime,
DowntimeDetector,
ExecuteMsg,
GeometricTwap,
Identifier,
InstantiateMsg,
OsmosisPriceSourceForString,
OwnerUpdate,
DowntimeDetector,
GeometricTwap,
RedemptionRateForString,
QueryMsg,
ConfigResponse,
PriceResponse,
PriceSourceResponseForString,
QueryMsg,
RedemptionRateForString,
ArrayOfPriceSourceResponseForString,
ArrayOfPriceResponse,
} from './MarsOracleOsmosis.types'
export interface MarsOracleOsmosisReadOnlyInterface {
contractAddress: string
@ -149,6 +149,7 @@ export interface MarsOracleOsmosisInterface extends MarsOracleOsmosisReadOnlyInt
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
custom: (fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>
}
export class MarsOracleOsmosisClient
extends MarsOracleOsmosisQueryClient
@ -167,6 +168,7 @@ export class MarsOracleOsmosisClient
this.removePriceSource = this.removePriceSource.bind(this)
this.updateOwner = this.updateOwner.bind(this)
this.updateConfig = this.updateConfig.bind(this)
this.custom = this.custom.bind(this)
}
setPriceSource = async (
@ -258,4 +260,20 @@ export class MarsOracleOsmosisClient
_funds,
)
}
custom = async (
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
custom: {},
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,33 +1,33 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import { StdFee, Coin } from '@cosmjs/amino'
import {
ArrayOfPriceResponse,
ArrayOfPriceSourceResponseForString,
ConfigResponse,
InstantiateMsg,
Empty,
ExecuteMsg,
OsmosisPriceSourceForString,
Decimal,
Downtime,
DowntimeDetector,
ExecuteMsg,
GeometricTwap,
Identifier,
InstantiateMsg,
OsmosisPriceSourceForString,
OwnerUpdate,
DowntimeDetector,
GeometricTwap,
RedemptionRateForString,
QueryMsg,
ConfigResponse,
PriceResponse,
PriceSourceResponseForString,
QueryMsg,
RedemptionRateForString,
ArrayOfPriceSourceResponseForString,
ArrayOfPriceResponse,
} from './MarsOracleOsmosis.types'
import { MarsOracleOsmosisClient, MarsOracleOsmosisQueryClient } from './MarsOracleOsmosis.client'
import { MarsOracleOsmosisQueryClient, MarsOracleOsmosisClient } from './MarsOracleOsmosis.client'
export const marsOracleOsmosisQueryKeys = {
contract: [
{
@ -168,6 +168,25 @@ export function useMarsOracleOsmosisConfigQuery<TData = ConfigResponse>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsOracleOsmosisCustomMutation {
client: MarsOracleOsmosisClient
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsOracleOsmosisCustomMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsOracleOsmosisCustomMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsOracleOsmosisCustomMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.custom(msg, fee, memo, funds),
options,
)
}
export interface MarsOracleOsmosisUpdateConfigMutation {
client: MarsOracleOsmosisClient
msg: {

View File

@ -1,14 +1,18 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
base_denom: string
custom_init?: Empty | null
owner: string
}
export interface Empty {
[k: string]: unknown
}
export type ExecuteMsg =
| {
set_price_source: {
@ -29,6 +33,9 @@ export type ExecuteMsg =
base_denom?: string | null
}
}
| {
custom: Empty
}
export type OsmosisPriceSourceForString =
| {
fixed: {

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.0.
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

View File

@ -1,41 +1,42 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Decimal,
InstantiateMsg,
ExecuteMsg,
OwnerUpdate,
AssetParamsUpdate,
HlsAssetTypeForString,
Uint128,
VaultConfigUpdate,
EmergencyUpdate,
CmEmergencyUpdate,
RedBankEmergencyUpdate,
AssetParamsBaseForString,
CmSettingsForString,
HlsParamsBaseForString,
LiquidationBonus,
RedBankSettings,
VaultConfigBaseForString,
Coin,
QueryMsg,
HlsAssetTypeForAddr,
Addr,
ArrayOfAssetParamsBaseForAddr,
ArrayOfVaultConfigBaseForAddr,
AssetParamsBaseForAddr,
AssetParamsBaseForString,
AssetParamsUpdate,
CmEmergencyUpdate,
CmSettingsForAddr,
CmSettingsForString,
Coin,
Decimal,
EmergencyUpdate,
ExecuteMsg,
HlsAssetTypeForAddr,
HlsAssetTypeForString,
HlsParamsBaseForAddr,
HlsParamsBaseForString,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RedBankEmergencyUpdate,
RedBankSettings,
Uint128,
ArrayOfVaultConfigBaseForAddr,
VaultConfigBaseForAddr,
VaultConfigBaseForString,
VaultConfigUpdate,
OwnerResponse,
TotalDepositResponse,
} from './MarsParams.types'
export interface MarsParamsReadOnlyInterface {
contractAddress: string
@ -56,7 +57,8 @@ export interface MarsParamsReadOnlyInterface {
limit?: number
startAfter?: string
}) => Promise<ArrayOfVaultConfigBaseForAddr>
maxCloseFactor: () => Promise<Decimal>
targetHealthFactor: () => Promise<Decimal>
totalDeposit: ({ denom }: { denom: string }) => Promise<TotalDepositResponse>
}
export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
client: CosmWasmClient
@ -70,7 +72,8 @@ export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
this.allAssetParams = this.allAssetParams.bind(this)
this.vaultConfig = this.vaultConfig.bind(this)
this.allVaultConfigs = this.allVaultConfigs.bind(this)
this.maxCloseFactor = this.maxCloseFactor.bind(this)
this.targetHealthFactor = this.targetHealthFactor.bind(this)
this.totalDeposit = this.totalDeposit.bind(this)
}
owner = async (): Promise<OwnerResponse> => {
@ -120,9 +123,16 @@ export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
},
})
}
maxCloseFactor = async (): Promise<Decimal> => {
targetHealthFactor = async (): Promise<Decimal> => {
return this.client.queryContractSmart(this.contractAddress, {
max_close_factor: {},
target_health_factor: {},
})
}
totalDeposit = async ({ denom }: { denom: string }): Promise<TotalDepositResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
total_deposit: {
denom,
},
})
}
}
@ -135,7 +145,7 @@ export interface MarsParamsInterface extends MarsParamsReadOnlyInterface {
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
updateMaxCloseFactor: (
updateTargetHealthFactor: (
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
@ -170,7 +180,7 @@ export class MarsParamsClient extends MarsParamsQueryClient implements MarsParam
this.sender = sender
this.contractAddress = contractAddress
this.updateOwner = this.updateOwner.bind(this)
this.updateMaxCloseFactor = this.updateMaxCloseFactor.bind(this)
this.updateTargetHealthFactor = this.updateTargetHealthFactor.bind(this)
this.updateAssetParams = this.updateAssetParams.bind(this)
this.updateVaultConfig = this.updateVaultConfig.bind(this)
this.emergencyUpdate = this.emergencyUpdate.bind(this)
@ -193,7 +203,7 @@ export class MarsParamsClient extends MarsParamsQueryClient implements MarsParam
_funds,
)
}
updateMaxCloseFactor = async (
updateTargetHealthFactor = async (
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
@ -202,7 +212,7 @@ export class MarsParamsClient extends MarsParamsQueryClient implements MarsParam
this.sender,
this.contractAddress,
{
update_max_close_factor: {},
update_target_health_factor: {},
},
fee,
memo,

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/
@ -8,41 +8,42 @@
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Decimal,
InstantiateMsg,
ExecuteMsg,
OwnerUpdate,
AssetParamsUpdate,
HlsAssetTypeForString,
Uint128,
VaultConfigUpdate,
EmergencyUpdate,
CmEmergencyUpdate,
RedBankEmergencyUpdate,
AssetParamsBaseForString,
CmSettingsForString,
HlsParamsBaseForString,
LiquidationBonus,
RedBankSettings,
VaultConfigBaseForString,
Coin,
QueryMsg,
HlsAssetTypeForAddr,
Addr,
ArrayOfAssetParamsBaseForAddr,
ArrayOfVaultConfigBaseForAddr,
AssetParamsBaseForAddr,
AssetParamsBaseForString,
AssetParamsUpdate,
CmEmergencyUpdate,
CmSettingsForAddr,
CmSettingsForString,
Coin,
Decimal,
EmergencyUpdate,
ExecuteMsg,
HlsAssetTypeForAddr,
HlsAssetTypeForString,
HlsParamsBaseForAddr,
HlsParamsBaseForString,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RedBankEmergencyUpdate,
RedBankSettings,
Uint128,
ArrayOfVaultConfigBaseForAddr,
VaultConfigBaseForAddr,
VaultConfigBaseForString,
VaultConfigUpdate,
OwnerResponse,
TotalDepositResponse,
} from './MarsParams.types'
export interface MarsParamsMessage {
contractAddress: string
sender: string
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
updateMaxCloseFactor: (_funds?: Coin[]) => MsgExecuteContractEncodeObject
updateTargetHealthFactor: (_funds?: Coin[]) => MsgExecuteContractEncodeObject
updateAssetParams: (
assetParamsUpdate: AssetParamsUpdate,
_funds?: Coin[],
@ -64,7 +65,7 @@ export class MarsParamsMessageComposer implements MarsParamsMessage {
this.sender = sender
this.contractAddress = contractAddress
this.updateOwner = this.updateOwner.bind(this)
this.updateMaxCloseFactor = this.updateMaxCloseFactor.bind(this)
this.updateTargetHealthFactor = this.updateTargetHealthFactor.bind(this)
this.updateAssetParams = this.updateAssetParams.bind(this)
this.updateVaultConfig = this.updateVaultConfig.bind(this)
this.emergencyUpdate = this.emergencyUpdate.bind(this)
@ -85,7 +86,7 @@ export class MarsParamsMessageComposer implements MarsParamsMessage {
}),
}
}
updateMaxCloseFactor = (_funds?: Coin[]): MsgExecuteContractEncodeObject => {
updateTargetHealthFactor = (_funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
@ -93,7 +94,7 @@ export class MarsParamsMessageComposer implements MarsParamsMessage {
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_max_close_factor: {},
update_target_health_factor: {},
}),
),
funds: _funds,

View File

@ -1,44 +1,45 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Decimal,
InstantiateMsg,
ExecuteMsg,
OwnerUpdate,
AssetParamsUpdate,
HlsAssetTypeForString,
Uint128,
VaultConfigUpdate,
EmergencyUpdate,
CmEmergencyUpdate,
RedBankEmergencyUpdate,
AssetParamsBaseForString,
CmSettingsForString,
HlsParamsBaseForString,
LiquidationBonus,
RedBankSettings,
VaultConfigBaseForString,
Coin,
QueryMsg,
HlsAssetTypeForAddr,
Addr,
ArrayOfAssetParamsBaseForAddr,
ArrayOfVaultConfigBaseForAddr,
AssetParamsBaseForAddr,
AssetParamsBaseForString,
AssetParamsUpdate,
CmEmergencyUpdate,
CmSettingsForAddr,
CmSettingsForString,
Coin,
Decimal,
EmergencyUpdate,
ExecuteMsg,
HlsAssetTypeForAddr,
HlsAssetTypeForString,
HlsParamsBaseForAddr,
HlsParamsBaseForString,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RedBankEmergencyUpdate,
RedBankSettings,
Uint128,
ArrayOfVaultConfigBaseForAddr,
VaultConfigBaseForAddr,
VaultConfigBaseForString,
VaultConfigUpdate,
OwnerResponse,
TotalDepositResponse,
} from './MarsParams.types'
import { MarsParamsClient, MarsParamsQueryClient } from './MarsParams.client'
import { MarsParamsQueryClient, MarsParamsClient } from './MarsParams.client'
export const marsParamsQueryKeys = {
contract: [
{
@ -61,9 +62,13 @@ export const marsParamsQueryKeys = {
[
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_vault_configs', args },
] as const,
maxCloseFactor: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
targetHealthFactor: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'max_close_factor', args },
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'target_health_factor', args },
] as const,
totalDeposit: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'total_deposit', args },
] as const,
}
export interface MarsParamsReactQuery<TResponse, TData = TResponse> {
@ -75,15 +80,37 @@ export interface MarsParamsReactQuery<TResponse, TData = TResponse> {
initialData?: undefined
}
}
export interface MarsParamsMaxCloseFactorQuery<TData>
export interface MarsParamsTotalDepositQuery<TData>
extends MarsParamsReactQuery<TotalDepositResponse, TData> {
args: {
denom: string
}
}
export function useMarsParamsTotalDepositQuery<TData = TotalDepositResponse>({
client,
args,
options,
}: MarsParamsTotalDepositQuery<TData>) {
return useQuery<TotalDepositResponse, Error, TData>(
marsParamsQueryKeys.totalDeposit(client?.contractAddress, args),
() =>
client
? client.totalDeposit({
denom: args.denom,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsParamsTargetHealthFactorQuery<TData>
extends MarsParamsReactQuery<Decimal, TData> {}
export function useMarsParamsMaxCloseFactorQuery<TData = Decimal>({
export function useMarsParamsTargetHealthFactorQuery<TData = Decimal>({
client,
options,
}: MarsParamsMaxCloseFactorQuery<TData>) {
}: MarsParamsTargetHealthFactorQuery<TData>) {
return useQuery<Decimal, Error, TData>(
marsParamsQueryKeys.maxCloseFactor(client?.contractAddress),
() => (client ? client.maxCloseFactor() : Promise.reject(new Error('Invalid client'))),
marsParamsQueryKeys.targetHealthFactor(client?.contractAddress),
() => (client ? client.targetHealthFactor() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
@ -253,7 +280,7 @@ export function useMarsParamsUpdateAssetParamsMutation(
options,
)
}
export interface MarsParamsUpdateMaxCloseFactorMutation {
export interface MarsParamsUpdateTargetHealthFactorMutation {
client: MarsParamsClient
args?: {
fee?: number | StdFee | 'auto'
@ -261,15 +288,15 @@ export interface MarsParamsUpdateMaxCloseFactorMutation {
funds?: Coin[]
}
}
export function useMarsParamsUpdateMaxCloseFactorMutation(
export function useMarsParamsUpdateTargetHealthFactorMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateMaxCloseFactorMutation>,
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateTargetHealthFactorMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsParamsUpdateMaxCloseFactorMutation>(
return useMutation<ExecuteResult, Error, MarsParamsUpdateTargetHealthFactorMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateMaxCloseFactor(msg, fee, memo, funds),
client.updateTargetHealthFactor(msg, fee, memo, funds),
options,
)
}

View File

@ -1,21 +1,22 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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 {
max_close_factor: Decimal
address_provider: string
owner: string
target_health_factor: Decimal
}
export type ExecuteMsg =
| {
update_owner: OwnerUpdate
}
| {
update_max_close_factor: Decimal
update_target_health_factor: Decimal
}
| {
update_asset_params: AssetParamsUpdate
@ -86,9 +87,11 @@ export type RedBankEmergencyUpdate = {
export interface AssetParamsBaseForString {
credit_manager: CmSettingsForString
denom: string
liquidation_bonus: Decimal
deposit_cap: Uint128
liquidation_bonus: LiquidationBonus
liquidation_threshold: Decimal
max_loan_to_value: Decimal
protocol_liquidation_fee: Decimal
red_bank: RedBankSettings
}
export interface CmSettingsForString {
@ -100,9 +103,14 @@ export interface HlsParamsBaseForString {
liquidation_threshold: Decimal
max_loan_to_value: Decimal
}
export interface LiquidationBonus {
max_lb: Decimal
min_lb: Decimal
slope: Decimal
starting_lb: Decimal
}
export interface RedBankSettings {
borrow_enabled: boolean
deposit_cap: Uint128
deposit_enabled: boolean
}
export interface VaultConfigBaseForString {
@ -145,7 +153,12 @@ export type QueryMsg =
}
}
| {
max_close_factor: {}
target_health_factor: {}
}
| {
total_deposit: {
denom: string
}
}
export type HlsAssetTypeForAddr =
| {
@ -163,9 +176,11 @@ export type ArrayOfAssetParamsBaseForAddr = AssetParamsBaseForAddr[]
export interface AssetParamsBaseForAddr {
credit_manager: CmSettingsForAddr
denom: string
liquidation_bonus: Decimal
deposit_cap: Uint128
liquidation_bonus: LiquidationBonus
liquidation_threshold: Decimal
max_loan_to_value: Decimal
protocol_liquidation_fee: Decimal
red_bank: RedBankSettings
}
export interface CmSettingsForAddr {
@ -193,3 +208,8 @@ export interface OwnerResponse {
owner?: string | null
proposed?: string | null
}
export interface TotalDepositResponse {
amount: Uint128
cap: Uint128
denom: string
}

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/

View File

@ -5,32 +5,31 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
ArrayOfMarket,
ArrayOfUncollateralizedLoanLimitResponse,
ArrayOfUserCollateralResponse,
ArrayOfUserDebtResponse,
ConfigResponse,
CreateOrUpdateConfig,
Decimal,
ExecuteMsg,
InitOrUpdateAssetParams,
InstantiateMsg,
InterestRateModel,
Market,
CreateOrUpdateConfig,
ExecuteMsg,
OwnerUpdate,
QueryMsg,
Uint128,
InitOrUpdateAssetParams,
InterestRateModel,
QueryMsg,
ConfigResponse,
Market,
ArrayOfMarket,
UncollateralizedLoanLimitResponse,
ArrayOfUncollateralizedLoanLimitResponse,
UserCollateralResponse,
ArrayOfUserCollateralResponse,
UserDebtResponse,
ArrayOfUserDebtResponse,
UserHealthStatus,
UserPositionResponse,
} from './MarsMockRedBank.types'
export interface MarsMockRedBankReadOnlyInterface {
} from './MarsRedBank.types'
export interface MarsRedBankReadOnlyInterface {
contractAddress: string
config: () => Promise<ConfigResponse>
market: ({ denom }: { denom: string }) => Promise<Market>
@ -101,7 +100,7 @@ export interface MarsMockRedBankReadOnlyInterface {
denom: string
}) => Promise<Uint128>
}
export class MarsMockRedBankQueryClient implements MarsMockRedBankReadOnlyInterface {
export class MarsRedBankQueryClient implements MarsRedBankReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
@ -307,7 +306,7 @@ export class MarsMockRedBankQueryClient implements MarsMockRedBankReadOnlyInterf
})
}
}
export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterface {
export interface MarsRedBankInterface extends MarsRedBankReadOnlyInterface {
contractAddress: string
sender: string
updateOwner: (
@ -316,12 +315,6 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
updateEmergencyOwner: (
ownerUpdate: OwnerUpdate,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
updateConfig: (
{
config,
@ -445,10 +438,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsMockRedBankClient
extends MarsMockRedBankQueryClient
implements MarsMockRedBankInterface
{
export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRedBankInterface {
client: SigningCosmWasmClient
sender: string
contractAddress: string
@ -459,7 +449,6 @@ export class MarsMockRedBankClient
this.sender = sender
this.contractAddress = contractAddress
this.updateOwner = this.updateOwner.bind(this)
this.updateEmergencyOwner = this.updateEmergencyOwner.bind(this)
this.updateConfig = this.updateConfig.bind(this)
this.initAsset = this.initAsset.bind(this)
this.updateAsset = this.updateAsset.bind(this)
@ -489,23 +478,6 @@ export class MarsMockRedBankClient
_funds,
)
}
updateEmergencyOwner = async (
ownerUpdate: OwnerUpdate,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_emergency_owner: ownerUpdate,
},
fee,
memo,
_funds,
)
}
updateConfig = async (
{
config,

View File

@ -5,54 +5,53 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import { StdFee, Coin } from '@cosmjs/amino'
import {
ArrayOfMarket,
ArrayOfUncollateralizedLoanLimitResponse,
ArrayOfUserCollateralResponse,
ArrayOfUserDebtResponse,
ConfigResponse,
CreateOrUpdateConfig,
Decimal,
ExecuteMsg,
InitOrUpdateAssetParams,
InstantiateMsg,
InterestRateModel,
Market,
CreateOrUpdateConfig,
ExecuteMsg,
OwnerUpdate,
QueryMsg,
Uint128,
InitOrUpdateAssetParams,
InterestRateModel,
QueryMsg,
ConfigResponse,
Market,
ArrayOfMarket,
UncollateralizedLoanLimitResponse,
ArrayOfUncollateralizedLoanLimitResponse,
UserCollateralResponse,
ArrayOfUserCollateralResponse,
UserDebtResponse,
ArrayOfUserDebtResponse,
UserHealthStatus,
UserPositionResponse,
} from './MarsMockRedBank.types'
import { MarsMockRedBankClient, MarsMockRedBankQueryClient } from './MarsMockRedBank.client'
export const marsMockRedBankQueryKeys = {
} from './MarsRedBank.types'
import { MarsRedBankQueryClient, MarsRedBankClient } from './MarsRedBank.client'
export const marsRedBankQueryKeys = {
contract: [
{
contract: 'marsMockRedBank',
contract: 'marsRedBank',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsMockRedBankQueryKeys.contract[0], address: contractAddress }] as const,
[{ ...marsRedBankQueryKeys.contract[0], address: contractAddress }] as const,
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
[{ ...marsRedBankQueryKeys.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,
[{ ...marsRedBankQueryKeys.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,
[{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'markets', args }] as const,
uncollateralizedLoanLimit: (
contractAddress: string | undefined,
args?: Record<string, unknown>,
) =>
[
{
...marsMockRedBankQueryKeys.address(contractAddress)[0],
...marsRedBankQueryKeys.address(contractAddress)[0],
method: 'uncollateralized_loan_limit',
args,
},
@ -63,46 +62,38 @@ export const marsMockRedBankQueryKeys = {
) =>
[
{
...marsMockRedBankQueryKeys.address(contractAddress)[0],
...marsRedBankQueryKeys.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,
[{ ...marsRedBankQueryKeys.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,
[{ ...marsRedBankQueryKeys.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 },
{ ...marsRedBankQueryKeys.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 },
{ ...marsRedBankQueryKeys.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 },
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args },
] as const,
scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockRedBankQueryKeys.address(contractAddress)[0],
...marsRedBankQueryKeys.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,
},
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'scaled_debt_amount', args },
] as const,
underlyingLiquidityAmount: (
contractAddress: string | undefined,
@ -110,7 +101,7 @@ export const marsMockRedBankQueryKeys = {
) =>
[
{
...marsMockRedBankQueryKeys.address(contractAddress)[0],
...marsRedBankQueryKeys.address(contractAddress)[0],
method: 'underlying_liquidity_amount',
args,
},
@ -118,14 +109,14 @@ export const marsMockRedBankQueryKeys = {
underlyingDebtAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsMockRedBankQueryKeys.address(contractAddress)[0],
...marsRedBankQueryKeys.address(contractAddress)[0],
method: 'underlying_debt_amount',
args,
},
] as const,
}
export interface MarsMockRedBankReactQuery<TResponse, TData = TResponse> {
client: MarsMockRedBankQueryClient | undefined
export interface MarsRedBankReactQuery<TResponse, TData = TResponse> {
client: MarsRedBankQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
@ -133,20 +124,20 @@ export interface MarsMockRedBankReactQuery<TResponse, TData = TResponse> {
initialData?: undefined
}
}
export interface MarsMockRedBankUnderlyingDebtAmountQuery<TData>
extends MarsMockRedBankReactQuery<Uint128, TData> {
export interface MarsRedBankUnderlyingDebtAmountQuery<TData>
extends MarsRedBankReactQuery<Uint128, TData> {
args: {
amountScaled: Uint128
denom: string
}
}
export function useMarsMockRedBankUnderlyingDebtAmountQuery<TData = Uint128>({
export function useMarsRedBankUnderlyingDebtAmountQuery<TData = Uint128>({
client,
args,
options,
}: MarsMockRedBankUnderlyingDebtAmountQuery<TData>) {
}: MarsRedBankUnderlyingDebtAmountQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsMockRedBankQueryKeys.underlyingDebtAmount(client?.contractAddress, args),
marsRedBankQueryKeys.underlyingDebtAmount(client?.contractAddress, args),
() =>
client
? client.underlyingDebtAmount({
@ -157,20 +148,20 @@ export function useMarsMockRedBankUnderlyingDebtAmountQuery<TData = Uint128>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUnderlyingLiquidityAmountQuery<TData>
extends MarsMockRedBankReactQuery<Uint128, TData> {
export interface MarsRedBankUnderlyingLiquidityAmountQuery<TData>
extends MarsRedBankReactQuery<Uint128, TData> {
args: {
amountScaled: Uint128
denom: string
}
}
export function useMarsMockRedBankUnderlyingLiquidityAmountQuery<TData = Uint128>({
export function useMarsRedBankUnderlyingLiquidityAmountQuery<TData = Uint128>({
client,
args,
options,
}: MarsMockRedBankUnderlyingLiquidityAmountQuery<TData>) {
}: MarsRedBankUnderlyingLiquidityAmountQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsMockRedBankQueryKeys.underlyingLiquidityAmount(client?.contractAddress, args),
marsRedBankQueryKeys.underlyingLiquidityAmount(client?.contractAddress, args),
() =>
client
? client.underlyingLiquidityAmount({
@ -181,20 +172,20 @@ export function useMarsMockRedBankUnderlyingLiquidityAmountQuery<TData = Uint128
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankScaledDebtAmountQuery<TData>
extends MarsMockRedBankReactQuery<Uint128, TData> {
export interface MarsRedBankScaledDebtAmountQuery<TData>
extends MarsRedBankReactQuery<Uint128, TData> {
args: {
amount: Uint128
denom: string
}
}
export function useMarsMockRedBankScaledDebtAmountQuery<TData = Uint128>({
export function useMarsRedBankScaledDebtAmountQuery<TData = Uint128>({
client,
args,
options,
}: MarsMockRedBankScaledDebtAmountQuery<TData>) {
}: MarsRedBankScaledDebtAmountQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsMockRedBankQueryKeys.scaledDebtAmount(client?.contractAddress, args),
marsRedBankQueryKeys.scaledDebtAmount(client?.contractAddress, args),
() =>
client
? client.scaledDebtAmount({
@ -205,20 +196,20 @@ export function useMarsMockRedBankScaledDebtAmountQuery<TData = Uint128>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankScaledLiquidityAmountQuery<TData>
extends MarsMockRedBankReactQuery<Uint128, TData> {
export interface MarsRedBankScaledLiquidityAmountQuery<TData>
extends MarsRedBankReactQuery<Uint128, TData> {
args: {
amount: Uint128
denom: string
}
}
export function useMarsMockRedBankScaledLiquidityAmountQuery<TData = Uint128>({
export function useMarsRedBankScaledLiquidityAmountQuery<TData = Uint128>({
client,
args,
options,
}: MarsMockRedBankScaledLiquidityAmountQuery<TData>) {
}: MarsRedBankScaledLiquidityAmountQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsMockRedBankQueryKeys.scaledLiquidityAmount(client?.contractAddress, args),
marsRedBankQueryKeys.scaledLiquidityAmount(client?.contractAddress, args),
() =>
client
? client.scaledLiquidityAmount({
@ -229,19 +220,19 @@ export function useMarsMockRedBankScaledLiquidityAmountQuery<TData = Uint128>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUserPositionQuery<TData>
extends MarsMockRedBankReactQuery<UserPositionResponse, TData> {
export interface MarsRedBankUserPositionQuery<TData>
extends MarsRedBankReactQuery<UserPositionResponse, TData> {
args: {
user: string
}
}
export function useMarsMockRedBankUserPositionQuery<TData = UserPositionResponse>({
export function useMarsRedBankUserPositionQuery<TData = UserPositionResponse>({
client,
args,
options,
}: MarsMockRedBankUserPositionQuery<TData>) {
}: MarsRedBankUserPositionQuery<TData>) {
return useQuery<UserPositionResponse, Error, TData>(
marsMockRedBankQueryKeys.userPosition(client?.contractAddress, args),
marsRedBankQueryKeys.userPosition(client?.contractAddress, args),
() =>
client
? client.userPosition({
@ -251,21 +242,21 @@ export function useMarsMockRedBankUserPositionQuery<TData = UserPositionResponse
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUserCollateralsQuery<TData>
extends MarsMockRedBankReactQuery<ArrayOfUserCollateralResponse, TData> {
export interface MarsRedBankUserCollateralsQuery<TData>
extends MarsRedBankReactQuery<ArrayOfUserCollateralResponse, TData> {
args: {
limit?: number
startAfter?: string
user: string
}
}
export function useMarsMockRedBankUserCollateralsQuery<TData = ArrayOfUserCollateralResponse>({
export function useMarsRedBankUserCollateralsQuery<TData = ArrayOfUserCollateralResponse>({
client,
args,
options,
}: MarsMockRedBankUserCollateralsQuery<TData>) {
}: MarsRedBankUserCollateralsQuery<TData>) {
return useQuery<ArrayOfUserCollateralResponse, Error, TData>(
marsMockRedBankQueryKeys.userCollaterals(client?.contractAddress, args),
marsRedBankQueryKeys.userCollaterals(client?.contractAddress, args),
() =>
client
? client.userCollaterals({
@ -277,20 +268,20 @@ export function useMarsMockRedBankUserCollateralsQuery<TData = ArrayOfUserCollat
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUserCollateralQuery<TData>
extends MarsMockRedBankReactQuery<UserCollateralResponse, TData> {
export interface MarsRedBankUserCollateralQuery<TData>
extends MarsRedBankReactQuery<UserCollateralResponse, TData> {
args: {
denom: string
user: string
}
}
export function useMarsMockRedBankUserCollateralQuery<TData = UserCollateralResponse>({
export function useMarsRedBankUserCollateralQuery<TData = UserCollateralResponse>({
client,
args,
options,
}: MarsMockRedBankUserCollateralQuery<TData>) {
}: MarsRedBankUserCollateralQuery<TData>) {
return useQuery<UserCollateralResponse, Error, TData>(
marsMockRedBankQueryKeys.userCollateral(client?.contractAddress, args),
marsRedBankQueryKeys.userCollateral(client?.contractAddress, args),
() =>
client
? client.userCollateral({
@ -301,21 +292,21 @@ export function useMarsMockRedBankUserCollateralQuery<TData = UserCollateralResp
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUserDebtsQuery<TData>
extends MarsMockRedBankReactQuery<ArrayOfUserDebtResponse, TData> {
export interface MarsRedBankUserDebtsQuery<TData>
extends MarsRedBankReactQuery<ArrayOfUserDebtResponse, TData> {
args: {
limit?: number
startAfter?: string
user: string
}
}
export function useMarsMockRedBankUserDebtsQuery<TData = ArrayOfUserDebtResponse>({
export function useMarsRedBankUserDebtsQuery<TData = ArrayOfUserDebtResponse>({
client,
args,
options,
}: MarsMockRedBankUserDebtsQuery<TData>) {
}: MarsRedBankUserDebtsQuery<TData>) {
return useQuery<ArrayOfUserDebtResponse, Error, TData>(
marsMockRedBankQueryKeys.userDebts(client?.contractAddress, args),
marsRedBankQueryKeys.userDebts(client?.contractAddress, args),
() =>
client
? client.userDebts({
@ -327,20 +318,20 @@ export function useMarsMockRedBankUserDebtsQuery<TData = ArrayOfUserDebtResponse
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUserDebtQuery<TData>
extends MarsMockRedBankReactQuery<UserDebtResponse, TData> {
export interface MarsRedBankUserDebtQuery<TData>
extends MarsRedBankReactQuery<UserDebtResponse, TData> {
args: {
denom: string
user: string
}
}
export function useMarsMockRedBankUserDebtQuery<TData = UserDebtResponse>({
export function useMarsRedBankUserDebtQuery<TData = UserDebtResponse>({
client,
args,
options,
}: MarsMockRedBankUserDebtQuery<TData>) {
}: MarsRedBankUserDebtQuery<TData>) {
return useQuery<UserDebtResponse, Error, TData>(
marsMockRedBankQueryKeys.userDebt(client?.contractAddress, args),
marsRedBankQueryKeys.userDebt(client?.contractAddress, args),
() =>
client
? client.userDebt({
@ -351,19 +342,19 @@ export function useMarsMockRedBankUserDebtQuery<TData = UserDebtResponse>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUncollateralizedLoanLimitsQuery<TData>
extends MarsMockRedBankReactQuery<ArrayOfUncollateralizedLoanLimitResponse, TData> {
export interface MarsRedBankUncollateralizedLoanLimitsQuery<TData>
extends MarsRedBankReactQuery<ArrayOfUncollateralizedLoanLimitResponse, TData> {
args: {
limit?: number
startAfter?: string
user: string
}
}
export function useMarsMockRedBankUncollateralizedLoanLimitsQuery<
export function useMarsRedBankUncollateralizedLoanLimitsQuery<
TData = ArrayOfUncollateralizedLoanLimitResponse,
>({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitsQuery<TData>) {
>({ client, args, options }: MarsRedBankUncollateralizedLoanLimitsQuery<TData>) {
return useQuery<ArrayOfUncollateralizedLoanLimitResponse, Error, TData>(
marsMockRedBankQueryKeys.uncollateralizedLoanLimits(client?.contractAddress, args),
marsRedBankQueryKeys.uncollateralizedLoanLimits(client?.contractAddress, args),
() =>
client
? client.uncollateralizedLoanLimits({
@ -375,18 +366,18 @@ export function useMarsMockRedBankUncollateralizedLoanLimitsQuery<
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankUncollateralizedLoanLimitQuery<TData>
extends MarsMockRedBankReactQuery<UncollateralizedLoanLimitResponse, TData> {
export interface MarsRedBankUncollateralizedLoanLimitQuery<TData>
extends MarsRedBankReactQuery<UncollateralizedLoanLimitResponse, TData> {
args: {
denom: string
user: string
}
}
export function useMarsMockRedBankUncollateralizedLoanLimitQuery<
export function useMarsRedBankUncollateralizedLoanLimitQuery<
TData = UncollateralizedLoanLimitResponse,
>({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitQuery<TData>) {
>({ client, args, options }: MarsRedBankUncollateralizedLoanLimitQuery<TData>) {
return useQuery<UncollateralizedLoanLimitResponse, Error, TData>(
marsMockRedBankQueryKeys.uncollateralizedLoanLimit(client?.contractAddress, args),
marsRedBankQueryKeys.uncollateralizedLoanLimit(client?.contractAddress, args),
() =>
client
? client.uncollateralizedLoanLimit({
@ -397,20 +388,20 @@ export function useMarsMockRedBankUncollateralizedLoanLimitQuery<
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankMarketsQuery<TData>
extends MarsMockRedBankReactQuery<ArrayOfMarket, TData> {
export interface MarsRedBankMarketsQuery<TData>
extends MarsRedBankReactQuery<ArrayOfMarket, TData> {
args: {
limit?: number
startAfter?: string
}
}
export function useMarsMockRedBankMarketsQuery<TData = ArrayOfMarket>({
export function useMarsRedBankMarketsQuery<TData = ArrayOfMarket>({
client,
args,
options,
}: MarsMockRedBankMarketsQuery<TData>) {
}: MarsRedBankMarketsQuery<TData>) {
return useQuery<ArrayOfMarket, Error, TData>(
marsMockRedBankQueryKeys.markets(client?.contractAddress, args),
marsRedBankQueryKeys.markets(client?.contractAddress, args),
() =>
client
? client.markets({
@ -421,19 +412,18 @@ export function useMarsMockRedBankMarketsQuery<TData = ArrayOfMarket>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankMarketQuery<TData>
extends MarsMockRedBankReactQuery<Market, TData> {
export interface MarsRedBankMarketQuery<TData> extends MarsRedBankReactQuery<Market, TData> {
args: {
denom: string
}
}
export function useMarsMockRedBankMarketQuery<TData = Market>({
export function useMarsRedBankMarketQuery<TData = Market>({
client,
args,
options,
}: MarsMockRedBankMarketQuery<TData>) {
}: MarsRedBankMarketQuery<TData>) {
return useQuery<Market, Error, TData>(
marsMockRedBankQueryKeys.market(client?.contractAddress, args),
marsRedBankQueryKeys.market(client?.contractAddress, args),
() =>
client
? client.market({
@ -443,20 +433,20 @@ export function useMarsMockRedBankMarketQuery<TData = Market>({
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsMockRedBankConfigQuery<TData>
extends MarsMockRedBankReactQuery<ConfigResponse, TData> {}
export function useMarsMockRedBankConfigQuery<TData = ConfigResponse>({
export interface MarsRedBankConfigQuery<TData>
extends MarsRedBankReactQuery<ConfigResponse, TData> {}
export function useMarsRedBankConfigQuery<TData = ConfigResponse>({
client,
options,
}: MarsMockRedBankConfigQuery<TData>) {
}: MarsRedBankConfigQuery<TData>) {
return useQuery<ConfigResponse, Error, TData>(
marsMockRedBankQueryKeys.config(client?.contractAddress),
marsRedBankQueryKeys.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
export interface MarsRedBankUpdateAssetCollateralStatusMutation {
client: MarsRedBankClient
msg: {
denom: string
enable: boolean
@ -467,20 +457,20 @@ export interface MarsMockRedBankUpdateAssetCollateralStatusMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankUpdateAssetCollateralStatusMutation(
export function useMarsRedBankUpdateAssetCollateralStatusMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateAssetCollateralStatusMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankUpdateAssetCollateralStatusMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateAssetCollateralStatusMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankUpdateAssetCollateralStatusMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateAssetCollateralStatus(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankLiquidateMutation {
client: MarsMockRedBankClient
export interface MarsRedBankLiquidateMutation {
client: MarsRedBankClient
msg: {
collateralDenom: string
recipient?: string
@ -492,19 +482,19 @@ export interface MarsMockRedBankLiquidateMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankLiquidateMutation(
export function useMarsRedBankLiquidateMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankLiquidateMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankLiquidateMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankLiquidateMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankLiquidateMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.liquidate(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankRepayMutation {
client: MarsMockRedBankClient
export interface MarsRedBankRepayMutation {
client: MarsRedBankClient
msg: {
onBehalfOf?: string
}
@ -514,19 +504,16 @@ export interface MarsMockRedBankRepayMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankRepayMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankRepayMutation>,
'mutationFn'
>,
export function useMarsRedBankRepayMutation(
options?: Omit<UseMutationOptions<ExecuteResult, Error, MarsRedBankRepayMutation>, 'mutationFn'>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankRepayMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankRepayMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.repay(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankBorrowMutation {
client: MarsMockRedBankClient
export interface MarsRedBankBorrowMutation {
client: MarsRedBankClient
msg: {
amount: Uint128
denom: string
@ -538,19 +525,16 @@ export interface MarsMockRedBankBorrowMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankBorrowMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankBorrowMutation>,
'mutationFn'
>,
export function useMarsRedBankBorrowMutation(
options?: Omit<UseMutationOptions<ExecuteResult, Error, MarsRedBankBorrowMutation>, 'mutationFn'>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankBorrowMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankBorrowMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.borrow(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankWithdrawMutation {
client: MarsMockRedBankClient
export interface MarsRedBankWithdrawMutation {
client: MarsRedBankClient
msg: {
amount?: Uint128
denom: string
@ -562,19 +546,19 @@ export interface MarsMockRedBankWithdrawMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankWithdrawMutation(
export function useMarsRedBankWithdrawMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankWithdrawMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankWithdrawMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankWithdrawMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankWithdrawMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.withdraw(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankDepositMutation {
client: MarsMockRedBankClient
export interface MarsRedBankDepositMutation {
client: MarsRedBankClient
msg: {
onBehalfOf?: string
}
@ -584,19 +568,19 @@ export interface MarsMockRedBankDepositMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankDepositMutation(
export function useMarsRedBankDepositMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankDepositMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankDepositMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankDepositMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankDepositMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.deposit(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankUpdateUncollateralizedLoanLimitMutation {
client: MarsMockRedBankClient
export interface MarsRedBankUpdateUncollateralizedLoanLimitMutation {
client: MarsRedBankClient
msg: {
denom: string
newLimit: Uint128
@ -608,24 +592,20 @@ export interface MarsMockRedBankUpdateUncollateralizedLoanLimitMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankUpdateUncollateralizedLoanLimitMutation(
export function useMarsRedBankUpdateUncollateralizedLoanLimitMutation(
options?: Omit<
UseMutationOptions<
ExecuteResult,
Error,
MarsMockRedBankUpdateUncollateralizedLoanLimitMutation
>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankUpdateUncollateralizedLoanLimitMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateUncollateralizedLoanLimitMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankUpdateUncollateralizedLoanLimitMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateUncollateralizedLoanLimit(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankUpdateAssetMutation {
client: MarsMockRedBankClient
export interface MarsRedBankUpdateAssetMutation {
client: MarsRedBankClient
msg: {
denom: string
params: InitOrUpdateAssetParams
@ -636,19 +616,19 @@ export interface MarsMockRedBankUpdateAssetMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankUpdateAssetMutation(
export function useMarsRedBankUpdateAssetMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateAssetMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankUpdateAssetMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateAssetMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankUpdateAssetMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateAsset(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankInitAssetMutation {
client: MarsMockRedBankClient
export interface MarsRedBankInitAssetMutation {
client: MarsRedBankClient
msg: {
denom: string
params: InitOrUpdateAssetParams
@ -659,19 +639,19 @@ export interface MarsMockRedBankInitAssetMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankInitAssetMutation(
export function useMarsRedBankInitAssetMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankInitAssetMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankInitAssetMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankInitAssetMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankInitAssetMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.initAsset(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankUpdateConfigMutation {
client: MarsMockRedBankClient
export interface MarsRedBankUpdateConfigMutation {
client: MarsRedBankClient
msg: {
config: CreateOrUpdateConfig
}
@ -681,20 +661,20 @@ export interface MarsMockRedBankUpdateConfigMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankUpdateConfigMutation(
export function useMarsRedBankUpdateConfigMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateConfigMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankUpdateConfigMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateConfigMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankUpdateConfigMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateConfig(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankUpdateEmergencyOwnerMutation {
client: MarsMockRedBankClient
export interface MarsRedBankUpdateOwnerMutation {
client: MarsRedBankClient
msg: OwnerUpdate
args?: {
fee?: number | StdFee | 'auto'
@ -702,34 +682,13 @@ export interface MarsMockRedBankUpdateEmergencyOwnerMutation {
funds?: Coin[]
}
}
export function useMarsMockRedBankUpdateEmergencyOwnerMutation(
export function useMarsRedBankUpdateOwnerMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateEmergencyOwnerMutation>,
UseMutationOptions<ExecuteResult, Error, MarsRedBankUpdateOwnerMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateEmergencyOwnerMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateEmergencyOwner(msg, fee, memo, funds),
options,
)
}
export interface MarsMockRedBankUpdateOwnerMutation {
client: MarsMockRedBankClient
msg: OwnerUpdate
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsMockRedBankUpdateOwnerMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateOwnerMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateOwnerMutation>(
return useMutation<ExecuteResult, Error, MarsRedBankUpdateOwnerMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
options,
)

View File

@ -5,16 +5,19 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
export type Decimal = string
export interface InstantiateMsg {
[k: string]: unknown
config: CreateOrUpdateConfig
owner: string
}
export interface CreateOrUpdateConfig {
address_provider?: string | null
close_factor?: Decimal | null
}
export type ExecuteMsg =
| {
update_owner: OwnerUpdate
}
| {
update_emergency_owner: OwnerUpdate
}
| {
update_config: {
config: CreateOrUpdateConfig
@ -85,12 +88,13 @@ export type OwnerUpdate =
| 'clear_proposed'
| 'accept_proposed'
| 'abolish_owner_role'
export type Decimal = string
| {
set_emergency_owner: {
emergency_owner: string
}
}
| 'clear_emergency_owner'
export type Uint128 = string
export interface CreateOrUpdateConfig {
address_provider?: string | null
close_factor?: Decimal | null
}
export interface InitOrUpdateAssetParams {
borrow_enabled?: boolean | null
deposit_cap?: Uint128 | null
@ -195,7 +199,6 @@ export interface ConfigResponse {
close_factor: Decimal
emergency_owner?: string | null
owner?: string | null
proposed_new_emergency_owner?: string | null
proposed_new_owner?: string | null
}
export interface Market {

View File

@ -5,10 +5,9 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import * as _40 from './MarsSwapperBase.types'
import * as _41 from './MarsSwapperBase.client'
import * as _42 from './MarsSwapperBase.message-composer'
import * as _43 from './MarsSwapperBase.react-query'
import * as _12 from './MarsRedBank.types'
import * as _13 from './MarsRedBank.client'
import * as _14 from './MarsRedBank.react-query'
export namespace contracts {
export const MarsSwapperBase = { ..._40, ..._41, ..._42, ..._43 }
export const MarsRedBank = { ..._12, ..._13, ..._14 }
}

View File

@ -1,36 +1,36 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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 {
AccountKind,
Addr,
AssetParamsBaseForAddr,
CmSettingsForAddr,
Coin,
CoinValue,
DebtAmount,
Decimal,
DenomsData,
HealthComputer,
HlsAssetTypeForAddr,
HlsParamsBaseForAddr,
LentAmount,
LockingVaultAmount,
Positions,
RedBankSettings,
Addr,
Decimal,
Uint128,
UnlockingPositions,
AccountKind,
VaultPositionAmount,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultConfigBaseForAddr,
UnlockingPositions,
HealthComputer,
DenomsData,
AssetParamsBaseForAddr,
CmSettingsForAddr,
HlsParamsBaseForAddr,
LiquidationBonus,
RedBankSettings,
Positions,
DebtAmount,
Coin,
VaultPosition,
VaultPositionAmount,
VaultPositionValue,
VaultsData,
LockingVaultAmount,
VaultUnlockingPosition,
VaultBaseForAddr,
VaultsData,
VaultConfigBaseForAddr,
VaultPositionValue,
CoinValue,
} from './MarsRoverHealthComputer.types'

View File

@ -1,36 +1,36 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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 {
AccountKind,
Addr,
AssetParamsBaseForAddr,
CmSettingsForAddr,
Coin,
CoinValue,
DebtAmount,
Decimal,
DenomsData,
HealthComputer,
HlsAssetTypeForAddr,
HlsParamsBaseForAddr,
LentAmount,
LockingVaultAmount,
Positions,
RedBankSettings,
Addr,
Decimal,
Uint128,
UnlockingPositions,
AccountKind,
VaultPositionAmount,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultConfigBaseForAddr,
UnlockingPositions,
HealthComputer,
DenomsData,
AssetParamsBaseForAddr,
CmSettingsForAddr,
HlsParamsBaseForAddr,
LiquidationBonus,
RedBankSettings,
Positions,
DebtAmount,
Coin,
VaultPosition,
VaultPositionAmount,
VaultPositionValue,
VaultsData,
LockingVaultAmount,
VaultUnlockingPosition,
VaultBaseForAddr,
VaultsData,
VaultConfigBaseForAddr,
VaultPositionValue,
CoinValue,
} from './MarsRoverHealthComputer.types'

View File

@ -1,37 +1,37 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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 {
AccountKind,
Addr,
AssetParamsBaseForAddr,
CmSettingsForAddr,
Coin,
CoinValue,
DebtAmount,
Decimal,
DenomsData,
HealthComputer,
HlsAssetTypeForAddr,
HlsParamsBaseForAddr,
LentAmount,
LockingVaultAmount,
Positions,
RedBankSettings,
Addr,
Decimal,
Uint128,
UnlockingPositions,
AccountKind,
VaultPositionAmount,
VaultAmount,
VaultAmount1,
VaultBaseForAddr,
VaultConfigBaseForAddr,
UnlockingPositions,
HealthComputer,
DenomsData,
AssetParamsBaseForAddr,
CmSettingsForAddr,
HlsParamsBaseForAddr,
LiquidationBonus,
RedBankSettings,
Positions,
DebtAmount,
Coin,
VaultPosition,
VaultPositionAmount,
VaultPositionValue,
VaultsData,
LockingVaultAmount,
VaultUnlockingPosition,
VaultBaseForAddr,
VaultsData,
VaultConfigBaseForAddr,
VaultPositionValue,
CoinValue,
} from './MarsRoverHealthComputer.types'
import './MarsRoverHealthComputer.client'

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/
@ -47,10 +47,11 @@ export interface DenomsData {
export interface AssetParamsBaseForAddr {
credit_manager: CmSettingsForAddr
denom: string
deposit_cap: Uint128
liquidation_bonus: LiquidationBonus
liquidation_threshold: Decimal
protocol_liquidation_fee: Decimal
max_loan_to_value: Decimal
protocol_liquidation_fee: Decimal
red_bank: RedBankSettings
}
export interface CmSettingsForAddr {
@ -62,16 +63,21 @@ export interface HlsParamsBaseForAddr {
liquidation_threshold: Decimal
max_loan_to_value: Decimal
}
export interface LiquidationBonus {
max_lb: Decimal
min_lb: Decimal
slope: Decimal
starting_lb: Decimal
}
export interface RedBankSettings {
borrow_enabled: boolean
deposit_cap: Uint128
deposit_enabled: boolean
}
export interface Positions {
account_id: string
debts: DebtAmount[]
deposits: Coin[]
lends: LentAmount[]
lends: Coin[]
vaults: VaultPosition[]
}
export interface DebtAmount {
@ -84,11 +90,6 @@ export interface Coin {
denom: string
[k: string]: unknown
}
export interface LentAmount {
amount: Uint128
denom: string
shares: Uint128
}
export interface VaultPosition {
amount: VaultPositionAmount
vault: VaultBaseForAddr
@ -129,10 +130,3 @@ export interface CoinValue {
denom: string
value: Uint128
}
export interface LiquidationBonus {
max_lb: Decimal
min_lb: Decimal
slope: Decimal
starting_lb: Decimal
}

View File

@ -1,6 +1,6 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.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.
*/

View File

@ -1,141 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
AccountKind,
ConfigResponse,
Decimal,
ExecuteMsg,
HealthResponse,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsRoverHealthTypes.types'
export interface MarsRoverHealthTypesReadOnlyInterface {
contractAddress: string
health: ({ accountId, kind }: { accountId: string; kind: AccountKind }) => Promise<HealthResponse>
config: () => Promise<ConfigResponse>
}
export class MarsRoverHealthTypesQueryClient implements MarsRoverHealthTypesReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.health = this.health.bind(this)
this.config = this.config.bind(this)
}
health = async ({
accountId,
kind,
}: {
accountId: string
kind: AccountKind
}): Promise<HealthResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
health: {
account_id: accountId,
kind,
},
})
}
config = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {},
})
}
}
export interface MarsRoverHealthTypesInterface extends MarsRoverHealthTypesReadOnlyInterface {
contractAddress: string
sender: string
updateOwner: (
ownerUpdate: OwnerUpdate,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
updateConfig: (
{
creditManager,
params,
}: {
creditManager?: string
params?: string
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsRoverHealthTypesClient
extends MarsRoverHealthTypesQueryClient
implements MarsRoverHealthTypesInterface
{
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.updateOwner = this.updateOwner.bind(this)
this.updateConfig = this.updateConfig.bind(this)
}
updateOwner = async (
ownerUpdate: OwnerUpdate,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_owner: ownerUpdate,
},
fee,
memo,
_funds,
)
}
updateConfig = async (
{
creditManager,
params,
}: {
creditManager?: string
params?: string
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_config: {
credit_manager: creditManager,
params,
},
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,93 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
AccountKind,
ConfigResponse,
Decimal,
ExecuteMsg,
HealthResponse,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsRoverHealthTypes.types'
export interface MarsRoverHealthTypesMessage {
contractAddress: string
sender: string
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
updateConfig: (
{
creditManager,
params,
}: {
creditManager?: string
params?: string
},
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
}
export class MarsRoverHealthTypesMessageComposer implements MarsRoverHealthTypesMessage {
sender: string
contractAddress: string
constructor(sender: string, contractAddress: string) {
this.sender = sender
this.contractAddress = contractAddress
this.updateOwner = this.updateOwner.bind(this)
this.updateConfig = this.updateConfig.bind(this)
}
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_owner: ownerUpdate,
}),
),
funds: _funds,
}),
}
}
updateConfig = (
{
creditManager,
params,
}: {
creditManager?: string
params?: 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: {
credit_manager: creditManager,
params,
},
}),
),
funds: _funds,
}),
}
}
}

View File

@ -1,133 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
AccountKind,
ConfigResponse,
Decimal,
ExecuteMsg,
HealthResponse,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsRoverHealthTypes.types'
import {
MarsRoverHealthTypesClient,
MarsRoverHealthTypesQueryClient,
} from './MarsRoverHealthTypes.client'
export const marsRoverHealthTypesQueryKeys = {
contract: [
{
contract: 'marsRoverHealthTypes',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsRoverHealthTypesQueryKeys.contract[0], address: contractAddress }] as const,
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'health', args },
] as const,
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{ ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'config', args },
] as const,
}
export interface MarsRoverHealthTypesReactQuery<TResponse, TData = TResponse> {
client: MarsRoverHealthTypesQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
> & {
initialData?: undefined
}
}
export interface MarsRoverHealthTypesConfigQuery<TData>
extends MarsRoverHealthTypesReactQuery<ConfigResponse, TData> {}
export function useMarsRoverHealthTypesConfigQuery<TData = ConfigResponse>({
client,
options,
}: MarsRoverHealthTypesConfigQuery<TData>) {
return useQuery<ConfigResponse, Error, TData>(
marsRoverHealthTypesQueryKeys.config(client?.contractAddress),
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsRoverHealthTypesHealthQuery<TData>
extends MarsRoverHealthTypesReactQuery<HealthResponse, TData> {
args: {
accountId: string
kind: AccountKind
}
}
export function useMarsRoverHealthTypesHealthQuery<TData = HealthResponse>({
client,
args,
options,
}: MarsRoverHealthTypesHealthQuery<TData>) {
return useQuery<HealthResponse, Error, TData>(
marsRoverHealthTypesQueryKeys.health(client?.contractAddress, args),
() =>
client
? client.health({
accountId: args.accountId,
kind: args.kind,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsRoverHealthTypesUpdateConfigMutation {
client: MarsRoverHealthTypesClient
msg: {
creditManager?: string
params?: string
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsRoverHealthTypesUpdateConfigMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthTypesUpdateConfigMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsRoverHealthTypesUpdateConfigMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateConfig(msg, fee, memo, funds),
options,
)
}
export interface MarsRoverHealthTypesUpdateOwnerMutation {
client: MarsRoverHealthTypesClient
msg: OwnerUpdate
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsRoverHealthTypesUpdateOwnerMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthTypesUpdateOwnerMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsRoverHealthTypesUpdateOwnerMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
options,
)
}

View File

@ -1,70 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
owner: string
}
export type ExecuteMsg =
| {
update_owner: OwnerUpdate
}
| {
update_config: {
credit_manager?: string | null
params?: string | null
}
}
export type OwnerUpdate =
| {
propose_new_owner: {
proposed: string
}
}
| 'clear_proposed'
| 'accept_proposed'
| 'abolish_owner_role'
| {
set_emergency_owner: {
emergency_owner: string
}
}
| 'clear_emergency_owner'
export type QueryMsg =
| {
health: {
account_id: string
kind: AccountKind
}
}
| {
config: {}
}
export type AccountKind = 'default' | 'high_levered_strategy'
export interface ConfigResponse {
credit_manager?: string | null
owner_response: OwnerResponse
params?: string | null
}
export interface OwnerResponse {
abolished: boolean
emergency_owner?: string | null
initialized: boolean
owner?: string | null
proposed?: string | null
}
export type Decimal = string
export type Uint128 = string
export interface HealthResponse {
above_max_ltv: boolean
liquidatable: boolean
liquidation_health_factor?: Decimal | null
liquidation_threshold_adjusted_collateral: Uint128
max_ltv_adjusted_collateral: Uint128
max_ltv_health_factor?: Decimal | null
total_collateral_value: Uint128
total_debt_value: Uint128
}

View File

@ -1,14 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 _36 from './MarsRoverHealthTypes.types'
import * as _37 from './MarsRoverHealthTypes.client'
import * as _38 from './MarsRoverHealthTypes.message-composer'
import * as _39 from './MarsRoverHealthTypes.react-query'
export namespace contracts {
export const MarsRoverHealthTypes = { ..._36, ..._37, ..._38, ..._39 }
}

View File

@ -1,141 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
AccountKind,
ConfigResponse,
Decimal,
ExecuteMsg,
HealthResponse,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsRoverHealth.types'
export interface MarsRoverHealthReadOnlyInterface {
contractAddress: string
health: ({ accountId, kind }: { accountId: string; kind: AccountKind }) => Promise<HealthResponse>
config: () => Promise<ConfigResponse>
}
export class MarsRoverHealthQueryClient implements MarsRoverHealthReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.health = this.health.bind(this)
this.config = this.config.bind(this)
}
health = async ({
accountId,
kind,
}: {
accountId: string
kind: AccountKind
}): Promise<HealthResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
health: {
account_id: accountId,
kind,
},
})
}
config = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
config: {},
})
}
}
export interface MarsRoverHealthInterface extends MarsRoverHealthReadOnlyInterface {
contractAddress: string
sender: string
updateOwner: (
ownerUpdate: OwnerUpdate,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
updateConfig: (
{
creditManager,
params,
}: {
creditManager?: string
params?: string
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsRoverHealthClient
extends MarsRoverHealthQueryClient
implements MarsRoverHealthInterface
{
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.updateOwner = this.updateOwner.bind(this)
this.updateConfig = this.updateConfig.bind(this)
}
updateOwner = async (
ownerUpdate: OwnerUpdate,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_owner: ownerUpdate,
},
fee,
memo,
_funds,
)
}
updateConfig = async (
{
creditManager,
params,
}: {
creditManager?: string
params?: string
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_config: {
credit_manager: creditManager,
params,
},
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,93 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
AccountKind,
ConfigResponse,
Decimal,
ExecuteMsg,
HealthResponse,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsRoverHealth.types'
export interface MarsRoverHealthMessage {
contractAddress: string
sender: string
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
updateConfig: (
{
creditManager,
params,
}: {
creditManager?: string
params?: string
},
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
}
export class MarsRoverHealthMessageComposer implements MarsRoverHealthMessage {
sender: string
contractAddress: string
constructor(sender: string, contractAddress: string) {
this.sender = sender
this.contractAddress = contractAddress
this.updateOwner = this.updateOwner.bind(this)
this.updateConfig = this.updateConfig.bind(this)
}
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_owner: ownerUpdate,
}),
),
funds: _funds,
}),
}
}
updateConfig = (
{
creditManager,
params,
}: {
creditManager?: string
params?: 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: {
credit_manager: creditManager,
params,
},
}),
),
funds: _funds,
}),
}
}
}

View File

@ -1,126 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { Coin, StdFee } from '@cosmjs/amino'
import {
AccountKind,
ConfigResponse,
Decimal,
ExecuteMsg,
HealthResponse,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsRoverHealth.types'
import { MarsRoverHealthClient, MarsRoverHealthQueryClient } from './MarsRoverHealth.client'
export const marsRoverHealthQueryKeys = {
contract: [
{
contract: 'marsRoverHealth',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsRoverHealthQueryKeys.contract[0], address: contractAddress }] as const,
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsRoverHealthQueryKeys.address(contractAddress)[0], method: 'health', args }] as const,
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsRoverHealthQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
}
export interface MarsRoverHealthReactQuery<TResponse, TData = TResponse> {
client: MarsRoverHealthQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
> & {
initialData?: undefined
}
}
export interface MarsRoverHealthConfigQuery<TData>
extends MarsRoverHealthReactQuery<ConfigResponse, TData> {}
export function useMarsRoverHealthConfigQuery<TData = ConfigResponse>({
client,
options,
}: MarsRoverHealthConfigQuery<TData>) {
return useQuery<ConfigResponse, Error, TData>(
marsRoverHealthQueryKeys.config(client?.contractAddress),
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsRoverHealthHealthQuery<TData>
extends MarsRoverHealthReactQuery<HealthResponse, TData> {
args: {
accountId: string
kind: AccountKind
}
}
export function useMarsRoverHealthHealthQuery<TData = HealthResponse>({
client,
args,
options,
}: MarsRoverHealthHealthQuery<TData>) {
return useQuery<HealthResponse, Error, TData>(
marsRoverHealthQueryKeys.health(client?.contractAddress, args),
() =>
client
? client.health({
accountId: args.accountId,
kind: args.kind,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsRoverHealthUpdateConfigMutation {
client: MarsRoverHealthClient
msg: {
creditManager?: string
params?: string
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsRoverHealthUpdateConfigMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthUpdateConfigMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsRoverHealthUpdateConfigMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.updateConfig(msg, fee, memo, funds),
options,
)
}
export interface MarsRoverHealthUpdateOwnerMutation {
client: MarsRoverHealthClient
msg: OwnerUpdate
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsRoverHealthUpdateOwnerMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthUpdateOwnerMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsRoverHealthUpdateOwnerMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
options,
)
}

View File

@ -1,70 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
owner: string
}
export type ExecuteMsg =
| {
update_owner: OwnerUpdate
}
| {
update_config: {
credit_manager?: string | null
params?: string | null
}
}
export type OwnerUpdate =
| {
propose_new_owner: {
proposed: string
}
}
| 'clear_proposed'
| 'accept_proposed'
| 'abolish_owner_role'
| {
set_emergency_owner: {
emergency_owner: string
}
}
| 'clear_emergency_owner'
export type QueryMsg =
| {
health: {
account_id: string
kind: AccountKind
}
}
| {
config: {}
}
export type AccountKind = 'default' | 'high_levered_strategy'
export interface ConfigResponse {
credit_manager?: string | null
owner_response: OwnerResponse
params?: string | null
}
export interface OwnerResponse {
abolished: boolean
emergency_owner?: string | null
initialized: boolean
owner?: string | null
proposed?: string | null
}
export type Decimal = string
export type Uint128 = string
export interface HealthResponse {
above_max_ltv: boolean
liquidatable: boolean
liquidation_health_factor?: Decimal | null
liquidation_threshold_adjusted_collateral: Uint128
max_ltv_adjusted_collateral: Uint128
max_ltv_health_factor?: Decimal | null
total_collateral_value: Uint128
total_debt_value: Uint128
}

View File

@ -1,14 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 './MarsRoverHealth.types'
import * as _29 from './MarsRoverHealth.client'
import * as _30 from './MarsRoverHealth.message-composer'
import * as _31 from './MarsRoverHealth.react-query'
export namespace contracts {
export const MarsRoverHealth = { ..._28, ..._29, ..._30, ..._31 }
}

View File

@ -1,287 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfRouteResponseForEmpty,
Coin,
Decimal,
Empty,
EstimateExactInSwapResponse,
ExecuteMsg,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RouteResponseForEmpty,
Uint128,
} from './MarsSwapperBase.types'
export interface MarsSwapperBaseReadOnlyInterface {
contractAddress: string
owner: () => Promise<OwnerResponse>
route: ({
denomIn,
denomOut,
}: {
denomIn: string
denomOut: string
}) => Promise<RouteResponseForEmpty>
routes: ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}) => Promise<ArrayOfRouteResponseForEmpty>
estimateExactInSwap: ({
coinIn,
denomOut,
}: {
coinIn: Coin
denomOut: string
}) => Promise<EstimateExactInSwapResponse>
}
export class MarsSwapperBaseQueryClient implements MarsSwapperBaseReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.owner = this.owner.bind(this)
this.route = this.route.bind(this)
this.routes = this.routes.bind(this)
this.estimateExactInSwap = this.estimateExactInSwap.bind(this)
}
owner = async (): Promise<OwnerResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
owner: {},
})
}
route = async ({
denomIn,
denomOut,
}: {
denomIn: string
denomOut: string
}): Promise<RouteResponseForEmpty> => {
return this.client.queryContractSmart(this.contractAddress, {
route: {
denom_in: denomIn,
denom_out: denomOut,
},
})
}
routes = async ({
limit,
startAfter,
}: {
limit?: number
startAfter?: string[][]
}): Promise<ArrayOfRouteResponseForEmpty> => {
return this.client.queryContractSmart(this.contractAddress, {
routes: {
limit,
start_after: startAfter,
},
})
}
estimateExactInSwap = async ({
coinIn,
denomOut,
}: {
coinIn: Coin
denomOut: string
}): Promise<EstimateExactInSwapResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
estimate_exact_in_swap: {
coin_in: coinIn,
denom_out: denomOut,
},
})
}
}
export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterface {
contractAddress: string
sender: string
updateOwner: (
ownerUpdate: OwnerUpdate,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
setRoute: (
{
denomIn,
denomOut,
route,
}: {
denomIn: string
denomOut: string
route: Empty
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
swapExactIn: (
{
coinIn,
denomOut,
slippage,
}: {
coinIn: Coin
denomOut: string
slippage: Decimal
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
transferResult: (
{
denomIn,
denomOut,
recipient,
}: {
denomIn: string
denomOut: string
recipient: Addr
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsSwapperBaseClient
extends MarsSwapperBaseQueryClient
implements MarsSwapperBaseInterface
{
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.updateOwner = this.updateOwner.bind(this)
this.setRoute = this.setRoute.bind(this)
this.swapExactIn = this.swapExactIn.bind(this)
this.transferResult = this.transferResult.bind(this)
}
updateOwner = async (
ownerUpdate: OwnerUpdate,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_owner: ownerUpdate,
},
fee,
memo,
_funds,
)
}
setRoute = async (
{
denomIn,
denomOut,
route,
}: {
denomIn: string
denomOut: string
route: Empty
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
set_route: {
denom_in: denomIn,
denom_out: denomOut,
route,
},
},
fee,
memo,
_funds,
)
}
swapExactIn = async (
{
coinIn,
denomOut,
slippage,
}: {
coinIn: Coin
denomOut: string
slippage: Decimal
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
swap_exact_in: {
coin_in: coinIn,
denom_out: denomOut,
slippage,
},
},
fee,
memo,
_funds,
)
}
transferResult = async (
{
denomIn,
denomOut,
recipient,
}: {
denomIn: string
denomOut: string
recipient: Addr
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
transfer_result: {
denom_in: denomIn,
denom_out: denomOut,
recipient,
},
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,186 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Addr,
ArrayOfRouteResponseForEmpty,
Coin,
Decimal,
Empty,
EstimateExactInSwapResponse,
ExecuteMsg,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RouteResponseForEmpty,
Uint128,
} from './MarsSwapperBase.types'
export interface MarsSwapperBaseMessage {
contractAddress: string
sender: string
updateOwner: (ownerUpdate: OwnerUpdate, _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.updateOwner = this.updateOwner.bind(this)
this.setRoute = this.setRoute.bind(this)
this.swapExactIn = this.swapExactIn.bind(this)
this.transferResult = this.transferResult.bind(this)
}
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_owner: ownerUpdate,
}),
),
funds: _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: _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: _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: _funds,
}),
}
}
}

View File

@ -1,236 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfRouteResponseForEmpty,
Coin,
Decimal,
Empty,
EstimateExactInSwapResponse,
ExecuteMsg,
InstantiateMsg,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RouteResponseForEmpty,
Uint128,
} from './MarsSwapperBase.types'
import { MarsSwapperBaseClient, MarsSwapperBaseQueryClient } from './MarsSwapperBase.client'
export const marsSwapperBaseQueryKeys = {
contract: [
{
contract: 'marsSwapperBase',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsSwapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsSwapperBaseQueryKeys.address(contractAddress)[0],
method: 'estimate_exact_in_swap',
args,
},
] as const,
}
export interface MarsSwapperBaseReactQuery<TResponse, TData = TResponse> {
client: MarsSwapperBaseQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
> & {
initialData?: undefined
}
}
export interface MarsSwapperBaseEstimateExactInSwapQuery<TData>
extends MarsSwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
args: {
coinIn: Coin
denomOut: string
}
}
export function useMarsSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
client,
args,
options,
}: MarsSwapperBaseEstimateExactInSwapQuery<TData>) {
return useQuery<EstimateExactInSwapResponse, Error, TData>(
marsSwapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args),
() =>
client
? client.estimateExactInSwap({
coinIn: args.coinIn,
denomOut: args.denomOut,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsSwapperBaseRoutesQuery<TData>
extends MarsSwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
args: {
limit?: number
startAfter?: string[][]
}
}
export function useMarsSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
client,
args,
options,
}: MarsSwapperBaseRoutesQuery<TData>) {
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
marsSwapperBaseQueryKeys.routes(client?.contractAddress, args),
() =>
client
? client.routes({
limit: args.limit,
startAfter: args.startAfter,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsSwapperBaseRouteQuery<TData>
extends MarsSwapperBaseReactQuery<RouteResponseForEmpty, TData> {
args: {
denomIn: string
denomOut: string
}
}
export function useMarsSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
client,
args,
options,
}: MarsSwapperBaseRouteQuery<TData>) {
return useQuery<RouteResponseForEmpty, Error, TData>(
marsSwapperBaseQueryKeys.route(client?.contractAddress, args),
() =>
client
? client.route({
denomIn: args.denomIn,
denomOut: args.denomOut,
})
: Promise.reject(new Error('Invalid client')),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsSwapperBaseOwnerQuery<TData>
extends MarsSwapperBaseReactQuery<OwnerResponse, TData> {}
export function useMarsSwapperBaseOwnerQuery<TData = OwnerResponse>({
client,
options,
}: MarsSwapperBaseOwnerQuery<TData>) {
return useQuery<OwnerResponse, Error, TData>(
marsSwapperBaseQueryKeys.owner(client?.contractAddress),
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsSwapperBaseTransferResultMutation {
client: MarsSwapperBaseClient
msg: {
denomIn: string
denomOut: string
recipient: Addr
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsSwapperBaseTransferResultMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.transferResult(msg, fee, memo, funds),
options,
)
}
export interface MarsSwapperBaseSwapExactInMutation {
client: MarsSwapperBaseClient
msg: {
coinIn: Coin
denomOut: string
slippage: Decimal
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsSwapperBaseSwapExactInMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
options,
)
}
export interface MarsSwapperBaseSetRouteMutation {
client: MarsSwapperBaseClient
msg: {
denomIn: string
denomOut: string
route: Empty
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsSwapperBaseSetRouteMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
options,
)
}
export interface MarsSwapperBaseUpdateOwnerMutation {
client: MarsSwapperBaseClient
msg: OwnerUpdate
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsSwapperBaseUpdateOwnerMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
options,
)
}

View File

@ -1,99 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
owner: string
}
export type ExecuteMsg =
| {
update_owner: OwnerUpdate
}
| {
set_route: {
denom_in: string
denom_out: string
route: Empty
}
}
| {
swap_exact_in: {
coin_in: Coin
denom_out: string
slippage: Decimal
}
}
| {
transfer_result: {
denom_in: string
denom_out: string
recipient: Addr
}
}
export type OwnerUpdate =
| {
propose_new_owner: {
proposed: string
}
}
| 'clear_proposed'
| 'accept_proposed'
| 'abolish_owner_role'
| {
set_emergency_owner: {
emergency_owner: string
}
}
| 'clear_emergency_owner'
export type Uint128 = string
export type Decimal = string
export type Addr = string
export interface Empty {
[k: string]: unknown
}
export interface Coin {
amount: Uint128
denom: string
[k: string]: unknown
}
export type QueryMsg =
| {
owner: {}
}
| {
route: {
denom_in: string
denom_out: string
}
}
| {
routes: {
limit?: number | null
start_after?: [string, string] | null
}
}
| {
estimate_exact_in_swap: {
coin_in: Coin
denom_out: string
}
}
export interface EstimateExactInSwapResponse {
amount: Uint128
}
export interface OwnerResponse {
abolished: boolean
emergency_owner?: string | null
initialized: boolean
owner?: string | null
proposed?: string | null
}
export interface RouteResponseForEmpty {
denom_in: string
denom_out: string
route: Empty
}
export type ArrayOfRouteResponseForEmpty = RouteResponseForEmpty[]

View File

@ -5,25 +5,24 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfRouteResponseForEmpty,
Coin,
Decimal,
Empty,
EstimateExactInSwapResponse,
ExecuteMsg,
InstantiateMsg,
OsmosisRoute,
OwnerResponse,
ExecuteMsg,
OwnerUpdate,
QueryMsg,
RouteResponseForEmpty,
SwapAmountInRoute,
OsmosisRoute,
Uint128,
Decimal,
Addr,
SwapAmountInRoute,
Coin,
QueryMsg,
EstimateExactInSwapResponse,
OwnerResponse,
RouteResponseForEmpty,
Empty,
ArrayOfRouteResponseForEmpty,
} from './MarsSwapperOsmosis.types'
export interface MarsSwapperOsmosisReadOnlyInterface {
contractAddress: string

View File

@ -1,188 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Addr,
ArrayOfRouteResponseForEmpty,
Coin,
Decimal,
Empty,
EstimateExactInSwapResponse,
ExecuteMsg,
InstantiateMsg,
OsmosisRoute,
OwnerResponse,
OwnerUpdate,
QueryMsg,
RouteResponseForEmpty,
SwapAmountInRoute,
Uint128,
} from './MarsSwapperOsmosis.types'
export interface MarsSwapperOsmosisMessage {
contractAddress: string
sender: string
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
setRoute: (
{
denomIn,
denomOut,
route,
}: {
denomIn: string
denomOut: string
route: OsmosisRoute
},
_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 MarsSwapperOsmosisMessageComposer implements MarsSwapperOsmosisMessage {
sender: string
contractAddress: string
constructor(sender: string, contractAddress: string) {
this.sender = sender
this.contractAddress = contractAddress
this.updateOwner = this.updateOwner.bind(this)
this.setRoute = this.setRoute.bind(this)
this.swapExactIn = this.swapExactIn.bind(this)
this.transferResult = this.transferResult.bind(this)
}
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_owner: ownerUpdate,
}),
),
funds: _funds,
}),
}
}
setRoute = (
{
denomIn,
denomOut,
route,
}: {
denomIn: string
denomOut: string
route: OsmosisRoute
},
_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: _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: _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: _funds,
}),
}
}
}

View File

@ -5,30 +5,29 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfRouteResponseForEmpty,
Coin,
Decimal,
Empty,
EstimateExactInSwapResponse,
ExecuteMsg,
InstantiateMsg,
OsmosisRoute,
OwnerResponse,
ExecuteMsg,
OwnerUpdate,
QueryMsg,
RouteResponseForEmpty,
SwapAmountInRoute,
OsmosisRoute,
Uint128,
Decimal,
Addr,
SwapAmountInRoute,
Coin,
QueryMsg,
EstimateExactInSwapResponse,
OwnerResponse,
RouteResponseForEmpty,
Empty,
ArrayOfRouteResponseForEmpty,
} from './MarsSwapperOsmosis.types'
import {
MarsSwapperOsmosisClient,
MarsSwapperOsmosisQueryClient,
MarsSwapperOsmosisClient,
} from './MarsSwapperOsmosis.client'
export const marsSwapperOsmosisQueryKeys = {
contract: [

View File

@ -5,10 +5,9 @@
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import * as _44 from './MarsSwapperOsmosis.types'
import * as _45 from './MarsSwapperOsmosis.client'
import * as _46 from './MarsSwapperOsmosis.message-composer'
import * as _47 from './MarsSwapperOsmosis.react-query'
import * as _21 from './MarsSwapperOsmosis.types'
import * as _22 from './MarsSwapperOsmosis.client'
import * as _23 from './MarsSwapperOsmosis.react-query'
export namespace contracts {
export const MarsSwapperOsmosis = { ..._44, ..._45, ..._46, ..._47 }
export const MarsSwapperOsmosis = { ..._21, ..._22, ..._23 }
}

View File

@ -1,191 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfCoin,
CallbackMsg,
Coin,
ExecuteMsg,
InstantiateMsg,
QueryMsg,
Uint128,
} from './MarsV2ZapperBase.types'
export interface MarsV2ZapperBaseReadOnlyInterface {
contractAddress: string
estimateProvideLiquidity: ({
coinsIn,
lpTokenOut,
}: {
coinsIn: Coin[]
lpTokenOut: string
}) => Promise<Uint128>
estimateWithdrawLiquidity: ({ coinIn }: { coinIn: Coin }) => Promise<ArrayOfCoin>
}
export class MarsV2ZapperBaseQueryClient implements MarsV2ZapperBaseReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
}
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 ({ coinIn }: { coinIn: Coin }): Promise<ArrayOfCoin> => {
return this.client.queryContractSmart(this.contractAddress, {
estimate_withdraw_liquidity: {
coin_in: coinIn,
},
})
}
}
export interface MarsV2ZapperBaseInterface extends MarsV2ZapperBaseReadOnlyInterface {
contractAddress: string
sender: string
provideLiquidity: (
{
lpTokenOut,
minimumReceive,
recipient,
}: {
lpTokenOut: string
minimumReceive: Uint128
recipient?: string
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
withdrawLiquidity: (
{
minimumReceive,
recipient,
}: {
minimumReceive: Coin[]
recipient?: string
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
callback: (
callbackMsg: CallbackMsg,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsV2ZapperBaseClient
extends MarsV2ZapperBaseQueryClient
implements MarsV2ZapperBaseInterface
{
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.provideLiquidity = this.provideLiquidity.bind(this)
this.withdrawLiquidity = this.withdrawLiquidity.bind(this)
this.callback = this.callback.bind(this)
}
provideLiquidity = async (
{
lpTokenOut,
minimumReceive,
recipient,
}: {
lpTokenOut: string
minimumReceive: Uint128
recipient?: string
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
provide_liquidity: {
lp_token_out: lpTokenOut,
minimum_receive: minimumReceive,
recipient,
},
},
fee,
memo,
_funds,
)
}
withdrawLiquidity = async (
{
minimumReceive,
recipient,
}: {
minimumReceive: Coin[]
recipient?: string
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
withdraw_liquidity: {
minimum_receive: minimumReceive,
recipient,
},
},
fee,
memo,
_funds,
)
}
callback = async (
callbackMsg: CallbackMsg,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
callback: callbackMsg,
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,133 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Addr,
ArrayOfCoin,
CallbackMsg,
Coin,
ExecuteMsg,
InstantiateMsg,
QueryMsg,
Uint128,
} from './MarsV2ZapperBase.types'
export interface MarsV2ZapperBaseMessage {
contractAddress: string
sender: string
provideLiquidity: (
{
lpTokenOut,
minimumReceive,
recipient,
}: {
lpTokenOut: string
minimumReceive: Uint128
recipient?: string
},
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
withdrawLiquidity: (
{
minimumReceive,
recipient,
}: {
minimumReceive: Coin[]
recipient?: string
},
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
callback: (callbackMsg: CallbackMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject
}
export class MarsV2ZapperBaseMessageComposer implements MarsV2ZapperBaseMessage {
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)
this.callback = this.callback.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: _funds,
}),
}
}
withdrawLiquidity = (
{
minimumReceive,
recipient,
}: {
minimumReceive: Coin[]
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: {
minimum_receive: minimumReceive,
recipient,
},
}),
),
funds: _funds,
}),
}
}
callback = (callbackMsg: CallbackMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
callback: callbackMsg,
}),
),
funds: _funds,
}),
}
}
}

View File

@ -1,174 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
ArrayOfCoin,
CallbackMsg,
Coin,
ExecuteMsg,
InstantiateMsg,
QueryMsg,
Uint128,
} from './MarsV2ZapperBase.types'
import { MarsV2ZapperBaseClient, MarsV2ZapperBaseQueryClient } from './MarsV2ZapperBase.client'
export const marsV2ZapperBaseQueryKeys = {
contract: [
{
contract: 'marsV2ZapperBase',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsV2ZapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[
{
...marsV2ZapperBaseQueryKeys.address(contractAddress)[0],
method: 'estimate_provide_liquidity',
args,
},
] as const,
estimateWithdrawLiquidity: (
contractAddress: string | undefined,
args?: Record<string, unknown>,
) =>
[
{
...marsV2ZapperBaseQueryKeys.address(contractAddress)[0],
method: 'estimate_withdraw_liquidity',
args,
},
] as const,
}
export interface MarsV2ZapperBaseReactQuery<TResponse, TData = TResponse> {
client: MarsV2ZapperBaseQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
> & {
initialData?: undefined
}
}
export interface MarsV2ZapperBaseEstimateWithdrawLiquidityQuery<TData>
extends MarsV2ZapperBaseReactQuery<ArrayOfCoin, TData> {
args: {
coinIn: Coin
}
}
export function useMarsV2ZapperBaseEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
client,
args,
options,
}: MarsV2ZapperBaseEstimateWithdrawLiquidityQuery<TData>) {
return useQuery<ArrayOfCoin, Error, TData>(
marsV2ZapperBaseQueryKeys.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 MarsV2ZapperBaseEstimateProvideLiquidityQuery<TData>
extends MarsV2ZapperBaseReactQuery<Uint128, TData> {
args: {
coinsIn: Coin[]
lpTokenOut: string
}
}
export function useMarsV2ZapperBaseEstimateProvideLiquidityQuery<TData = Uint128>({
client,
args,
options,
}: MarsV2ZapperBaseEstimateProvideLiquidityQuery<TData>) {
return useQuery<Uint128, Error, TData>(
marsV2ZapperBaseQueryKeys.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 MarsV2ZapperBaseCallbackMutation {
client: MarsV2ZapperBaseClient
msg: CallbackMsg
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsV2ZapperBaseCallbackMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsV2ZapperBaseCallbackMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsV2ZapperBaseCallbackMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
options,
)
}
export interface MarsV2ZapperBaseWithdrawLiquidityMutation {
client: MarsV2ZapperBaseClient
msg: {
minimumReceive: Coin[]
recipient?: string
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsV2ZapperBaseWithdrawLiquidityMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsV2ZapperBaseWithdrawLiquidityMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsV2ZapperBaseWithdrawLiquidityMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.withdrawLiquidity(msg, fee, memo, funds),
options,
)
}
export interface MarsV2ZapperBaseProvideLiquidityMutation {
client: MarsV2ZapperBaseClient
msg: {
lpTokenOut: string
minimumReceive: Uint128
recipient?: string
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsV2ZapperBaseProvideLiquidityMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsV2ZapperBaseProvideLiquidityMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsV2ZapperBaseProvideLiquidityMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.provideLiquidity(msg, fee, memo, funds),
options,
)
}

View File

@ -1,51 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {}
export type ExecuteMsg =
| {
provide_liquidity: {
lp_token_out: string
minimum_receive: Uint128
recipient?: string | null
}
}
| {
withdraw_liquidity: {
minimum_receive: Coin[]
recipient?: string | null
}
}
| {
callback: CallbackMsg
}
export type Uint128 = string
export type CallbackMsg = {
return_coin: {
balance_before: Coin
recipient: Addr
}
}
export type Addr = string
export interface Coin {
amount: Uint128
denom: string
[k: string]: unknown
}
export type QueryMsg =
| {
estimate_provide_liquidity: {
coins_in: Coin[]
lp_token_out: string
}
}
| {
estimate_withdraw_liquidity: {
coin_in: Coin
}
}
export type ArrayOfCoin = Coin[]

View File

@ -1,14 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 _48 from './MarsV2ZapperBase.types'
import * as _49 from './MarsV2ZapperBase.client'
import * as _50 from './MarsV2ZapperBase.message-composer'
import * as _51 from './MarsV2ZapperBase.react-query'
export namespace contracts {
export const MarsV2ZapperBase = { ..._48, ..._49, ..._50, ..._51 }
}

View File

@ -1,169 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
CallbackMsg,
Coin,
ExecuteMsg,
InstantiateMsg,
NewPositionRequest,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsV3ZapperBase.types'
export interface MarsV3ZapperBaseReadOnlyInterface {
contractAddress: string
owner: () => Promise<OwnerResponse>
}
export class MarsV3ZapperBaseQueryClient implements MarsV3ZapperBaseReadOnlyInterface {
client: CosmWasmClient
contractAddress: string
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client
this.contractAddress = contractAddress
this.owner = this.owner.bind(this)
}
owner = async (): Promise<OwnerResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
owner: {},
})
}
}
export interface MarsV3ZapperBaseInterface extends MarsV3ZapperBaseReadOnlyInterface {
contractAddress: string
sender: string
createPosition: (
{
lowerTick,
poolId,
tokenMinAmount0,
tokenMinAmount1,
tokensProvided,
upperTick,
}: {
lowerTick: number
poolId: number
tokenMinAmount0: string
tokenMinAmount1: string
tokensProvided: Coin[]
upperTick: number
},
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
updateOwner: (
ownerUpdate: OwnerUpdate,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
callback: (
callbackMsg: CallbackMsg,
fee?: number | StdFee | 'auto',
memo?: string,
_funds?: Coin[],
) => Promise<ExecuteResult>
}
export class MarsV3ZapperBaseClient
extends MarsV3ZapperBaseQueryClient
implements MarsV3ZapperBaseInterface
{
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.createPosition = this.createPosition.bind(this)
this.updateOwner = this.updateOwner.bind(this)
this.callback = this.callback.bind(this)
}
createPosition = async (
{
lowerTick,
poolId,
tokenMinAmount0,
tokenMinAmount1,
tokensProvided,
upperTick,
}: {
lowerTick: number
poolId: number
tokenMinAmount0: string
tokenMinAmount1: string
tokensProvided: Coin[]
upperTick: number
},
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
create_position: {
lower_tick: lowerTick,
pool_id: poolId,
token_min_amount0: tokenMinAmount0,
token_min_amount1: tokenMinAmount1,
tokens_provided: tokensProvided,
upper_tick: upperTick,
},
},
fee,
memo,
_funds,
)
}
updateOwner = async (
ownerUpdate: OwnerUpdate,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
update_owner: ownerUpdate,
},
fee,
memo,
_funds,
)
}
callback = async (
callbackMsg: CallbackMsg,
fee: number | StdFee | 'auto' = 'auto',
memo?: string,
_funds?: Coin[],
): Promise<ExecuteResult> => {
return await this.client.execute(
this.sender,
this.contractAddress,
{
callback: callbackMsg,
},
fee,
memo,
_funds,
)
}
}

View File

@ -1,129 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 '@cosmjs/cosmwasm-stargate'
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
import { toUtf8 } from '@cosmjs/encoding'
import {
Addr,
CallbackMsg,
Coin,
ExecuteMsg,
InstantiateMsg,
NewPositionRequest,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsV3ZapperBase.types'
export interface MarsV3ZapperBaseMessage {
contractAddress: string
sender: string
createPosition: (
{
lowerTick,
poolId,
tokenMinAmount0,
tokenMinAmount1,
tokensProvided,
upperTick,
}: {
lowerTick: number
poolId: number
tokenMinAmount0: string
tokenMinAmount1: string
tokensProvided: Coin[]
upperTick: number
},
_funds?: Coin[],
) => MsgExecuteContractEncodeObject
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
callback: (callbackMsg: CallbackMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject
}
export class MarsV3ZapperBaseMessageComposer implements MarsV3ZapperBaseMessage {
sender: string
contractAddress: string
constructor(sender: string, contractAddress: string) {
this.sender = sender
this.contractAddress = contractAddress
this.createPosition = this.createPosition.bind(this)
this.updateOwner = this.updateOwner.bind(this)
this.callback = this.callback.bind(this)
}
createPosition = (
{
lowerTick,
poolId,
tokenMinAmount0,
tokenMinAmount1,
tokensProvided,
upperTick,
}: {
lowerTick: number
poolId: number
tokenMinAmount0: string
tokenMinAmount1: string
tokensProvided: Coin[]
upperTick: number
},
_funds?: Coin[],
): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
create_position: {
lower_tick: lowerTick,
pool_id: poolId,
token_min_amount0: tokenMinAmount0,
token_min_amount1: tokenMinAmount1,
tokens_provided: tokensProvided,
upper_tick: upperTick,
},
}),
),
funds: _funds,
}),
}
}
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
update_owner: ownerUpdate,
}),
),
funds: _funds,
}),
}
}
callback = (callbackMsg: CallbackMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(
JSON.stringify({
callback: callbackMsg,
}),
),
funds: _funds,
}),
}
}
}

View File

@ -1,124 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
import { StdFee } from '@cosmjs/amino'
import {
Addr,
CallbackMsg,
Coin,
ExecuteMsg,
InstantiateMsg,
NewPositionRequest,
OwnerResponse,
OwnerUpdate,
QueryMsg,
Uint128,
} from './MarsV3ZapperBase.types'
import { MarsV3ZapperBaseClient, MarsV3ZapperBaseQueryClient } from './MarsV3ZapperBase.client'
export const marsV3ZapperBaseQueryKeys = {
contract: [
{
contract: 'marsV3ZapperBase',
},
] as const,
address: (contractAddress: string | undefined) =>
[{ ...marsV3ZapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
[{ ...marsV3ZapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
}
export interface MarsV3ZapperBaseReactQuery<TResponse, TData = TResponse> {
client: MarsV3ZapperBaseQueryClient | undefined
options?: Omit<
UseQueryOptions<TResponse, Error, TData>,
"'queryKey' | 'queryFn' | 'initialData'"
> & {
initialData?: undefined
}
}
export interface MarsV3ZapperBaseOwnerQuery<TData>
extends MarsV3ZapperBaseReactQuery<OwnerResponse, TData> {}
export function useMarsV3ZapperBaseOwnerQuery<TData = OwnerResponse>({
client,
options,
}: MarsV3ZapperBaseOwnerQuery<TData>) {
return useQuery<OwnerResponse, Error, TData>(
marsV3ZapperBaseQueryKeys.owner(client?.contractAddress),
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
)
}
export interface MarsV3ZapperBaseCallbackMutation {
client: MarsV3ZapperBaseClient
msg: CallbackMsg
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsV3ZapperBaseCallbackMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsV3ZapperBaseCallbackMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsV3ZapperBaseCallbackMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
options,
)
}
export interface MarsV3ZapperBaseUpdateOwnerMutation {
client: MarsV3ZapperBaseClient
msg: OwnerUpdate
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsV3ZapperBaseUpdateOwnerMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsV3ZapperBaseUpdateOwnerMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsV3ZapperBaseUpdateOwnerMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
options,
)
}
export interface MarsV3ZapperBaseCreatePositionMutation {
client: MarsV3ZapperBaseClient
msg: {
lowerTick: number
poolId: number
tokenMinAmount0: string
tokenMinAmount1: string
tokensProvided: Coin[]
upperTick: number
}
args?: {
fee?: number | StdFee | 'auto'
memo?: string
funds?: Coin[]
}
}
export function useMarsV3ZapperBaseCreatePositionMutation(
options?: Omit<
UseMutationOptions<ExecuteResult, Error, MarsV3ZapperBaseCreatePositionMutation>,
'mutationFn'
>,
) {
return useMutation<ExecuteResult, Error, MarsV3ZapperBaseCreatePositionMutation>(
({ client, msg, args: { fee, memo, funds } = {} }) =>
client.createPosition(msg, fee, memo, funds),
options,
)
}

View File

@ -1,66 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 interface InstantiateMsg {
owner: string
}
export type ExecuteMsg =
| {
create_position: NewPositionRequest
}
| {
update_owner: OwnerUpdate
}
| {
callback: CallbackMsg
}
export type Uint128 = string
export type OwnerUpdate =
| {
propose_new_owner: {
proposed: string
}
}
| 'clear_proposed'
| 'accept_proposed'
| 'abolish_owner_role'
| {
set_emergency_owner: {
emergency_owner: string
}
}
| 'clear_emergency_owner'
export type CallbackMsg = {
refund_coin: {
denoms: string[]
recipient: Addr
}
}
export type Addr = string
export interface NewPositionRequest {
lower_tick: number
pool_id: number
token_min_amount0: string
token_min_amount1: string
tokens_provided: Coin[]
upper_tick: number
}
export interface Coin {
amount: Uint128
denom: string
[k: string]: unknown
}
export type QueryMsg = {
owner: {}
}
export interface OwnerResponse {
abolished: boolean
emergency_owner?: string | null
initialized: boolean
owner?: string | null
proposed?: string | null
}

View File

@ -1,14 +0,0 @@
// @ts-nocheck
/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
* 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 _52 from './MarsV3ZapperBase.types'
import * as _53 from './MarsV3ZapperBase.client'
import * as _54 from './MarsV3ZapperBase.message-composer'
import * as _55 from './MarsV3ZapperBase.react-query'
export namespace contracts {
export const MarsV3ZapperBase = { ..._52, ..._53, ..._54, ..._55 }
}

View File

@ -1,20 +1,20 @@
import { Market as RedBankMarket } from 'types/generated/mars-mock-red-bank/MarsMockRedBank.types'
import { Market as RedBankMarket } from 'types/generated/mars-red-bank/MarsRedBank.types'
import { AssetParamsBaseForAddr as AssetParams } from 'types/generated/mars-params/MarsParams.types'
export function resolveMarketResponses(responses: RedBankMarket[]): Market[] {
return responses.map(resolveMarketResponse)
}
export function resolveMarketResponse(response: RedBankMarket): Market {
export function resolveMarketResponse(
marketResponse: RedBankMarket,
assetParamsResponse: AssetParams,
): Market {
return {
denom: response.denom,
borrowRate: Number(response.borrow_rate),
debtTotalScaled: response.debt_total_scaled,
collateralTotalScaled: response.collateral_total_scaled,
depositEnabled: response.deposit_enabled,
borrowEnabled: response.borrow_enabled,
depositCap: response.deposit_cap,
maxLtv: Number(response.max_loan_to_value),
liquidityRate: Number(response.liquidity_rate),
liquidationThreshold: Number(response.liquidation_threshold),
denom: marketResponse.denom,
borrowRate: Number(marketResponse.borrow_rate),
debtTotalScaled: marketResponse.debt_total_scaled,
collateralTotalScaled: marketResponse.collateral_total_scaled,
depositEnabled: assetParamsResponse.red_bank.deposit_enabled,
borrowEnabled: assetParamsResponse.red_bank.borrow_enabled,
depositCap: assetParamsResponse.deposit_cap,
maxLtv: Number(assetParamsResponse.max_loan_to_value),
liquidityRate: Number(marketResponse.liquidity_rate),
liquidationThreshold: Number(assetParamsResponse.liquidation_threshold),
}
}