diff --git a/.env.example b/.env.example index 5cafa626..73d3a30d 100644 --- a/.env.example +++ b/.env.example @@ -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" diff --git a/src/api/cosmwasm-client.ts b/src/api/cosmwasm-client.ts index 015ff2d8..c65291a1 100644 --- a/src/api/cosmwasm-client.ts +++ b/src/api/cosmwasm-client.ts @@ -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 diff --git a/src/api/incentives/calculateAssetIncentivesApy.ts b/src/api/incentives/calculateAssetIncentivesApy.ts index a4adfcf2..584695fa 100644 --- a/src/api/incentives/calculateAssetIncentivesApy.ts +++ b/src/api/incentives/calculateAssetIncentivesApy.ts @@ -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) diff --git a/src/api/incentives/getAssetIncentive.ts b/src/api/incentives/getAssetIncentive.ts index a04b5a4e..dece84a1 100644 --- a/src/api/incentives/getAssetIncentive.ts +++ b/src/api/incentives/getAssetIncentive.ts @@ -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 { +export default async function getAssetIncentive(denom: string): Promise { 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 } } diff --git a/src/api/markets/getMarket.ts b/src/api/markets/getMarket.ts index cab1e272..623c3525 100644 --- a/src/api/markets/getMarket.ts +++ b/src/api/markets/getMarket.ts @@ -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 { 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 } diff --git a/src/api/markets/getMarkets.ts b/src/api/markets/getMarkets.ts index 50105408..aa448ba7 100644 --- a/src/api/markets/getMarkets.ts +++ b/src/api/markets/getMarkets.ts @@ -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 { 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 diff --git a/src/api/vaults/getVaultUtilizations.ts b/src/api/vaults/getVaultUtilizations.ts index 383829b1..2fe32e96 100644 --- a/src/api/vaults/getVaultUtilizations.ts +++ b/src/api/vaults/getVaultUtilizations.ts @@ -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 ( diff --git a/src/components/Modals/BorrowModal.tsx b/src/components/Modals/BorrowModal.tsx index b1cc4f0a..cb322a9f 100644 --- a/src/components/Modals/BorrowModal.tsx +++ b/src/components/Modals/BorrowModal.tsx @@ -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 } interface Props { account: Account + modal: BorrowModal } export default function BorrowModalController() { const account = useCurrentAccount() - if (!account) return null + const modal = useStore((s) => s.borrowModal) - return + if (account && modal) { + return + } + + 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() 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) { >
@@ -214,7 +219,7 @@ function BorrowModal(props: Props) { rightIcon={} /> - +
) diff --git a/src/constants/assets.ts b/src/constants/assets.ts index 13cb49ac..adc6a467 100644 --- a/src/constants/assets.ts +++ b/src/constants/assets.ts @@ -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', diff --git a/src/hooks/useHealthComputer.tsx b/src/hooks/useHealthComputer.tsx index 93ca9b91..d9be8ad6 100644 --- a/src/hooks/useHealthComputer.tsx +++ b/src/hooks/useHealthComputer.tsx @@ -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( diff --git a/src/store/slices/broadcast.ts b/src/store/slices/broadcast.ts index a0011ec0..41e6768a 100644 --- a/src/store/slices/broadcast.ts +++ b/src/store/slices/broadcast.ts @@ -313,7 +313,7 @@ export default function createBroadcastSlice( account_id: options.accountId, actions: [ { - lend: options.coin.toCoin(), + lend: options.coin.toActionCoin(options.isMax), }, ], }, diff --git a/src/types/generated/mars-account-nft/MarsAccountNft.client.ts b/src/types/generated/mars-account-nft/MarsAccountNft.client.ts index 0fc7bbc6..d2c9dce8 100644 --- a/src/types/generated/mars-account-nft/MarsAccountNft.client.ts +++ b/src/types/generated/mars-account-nft/MarsAccountNft.client.ts @@ -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 diff --git a/src/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts b/src/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts index bf1463bf..ac85511d 100644 --- a/src/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts +++ b/src/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts @@ -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 diff --git a/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts b/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts index 71f13fcd..ceea0e59 100644 --- a/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts +++ b/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts @@ -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: [ { diff --git a/src/types/generated/mars-account-nft/MarsAccountNft.types.ts b/src/types/generated/mars-account-nft/MarsAccountNft.types.ts index 2d35e803..f7ef1687 100644 --- a/src/types/generated/mars-account-nft/MarsAccountNft.types.ts +++ b/src/types/generated/mars-account-nft/MarsAccountNft.types.ts @@ -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. */ diff --git a/src/types/generated/mars-account-nft/bundle.ts b/src/types/generated/mars-account-nft/bundle.ts index 8dc6478e..b0ca12db 100644 --- a/src/types/generated/mars-account-nft/bundle.ts +++ b/src/types/generated/mars-account-nft/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts index fbcb6d93..ec409412 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts @@ -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 + accounts: ({ + limit, + owner, + startAfter, + }: { + limit?: number + owner: string + startAfter?: string + }) => Promise config: () => Promise vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise positions: ({ accountId }: { accountId: string }) => Promise @@ -91,21 +101,6 @@ export interface MarsCreditManagerReadOnlyInterface { limit?: number startAfter?: string }) => Promise - allLentShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - totalLentShares: () => Promise - allTotalLentShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }) => Promise 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 => { + return this.client.queryContractSmart(this.contractAddress, { + accounts: { + limit, + owner, + start_after: startAfter, + }, + }) + } config = async (): Promise => { 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 => { - return this.client.queryContractSmart(this.contractAddress, { - all_lent_shares: { - limit, - start_after: startAfter, - }, - }) - } - totalLentShares = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - total_lent_shares: {}, - }) - } - allTotalLentShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_total_lent_shares: { - limit, - start_after: startAfter, - }, - }) - } allVaultPositions = async ({ limit, startAfter, diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts index df344825..eeb49b48 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts @@ -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 diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts index 444da6ec..bad5a542 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts @@ -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) => + [ + { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'accounts', args }, + ] as const, config: (contractAddress: string | undefined, args?: Record) => [ { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }, @@ -125,30 +130,6 @@ export const marsCreditManagerQueryKeys = { args, }, ] as const, - allLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_lent_shares', - args, - }, - ] as const, - totalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_lent_shares', - args, - }, - ] as const, - allTotalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_lent_shares', - args, - }, - ] as const, allVaultPositions: (contractAddress: string | undefined, args?: Record) => [ { @@ -284,66 +265,6 @@ export function useMarsCreditManagerAllVaultPositionsQuery< { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsCreditManagerAllTotalLentSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsCreditManagerAllTotalLentSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllTotalLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args), - () => - client - ? client.allTotalLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerTotalLentSharesQuery - extends MarsCreditManagerReactQuery {} -export function useMarsCreditManagerTotalLentSharesQuery({ - client, - options, -}: MarsCreditManagerTotalLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.totalLentShares(client?.contractAddress), - () => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllLentSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsCreditManagerAllLentSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allLentShares(client?.contractAddress, args), - () => - client - ? client.allLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} export interface MarsCreditManagerAllTotalDebtSharesQuery extends MarsCreditManagerReactQuery { args: { @@ -484,6 +405,32 @@ export function useMarsCreditManagerConfigQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } +export interface MarsCreditManagerAccountsQuery + extends MarsCreditManagerReactQuery { + args: { + limit?: number + owner: string + startAfter?: string + } +} +export function useMarsCreditManagerAccountsQuery({ + client, + args, + options, +}: MarsCreditManagerAccountsQuery) { + return useQuery( + 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 extends MarsCreditManagerReactQuery { args: { diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts index 56970e77..8bded465 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts @@ -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 diff --git a/src/types/generated/mars-credit-manager/bundle.ts b/src/types/generated/mars-credit-manager/bundle.ts index f9684e57..ce848a6d 100644 --- a/src/types/generated/mars-credit-manager/bundle.ts +++ b/src/types/generated/mars-credit-manager/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-incentives/MarsIncentives.client.ts b/src/types/generated/mars-incentives/MarsIncentives.client.ts index ebb45173..566f4bbc 100644 --- a/src/types/generated/mars-incentives/MarsIncentives.client.ts +++ b/src/types/generated/mars-incentives/MarsIncentives.client.ts @@ -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 config: () => Promise - assetIncentive: ({ denom }: { denom: string }) => Promise - assetIncentives: ({ + incentiveState: ({ + collateralDenom, + incentiveDenom, + }: { + collateralDenom: string + incentiveDenom: string + }) => Promise + incentiveStates: ({ limit, - startAfter, + startAfterCollateralDenom, + startAfterIncentiveDenom, }: { limit?: number - startAfter?: string - }) => Promise - userUnclaimedRewards: ({ user }: { user: string }) => Promise + startAfterCollateralDenom?: string + startAfterIncentiveDenom?: string + }) => Promise + emission: ({ + collateralDenom, + incentiveDenom, + timestamp, + }: { + collateralDenom: string + incentiveDenom: string + timestamp: number + }) => Promise + emissions: ({ + collateralDenom, + incentiveDenom, + limit, + startAfterTimestamp, + }: { + collateralDenom: string + incentiveDenom: string + limit?: number + startAfterTimestamp?: number + }) => Promise + userUnclaimedRewards: ({ + limit, + startAfterCollateralDenom, + startAfterIncentiveDenom, + user, + }: { + limit?: number + startAfterCollateralDenom?: string + startAfterIncentiveDenom?: string + user: string + }) => Promise + whitelist: () => Promise } 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 => { + return this.client.queryContractSmart(this.contractAddress, { + active_emissions: { + collateral_denom: collateralDenom, + }, + }) + } config = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { config: {}, }) } - assetIncentive = async ({ denom }: { denom: string }): Promise => { + incentiveState = async ({ + collateralDenom, + incentiveDenom, + }: { + collateralDenom: string + incentiveDenom: string + }): Promise => { 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 => { + startAfterCollateralDenom?: string + startAfterIncentiveDenom?: string + }): Promise => { 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 => { + emission = async ({ + collateralDenom, + incentiveDenom, + timestamp, + }: { + collateralDenom: string + incentiveDenom: string + timestamp: number + }): Promise => { + 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 => { + 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 => { return this.client.queryContractSmart(this.contractAddress, { user_unclaimed_rewards: { + limit, + start_after_collateral_denom: startAfterCollateralDenom, + start_after_incentive_denom: startAfterIncentiveDenom, user, }, }) } + whitelist = async (): Promise => { + 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 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 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 => { + 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, diff --git a/src/types/generated/mars-incentives/MarsIncentives.react-query.ts b/src/types/generated/mars-incentives/MarsIncentives.react-query.ts index 3416cc4d..9386101c 100644 --- a/src/types/generated/mars-incentives/MarsIncentives.react-query.ts +++ b/src/types/generated/mars-incentives/MarsIncentives.react-query.ts @@ -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) => + [ + { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'active_emissions', args }, + ] as const, config: (contractAddress: string | undefined, args?: Record) => [{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'config', args }] as const, - assetIncentive: (contractAddress: string | undefined, args?: Record) => + incentiveState: (contractAddress: string | undefined, args?: Record) => [ - { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'asset_incentive', args }, + { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'incentive_state', args }, ] as const, - assetIncentives: (contractAddress: string | undefined, args?: Record) => + incentiveStates: (contractAddress: string | undefined, args?: Record) => [ - { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'asset_incentives', args }, + { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'incentive_states', args }, + ] as const, + emission: (contractAddress: string | undefined, args?: Record) => + [{ ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'emission', args }] as const, + emissions: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'emissions', args }, ] as const, userUnclaimedRewards: (contractAddress: string | undefined, args?: Record) => [ @@ -48,6 +65,10 @@ export const marsIncentivesQueryKeys = { args, }, ] as const, + whitelist: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsIncentivesQueryKeys.address(contractAddress)[0], method: 'whitelist', args }, + ] as const, } export interface MarsIncentivesReactQuery { client: MarsIncentivesQueryClient | undefined @@ -58,69 +79,145 @@ export interface MarsIncentivesReactQuery { initialData?: undefined } } +export interface MarsIncentivesWhitelistQuery + extends MarsIncentivesReactQuery {} +export function useMarsIncentivesWhitelistQuery({ + client, + options, +}: MarsIncentivesWhitelistQuery) { + return useQuery( + 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 - extends MarsIncentivesReactQuery { + extends MarsIncentivesReactQuery { args: { + limit?: number + startAfterCollateralDenom?: string + startAfterIncentiveDenom?: string user: string } } -export function useMarsIncentivesUserUnclaimedRewardsQuery({ +export function useMarsIncentivesUserUnclaimedRewardsQuery({ client, args, options, }: MarsIncentivesUserUnclaimedRewardsQuery) { - return useQuery( + return useQuery( 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 - extends MarsIncentivesReactQuery { +export interface MarsIncentivesEmissionsQuery + extends MarsIncentivesReactQuery { args: { + collateralDenom: string + incentiveDenom: string limit?: number - startAfter?: string + startAfterTimestamp?: number } } -export function useMarsIncentivesAssetIncentivesQuery({ +export function useMarsIncentivesEmissionsQuery({ client, args, options, -}: MarsIncentivesAssetIncentivesQuery) { - return useQuery( - marsIncentivesQueryKeys.assetIncentives(client?.contractAddress, args), +}: MarsIncentivesEmissionsQuery) { + return useQuery( + 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 - extends MarsIncentivesReactQuery { +export interface MarsIncentivesEmissionQuery + extends MarsIncentivesReactQuery { args: { - denom: string + collateralDenom: string + incentiveDenom: string + timestamp: number } } -export function useMarsIncentivesAssetIncentiveQuery({ +export function useMarsIncentivesEmissionQuery({ client, args, options, -}: MarsIncentivesAssetIncentiveQuery) { - return useQuery( - marsIncentivesQueryKeys.assetIncentive(client?.contractAddress, args), +}: MarsIncentivesEmissionQuery) { + return useQuery( + 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 + extends MarsIncentivesReactQuery { + args: { + limit?: number + startAfterCollateralDenom?: string + startAfterIncentiveDenom?: string + } +} +export function useMarsIncentivesIncentiveStatesQuery({ + client, + args, + options, +}: MarsIncentivesIncentiveStatesQuery) { + return useQuery( + 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 + extends MarsIncentivesReactQuery { + args: { + collateralDenom: string + incentiveDenom: string + } +} +export function useMarsIncentivesIncentiveStateQuery({ + client, + args, + options, +}: MarsIncentivesIncentiveStateQuery) { + return useQuery( + 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({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } +export interface MarsIncentivesActiveEmissionsQuery + extends MarsIncentivesReactQuery { + args: { + collateralDenom: string + } +} +export function useMarsIncentivesActiveEmissionsQuery({ + client, + args, + options, +}: MarsIncentivesActiveEmissionsQuery) { + return useQuery( + 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( - ({ 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, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.updateWhitelist(msg, fee, memo, funds), + options, + ) +} diff --git a/src/types/generated/mars-incentives/MarsIncentives.types.ts b/src/types/generated/mars-incentives/MarsIncentives.types.ts index f1328167..f3b2ca4d 100644 --- a/src/types/generated/mars-incentives/MarsIncentives.types.ts +++ b/src/types/generated/mars-incentives/MarsIncentives.types.ts @@ -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[] diff --git a/src/types/generated/mars-incentives/bundle.ts b/src/types/generated/mars-incentives/bundle.ts index 96ab4693..16d22368 100644 --- a/src/types/generated/mars-incentives/bundle.ts +++ b/src/types/generated/mars-incentives/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.client.ts b/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.client.ts deleted file mode 100644 index 6eb0ce54..00000000 --- a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.client.ts +++ /dev/null @@ -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 - config: () => Promise - vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise - positions: ({ accountId }: { accountId: string }) => Promise - allCoinBalances: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - allDebtShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - totalDebtShares: () => Promise - allTotalDebtShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }) => Promise - allLentShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - totalLentShares: () => Promise - allTotalLentShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }) => Promise - allVaultPositions: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - estimateProvideLiquidity: ({ - coinsIn, - lpTokenOut, - }: { - coinsIn: Coin[] - lpTokenOut: string - }) => Promise - estimateWithdrawLiquidity: ({ lpToken }: { lpToken: Coin }) => Promise - vaultPositionValue: ({ - vaultPosition, - }: { - vaultPosition: VaultPosition - }) => Promise -} -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 => { - return this.client.queryContractSmart(this.contractAddress, { - account_kind: { - account_id: accountId, - }, - }) - } - config = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - config: {}, - }) - } - vaultUtilization = async ({ - vault, - }: { - vault: VaultBaseForString - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - vault_utilization: { - vault, - }, - }) - } - positions = async ({ accountId }: { accountId: string }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - positions: { - account_id: accountId, - }, - }) - } - allCoinBalances = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_coin_balances: { - limit, - start_after: startAfter, - }, - }) - } - allDebtShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_debt_shares: { - limit, - start_after: startAfter, - }, - }) - } - totalDebtShares = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - total_debt_shares: {}, - }) - } - allTotalDebtShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_total_debt_shares: { - limit, - start_after: startAfter, - }, - }) - } - allLentShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_lent_shares: { - limit, - start_after: startAfter, - }, - }) - } - totalLentShares = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - total_lent_shares: {}, - }) - } - allTotalLentShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_total_lent_shares: { - limit, - start_after: startAfter, - }, - }) - } - allVaultPositions = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_vault_positions: { - limit, - start_after: startAfter, - }, - }) - } - estimateProvideLiquidity = async ({ - coinsIn, - lpTokenOut, - }: { - coinsIn: Coin[] - lpTokenOut: string - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - estimate_provide_liquidity: { - coins_in: coinsIn, - lp_token_out: lpTokenOut, - }, - }) - } - estimateWithdrawLiquidity = async ({ lpToken }: { lpToken: Coin }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - estimate_withdraw_liquidity: { - lp_token: lpToken, - }, - }) - } - vaultPositionValue = async ({ - vaultPosition, - }: { - vaultPosition: VaultPosition - }): Promise => { - 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 -} -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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - set_positions_response: { - account_id: accountId, - positions, - }, - }, - fee, - memo, - _funds, - ) - } -} diff --git a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.message-composer.ts b/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.message-composer.ts deleted file mode 100644 index 39c5d8c0..00000000 --- a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts b/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts deleted file mode 100644 index 74b9ca13..00000000 --- a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.react-query.ts +++ /dev/null @@ -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) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'account_kind', - args, - }, - ] as const, - config: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }, - ] as const, - vaultUtilization: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'vault_utilization', - args, - }, - ] as const, - positions: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args }, - ] as const, - allCoinBalances: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_coin_balances', - args, - }, - ] as const, - allDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_debt_shares', - args, - }, - ] as const, - totalDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_debt_shares', - args, - }, - ] as const, - allTotalDebtShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_debt_shares', - args, - }, - ] as const, - allLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_lent_shares', - args, - }, - ] as const, - totalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_lent_shares', - args, - }, - ] as const, - allTotalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_lent_shares', - args, - }, - ] as const, - allVaultPositions: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_vault_positions', - args, - }, - ] as const, - estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'estimate_provide_liquidity', - args, - }, - ] as const, - estimateWithdrawLiquidity: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'estimate_withdraw_liquidity', - args, - }, - ] as const, - vaultPositionValue: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], - method: 'vault_position_value', - args, - }, - ] as const, -} -export interface MarsMockCreditManagerReactQuery { - client: MarsMockCreditManagerQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsMockCreditManagerVaultPositionValueQuery - extends MarsMockCreditManagerReactQuery { - args: { - vaultPosition: VaultPosition - } -} -export function useMarsMockCreditManagerVaultPositionValueQuery({ - client, - args, - options, -}: MarsMockCreditManagerVaultPositionValueQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args), - () => - client - ? client.vaultPositionValue({ - vaultPosition: args.vaultPosition, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerEstimateWithdrawLiquidityQuery - extends MarsMockCreditManagerReactQuery { - args: { - lpToken: Coin - } -} -export function useMarsMockCreditManagerEstimateWithdrawLiquidityQuery({ - client, - args, - options, -}: MarsMockCreditManagerEstimateWithdrawLiquidityQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateWithdrawLiquidity({ - lpToken: args.lpToken, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerEstimateProvideLiquidityQuery - extends MarsMockCreditManagerReactQuery { - args: { - coinsIn: Coin[] - lpTokenOut: string - } -} -export function useMarsMockCreditManagerEstimateProvideLiquidityQuery({ - client, - args, - options, -}: MarsMockCreditManagerEstimateProvideLiquidityQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.estimateProvideLiquidity(client?.contractAddress, args), - () => - client - ? client.estimateProvideLiquidity({ - coinsIn: args.coinsIn, - lpTokenOut: args.lpTokenOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllVaultPositionsQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllVaultPositionsQuery< - TData = ArrayOfVaultPositionResponseItem, ->({ client, args, options }: MarsMockCreditManagerAllVaultPositionsQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allVaultPositions(client?.contractAddress, args), - () => - client - ? client.allVaultPositions({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllTotalLentSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsMockCreditManagerAllTotalLentSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllTotalLentSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args), - () => - client - ? client.allTotalLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerTotalLentSharesQuery - extends MarsMockCreditManagerReactQuery {} -export function useMarsMockCreditManagerTotalLentSharesQuery({ - client, - options, -}: MarsMockCreditManagerTotalLentSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.totalLentShares(client?.contractAddress), - () => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllLentSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllLentSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllLentSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allLentShares(client?.contractAddress, args), - () => - client - ? client.allLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllTotalDebtSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsMockCreditManagerAllTotalDebtSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllTotalDebtSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args), - () => - client - ? client.allTotalDebtShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerTotalDebtSharesQuery - extends MarsMockCreditManagerReactQuery {} -export function useMarsMockCreditManagerTotalDebtSharesQuery({ - client, - options, -}: MarsMockCreditManagerTotalDebtSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.totalDebtShares(client?.contractAddress), - () => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllDebtSharesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllDebtSharesQuery({ - client, - args, - options, -}: MarsMockCreditManagerAllDebtSharesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allDebtShares(client?.contractAddress, args), - () => - client - ? client.allDebtShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAllCoinBalancesQuery - extends MarsMockCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsMockCreditManagerAllCoinBalancesQuery< - TData = ArrayOfCoinBalanceResponseItem, ->({ client, args, options }: MarsMockCreditManagerAllCoinBalancesQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.allCoinBalances(client?.contractAddress, args), - () => - client - ? client.allCoinBalances({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerPositionsQuery - extends MarsMockCreditManagerReactQuery { - args: { - accountId: string - } -} -export function useMarsMockCreditManagerPositionsQuery({ - client, - args, - options, -}: MarsMockCreditManagerPositionsQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.positions(client?.contractAddress, args), - () => - client - ? client.positions({ - accountId: args.accountId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerVaultUtilizationQuery - extends MarsMockCreditManagerReactQuery { - args: { - vault: VaultBaseForString - } -} -export function useMarsMockCreditManagerVaultUtilizationQuery({ - client, - args, - options, -}: MarsMockCreditManagerVaultUtilizationQuery) { - return useQuery( - 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 - extends MarsMockCreditManagerReactQuery {} -export function useMarsMockCreditManagerConfigQuery({ - client, - options, -}: MarsMockCreditManagerConfigQuery) { - return useQuery( - marsMockCreditManagerQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsMockCreditManagerAccountKindQuery - extends MarsMockCreditManagerReactQuery { - args: { - accountId: string - } -} -export function useMarsMockCreditManagerAccountKindQuery({ - client, - args, - options, -}: MarsMockCreditManagerAccountKindQuery) { - return useQuery( - 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, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.setPositionsResponse(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.types.ts b/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.types.ts deleted file mode 100644 index b2020398..00000000 --- a/src/types/generated/mars-mock-credit-manager/MarsMockCreditManager.types.ts +++ /dev/null @@ -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 -} diff --git a/src/types/generated/mars-mock-credit-manager/bundle.ts b/src/types/generated/mars-mock-credit-manager/bundle.ts deleted file mode 100644 index 77553d89..00000000 --- a/src/types/generated/mars-mock-credit-manager/bundle.ts +++ /dev/null @@ -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 } -} diff --git a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts b/src/types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts deleted file mode 100644 index ae90fb6f..00000000 --- a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-mock-red-bank/bundle.ts b/src/types/generated/mars-mock-red-bank/bundle.ts deleted file mode 100644 index a3d47dd3..00000000 --- a/src/types/generated/mars-mock-red-bank/bundle.ts +++ /dev/null @@ -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 } -} diff --git a/src/types/generated/mars-mock-vault/MarsMockVault.client.ts b/src/types/generated/mars-mock-vault/MarsMockVault.client.ts index 020666eb..b4f6ec66 100644 --- a/src/types/generated/mars-mock-vault/MarsMockVault.client.ts +++ b/src/types/generated/mars-mock-vault/MarsMockVault.client.ts @@ -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 { diff --git a/src/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts b/src/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts index ef86bf07..51956585 100644 --- a/src/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts +++ b/src/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts @@ -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 { diff --git a/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts b/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts index 3a685a49..7471e954 100644 --- a/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts +++ b/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts @@ -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: [ { diff --git a/src/types/generated/mars-mock-vault/MarsMockVault.types.ts b/src/types/generated/mars-mock-vault/MarsMockVault.types.ts index a5f8fab3..34bbafd0 100644 --- a/src/types/generated/mars-mock-vault/MarsMockVault.types.ts +++ b/src/types/generated/mars-mock-vault/MarsMockVault.types.ts @@ -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 diff --git a/src/types/generated/mars-mock-vault/bundle.ts b/src/types/generated/mars-mock-vault/bundle.ts index 09436699..13a0df97 100644 --- a/src/types/generated/mars-mock-vault/bundle.ts +++ b/src/types/generated/mars-mock-vault/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client.ts b/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client.ts index 9df5e5b0..c70068b2 100644 --- a/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client.ts +++ b/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client.ts @@ -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 + custom: (fee?: number | StdFee | 'auto', memo?: string, _funds?: Coin[]) => Promise } 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 => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + custom: {}, + }, + fee, + memo, + _funds, + ) + } } diff --git a/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.react-query.ts b/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.react-query.ts index fcab034d..739c3a02 100644 --- a/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.react-query.ts +++ b/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.react-query.ts @@ -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({ { ...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, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => client.custom(msg, fee, memo, funds), + options, + ) +} export interface MarsOracleOsmosisUpdateConfigMutation { client: MarsOracleOsmosisClient msg: { diff --git a/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.types.ts b/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.types.ts index d5f9b5cb..d1ee479f 100644 --- a/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.types.ts +++ b/src/types/generated/mars-oracle-osmosis/MarsOracleOsmosis.types.ts @@ -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: { diff --git a/src/types/generated/mars-oracle-osmosis/bundle.ts b/src/types/generated/mars-oracle-osmosis/bundle.ts index 4703314d..cfdc6968 100644 --- a/src/types/generated/mars-oracle-osmosis/bundle.ts +++ b/src/types/generated/mars-oracle-osmosis/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-params/MarsParams.client.ts b/src/types/generated/mars-params/MarsParams.client.ts index fe054bb4..68968aa9 100644 --- a/src/types/generated/mars-params/MarsParams.client.ts +++ b/src/types/generated/mars-params/MarsParams.client.ts @@ -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 - maxCloseFactor: () => Promise + targetHealthFactor: () => Promise + totalDeposit: ({ denom }: { denom: string }) => Promise } 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 => { @@ -120,9 +123,16 @@ export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface { }, }) } - maxCloseFactor = async (): Promise => { + targetHealthFactor = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { - max_close_factor: {}, + target_health_factor: {}, + }) + } + totalDeposit = async ({ denom }: { denom: string }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + total_deposit: { + denom, + }, }) } } @@ -135,7 +145,7 @@ export interface MarsParamsInterface extends MarsParamsReadOnlyInterface { memo?: string, _funds?: Coin[], ) => Promise - 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, diff --git a/src/types/generated/mars-params/MarsParams.message-composer.ts b/src/types/generated/mars-params/MarsParams.message-composer.ts index 0185250b..b135caaa 100644 --- a/src/types/generated/mars-params/MarsParams.message-composer.ts +++ b/src/types/generated/mars-params/MarsParams.message-composer.ts @@ -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, diff --git a/src/types/generated/mars-params/MarsParams.react-query.ts b/src/types/generated/mars-params/MarsParams.react-query.ts index c3f82e4e..70179ee7 100644 --- a/src/types/generated/mars-params/MarsParams.react-query.ts +++ b/src/types/generated/mars-params/MarsParams.react-query.ts @@ -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) => + targetHealthFactor: (contractAddress: string | undefined, args?: Record) => [ - { ...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) => + [ + { ...marsParamsQueryKeys.address(contractAddress)[0], method: 'total_deposit', args }, ] as const, } export interface MarsParamsReactQuery { @@ -75,15 +80,37 @@ export interface MarsParamsReactQuery { initialData?: undefined } } -export interface MarsParamsMaxCloseFactorQuery +export interface MarsParamsTotalDepositQuery + extends MarsParamsReactQuery { + args: { + denom: string + } +} +export function useMarsParamsTotalDepositQuery({ + client, + args, + options, +}: MarsParamsTotalDepositQuery) { + return useQuery( + 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 extends MarsParamsReactQuery {} -export function useMarsParamsMaxCloseFactorQuery({ +export function useMarsParamsTargetHealthFactorQuery({ client, options, -}: MarsParamsMaxCloseFactorQuery) { +}: MarsParamsTargetHealthFactorQuery) { return useQuery( - 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ client, msg, args: { fee, memo, funds } = {} }) => - client.updateMaxCloseFactor(msg, fee, memo, funds), + client.updateTargetHealthFactor(msg, fee, memo, funds), options, ) } diff --git a/src/types/generated/mars-params/MarsParams.types.ts b/src/types/generated/mars-params/MarsParams.types.ts index aa046b17..04005ce3 100644 --- a/src/types/generated/mars-params/MarsParams.types.ts +++ b/src/types/generated/mars-params/MarsParams.types.ts @@ -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 +} diff --git a/src/types/generated/mars-params/bundle.ts b/src/types/generated/mars-params/bundle.ts index 41fb67b9..ff151def 100644 --- a/src/types/generated/mars-params/bundle.ts +++ b/src/types/generated/mars-params/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts b/src/types/generated/mars-red-bank/MarsRedBank.client.ts similarity index 93% rename from src/types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts rename to src/types/generated/mars-red-bank/MarsRedBank.client.ts index c89e1d9f..a29545a4 100644 --- a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts +++ b/src/types/generated/mars-red-bank/MarsRedBank.client.ts @@ -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 market: ({ denom }: { denom: string }) => Promise @@ -101,7 +100,7 @@ export interface MarsMockRedBankReadOnlyInterface { denom: string }) => Promise } -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 - updateEmergencyOwner: ( - ownerUpdate: OwnerUpdate, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise updateConfig: ( { config, @@ -445,10 +438,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa _funds?: Coin[], ) => Promise } -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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - update_emergency_owner: ownerUpdate, - }, - fee, - memo, - _funds, - ) - } updateConfig = async ( { config, diff --git a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts b/src/types/generated/mars-red-bank/MarsRedBank.react-query.ts similarity index 54% rename from src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts rename to src/types/generated/mars-red-bank/MarsRedBank.react-query.ts index 8541517d..394377bf 100644 --- a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts +++ b/src/types/generated/mars-red-bank/MarsRedBank.react-query.ts @@ -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) => - [{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'config', args }] as const, + [{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'config', args }] as const, market: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const, + [{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const, markets: (contractAddress: string | undefined, args?: Record) => - [{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'markets', args }] as const, + [{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'markets', args }] as const, uncollateralizedLoanLimit: ( contractAddress: string | undefined, args?: Record, ) => [ { - ...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) => - [ - { ...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) => - [ - { ...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) => [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collateral', args }, + { ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_collateral', args }, ] as const, userCollaterals: (contractAddress: string | undefined, args?: Record) => [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args }, + { ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args }, ] as const, userPosition: (contractAddress: string | undefined, args?: Record) => [ - { ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args }, + { ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args }, ] as const, scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record) => [ { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], + ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'scaled_liquidity_amount', args, }, ] as const, scaledDebtAmount: (contractAddress: string | undefined, args?: Record) => [ - { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], - method: 'scaled_debt_amount', - args, - }, + { ...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) => [ { - ...marsMockRedBankQueryKeys.address(contractAddress)[0], + ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'underlying_debt_amount', args, }, ] as const, } -export interface MarsMockRedBankReactQuery { - client: MarsMockRedBankQueryClient | undefined +export interface MarsRedBankReactQuery { + client: MarsRedBankQueryClient | undefined options?: Omit< UseQueryOptions, "'queryKey' | 'queryFn' | 'initialData'" @@ -133,20 +124,20 @@ export interface MarsMockRedBankReactQuery { initialData?: undefined } } -export interface MarsMockRedBankUnderlyingDebtAmountQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUnderlyingDebtAmountQuery + extends MarsRedBankReactQuery { args: { amountScaled: Uint128 denom: string } } -export function useMarsMockRedBankUnderlyingDebtAmountQuery({ +export function useMarsRedBankUnderlyingDebtAmountQuery({ client, args, options, -}: MarsMockRedBankUnderlyingDebtAmountQuery) { +}: MarsRedBankUnderlyingDebtAmountQuery) { return useQuery( - marsMockRedBankQueryKeys.underlyingDebtAmount(client?.contractAddress, args), + marsRedBankQueryKeys.underlyingDebtAmount(client?.contractAddress, args), () => client ? client.underlyingDebtAmount({ @@ -157,20 +148,20 @@ export function useMarsMockRedBankUnderlyingDebtAmountQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsMockRedBankUnderlyingLiquidityAmountQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUnderlyingLiquidityAmountQuery + extends MarsRedBankReactQuery { args: { amountScaled: Uint128 denom: string } } -export function useMarsMockRedBankUnderlyingLiquidityAmountQuery({ +export function useMarsRedBankUnderlyingLiquidityAmountQuery({ client, args, options, -}: MarsMockRedBankUnderlyingLiquidityAmountQuery) { +}: MarsRedBankUnderlyingLiquidityAmountQuery) { return useQuery( - marsMockRedBankQueryKeys.underlyingLiquidityAmount(client?.contractAddress, args), + marsRedBankQueryKeys.underlyingLiquidityAmount(client?.contractAddress, args), () => client ? client.underlyingLiquidityAmount({ @@ -181,20 +172,20 @@ export function useMarsMockRedBankUnderlyingLiquidityAmountQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankScaledDebtAmountQuery + extends MarsRedBankReactQuery { args: { amount: Uint128 denom: string } } -export function useMarsMockRedBankScaledDebtAmountQuery({ +export function useMarsRedBankScaledDebtAmountQuery({ client, args, options, -}: MarsMockRedBankScaledDebtAmountQuery) { +}: MarsRedBankScaledDebtAmountQuery) { return useQuery( - marsMockRedBankQueryKeys.scaledDebtAmount(client?.contractAddress, args), + marsRedBankQueryKeys.scaledDebtAmount(client?.contractAddress, args), () => client ? client.scaledDebtAmount({ @@ -205,20 +196,20 @@ export function useMarsMockRedBankScaledDebtAmountQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsMockRedBankScaledLiquidityAmountQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankScaledLiquidityAmountQuery + extends MarsRedBankReactQuery { args: { amount: Uint128 denom: string } } -export function useMarsMockRedBankScaledLiquidityAmountQuery({ +export function useMarsRedBankScaledLiquidityAmountQuery({ client, args, options, -}: MarsMockRedBankScaledLiquidityAmountQuery) { +}: MarsRedBankScaledLiquidityAmountQuery) { return useQuery( - marsMockRedBankQueryKeys.scaledLiquidityAmount(client?.contractAddress, args), + marsRedBankQueryKeys.scaledLiquidityAmount(client?.contractAddress, args), () => client ? client.scaledLiquidityAmount({ @@ -229,19 +220,19 @@ export function useMarsMockRedBankScaledLiquidityAmountQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsMockRedBankUserPositionQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUserPositionQuery + extends MarsRedBankReactQuery { args: { user: string } } -export function useMarsMockRedBankUserPositionQuery({ +export function useMarsRedBankUserPositionQuery({ client, args, options, -}: MarsMockRedBankUserPositionQuery) { +}: MarsRedBankUserPositionQuery) { return useQuery( - marsMockRedBankQueryKeys.userPosition(client?.contractAddress, args), + marsRedBankQueryKeys.userPosition(client?.contractAddress, args), () => client ? client.userPosition({ @@ -251,21 +242,21 @@ export function useMarsMockRedBankUserPositionQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUserCollateralsQuery + extends MarsRedBankReactQuery { args: { limit?: number startAfter?: string user: string } } -export function useMarsMockRedBankUserCollateralsQuery({ +export function useMarsRedBankUserCollateralsQuery({ client, args, options, -}: MarsMockRedBankUserCollateralsQuery) { +}: MarsRedBankUserCollateralsQuery) { return useQuery( - marsMockRedBankQueryKeys.userCollaterals(client?.contractAddress, args), + marsRedBankQueryKeys.userCollaterals(client?.contractAddress, args), () => client ? client.userCollaterals({ @@ -277,20 +268,20 @@ export function useMarsMockRedBankUserCollateralsQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUserCollateralQuery + extends MarsRedBankReactQuery { args: { denom: string user: string } } -export function useMarsMockRedBankUserCollateralQuery({ +export function useMarsRedBankUserCollateralQuery({ client, args, options, -}: MarsMockRedBankUserCollateralQuery) { +}: MarsRedBankUserCollateralQuery) { return useQuery( - marsMockRedBankQueryKeys.userCollateral(client?.contractAddress, args), + marsRedBankQueryKeys.userCollateral(client?.contractAddress, args), () => client ? client.userCollateral({ @@ -301,21 +292,21 @@ export function useMarsMockRedBankUserCollateralQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUserDebtsQuery + extends MarsRedBankReactQuery { args: { limit?: number startAfter?: string user: string } } -export function useMarsMockRedBankUserDebtsQuery({ +export function useMarsRedBankUserDebtsQuery({ client, args, options, -}: MarsMockRedBankUserDebtsQuery) { +}: MarsRedBankUserDebtsQuery) { return useQuery( - marsMockRedBankQueryKeys.userDebts(client?.contractAddress, args), + marsRedBankQueryKeys.userDebts(client?.contractAddress, args), () => client ? client.userDebts({ @@ -327,20 +318,20 @@ export function useMarsMockRedBankUserDebtsQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUserDebtQuery + extends MarsRedBankReactQuery { args: { denom: string user: string } } -export function useMarsMockRedBankUserDebtQuery({ +export function useMarsRedBankUserDebtQuery({ client, args, options, -}: MarsMockRedBankUserDebtQuery) { +}: MarsRedBankUserDebtQuery) { return useQuery( - marsMockRedBankQueryKeys.userDebt(client?.contractAddress, args), + marsRedBankQueryKeys.userDebt(client?.contractAddress, args), () => client ? client.userDebt({ @@ -351,19 +342,19 @@ export function useMarsMockRedBankUserDebtQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsMockRedBankUncollateralizedLoanLimitsQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUncollateralizedLoanLimitsQuery + extends MarsRedBankReactQuery { args: { limit?: number startAfter?: string user: string } } -export function useMarsMockRedBankUncollateralizedLoanLimitsQuery< +export function useMarsRedBankUncollateralizedLoanLimitsQuery< TData = ArrayOfUncollateralizedLoanLimitResponse, ->({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitsQuery) { +>({ client, args, options }: MarsRedBankUncollateralizedLoanLimitsQuery) { return useQuery( - 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 - extends MarsMockRedBankReactQuery { +export interface MarsRedBankUncollateralizedLoanLimitQuery + extends MarsRedBankReactQuery { args: { denom: string user: string } } -export function useMarsMockRedBankUncollateralizedLoanLimitQuery< +export function useMarsRedBankUncollateralizedLoanLimitQuery< TData = UncollateralizedLoanLimitResponse, ->({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitQuery) { +>({ client, args, options }: MarsRedBankUncollateralizedLoanLimitQuery) { return useQuery( - 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 - extends MarsMockRedBankReactQuery { +export interface MarsRedBankMarketsQuery + extends MarsRedBankReactQuery { args: { limit?: number startAfter?: string } } -export function useMarsMockRedBankMarketsQuery({ +export function useMarsRedBankMarketsQuery({ client, args, options, -}: MarsMockRedBankMarketsQuery) { +}: MarsRedBankMarketsQuery) { return useQuery( - marsMockRedBankQueryKeys.markets(client?.contractAddress, args), + marsRedBankQueryKeys.markets(client?.contractAddress, args), () => client ? client.markets({ @@ -421,19 +412,18 @@ export function useMarsMockRedBankMarketsQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsMockRedBankMarketQuery - extends MarsMockRedBankReactQuery { +export interface MarsRedBankMarketQuery extends MarsRedBankReactQuery { args: { denom: string } } -export function useMarsMockRedBankMarketQuery({ +export function useMarsRedBankMarketQuery({ client, args, options, -}: MarsMockRedBankMarketQuery) { +}: MarsRedBankMarketQuery) { return useQuery( - marsMockRedBankQueryKeys.market(client?.contractAddress, args), + marsRedBankQueryKeys.market(client?.contractAddress, args), () => client ? client.market({ @@ -443,20 +433,20 @@ export function useMarsMockRedBankMarketQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsMockRedBankConfigQuery - extends MarsMockRedBankReactQuery {} -export function useMarsMockRedBankConfigQuery({ +export interface MarsRedBankConfigQuery + extends MarsRedBankReactQuery {} +export function useMarsRedBankConfigQuery({ client, options, -}: MarsMockRedBankConfigQuery) { +}: MarsRedBankConfigQuery) { return useQuery( - 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, - 'mutationFn' - >, +export function useMarsRedBankRepayMutation( + options?: Omit, 'mutationFn'>, ) { - return useMutation( + return useMutation( ({ 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, - 'mutationFn' - >, +export function useMarsRedBankBorrowMutation( + options?: Omit, 'mutationFn'>, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( + return useMutation( ({ 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, + UseMutationOptions, 'mutationFn' >, ) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( + return useMutation( ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), options, ) diff --git a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts b/src/types/generated/mars-red-bank/MarsRedBank.types.ts similarity index 97% rename from src/types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts rename to src/types/generated/mars-red-bank/MarsRedBank.types.ts index 7b992d5b..10a39d40 100644 --- a/src/types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts +++ b/src/types/generated/mars-red-bank/MarsRedBank.types.ts @@ -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 { diff --git a/src/types/generated/mars-swapper-base/bundle.ts b/src/types/generated/mars-red-bank/bundle.ts similarity index 50% rename from src/types/generated/mars-swapper-base/bundle.ts rename to src/types/generated/mars-red-bank/bundle.ts index 23d5a092..1277c55d 100644 --- a/src/types/generated/mars-swapper-base/bundle.ts +++ b/src/types/generated/mars-red-bank/bundle.ts @@ -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 } } diff --git a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.client.ts b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.client.ts index bcdfc735..7975e367 100644 --- a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.client.ts +++ b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.client.ts @@ -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' diff --git a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.message-composer.ts b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.message-composer.ts index bcdfc735..7975e367 100644 --- a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.message-composer.ts +++ b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.message-composer.ts @@ -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' diff --git a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts index 3bd244be..eac6eec5 100644 --- a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts +++ b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.react-query.ts @@ -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' diff --git a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.types.ts b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.types.ts index 98f84b76..20dadd57 100644 --- a/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.types.ts +++ b/src/types/generated/mars-rover-health-computer/MarsRoverHealthComputer.types.ts @@ -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 -} diff --git a/src/types/generated/mars-rover-health-computer/bundle.ts b/src/types/generated/mars-rover-health-computer/bundle.ts index 2bedb8ef..6293c4bc 100644 --- a/src/types/generated/mars-rover-health-computer/bundle.ts +++ b/src/types/generated/mars-rover-health-computer/bundle.ts @@ -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. */ diff --git a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.client.ts b/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.client.ts deleted file mode 100644 index 4e791869..00000000 --- a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.client.ts +++ /dev/null @@ -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 - config: () => Promise -} -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 => { - return this.client.queryContractSmart(this.contractAddress, { - health: { - account_id: accountId, - kind, - }, - }) - } - config = async (): Promise => { - 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 - updateConfig: ( - { - creditManager, - params, - }: { - creditManager?: string - params?: string - }, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise -} -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 => { - 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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - update_config: { - credit_manager: creditManager, - params, - }, - }, - fee, - memo, - _funds, - ) - } -} diff --git a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.message-composer.ts b/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.message-composer.ts deleted file mode 100644 index 750aa5ca..00000000 --- a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts b/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts deleted file mode 100644 index 0c9cf83f..00000000 --- a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.react-query.ts +++ /dev/null @@ -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) => - [ - { ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'health', args }, - ] as const, - config: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'config', args }, - ] as const, -} -export interface MarsRoverHealthTypesReactQuery { - client: MarsRoverHealthTypesQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsRoverHealthTypesConfigQuery - extends MarsRoverHealthTypesReactQuery {} -export function useMarsRoverHealthTypesConfigQuery({ - client, - options, -}: MarsRoverHealthTypesConfigQuery) { - return useQuery( - marsRoverHealthTypesQueryKeys.config(client?.contractAddress), - () => (client ? client.config() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsRoverHealthTypesHealthQuery - extends MarsRoverHealthTypesReactQuery { - args: { - accountId: string - kind: AccountKind - } -} -export function useMarsRoverHealthTypesHealthQuery({ - client, - args, - options, -}: MarsRoverHealthTypesHealthQuery) { - return useQuery( - 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, - 'mutationFn' - >, -) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.types.ts b/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.types.ts deleted file mode 100644 index 3ef81045..00000000 --- a/src/types/generated/mars-rover-health-types/MarsRoverHealthTypes.types.ts +++ /dev/null @@ -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 -} diff --git a/src/types/generated/mars-rover-health-types/bundle.ts b/src/types/generated/mars-rover-health-types/bundle.ts deleted file mode 100644 index 6e5aaf5b..00000000 --- a/src/types/generated/mars-rover-health-types/bundle.ts +++ /dev/null @@ -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 } -} diff --git a/src/types/generated/mars-rover-health/MarsRoverHealth.client.ts b/src/types/generated/mars-rover-health/MarsRoverHealth.client.ts deleted file mode 100644 index 18abb165..00000000 --- a/src/types/generated/mars-rover-health/MarsRoverHealth.client.ts +++ /dev/null @@ -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 - config: () => Promise -} -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 => { - return this.client.queryContractSmart(this.contractAddress, { - health: { - account_id: accountId, - kind, - }, - }) - } - config = async (): Promise => { - 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 - updateConfig: ( - { - creditManager, - params, - }: { - creditManager?: string - params?: string - }, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise -} -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 => { - 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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - update_config: { - credit_manager: creditManager, - params, - }, - }, - fee, - memo, - _funds, - ) - } -} diff --git a/src/types/generated/mars-rover-health/MarsRoverHealth.message-composer.ts b/src/types/generated/mars-rover-health/MarsRoverHealth.message-composer.ts deleted file mode 100644 index 8b06be3b..00000000 --- a/src/types/generated/mars-rover-health/MarsRoverHealth.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-rover-health/MarsRoverHealth.react-query.ts b/src/types/generated/mars-rover-health/MarsRoverHealth.react-query.ts deleted file mode 100644 index d3c02a0c..00000000 --- a/src/types/generated/mars-rover-health/MarsRoverHealth.react-query.ts +++ /dev/null @@ -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) => - [{ ...marsRoverHealthQueryKeys.address(contractAddress)[0], method: 'health', args }] as const, - config: (contractAddress: string | undefined, args?: Record) => - [{ ...marsRoverHealthQueryKeys.address(contractAddress)[0], method: 'config', args }] as const, -} -export interface MarsRoverHealthReactQuery { - client: MarsRoverHealthQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsRoverHealthConfigQuery - extends MarsRoverHealthReactQuery {} -export function useMarsRoverHealthConfigQuery({ - client, - options, -}: MarsRoverHealthConfigQuery) { - return useQuery( - 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 - extends MarsRoverHealthReactQuery { - args: { - accountId: string - kind: AccountKind - } -} -export function useMarsRoverHealthHealthQuery({ - client, - args, - options, -}: MarsRoverHealthHealthQuery) { - return useQuery( - 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, - 'mutationFn' - >, -) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-rover-health/MarsRoverHealth.types.ts b/src/types/generated/mars-rover-health/MarsRoverHealth.types.ts deleted file mode 100644 index 3ef81045..00000000 --- a/src/types/generated/mars-rover-health/MarsRoverHealth.types.ts +++ /dev/null @@ -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 -} diff --git a/src/types/generated/mars-rover-health/bundle.ts b/src/types/generated/mars-rover-health/bundle.ts deleted file mode 100644 index 17b65c7d..00000000 --- a/src/types/generated/mars-rover-health/bundle.ts +++ /dev/null @@ -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 } -} diff --git a/src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts deleted file mode 100644 index 3ecb8be5..00000000 --- a/src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts +++ /dev/null @@ -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 - route: ({ - denomIn, - denomOut, - }: { - denomIn: string - denomOut: string - }) => Promise - routes: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - estimateExactInSwap: ({ - coinIn, - denomOut, - }: { - coinIn: Coin - denomOut: string - }) => Promise -} -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 => { - return this.client.queryContractSmart(this.contractAddress, { - owner: {}, - }) - } - route = async ({ - denomIn, - denomOut, - }: { - denomIn: string - denomOut: string - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - route: { - denom_in: denomIn, - denom_out: denomOut, - }, - }) - } - routes = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - routes: { - limit, - start_after: startAfter, - }, - }) - } - estimateExactInSwap = async ({ - coinIn, - denomOut, - }: { - coinIn: Coin - denomOut: string - }): Promise => { - 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 - setRoute: ( - { - denomIn, - denomOut, - route, - }: { - denomIn: string - denomOut: string - route: Empty - }, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise - swapExactIn: ( - { - coinIn, - denomOut, - slippage, - }: { - coinIn: Coin - denomOut: string - slippage: Decimal - }, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise - transferResult: ( - { - denomIn, - denomOut, - recipient, - }: { - denomIn: string - denomOut: string - recipient: Addr - }, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise -} -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 => { - 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 => { - 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 => { - 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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - transfer_result: { - denom_in: denomIn, - denom_out: denomOut, - recipient, - }, - }, - fee, - memo, - _funds, - ) - } -} diff --git a/src/types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts deleted file mode 100644 index 9b180ae2..00000000 --- a/src/types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts deleted file mode 100644 index 5cda4b1c..00000000 --- a/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts +++ /dev/null @@ -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) => - [{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const, - route: (contractAddress: string | undefined, args?: Record) => - [{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const, - routes: (contractAddress: string | undefined, args?: Record) => - [{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const, - estimateExactInSwap: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsSwapperBaseQueryKeys.address(contractAddress)[0], - method: 'estimate_exact_in_swap', - args, - }, - ] as const, -} -export interface MarsSwapperBaseReactQuery { - client: MarsSwapperBaseQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsSwapperBaseEstimateExactInSwapQuery - extends MarsSwapperBaseReactQuery { - args: { - coinIn: Coin - denomOut: string - } -} -export function useMarsSwapperBaseEstimateExactInSwapQuery({ - client, - args, - options, -}: MarsSwapperBaseEstimateExactInSwapQuery) { - return useQuery( - marsSwapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args), - () => - client - ? client.estimateExactInSwap({ - coinIn: args.coinIn, - denomOut: args.denomOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseRoutesQuery - extends MarsSwapperBaseReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsSwapperBaseRoutesQuery({ - client, - args, - options, -}: MarsSwapperBaseRoutesQuery) { - return useQuery( - marsSwapperBaseQueryKeys.routes(client?.contractAddress, args), - () => - client - ? client.routes({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseRouteQuery - extends MarsSwapperBaseReactQuery { - args: { - denomIn: string - denomOut: string - } -} -export function useMarsSwapperBaseRouteQuery({ - client, - args, - options, -}: MarsSwapperBaseRouteQuery) { - return useQuery( - marsSwapperBaseQueryKeys.route(client?.contractAddress, args), - () => - client - ? client.route({ - denomIn: args.denomIn, - denomOut: args.denomOut, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseOwnerQuery - extends MarsSwapperBaseReactQuery {} -export function useMarsSwapperBaseOwnerQuery({ - client, - options, -}: MarsSwapperBaseOwnerQuery) { - return useQuery( - marsSwapperBaseQueryKeys.owner(client?.contractAddress), - () => (client ? client.owner() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsSwapperBaseTransferResultMutation { - client: MarsSwapperBaseClient - msg: { - denomIn: string - denomOut: string - recipient: Addr - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseTransferResultMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.transferResult(msg, fee, memo, funds), - options, - ) -} -export interface MarsSwapperBaseSwapExactInMutation { - client: MarsSwapperBaseClient - msg: { - coinIn: Coin - denomOut: string - slippage: Decimal - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseSwapExactInMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds), - options, - ) -} -export interface MarsSwapperBaseSetRouteMutation { - client: MarsSwapperBaseClient - msg: { - denomIn: string - denomOut: string - route: Empty - } - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseSetRouteMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds), - options, - ) -} -export interface MarsSwapperBaseUpdateOwnerMutation { - client: MarsSwapperBaseClient - msg: OwnerUpdate - args?: { - fee?: number | StdFee | 'auto' - memo?: string - funds?: Coin[] - } -} -export function useMarsSwapperBaseUpdateOwnerMutation( - options?: Omit< - UseMutationOptions, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-swapper-base/MarsSwapperBase.types.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.types.ts deleted file mode 100644 index cb948d18..00000000 --- a/src/types/generated/mars-swapper-base/MarsSwapperBase.types.ts +++ /dev/null @@ -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[] diff --git a/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client.ts b/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client.ts index 3d0c789b..42a2e06e 100644 --- a/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client.ts +++ b/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client.ts @@ -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 diff --git a/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.message-composer.ts b/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.message-composer.ts deleted file mode 100644 index 4550ecba..00000000 --- a/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.react-query.ts b/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.react-query.ts index 1925cffa..08701f35 100644 --- a/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.react-query.ts +++ b/src/types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.react-query.ts @@ -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: [ diff --git a/src/types/generated/mars-swapper-osmosis/bundle.ts b/src/types/generated/mars-swapper-osmosis/bundle.ts index 5af932c8..66a5acd8 100644 --- a/src/types/generated/mars-swapper-osmosis/bundle.ts +++ b/src/types/generated/mars-swapper-osmosis/bundle.ts @@ -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 } } diff --git a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.client.ts b/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.client.ts deleted file mode 100644 index b3fb64fe..00000000 --- a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.client.ts +++ /dev/null @@ -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 - estimateWithdrawLiquidity: ({ coinIn }: { coinIn: Coin }) => Promise -} -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 => { - return this.client.queryContractSmart(this.contractAddress, { - estimate_provide_liquidity: { - coins_in: coinsIn, - lp_token_out: lpTokenOut, - }, - }) - } - estimateWithdrawLiquidity = async ({ coinIn }: { coinIn: Coin }): Promise => { - 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 - withdrawLiquidity: ( - { - minimumReceive, - recipient, - }: { - minimumReceive: Coin[] - recipient?: string - }, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise - callback: ( - callbackMsg: CallbackMsg, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise -} -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 => { - 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 => { - 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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - callback: callbackMsg, - }, - fee, - memo, - _funds, - ) - } -} diff --git a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.message-composer.ts b/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.message-composer.ts deleted file mode 100644 index 00f44e93..00000000 --- a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.react-query.ts b/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.react-query.ts deleted file mode 100644 index da2a52a1..00000000 --- a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.react-query.ts +++ /dev/null @@ -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) => - [ - { - ...marsV2ZapperBaseQueryKeys.address(contractAddress)[0], - method: 'estimate_provide_liquidity', - args, - }, - ] as const, - estimateWithdrawLiquidity: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsV2ZapperBaseQueryKeys.address(contractAddress)[0], - method: 'estimate_withdraw_liquidity', - args, - }, - ] as const, -} -export interface MarsV2ZapperBaseReactQuery { - client: MarsV2ZapperBaseQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsV2ZapperBaseEstimateWithdrawLiquidityQuery - extends MarsV2ZapperBaseReactQuery { - args: { - coinIn: Coin - } -} -export function useMarsV2ZapperBaseEstimateWithdrawLiquidityQuery({ - client, - args, - options, -}: MarsV2ZapperBaseEstimateWithdrawLiquidityQuery) { - return useQuery( - 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 - extends MarsV2ZapperBaseReactQuery { - args: { - coinsIn: Coin[] - lpTokenOut: string - } -} -export function useMarsV2ZapperBaseEstimateProvideLiquidityQuery({ - client, - args, - options, -}: MarsV2ZapperBaseEstimateProvideLiquidityQuery) { - return useQuery( - 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, - 'mutationFn' - >, -) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.provideLiquidity(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.types.ts b/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.types.ts deleted file mode 100644 index d367530a..00000000 --- a/src/types/generated/mars-v2-zapper-base/MarsV2ZapperBase.types.ts +++ /dev/null @@ -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[] diff --git a/src/types/generated/mars-v2-zapper-base/bundle.ts b/src/types/generated/mars-v2-zapper-base/bundle.ts deleted file mode 100644 index d45d51de..00000000 --- a/src/types/generated/mars-v2-zapper-base/bundle.ts +++ /dev/null @@ -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 } -} diff --git a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.client.ts b/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.client.ts deleted file mode 100644 index 8dcbbc3f..00000000 --- a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.client.ts +++ /dev/null @@ -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 -} -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 => { - 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 - updateOwner: ( - ownerUpdate: OwnerUpdate, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise - callback: ( - callbackMsg: CallbackMsg, - fee?: number | StdFee | 'auto', - memo?: string, - _funds?: Coin[], - ) => Promise -} -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 => { - 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 => { - 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 => { - return await this.client.execute( - this.sender, - this.contractAddress, - { - callback: callbackMsg, - }, - fee, - memo, - _funds, - ) - } -} diff --git a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.message-composer.ts b/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.message-composer.ts deleted file mode 100644 index 21b03db0..00000000 --- a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.message-composer.ts +++ /dev/null @@ -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, - }), - } - } -} diff --git a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.react-query.ts b/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.react-query.ts deleted file mode 100644 index f2dff863..00000000 --- a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.react-query.ts +++ /dev/null @@ -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) => - [{ ...marsV3ZapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const, -} -export interface MarsV3ZapperBaseReactQuery { - client: MarsV3ZapperBaseQueryClient | undefined - options?: Omit< - UseQueryOptions, - "'queryKey' | 'queryFn' | 'initialData'" - > & { - initialData?: undefined - } -} -export interface MarsV3ZapperBaseOwnerQuery - extends MarsV3ZapperBaseReactQuery {} -export function useMarsV3ZapperBaseOwnerQuery({ - client, - options, -}: MarsV3ZapperBaseOwnerQuery) { - return useQuery( - 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, - 'mutationFn' - >, -) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( - ({ 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, - 'mutationFn' - >, -) { - return useMutation( - ({ client, msg, args: { fee, memo, funds } = {} }) => - client.createPosition(msg, fee, memo, funds), - options, - ) -} diff --git a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.types.ts b/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.types.ts deleted file mode 100644 index baf3d1b4..00000000 --- a/src/types/generated/mars-v3-zapper-base/MarsV3ZapperBase.types.ts +++ /dev/null @@ -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 -} diff --git a/src/types/generated/mars-v3-zapper-base/bundle.ts b/src/types/generated/mars-v3-zapper-base/bundle.ts deleted file mode 100644 index 1605a0b6..00000000 --- a/src/types/generated/mars-v3-zapper-base/bundle.ts +++ /dev/null @@ -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 } -} diff --git a/src/utils/resolvers.ts b/src/utils/resolvers.ts index 3a9ee39e..5a69b2e8 100644 --- a/src/utils/resolvers.ts +++ b/src/utils/resolvers.ts @@ -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), } }