Mp 2993 update smart contracts (#262)
* feat: update contract addresses and types * feat: add account type * feat: comment out old contract vaults * tests: disable vaults test suite * instantiate contract-specfiic clients * fix build * rebase and fix test --------- Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
This commit is contained in:
parent
f614ad27fa
commit
db9f222732
@ -6,13 +6,14 @@ NEXT_PUBLIC_REST=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmos
|
||||
NEXT_PUBLIC_SWAP=https://testnet.osmosis.zone
|
||||
NEXT_PUBLIC_APOLLO_APR=https://api.apollo.farm/api/vault_infos/v2/osmo-test-5
|
||||
NEXT_PUBLIC_WALLETS=keplr,cosmostation
|
||||
NEXT_PUBLIC_ACCOUNT_NFT=osmo1ye2rntzz9qmxgv7eg09supww6k6xs0y0sekcr3x5clp087fymn4q3y33s4
|
||||
NEXT_PUBLIC_ACCOUNT_NFT=osmo1gmpua5rkzg6cmju73fz5a9x454nz4vwlnkgs4g8wjlyeqtmzsuhq5funky
|
||||
NEXT_PUBLIC_ORACLE=osmo1khe29uw3t85nmmp3mtr8dls7v2qwsfk3tndu5h4w5g2r5tzlz5qqarq2e2
|
||||
NEXT_PUBLIC_RED_BANK=osmo1dl4rylasnd7mtfzlkdqn2gr0ss4gvyykpvr6d7t5ylzf6z535n9s5jjt8u
|
||||
NEXT_PUBLIC_CREDIT_MANAGER=osmo15ywk53ck3wp6tnqgedfd8cnfx7fuhz9dr583hw8scp0xjgw46m0sf3kyyp
|
||||
NEXT_PUBLIC_CREDIT_MANAGER=osmo1sp7hlk78xpw6aer9wvskpz5ryknafw5lgf7f4jku4zfxkmuee6nqswkr8f
|
||||
NEXT_PUBLIC_INCENTIVES=osmo1zyz57xf82963mcsgqu3hq5y0h9mrltm4ttq2qe5mjth9ezp3375qe0sm7d
|
||||
NEXT_PUBLIC_ZAPPER=osmo1m77x80a5rgsdw3ak0hmxkhzltlh2qf3hjdu24fsnl9v3ekhvdugsmy94uh
|
||||
NEXT_PUBLIC_SWAPPER=osmo183uu809nq80xuh0r86dkadq9djza6ln5cf5hmszt6zcfdy454chq3dcgm4
|
||||
NEXT_PUBLIC_ZAPPER=osmo1dz3ysw5sl0rvvnvatv7nu6vyam687tentfuxfa22sxqqafdcnkdqht3uw5
|
||||
NEXT_PUBLIC_SWAPPER=osmo1q3p82qtudu7f5edgvqyzf6hk8xanezlr0w7ntypnsea4jfpe37ps29eay3
|
||||
NEXT_PUBLIC_PARAMS=osmo1xvg28lrr72662t9u0hntt76lyax9zvptdvdmff4k2q9dhjm8x6ws9zym4v
|
||||
NEXT_PUBLIC_API=http://localhost:3000/api
|
||||
|
||||
# MAINNET #
|
||||
|
@ -2,7 +2,7 @@ import { render } from '@testing-library/react'
|
||||
|
||||
import Modal from 'components/Modal'
|
||||
import UnlockModal from 'components/Modals/Unlock/UnlockModal'
|
||||
import { TESTNET_VAULTS } from 'constants/vaults'
|
||||
import { TESTNET_VAULTS_META_DATA } from 'constants/vaults'
|
||||
import useStore from 'store'
|
||||
import { BN } from 'utils/helpers'
|
||||
|
||||
@ -10,7 +10,7 @@ jest.mock('components/Modal')
|
||||
const mockedModal = jest.mocked(Modal).mockImplementation(() => <div>Modal</div>)
|
||||
|
||||
const mockedDepositedVault: DepositedVault = {
|
||||
...TESTNET_VAULTS[0],
|
||||
...TESTNET_VAULTS_META_DATA[0],
|
||||
status: 'active',
|
||||
apy: 1,
|
||||
ltv: {
|
||||
|
@ -22,12 +22,13 @@ describe('getVaultMetaData()', () => {
|
||||
expect(getVaultMetaData(testAddress)?.name).toBe(testVaultName)
|
||||
})
|
||||
|
||||
it('returns the TESTNET vault of given address WHEN environment configured to testnet', () => {
|
||||
jest.spyOn(constants, 'IS_TESTNET', 'get').mockReturnValue(true)
|
||||
// TODO: Update the following test suite accordingly after new testnet vaults placed in constants
|
||||
// it('returns the TESTNET vault of given address WHEN environment configured to testnet', () => {
|
||||
// jest.spyOn(constants, 'IS_TESTNET', 'get').mockReturnValue(true)
|
||||
|
||||
const testAddress = 'osmo1q40xvrzpldwq5he4ftsf7zm2jf80tj373qaven38yqrvhex8r9rs8n94kv'
|
||||
const testVaultName = 'OSMO-USDC.n'
|
||||
// const testAddress = 'osmo1q40xvrzpldwq5he4ftsf7zm2jf80tj373qaven38yqrvhex8r9rs8n94kv'
|
||||
// const testVaultName = 'OSMO-USDC.n'
|
||||
|
||||
expect(getVaultMetaData(testAddress)?.name).toBe(testVaultName)
|
||||
})
|
||||
// expect(getVaultMetaData(testAddress)?.name).toBe(testVaultName)
|
||||
// })
|
||||
})
|
||||
|
@ -1,14 +1,10 @@
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { ENV } from 'constants/env'
|
||||
import { getCreditManagerQueryClient } from 'api/cosmwasm-client'
|
||||
import { Positions } from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
||||
|
||||
export default async function getAccount(accountId: string): Promise<AccountResponse> {
|
||||
const client = await getClient()
|
||||
export default async function getAccount(accountId: string): Promise<Positions> {
|
||||
const creditManagerQueryClient = await getCreditManagerQueryClient()
|
||||
|
||||
const account: AccountResponse = await client.queryContractSmart(ENV.ADDRESS_CREDIT_MANAGER, {
|
||||
positions: {
|
||||
account_id: accountId,
|
||||
},
|
||||
})
|
||||
const account = creditManagerQueryClient.positions({ accountId })
|
||||
|
||||
if (account) {
|
||||
return account
|
||||
|
@ -1,8 +1,20 @@
|
||||
import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
||||
|
||||
import { ENV } from 'constants/env'
|
||||
import { MarsAccountNftQueryClient } from 'types/generated/mars-account-nft/MarsAccountNft.client'
|
||||
import { MarsCreditManagerQueryClient } from 'types/generated/mars-credit-manager/MarsCreditManager.client'
|
||||
import { MarsMockOracleQueryClient } from 'types/generated/mars-mock-oracle/MarsMockOracle.client'
|
||||
import { MarsMockRedBankQueryClient } from 'types/generated/mars-mock-red-bank/MarsMockRedBank.client'
|
||||
import { MarsMockRedBankReactQuery } from 'types/generated/mars-mock-red-bank/MarsMockRedBank.react-query'
|
||||
import { MarsMockVaultQueryClient } from 'types/generated/mars-mock-vault/MarsMockVault.client'
|
||||
import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client'
|
||||
|
||||
let _cosmWasmClient: CosmWasmClient
|
||||
let _accountNftQueryClient: MarsAccountNftQueryClient
|
||||
let _creditManagerQueryClient: MarsCreditManagerQueryClient
|
||||
let _oracleQueryClient: MarsMockOracleQueryClient
|
||||
let _redBankQueryClient: MarsMockRedBankQueryClient
|
||||
let _paramsQueryClient: MarsParamsQueryClient
|
||||
|
||||
const getClient = async () => {
|
||||
try {
|
||||
@ -16,4 +28,89 @@ const getClient = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
export { getClient }
|
||||
const getAccountNftQueryClient = async () => {
|
||||
try {
|
||||
if (!_accountNftQueryClient) {
|
||||
const client = await getClient()
|
||||
_accountNftQueryClient = new MarsAccountNftQueryClient(client, ENV.ADDRESS_ACCOUNT_NFT)
|
||||
}
|
||||
|
||||
return _accountNftQueryClient
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getCreditManagerQueryClient = async () => {
|
||||
try {
|
||||
if (!_creditManagerQueryClient) {
|
||||
const client = await getClient()
|
||||
_creditManagerQueryClient = new MarsCreditManagerQueryClient(
|
||||
client,
|
||||
ENV.ADDRESS_CREDIT_MANAGER,
|
||||
)
|
||||
}
|
||||
|
||||
return _creditManagerQueryClient
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getParamsQueryClient = async () => {
|
||||
try {
|
||||
if (!_paramsQueryClient) {
|
||||
const client = await getClient()
|
||||
_paramsQueryClient = new MarsParamsQueryClient(client, ENV.ADDRESS_PARAMS)
|
||||
}
|
||||
|
||||
return _paramsQueryClient
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getOracleQueryClient = async () => {
|
||||
try {
|
||||
if (!_oracleQueryClient) {
|
||||
const client = await getClient()
|
||||
_oracleQueryClient = new MarsMockOracleQueryClient(client, ENV.ADDRESS_ORACLE)
|
||||
}
|
||||
|
||||
return _oracleQueryClient
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getRedBankQueryClient = async () => {
|
||||
try {
|
||||
if (!_redBankQueryClient) {
|
||||
const client = await getClient()
|
||||
_redBankQueryClient = new MarsMockRedBankQueryClient(client, ENV.ADDRESS_RED_BANK)
|
||||
}
|
||||
|
||||
return _redBankQueryClient
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getVaultQueryClient = async (address: string) => {
|
||||
try {
|
||||
const client = await getClient()
|
||||
return new MarsMockVaultQueryClient(client, address)
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
getClient,
|
||||
getAccountNftQueryClient,
|
||||
getCreditManagerQueryClient,
|
||||
getParamsQueryClient,
|
||||
getOracleQueryClient,
|
||||
getRedBankQueryClient,
|
||||
getVaultQueryClient,
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
import { ENV } from 'constants/env'
|
||||
import getMarkets from 'api/markets/getMarkets'
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { getRedBankQueryClient } from 'api/cosmwasm-client'
|
||||
|
||||
export default async function getMarketDebts(): Promise<Coin[]> {
|
||||
try {
|
||||
const markets: Market[] = await getMarkets()
|
||||
const client = await getClient()
|
||||
const redBankQueryClient = await getRedBankQueryClient()
|
||||
|
||||
const debtQueries = markets.map((asset) =>
|
||||
client.queryContractSmart(ENV.ADDRESS_RED_BANK, {
|
||||
underlying_debt_amount: {
|
||||
denom: asset.denom,
|
||||
amount_scaled: asset.debtTotalScaled,
|
||||
},
|
||||
redBankQueryClient.underlyingDebtAmount({
|
||||
denom: asset.denom,
|
||||
amountScaled: asset.debtTotalScaled,
|
||||
}),
|
||||
)
|
||||
const debtsResults = await Promise.all(debtQueries)
|
||||
|
@ -1,18 +1,15 @@
|
||||
import { ENV } from 'constants/env'
|
||||
import getMarkets from 'api/markets/getMarkets'
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { getRedBankQueryClient } from 'api/cosmwasm-client'
|
||||
|
||||
export default async function getMarketDeposits(): Promise<Coin[]> {
|
||||
try {
|
||||
const markets: Market[] = await getMarkets()
|
||||
const client = await getClient()
|
||||
const redBankQueryClient = await getRedBankQueryClient()
|
||||
|
||||
const depositQueries = markets.map((asset) =>
|
||||
client.queryContractSmart(ENV.ADDRESS_RED_BANK, {
|
||||
underlying_liquidity_amount: {
|
||||
denom: asset.denom,
|
||||
amount_scaled: asset.collateralTotalScaled,
|
||||
},
|
||||
redBankQueryClient.underlyingLiquidityAmount({
|
||||
denom: asset.denom,
|
||||
amountScaled: asset.collateralTotalScaled,
|
||||
}),
|
||||
)
|
||||
const depositsResults = await Promise.all(depositQueries)
|
||||
|
@ -1,19 +1,14 @@
|
||||
import { ENV } from 'constants/env'
|
||||
import { getEnabledMarketAssets } from 'utils/assets'
|
||||
import { resolveMarketResponses } from 'utils/resolvers'
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { getRedBankQueryClient } from 'api/cosmwasm-client'
|
||||
|
||||
export default async function getMarkets(): Promise<Market[]> {
|
||||
try {
|
||||
const enabledAssets = getEnabledMarketAssets()
|
||||
const client = await getClient()
|
||||
const redBankQueryClient = await getRedBankQueryClient()
|
||||
|
||||
const marketQueries = enabledAssets.map((asset) =>
|
||||
client.queryContractSmart(ENV.ADDRESS_RED_BANK, {
|
||||
market: {
|
||||
denom: asset.denom,
|
||||
},
|
||||
}),
|
||||
redBankQueryClient.market({ denom: asset.denom }),
|
||||
)
|
||||
const marketResults = await Promise.all(marketQueries)
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { ENV } from 'constants/env'
|
||||
import { getOracleQueryClient } from 'api/cosmwasm-client'
|
||||
import { PriceResponse } from 'types/generated/mars-mock-oracle/MarsMockOracle.types'
|
||||
|
||||
export default async function getPrice(denom: string): Promise<PriceResult> {
|
||||
export default async function getPrice(denom: string): Promise<PriceResponse> {
|
||||
try {
|
||||
const client = await getClient()
|
||||
const oracleQueryClient = getOracleQueryClient()
|
||||
|
||||
return await client.queryContractSmart(ENV.ADDRESS_ORACLE, {
|
||||
price: {
|
||||
denom,
|
||||
},
|
||||
})
|
||||
return (await oracleQueryClient).price({ denom })
|
||||
} catch (ex) {
|
||||
throw ex
|
||||
}
|
||||
|
@ -1,23 +1,20 @@
|
||||
import { ASSETS } from 'constants/assets'
|
||||
import { ENV } from 'constants/env'
|
||||
import { getEnabledMarketAssets } from 'utils/assets'
|
||||
import { BN } from 'utils/helpers'
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { getOracleQueryClient } from 'api/cosmwasm-client'
|
||||
|
||||
export default async function getPrices(): Promise<Coin[]> {
|
||||
try {
|
||||
const enabledAssets = getEnabledMarketAssets()
|
||||
const client = await getClient()
|
||||
const oracleQueryClient = await getOracleQueryClient()
|
||||
const baseCurrency = ASSETS[0]
|
||||
|
||||
const priceQueries = enabledAssets.map((asset) =>
|
||||
client.queryContractSmart(ENV.ADDRESS_ORACLE, {
|
||||
price: {
|
||||
denom: asset.denom,
|
||||
},
|
||||
oracleQueryClient.price({
|
||||
denom: asset.denom,
|
||||
}),
|
||||
)
|
||||
const priceResults: PriceResult[] = await Promise.all(priceQueries)
|
||||
const priceResults = await Promise.all(priceQueries)
|
||||
|
||||
const assetPrices = priceResults.map(({ denom, price }, index) => {
|
||||
const asset = enabledAssets[index]
|
||||
|
@ -1,15 +1,13 @@
|
||||
import moment from 'moment'
|
||||
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { ENV } from 'constants/env'
|
||||
import { getClient, getCreditManagerQueryClient, getVaultQueryClient } from 'api/cosmwasm-client'
|
||||
import getVaults from 'api/vaults/getVaults'
|
||||
import { BN } from 'utils/helpers'
|
||||
import getPrice from 'api/prices/getPrice'
|
||||
import {
|
||||
Positions,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
} from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
||||
import { BN } from 'utils/helpers'
|
||||
import getPrice from 'api/prices/getPrice'
|
||||
|
||||
async function getUnlocksAtTimestamp(unlockingId: number, vaultAddress: string) {
|
||||
try {
|
||||
@ -73,25 +71,22 @@ async function getLpTokensForVaultPosition(
|
||||
vaultPosition: VaultPosition,
|
||||
): Promise<Coin[]> {
|
||||
try {
|
||||
const client = await getClient()
|
||||
const vaultQueryClient = await getVaultQueryClient(vault.address)
|
||||
const creditManagerQueryClient = await getCreditManagerQueryClient()
|
||||
const amounts = flatVaultPositionAmount(vaultPosition.amount)
|
||||
const totalAmount = BN(amounts.locked)
|
||||
.plus(BN(amounts.unlocked))
|
||||
.plus(BN(amounts.unlocking))
|
||||
.toString()
|
||||
|
||||
const lpAmount = await client.queryContractSmart(vault.address, {
|
||||
preview_redeem: {
|
||||
amount: totalAmount,
|
||||
},
|
||||
const lpAmount = await vaultQueryClient.previewRedeem({
|
||||
amount: totalAmount,
|
||||
})
|
||||
|
||||
const lpTokens: Coin[] = await client.queryContractSmart(ENV.ADDRESS_CREDIT_MANAGER, {
|
||||
estimate_withdraw_liquidity: {
|
||||
lp_token: {
|
||||
amount: lpAmount,
|
||||
denom: vault.denoms.lp,
|
||||
},
|
||||
const lpTokens = await creditManagerQueryClient.estimateWithdrawLiquidity({
|
||||
lpToken: {
|
||||
amount: lpAmount,
|
||||
denom: vault.denoms.lp,
|
||||
},
|
||||
})
|
||||
|
||||
@ -146,13 +141,8 @@ async function getVaultValuesAndAmounts(
|
||||
|
||||
async function getDepositedVaults(accountId: string): Promise<DepositedVault[]> {
|
||||
try {
|
||||
const client = await getClient()
|
||||
|
||||
const positionsQuery = client.queryContractSmart(ENV.ADDRESS_CREDIT_MANAGER, {
|
||||
positions: {
|
||||
account_id: accountId,
|
||||
},
|
||||
}) as Promise<Positions>
|
||||
const creditManagerQueryClient = await getCreditManagerQueryClient()
|
||||
const positionsQuery = creditManagerQueryClient.positions({ accountId })
|
||||
|
||||
const [positions, allVaults] = await Promise.all([positionsQuery, getVaults()])
|
||||
|
||||
|
@ -1,64 +1,27 @@
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { ENV, IS_TESTNET } from 'constants/env'
|
||||
import { TESTNET_VAULTS, VAULTS } from 'constants/vaults'
|
||||
import {
|
||||
ArrayOfVaultInfoResponse,
|
||||
VaultBaseForString,
|
||||
} from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
||||
import { getParamsQueryClient } from 'api/cosmwasm-client'
|
||||
import { ENV } from 'constants/env'
|
||||
import { VaultConfigBaseForString } from 'types/generated/mars-params/MarsParams.types'
|
||||
|
||||
export default async function getVaultConfigs(): Promise<VaultConfig[]> {
|
||||
const vaultInfos: VaultInfo[] = await getVaultInfos([])
|
||||
const vaults = IS_TESTNET ? TESTNET_VAULTS : VAULTS
|
||||
|
||||
return vaults.map((vaultMetaData) => {
|
||||
const vaultConfig = vaultInfos.find((vaultInfo) => vaultInfo.address === vaultMetaData.address)
|
||||
|
||||
return {
|
||||
...vaultMetaData,
|
||||
...vaultConfig,
|
||||
} as VaultConfig
|
||||
})
|
||||
}
|
||||
|
||||
const getVaultInfos = async (
|
||||
vaultInfos: VaultInfo[],
|
||||
startAfter?: VaultBaseForString,
|
||||
): Promise<VaultInfo[]> => {
|
||||
if (!ENV.ADDRESS_CREDIT_MANAGER) return []
|
||||
const client = await getClient()
|
||||
export const getVaultConfigs = async (
|
||||
vaultConfigs: VaultConfigBaseForString[],
|
||||
startAfter?: string,
|
||||
): Promise<VaultConfigBaseForString[]> => {
|
||||
if (!ENV.ADDRESS_PARAMS) return []
|
||||
const paramsQueryClient = await getParamsQueryClient()
|
||||
try {
|
||||
const batch: ArrayOfVaultInfoResponse = await client.queryContractSmart(
|
||||
ENV.ADDRESS_CREDIT_MANAGER,
|
||||
{
|
||||
vaults_info: { limit: 4, start_after: startAfter },
|
||||
},
|
||||
)
|
||||
|
||||
const batchProcessed = batch?.map((vaultInfo) => {
|
||||
return {
|
||||
address: vaultInfo.vault.address,
|
||||
cap: {
|
||||
denom: vaultInfo.config.deposit_cap.denom,
|
||||
used: Number(vaultInfo.utilization.amount),
|
||||
max: Number(vaultInfo.config.deposit_cap.amount),
|
||||
},
|
||||
ltv: {
|
||||
max: Number(vaultInfo.config.max_ltv),
|
||||
liq: Number(vaultInfo.config.liquidation_threshold),
|
||||
},
|
||||
} as VaultConfig
|
||||
const batch = await paramsQueryClient.allVaultConfigs({
|
||||
limit: 4,
|
||||
startAfter,
|
||||
})
|
||||
|
||||
vaultInfos.push(...batchProcessed)
|
||||
vaultConfigs.push(...batch)
|
||||
|
||||
if (batch.length === 4) {
|
||||
return await getVaultInfos(vaultInfos, {
|
||||
address: batchProcessed[batchProcessed.length - 1].address,
|
||||
} as VaultBaseForString)
|
||||
return await getVaultConfigs(vaultConfigs, batch[batch.length - 1].addr)
|
||||
}
|
||||
|
||||
return vaultInfos
|
||||
return vaultConfigs
|
||||
} catch {
|
||||
return vaultInfos
|
||||
return vaultConfigs
|
||||
}
|
||||
}
|
||||
|
20
src/api/vaults/getVaultUtilizations.ts
Normal file
20
src/api/vaults/getVaultUtilizations.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { getCreditManagerQueryClient } from 'api/cosmwasm-client'
|
||||
import { ENV } from 'constants/env'
|
||||
import { VaultUtilizationResponse } from 'types/generated/mars-mock-credit-manager/MarsMockCreditManager.types'
|
||||
import { VaultConfigBaseForString } from 'types/generated/mars-params/MarsParams.types'
|
||||
|
||||
export const getVaultUtilizations = async (
|
||||
vaultConfigs: VaultConfigBaseForString[],
|
||||
): Promise<VaultUtilizationResponse[]> => {
|
||||
if (!ENV.ADDRESS_PARAMS) return []
|
||||
const creditManagerQueryClient = await getCreditManagerQueryClient()
|
||||
try {
|
||||
const vaultUtilizations$ = vaultConfigs.map((vaultConfig) => {
|
||||
return creditManagerQueryClient.vaultUtilization({ vault: { address: vaultConfig.addr } })
|
||||
})
|
||||
|
||||
return await Promise.all(vaultUtilizations$).then((vaultUtilizations) => vaultUtilizations)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
@ -1,23 +1,45 @@
|
||||
import { convertAprToApy } from 'utils/parsers'
|
||||
import getVaultConfigs from 'api/vaults/getVaultConfigs'
|
||||
import getAprs from 'api/vaults/getVaultAprs'
|
||||
import { getVaultConfigs } from 'api/vaults/getVaultConfigs'
|
||||
import { getVaultUtilizations } from 'api/vaults/getVaultUtilizations'
|
||||
import { ENV } from 'constants/env'
|
||||
import { TESTNET_VAULTS_META_DATA, VAULTS_META_DATA } from 'constants/vaults'
|
||||
|
||||
export default async function getVaults(): Promise<Vault[]> {
|
||||
const $vaultConfigs = getVaultConfigs()
|
||||
const vaultConfigs = await getVaultConfigs([])
|
||||
const $vaultUtilizations = getVaultUtilizations(vaultConfigs)
|
||||
const $aprs = getAprs()
|
||||
const vaults: Vault[] = await Promise.all([$vaultConfigs, $aprs]).then(([vaultConfigs, aprs]) => {
|
||||
const vaultMetaDatas = ENV.NETWORK === 'testnet' ? TESTNET_VAULTS_META_DATA : VAULTS_META_DATA
|
||||
|
||||
const vaults: Vault[] = []
|
||||
await Promise.all([$vaultUtilizations, $aprs]).then(([vaultUtilizations, aprs]) => {
|
||||
return vaultConfigs.map((vaultConfig) => {
|
||||
const apr = aprs.find((apr) => apr.address === vaultConfig.address)
|
||||
if (apr) {
|
||||
return {
|
||||
...vaultConfig,
|
||||
apy: convertAprToApy(apr.apr, 365),
|
||||
}
|
||||
}
|
||||
return {
|
||||
...vaultConfig,
|
||||
apy: null,
|
||||
const apr = aprs.find((apr) => apr.address === vaultConfig.addr)
|
||||
const vaultMetaData = vaultMetaDatas.find(
|
||||
(vaultMetaData) => vaultMetaData.address === vaultConfig.addr,
|
||||
)
|
||||
|
||||
if (!vaultMetaData) return
|
||||
|
||||
const vault: Vault = {
|
||||
...vaultMetaData,
|
||||
cap: {
|
||||
max: Number(vaultConfig.deposit_cap.amount),
|
||||
denom: vaultConfig.deposit_cap.denom,
|
||||
used: Number(
|
||||
vaultUtilizations.find(
|
||||
(vaultUtilization) => vaultUtilization.vault.address === vaultConfig.addr,
|
||||
) || 0,
|
||||
),
|
||||
},
|
||||
apy: apr ? convertAprToApy(apr.apr, 365) : null,
|
||||
ltv: {
|
||||
max: Number(vaultConfig.max_loan_to_value),
|
||||
liq: Number(vaultConfig.liquidation_threshold),
|
||||
},
|
||||
}
|
||||
|
||||
vaults.push(vault)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1,14 +1,9 @@
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { ENV } from 'constants/env'
|
||||
import { getAccountNftQueryClient } from 'api/cosmwasm-client'
|
||||
|
||||
export default async function getAccountIds(address: string) {
|
||||
const client = await getClient()
|
||||
export default async function getAccountIds(address: string): Promise<string[]> {
|
||||
const accountNftQueryClient = await getAccountNftQueryClient()
|
||||
|
||||
const data = await client.queryContractSmart(ENV.ADDRESS_ACCOUNT_NFT, {
|
||||
tokens: {
|
||||
owner: address,
|
||||
},
|
||||
})
|
||||
const data = await accountNftQueryClient.tokens({ owner: address })
|
||||
|
||||
if (data.tokens) {
|
||||
return data.tokens
|
||||
|
@ -1,19 +1,12 @@
|
||||
import { ENV } from 'constants/env'
|
||||
import { resolvePositionResponses } from 'utils/resolvers'
|
||||
import getWalletAccountIds from 'api/wallets/getAccountIds'
|
||||
import { getClient } from 'api/cosmwasm-client'
|
||||
import { getCreditManagerQueryClient } from 'api/cosmwasm-client'
|
||||
|
||||
export default async function getAccounts(address: string): Promise<Account[]> {
|
||||
const accountIds: string[] = await getWalletAccountIds(address)
|
||||
const client = await getClient()
|
||||
const creditManagerQueryClient = await getCreditManagerQueryClient()
|
||||
|
||||
const $accounts: Promise<AccountResponse>[] = accountIds.map((accountId) =>
|
||||
client.queryContractSmart(ENV.ADDRESS_CREDIT_MANAGER!, {
|
||||
positions: {
|
||||
account_id: `${accountId}`,
|
||||
},
|
||||
}),
|
||||
)
|
||||
const $accounts = accountIds.map((accountId) => creditManagerQueryClient.positions({ accountId }))
|
||||
|
||||
const accounts = await Promise.all($accounts).then((accounts) => accounts)
|
||||
|
||||
|
@ -4,7 +4,7 @@ import Card from 'components/Card'
|
||||
import { VaultTable } from 'components/Earn/vault/VaultTable'
|
||||
import Text from 'components/Text'
|
||||
import { IS_TESTNET } from 'constants/env'
|
||||
import { TESTNET_VAULTS, VAULTS } from 'constants/vaults'
|
||||
import { TESTNET_VAULTS_META_DATA, VAULTS_META_DATA } from 'constants/vaults'
|
||||
import useVaults from 'hooks/useVaults'
|
||||
|
||||
function Content() {
|
||||
@ -27,7 +27,7 @@ export default function AvailableVaults() {
|
||||
|
||||
function Fallback() {
|
||||
// TODO: Replace with loading state of vaulttable
|
||||
const vaults = IS_TESTNET ? TESTNET_VAULTS : VAULTS
|
||||
const vaults = IS_TESTNET ? TESTNET_VAULTS_META_DATA : VAULTS_META_DATA
|
||||
return (
|
||||
<>
|
||||
{vaults.map((vault) => (
|
||||
|
@ -3,6 +3,7 @@ interface EnvironmentVariables {
|
||||
ADDRESS_CREDIT_MANAGER: string
|
||||
ADDRESS_INCENTIVES: string
|
||||
ADDRESS_ORACLE: string
|
||||
ADDRESS_PARAMS: string
|
||||
ADDRESS_RED_BANK: string
|
||||
ADDRESS_SWAPPER: string
|
||||
ADDRESS_ZAPPER: string
|
||||
@ -21,6 +22,7 @@ export const ENV: EnvironmentVariables = {
|
||||
ADDRESS_CREDIT_MANAGER: process.env.NEXT_PUBLIC_CREDIT_MANAGER || '',
|
||||
ADDRESS_INCENTIVES: process.env.NEXT_PUBLIC_INCENTIVES || '',
|
||||
ADDRESS_ORACLE: process.env.NEXT_PUBLIC_ORACLE || '',
|
||||
ADDRESS_PARAMS: process.env.NEXT_PUBLIC_PARAMS || '',
|
||||
ADDRESS_RED_BANK: process.env.NEXT_PUBLIC_RED_BANK || '',
|
||||
ADDRESS_SWAPPER: process.env.NEXT_PUBLIC_SWAPPER || '',
|
||||
ADDRESS_ZAPPER: process.env.NEXT_PUBLIC_ZAPPER || '',
|
||||
|
@ -1,6 +1,6 @@
|
||||
export const VAULT_DEPOSIT_BUFFER = 0.999
|
||||
|
||||
export const TESTNET_VAULTS: VaultMetaData[] = [
|
||||
export const TESTNET_VAULTS_META_DATA: VaultMetaData[] = [
|
||||
{
|
||||
address: 'osmo1q40xvrzpldwq5he4ftsf7zm2jf80tj373qaven38yqrvhex8r9rs8n94kv',
|
||||
name: 'OSMO-USDC.n',
|
||||
@ -60,7 +60,7 @@ export const TESTNET_VAULTS: VaultMetaData[] = [
|
||||
},
|
||||
]
|
||||
|
||||
export const VAULTS: VaultMetaData[] = [
|
||||
export const VAULTS_META_DATA: VaultMetaData[] = [
|
||||
// Mainnet Vaults
|
||||
{
|
||||
address: 'osmo1g3kmqpp8608szfp0pdag3r6z85npph7wmccat8lgl3mp407kv73qlj7qwp',
|
||||
|
@ -45,7 +45,7 @@ export default function createBroadcastSlice(
|
||||
},
|
||||
createAccount: async (options: { fee: StdFee }) => {
|
||||
const msg = {
|
||||
create_credit_account: {},
|
||||
create_credit_account: 'default',
|
||||
}
|
||||
set({ createAccountModal: true })
|
||||
const response = await get().executeMsg({ msg, fee: options.fee })
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -9,6 +9,8 @@ import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/co
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
Action,
|
||||
Addr,
|
||||
AllNftInfoResponseForEmpty,
|
||||
Approval,
|
||||
ApprovalResponse,
|
||||
@ -26,7 +28,9 @@ import {
|
||||
NumTokensResponse,
|
||||
OperatorsResponse,
|
||||
OwnerOfResponse,
|
||||
OwnershipForAddr,
|
||||
QueryMsg,
|
||||
String,
|
||||
Timestamp,
|
||||
TokensResponse,
|
||||
Uint128,
|
||||
@ -35,7 +39,7 @@ import {
|
||||
export interface MarsAccountNftReadOnlyInterface {
|
||||
contractAddress: string
|
||||
config: () => Promise<NftConfigBaseForString>
|
||||
nextId: () => Promise<Uint64>
|
||||
nextId: () => Promise<String>
|
||||
ownerOf: ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
@ -97,6 +101,7 @@ export interface MarsAccountNftReadOnlyInterface {
|
||||
startAfter?: string
|
||||
}) => Promise<TokensResponse>
|
||||
minter: () => Promise<MinterResponse>
|
||||
ownership: () => Promise<OwnershipForAddr>
|
||||
}
|
||||
export class MarsAccountNftQueryClient implements MarsAccountNftReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
@ -118,6 +123,7 @@ export class MarsAccountNftQueryClient implements MarsAccountNftReadOnlyInterfac
|
||||
this.tokens = this.tokens.bind(this)
|
||||
this.allTokens = this.allTokens.bind(this)
|
||||
this.minter = this.minter.bind(this)
|
||||
this.ownership = this.ownership.bind(this)
|
||||
}
|
||||
|
||||
config = async (): Promise<NftConfigBaseForString> => {
|
||||
@ -125,7 +131,7 @@ export class MarsAccountNftQueryClient implements MarsAccountNftReadOnlyInterfac
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
nextId = async (): Promise<Uint64> => {
|
||||
nextId = async (): Promise<String> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
next_id: {},
|
||||
})
|
||||
@ -262,6 +268,11 @@ export class MarsAccountNftQueryClient implements MarsAccountNftReadOnlyInterfac
|
||||
minter: {},
|
||||
})
|
||||
}
|
||||
ownership = async (): Promise<OwnershipForAddr> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
ownership: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface {
|
||||
contractAddress: string
|
||||
@ -274,12 +285,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
acceptMinterRole: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
mint: (
|
||||
{
|
||||
@ -289,7 +295,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
burn: (
|
||||
{
|
||||
@ -299,7 +305,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
transferNft: (
|
||||
{
|
||||
@ -311,7 +317,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
sendNft: (
|
||||
{
|
||||
@ -325,7 +331,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
approve: (
|
||||
{
|
||||
@ -339,7 +345,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
revoke: (
|
||||
{
|
||||
@ -351,7 +357,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
approveAll: (
|
||||
{
|
||||
@ -363,7 +369,7 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
revokeAll: (
|
||||
{
|
||||
@ -373,7 +379,13 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateOwnership: (
|
||||
action: Action,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsAccountNftClient
|
||||
@ -390,7 +402,6 @@ export class MarsAccountNftClient
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
this.acceptMinterRole = this.acceptMinterRole.bind(this)
|
||||
this.mint = this.mint.bind(this)
|
||||
this.burn = this.burn.bind(this)
|
||||
this.transferNft = this.transferNft.bind(this)
|
||||
@ -399,6 +410,7 @@ export class MarsAccountNftClient
|
||||
this.revoke = this.revoke.bind(this)
|
||||
this.approveAll = this.approveAll.bind(this)
|
||||
this.revokeAll = this.revokeAll.bind(this)
|
||||
this.updateOwnership = this.updateOwnership.bind(this)
|
||||
}
|
||||
|
||||
updateConfig = async (
|
||||
@ -409,7 +421,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -421,23 +433,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
acceptMinterRole = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
accept_minter_role: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
mint = async (
|
||||
@ -448,7 +444,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -460,7 +456,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
burn = async (
|
||||
@ -471,7 +467,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -483,7 +479,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
transferNft = async (
|
||||
@ -496,7 +492,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -509,7 +505,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
sendNft = async (
|
||||
@ -524,7 +520,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -538,7 +534,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
approve = async (
|
||||
@ -553,7 +549,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -567,7 +563,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
revoke = async (
|
||||
@ -580,7 +576,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -593,7 +589,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
approveAll = async (
|
||||
@ -606,7 +602,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -619,7 +615,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
revokeAll = async (
|
||||
@ -630,7 +626,7 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -642,7 +638,24 @@ export class MarsAccountNftClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateOwnership = async (
|
||||
action: Action,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_ownership: action,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,18 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { Coin } from '@cosmjs/amino'
|
||||
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
import {
|
||||
Action,
|
||||
Addr,
|
||||
AllNftInfoResponseForEmpty,
|
||||
Approval,
|
||||
ApprovalResponse,
|
||||
@ -28,7 +30,9 @@ import {
|
||||
NumTokensResponse,
|
||||
OperatorsResponse,
|
||||
OwnerOfResponse,
|
||||
OwnershipForAddr,
|
||||
QueryMsg,
|
||||
String,
|
||||
Timestamp,
|
||||
TokensResponse,
|
||||
Uint128,
|
||||
@ -43,16 +47,15 @@ export interface MarsAccountNftMessage {
|
||||
}: {
|
||||
updates: NftConfigUpdates
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
acceptMinterRole: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
mint: (
|
||||
{
|
||||
user,
|
||||
}: {
|
||||
user: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
burn: (
|
||||
{
|
||||
@ -60,7 +63,7 @@ export interface MarsAccountNftMessage {
|
||||
}: {
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
transferNft: (
|
||||
{
|
||||
@ -70,7 +73,7 @@ export interface MarsAccountNftMessage {
|
||||
recipient: string
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
sendNft: (
|
||||
{
|
||||
@ -82,7 +85,7 @@ export interface MarsAccountNftMessage {
|
||||
msg: Binary
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
approve: (
|
||||
{
|
||||
@ -94,7 +97,7 @@ export interface MarsAccountNftMessage {
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
revoke: (
|
||||
{
|
||||
@ -104,7 +107,7 @@ export interface MarsAccountNftMessage {
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
approveAll: (
|
||||
{
|
||||
@ -114,7 +117,7 @@ export interface MarsAccountNftMessage {
|
||||
expires?: Expiration
|
||||
operator: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
revokeAll: (
|
||||
{
|
||||
@ -122,8 +125,9 @@ export interface MarsAccountNftMessage {
|
||||
}: {
|
||||
operator: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateOwnership: (action: Action, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
sender: string
|
||||
@ -133,7 +137,6 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
this.acceptMinterRole = this.acceptMinterRole.bind(this)
|
||||
this.mint = this.mint.bind(this)
|
||||
this.burn = this.burn.bind(this)
|
||||
this.transferNft = this.transferNft.bind(this)
|
||||
@ -142,6 +145,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
this.revoke = this.revoke.bind(this)
|
||||
this.approveAll = this.approveAll.bind(this)
|
||||
this.revokeAll = this.revokeAll.bind(this)
|
||||
this.updateOwnership = this.updateOwnership.bind(this)
|
||||
}
|
||||
|
||||
updateConfig = (
|
||||
@ -150,7 +154,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
}: {
|
||||
updates: NftConfigUpdates
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -164,22 +168,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
acceptMinterRole = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
accept_minter_role: {},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -189,7 +178,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
}: {
|
||||
user: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -203,7 +192,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -213,7 +202,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
}: {
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -227,7 +216,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -239,7 +228,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
recipient: string
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -254,7 +243,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -268,7 +257,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
msg: Binary
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -284,7 +273,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -298,7 +287,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -314,7 +303,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -326,7 +315,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -341,7 +330,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -353,7 +342,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
expires?: Expiration
|
||||
operator: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -368,7 +357,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -378,7 +367,7 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
}: {
|
||||
operator: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -392,7 +381,22 @@ export class MarsAccountNftMessageComposer implements MarsAccountNftMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateOwnership = (action: Action, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_ownership: action,
|
||||
}),
|
||||
),
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,596 @@
|
||||
// @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 {
|
||||
Action,
|
||||
Addr,
|
||||
AllNftInfoResponseForEmpty,
|
||||
Approval,
|
||||
ApprovalResponse,
|
||||
ApprovalsResponse,
|
||||
Binary,
|
||||
ContractInfoResponse,
|
||||
Empty,
|
||||
ExecuteMsg,
|
||||
Expiration,
|
||||
InstantiateMsg,
|
||||
MinterResponse,
|
||||
NftConfigBaseForString,
|
||||
NftConfigUpdates,
|
||||
NftInfoResponseForEmpty,
|
||||
NumTokensResponse,
|
||||
OperatorsResponse,
|
||||
OwnerOfResponse,
|
||||
OwnershipForAddr,
|
||||
QueryMsg,
|
||||
String,
|
||||
Timestamp,
|
||||
TokensResponse,
|
||||
Uint128,
|
||||
Uint64,
|
||||
} from './MarsAccountNft.types'
|
||||
import { MarsAccountNftClient, MarsAccountNftQueryClient } from './MarsAccountNft.client'
|
||||
export const marsAccountNftQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsAccountNft',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsAccountNftQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
nextId: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'next_id', args }] as const,
|
||||
ownerOf: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'owner_of', args }] as const,
|
||||
approval: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approval', args }] as const,
|
||||
approvals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'approvals', args },
|
||||
] as const,
|
||||
allOperators: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_operators', args },
|
||||
] as const,
|
||||
numTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'num_tokens', args },
|
||||
] as const,
|
||||
contractInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'contract_info', args },
|
||||
] as const,
|
||||
nftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'nft_info', args }] as const,
|
||||
allNftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_nft_info', args },
|
||||
] as const,
|
||||
tokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'tokens', args }] as const,
|
||||
allTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'all_tokens', args },
|
||||
] as const,
|
||||
minter: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'minter', args }] as const,
|
||||
ownership: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsAccountNftQueryKeys.address(contractAddress)[0], method: 'ownership', args },
|
||||
] as const,
|
||||
}
|
||||
export interface MarsAccountNftReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsAccountNftQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsAccountNftOwnershipQuery<TData>
|
||||
extends MarsAccountNftReactQuery<OwnershipForAddr, TData> {}
|
||||
export function useMarsAccountNftOwnershipQuery<TData = OwnershipForAddr>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftOwnershipQuery<TData>) {
|
||||
return useQuery<OwnershipForAddr, Error, TData>(
|
||||
marsAccountNftQueryKeys.ownership(client?.contractAddress),
|
||||
() => (client ? client.ownership() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftMinterQuery<TData>
|
||||
extends MarsAccountNftReactQuery<MinterResponse, TData> {}
|
||||
export function useMarsAccountNftMinterQuery<TData = MinterResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftMinterQuery<TData>) {
|
||||
return useQuery<MinterResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.minter(client?.contractAddress),
|
||||
() => (client ? client.minter() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftAllTokensQuery<TData>
|
||||
extends MarsAccountNftReactQuery<TokensResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftAllTokensQuery<TData = TokensResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftAllTokensQuery<TData>) {
|
||||
return useQuery<TokensResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.allTokens(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTokens({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftTokensQuery<TData>
|
||||
extends MarsAccountNftReactQuery<TokensResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftTokensQuery<TData = TokensResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftTokensQuery<TData>) {
|
||||
return useQuery<TokensResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.tokens(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.tokens({
|
||||
limit: args.limit,
|
||||
owner: args.owner,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftAllNftInfoQuery<TData>
|
||||
extends MarsAccountNftReactQuery<AllNftInfoResponseForEmpty, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftAllNftInfoQuery<TData = AllNftInfoResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftAllNftInfoQuery<TData>) {
|
||||
return useQuery<AllNftInfoResponseForEmpty, Error, TData>(
|
||||
marsAccountNftQueryKeys.allNftInfo(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allNftInfo({
|
||||
includeExpired: args.includeExpired,
|
||||
tokenId: args.tokenId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftNftInfoQuery<TData>
|
||||
extends MarsAccountNftReactQuery<NftInfoResponseForEmpty, TData> {
|
||||
args: {
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftNftInfoQuery<TData = NftInfoResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftNftInfoQuery<TData>) {
|
||||
return useQuery<NftInfoResponseForEmpty, Error, TData>(
|
||||
marsAccountNftQueryKeys.nftInfo(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.nftInfo({
|
||||
tokenId: args.tokenId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftContractInfoQuery<TData>
|
||||
extends MarsAccountNftReactQuery<ContractInfoResponse, TData> {}
|
||||
export function useMarsAccountNftContractInfoQuery<TData = ContractInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftContractInfoQuery<TData>) {
|
||||
return useQuery<ContractInfoResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.contractInfo(client?.contractAddress),
|
||||
() => (client ? client.contractInfo() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftNumTokensQuery<TData>
|
||||
extends MarsAccountNftReactQuery<NumTokensResponse, TData> {}
|
||||
export function useMarsAccountNftNumTokensQuery<TData = NumTokensResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftNumTokensQuery<TData>) {
|
||||
return useQuery<NumTokensResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.numTokens(client?.contractAddress),
|
||||
() => (client ? client.numTokens() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftAllOperatorsQuery<TData>
|
||||
extends MarsAccountNftReactQuery<OperatorsResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftAllOperatorsQuery<TData = OperatorsResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftAllOperatorsQuery<TData>) {
|
||||
return useQuery<OperatorsResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.allOperators(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allOperators({
|
||||
includeExpired: args.includeExpired,
|
||||
limit: args.limit,
|
||||
owner: args.owner,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftApprovalsQuery<TData>
|
||||
extends MarsAccountNftReactQuery<ApprovalsResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftApprovalsQuery<TData = ApprovalsResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftApprovalsQuery<TData>) {
|
||||
return useQuery<ApprovalsResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.approvals(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.approvals({
|
||||
includeExpired: args.includeExpired,
|
||||
tokenId: args.tokenId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftApprovalQuery<TData>
|
||||
extends MarsAccountNftReactQuery<ApprovalResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftApprovalQuery<TData = ApprovalResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftApprovalQuery<TData>) {
|
||||
return useQuery<ApprovalResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.approval(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.approval({
|
||||
includeExpired: args.includeExpired,
|
||||
spender: args.spender,
|
||||
tokenId: args.tokenId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftOwnerOfQuery<TData>
|
||||
extends MarsAccountNftReactQuery<OwnerOfResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftOwnerOfQuery<TData = OwnerOfResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsAccountNftOwnerOfQuery<TData>) {
|
||||
return useQuery<OwnerOfResponse, Error, TData>(
|
||||
marsAccountNftQueryKeys.ownerOf(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.ownerOf({
|
||||
includeExpired: args.includeExpired,
|
||||
tokenId: args.tokenId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftNextIdQuery<TData> extends MarsAccountNftReactQuery<String, TData> {}
|
||||
export function useMarsAccountNftNextIdQuery<TData = String>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftNextIdQuery<TData>) {
|
||||
return useQuery<String, Error, TData>(
|
||||
marsAccountNftQueryKeys.nextId(client?.contractAddress),
|
||||
() => (client ? client.nextId() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftConfigQuery<TData>
|
||||
extends MarsAccountNftReactQuery<NftConfigBaseForString, TData> {}
|
||||
export function useMarsAccountNftConfigQuery<TData = NftConfigBaseForString>({
|
||||
client,
|
||||
options,
|
||||
}: MarsAccountNftConfigQuery<TData>) {
|
||||
return useQuery<NftConfigBaseForString, Error, TData>(
|
||||
marsAccountNftQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftUpdateOwnershipMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: Action
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftUpdateOwnershipMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftUpdateOwnershipMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftUpdateOwnershipMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateOwnership(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftRevokeAllMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
operator: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftRevokeAllMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftRevokeAllMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftRevokeAllMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.revokeAll(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftApproveAllMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
expires?: Expiration
|
||||
operator: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftApproveAllMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftApproveAllMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftApproveAllMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.approveAll(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftRevokeMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftRevokeMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftRevokeMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftRevokeMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.revoke(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftApproveMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
expires?: Expiration
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftApproveMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftApproveMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftApproveMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.approve(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftSendNftMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
contract: string
|
||||
msg: Binary
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftSendNftMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftSendNftMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftSendNftMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.sendNft(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftTransferNftMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
recipient: string
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftTransferNftMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftTransferNftMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftTransferNftMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.transferNft(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftBurnMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftBurnMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftBurnMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftBurnMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.burn(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftMintMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
user: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftMintMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftMintMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftMintMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.mint(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsAccountNftUpdateConfigMutation {
|
||||
client: MarsAccountNftClient
|
||||
msg: {
|
||||
updates: NftConfigUpdates
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsAccountNftUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsAccountNftUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsAccountNftUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -19,9 +19,6 @@ export type ExecuteMsg =
|
||||
updates: NftConfigUpdates
|
||||
}
|
||||
}
|
||||
| {
|
||||
accept_minter_role: {}
|
||||
}
|
||||
| {
|
||||
mint: {
|
||||
user: string
|
||||
@ -69,6 +66,9 @@ export type ExecuteMsg =
|
||||
operator: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
update_ownership: Action
|
||||
}
|
||||
export type Binary = string
|
||||
export type Expiration =
|
||||
| {
|
||||
@ -82,10 +82,18 @@ export type Expiration =
|
||||
}
|
||||
export type Timestamp = Uint64
|
||||
export type Uint64 = string
|
||||
export type Action =
|
||||
| {
|
||||
transfer_ownership: {
|
||||
expiry?: Expiration | null
|
||||
new_owner: string
|
||||
}
|
||||
}
|
||||
| 'accept_ownership'
|
||||
| 'renounce_ownership'
|
||||
export interface NftConfigUpdates {
|
||||
health_contract_addr?: string | null
|
||||
max_value_for_burn?: Uint128 | null
|
||||
proposed_new_minter?: string | null
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
@ -154,6 +162,9 @@ export type QueryMsg =
|
||||
| {
|
||||
minter: {}
|
||||
}
|
||||
| {
|
||||
ownership: {}
|
||||
}
|
||||
export interface AllNftInfoResponseForEmpty {
|
||||
access: OwnerOfResponse
|
||||
info: NftInfoResponseForEmpty
|
||||
@ -188,15 +199,21 @@ export interface ApprovalsResponse {
|
||||
export interface NftConfigBaseForString {
|
||||
health_contract_addr?: string | null
|
||||
max_value_for_burn: Uint128
|
||||
proposed_new_minter?: string | null
|
||||
}
|
||||
export interface ContractInfoResponse {
|
||||
name: string
|
||||
symbol: string
|
||||
}
|
||||
export interface MinterResponse {
|
||||
minter: string
|
||||
minter?: string | null
|
||||
}
|
||||
export type String = string
|
||||
export interface NumTokensResponse {
|
||||
count: number
|
||||
}
|
||||
export type Addr = string
|
||||
export interface OwnershipForAddr {
|
||||
owner?: Addr | null
|
||||
pending_expiry?: Expiration | null
|
||||
pending_owner?: Addr | null
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -9,6 +9,8 @@ import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/co
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
AccountNftBaseForString,
|
||||
Action,
|
||||
ActionAmount,
|
||||
ActionCoin,
|
||||
@ -18,10 +20,7 @@ import {
|
||||
ArrayOfDebtShares,
|
||||
ArrayOfLentShares,
|
||||
ArrayOfSharesResponseItem,
|
||||
ArrayOfString,
|
||||
ArrayOfVaultInfoResponse,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
ArrayOfVaultWithBalance,
|
||||
CallbackMsg,
|
||||
Coin,
|
||||
CoinBalanceResponseItem,
|
||||
@ -36,10 +35,14 @@ import {
|
||||
InstantiateMsg,
|
||||
LentAmount,
|
||||
LentShares,
|
||||
LiquidateRequestForVaultBaseForAddr,
|
||||
LiquidateRequestForVaultBaseForString,
|
||||
LockingVaultAmount,
|
||||
NftConfigUpdates,
|
||||
OracleBaseForString,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
ParamsBaseForString,
|
||||
Positions,
|
||||
QueryMsg,
|
||||
RedBankBaseForString,
|
||||
@ -51,36 +54,20 @@ import {
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultBaseForString,
|
||||
VaultConfig,
|
||||
VaultInfoResponse,
|
||||
VaultInstantiateConfig,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionResponseItem,
|
||||
VaultPositionType,
|
||||
VaultPositionValue,
|
||||
VaultUnlockingPosition,
|
||||
VaultWithBalance,
|
||||
VaultUtilizationResponse,
|
||||
ZapperBaseForString,
|
||||
} from './MarsCreditManager.types'
|
||||
export interface MarsCreditManagerReadOnlyInterface {
|
||||
contractAddress: string
|
||||
accountKind: ({ accountId }: { accountId: string }) => Promise<AccountKind>
|
||||
config: () => Promise<ConfigResponse>
|
||||
vaultInfo: ({ vault }: { vault: VaultBaseForString }) => Promise<VaultInfoResponse>
|
||||
vaultsInfo: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}) => Promise<ArrayOfVaultInfoResponse>
|
||||
allowedCoins: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfString>
|
||||
vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise<VaultUtilizationResponse>
|
||||
positions: ({ accountId }: { accountId: string }) => Promise<Positions>
|
||||
allCoinBalances: ({
|
||||
limit,
|
||||
@ -126,14 +113,6 @@ export interface MarsCreditManagerReadOnlyInterface {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}) => Promise<ArrayOfVaultPositionResponseItem>
|
||||
totalVaultCoinBalance: ({ vault }: { vault: VaultBaseForString }) => Promise<Uint128>
|
||||
allTotalVaultCoinBalances: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}) => Promise<ArrayOfVaultWithBalance>
|
||||
estimateProvideLiquidity: ({
|
||||
coinsIn,
|
||||
lpTokenOut,
|
||||
@ -155,10 +134,9 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.accountKind = this.accountKind.bind(this)
|
||||
this.config = this.config.bind(this)
|
||||
this.vaultInfo = this.vaultInfo.bind(this)
|
||||
this.vaultsInfo = this.vaultsInfo.bind(this)
|
||||
this.allowedCoins = this.allowedCoins.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)
|
||||
@ -168,53 +146,34 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
|
||||
this.totalLentShares = this.totalLentShares.bind(this)
|
||||
this.allTotalLentShares = this.allTotalLentShares.bind(this)
|
||||
this.allVaultPositions = this.allVaultPositions.bind(this)
|
||||
this.totalVaultCoinBalance = this.totalVaultCoinBalance.bind(this)
|
||||
this.allTotalVaultCoinBalances = this.allTotalVaultCoinBalances.bind(this)
|
||||
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
|
||||
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
|
||||
this.vaultPositionValue = this.vaultPositionValue.bind(this)
|
||||
}
|
||||
|
||||
accountKind = async ({ accountId }: { accountId: string }): Promise<AccountKind> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
account_kind: {
|
||||
account_id: accountId,
|
||||
},
|
||||
})
|
||||
}
|
||||
config = async (): Promise<ConfigResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
vaultInfo = async ({ vault }: { vault: VaultBaseForString }): Promise<VaultInfoResponse> => {
|
||||
vaultUtilization = async ({
|
||||
vault,
|
||||
}: {
|
||||
vault: VaultBaseForString
|
||||
}): Promise<VaultUtilizationResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
vault_info: {
|
||||
vault_utilization: {
|
||||
vault,
|
||||
},
|
||||
})
|
||||
}
|
||||
vaultsInfo = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}): Promise<ArrayOfVaultInfoResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
vaults_info: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
allowedCoins = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<ArrayOfString> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
allowed_coins: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
positions = async ({ accountId }: { accountId: string }): Promise<Positions> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
positions: {
|
||||
@ -316,27 +275,6 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn
|
||||
},
|
||||
})
|
||||
}
|
||||
totalVaultCoinBalance = async ({ vault }: { vault: VaultBaseForString }): Promise<Uint128> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
total_vault_coin_balance: {
|
||||
vault,
|
||||
},
|
||||
})
|
||||
}
|
||||
allTotalVaultCoinBalances = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}): Promise<ArrayOfVaultWithBalance> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_total_vault_coin_balances: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
estimateProvideLiquidity = async ({
|
||||
coinsIn,
|
||||
lpTokenOut,
|
||||
@ -376,7 +314,7 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt
|
||||
createCreditAccount: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateCreditAccount: (
|
||||
{
|
||||
@ -388,7 +326,17 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
repayFromWallet: (
|
||||
{
|
||||
accountId,
|
||||
}: {
|
||||
accountId: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateConfig: (
|
||||
{
|
||||
@ -398,27 +346,31 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateNftConfig: (
|
||||
{
|
||||
updates,
|
||||
config,
|
||||
ownership,
|
||||
}: {
|
||||
updates: NftConfigUpdates
|
||||
config?: NftConfigUpdates
|
||||
ownership?: Action
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
callback: (
|
||||
callbackMsg: CallbackMsg,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsCreditManagerClient
|
||||
@ -436,6 +388,7 @@ export class MarsCreditManagerClient
|
||||
this.contractAddress = contractAddress
|
||||
this.createCreditAccount = this.createCreditAccount.bind(this)
|
||||
this.updateCreditAccount = this.updateCreditAccount.bind(this)
|
||||
this.repayFromWallet = this.repayFromWallet.bind(this)
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
this.updateOwner = this.updateOwner.bind(this)
|
||||
this.updateNftConfig = this.updateNftConfig.bind(this)
|
||||
@ -445,7 +398,7 @@ export class MarsCreditManagerClient
|
||||
createCreditAccount = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -455,7 +408,7 @@ export class MarsCreditManagerClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateCreditAccount = async (
|
||||
@ -468,7 +421,7 @@ export class MarsCreditManagerClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -481,7 +434,30 @@ export class MarsCreditManagerClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
repayFromWallet = async (
|
||||
{
|
||||
accountId,
|
||||
}: {
|
||||
accountId: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
repay_from_wallet: {
|
||||
account_id: accountId,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateConfig = async (
|
||||
@ -492,7 +468,7 @@ export class MarsCreditManagerClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -504,62 +480,67 @@ export class MarsCreditManagerClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateNftConfig = async (
|
||||
{
|
||||
updates,
|
||||
config,
|
||||
ownership,
|
||||
}: {
|
||||
updates: NftConfigUpdates
|
||||
config?: NftConfigUpdates
|
||||
ownership?: Action
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_nft_config: {
|
||||
updates,
|
||||
config,
|
||||
ownership,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
callback = async (
|
||||
callbackMsg: CallbackMsg,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
callback: {},
|
||||
callback: callbackMsg,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,17 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
AccountNftBaseForString,
|
||||
Action,
|
||||
ActionAmount,
|
||||
ActionCoin,
|
||||
@ -19,10 +21,7 @@ import {
|
||||
ArrayOfDebtShares,
|
||||
ArrayOfLentShares,
|
||||
ArrayOfSharesResponseItem,
|
||||
ArrayOfString,
|
||||
ArrayOfVaultInfoResponse,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
ArrayOfVaultWithBalance,
|
||||
CallbackMsg,
|
||||
Coin,
|
||||
CoinBalanceResponseItem,
|
||||
@ -37,10 +36,14 @@ import {
|
||||
InstantiateMsg,
|
||||
LentAmount,
|
||||
LentShares,
|
||||
LiquidateRequestForVaultBaseForAddr,
|
||||
LiquidateRequestForVaultBaseForString,
|
||||
LockingVaultAmount,
|
||||
NftConfigUpdates,
|
||||
OracleBaseForString,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
ParamsBaseForString,
|
||||
Positions,
|
||||
QueryMsg,
|
||||
RedBankBaseForString,
|
||||
@ -52,22 +55,19 @@ import {
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultBaseForString,
|
||||
VaultConfig,
|
||||
VaultInfoResponse,
|
||||
VaultInstantiateConfig,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionResponseItem,
|
||||
VaultPositionType,
|
||||
VaultPositionValue,
|
||||
VaultUnlockingPosition,
|
||||
VaultWithBalance,
|
||||
VaultUtilizationResponse,
|
||||
ZapperBaseForString,
|
||||
} from './MarsCreditManager.types'
|
||||
export interface MarsCreditManagerMessage {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
createCreditAccount: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
createCreditAccount: (_funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateCreditAccount: (
|
||||
{
|
||||
accountId,
|
||||
@ -76,7 +76,15 @@ export interface MarsCreditManagerMessage {
|
||||
accountId: string
|
||||
actions: Action[]
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
repayFromWallet: (
|
||||
{
|
||||
accountId,
|
||||
}: {
|
||||
accountId: string
|
||||
},
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateConfig: (
|
||||
{
|
||||
@ -84,18 +92,20 @@ export interface MarsCreditManagerMessage {
|
||||
}: {
|
||||
updates: ConfigUpdates
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateOwner: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateNftConfig: (
|
||||
{
|
||||
updates,
|
||||
config,
|
||||
ownership,
|
||||
}: {
|
||||
updates: NftConfigUpdates
|
||||
config?: NftConfigUpdates
|
||||
ownership?: Action
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
callback: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
callback: (callbackMsg: CallbackMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessage {
|
||||
sender: string
|
||||
@ -106,13 +116,14 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
this.contractAddress = contractAddress
|
||||
this.createCreditAccount = this.createCreditAccount.bind(this)
|
||||
this.updateCreditAccount = this.updateCreditAccount.bind(this)
|
||||
this.repayFromWallet = this.repayFromWallet.bind(this)
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
this.updateOwner = this.updateOwner.bind(this)
|
||||
this.updateNftConfig = this.updateNftConfig.bind(this)
|
||||
this.callback = this.callback.bind(this)
|
||||
}
|
||||
|
||||
createCreditAccount = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
createCreditAccount = (_funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -123,7 +134,7 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
create_credit_account: {},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -135,7 +146,7 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
accountId: string
|
||||
actions: Action[]
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -150,7 +161,31 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
repayFromWallet = (
|
||||
{
|
||||
accountId,
|
||||
}: {
|
||||
accountId: string
|
||||
},
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
repay_from_wallet: {
|
||||
account_id: accountId,
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -160,7 +195,7 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
}: {
|
||||
updates: ConfigUpdates
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -174,11 +209,11 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateOwner = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -186,20 +221,22 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateNftConfig = (
|
||||
{
|
||||
updates,
|
||||
config,
|
||||
ownership,
|
||||
}: {
|
||||
updates: NftConfigUpdates
|
||||
config?: NftConfigUpdates
|
||||
ownership?: Action
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -209,15 +246,16 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_nft_config: {
|
||||
updates,
|
||||
config,
|
||||
ownership,
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
callback = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
callback = (callbackMsg: CallbackMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -225,10 +263,10 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
callback: {},
|
||||
callback: callbackMsg,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,662 @@
|
||||
// @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,
|
||||
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,
|
||||
OwnerUpdate,
|
||||
ParamsBaseForString,
|
||||
Positions,
|
||||
QueryMsg,
|
||||
RedBankBaseForString,
|
||||
SharesResponseItem,
|
||||
SwapperBaseForString,
|
||||
Uint128,
|
||||
UnlockingPositions,
|
||||
VaultAmount,
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultBaseForString,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionResponseItem,
|
||||
VaultPositionType,
|
||||
VaultPositionValue,
|
||||
VaultUnlockingPosition,
|
||||
VaultUtilizationResponse,
|
||||
ZapperBaseForString,
|
||||
} from './MarsCreditManager.types'
|
||||
import { MarsCreditManagerClient, MarsCreditManagerQueryClient } from './MarsCreditManager.client'
|
||||
export const marsCreditManagerQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsCreditManager',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsCreditManagerQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
accountKind: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'account_kind', args },
|
||||
] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
vaultUtilization: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_utilization',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args },
|
||||
] as const,
|
||||
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_vault_positions',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_provide_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateWithdrawLiquidity: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_withdraw_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
vaultPositionValue: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_position_value',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsCreditManagerReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsCreditManagerQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsCreditManagerVaultPositionValueQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<VaultPositionValue, TData> {
|
||||
args: {
|
||||
vaultPosition: VaultPosition
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerVaultPositionValueQuery<TData = VaultPositionValue>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerVaultPositionValueQuery<TData>) {
|
||||
return useQuery<VaultPositionValue, Error, TData>(
|
||||
marsCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.vaultPositionValue({
|
||||
vaultPosition: args.vaultPosition,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerEstimateWithdrawLiquidityQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
lpToken: Coin
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerEstimateWithdrawLiquidityQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
marsCreditManagerQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateWithdrawLiquidity({
|
||||
lpToken: args.lpToken,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerEstimateProvideLiquidityQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
coinsIn: Coin[]
|
||||
lpTokenOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerEstimateProvideLiquidityQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsCreditManagerQueryKeys.estimateProvideLiquidity(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateProvideLiquidity({
|
||||
coinsIn: args.coinsIn,
|
||||
lpTokenOut: args.lpTokenOut,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAllVaultPositionsQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllVaultPositionsQuery<
|
||||
TData = ArrayOfVaultPositionResponseItem,
|
||||
>({ client, args, options }: MarsCreditManagerAllVaultPositionsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
|
||||
marsCreditManagerQueryKeys.allVaultPositions(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allVaultPositions({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAllTotalLentSharesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfLentShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllTotalLentSharesQuery<TData = ArrayOfLentShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllTotalLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfLentShares, Error, TData>(
|
||||
marsCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTotalLentShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerTotalLentSharesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<LentShares, TData> {}
|
||||
export function useMarsCreditManagerTotalLentSharesQuery<TData = LentShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsCreditManagerTotalLentSharesQuery<TData>) {
|
||||
return useQuery<LentShares, Error, TData>(
|
||||
marsCreditManagerQueryKeys.totalLentShares(client?.contractAddress),
|
||||
() => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAllLentSharesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllLentSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
marsCreditManagerQueryKeys.allLentShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allLentShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAllTotalDebtSharesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfDebtShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfDebtShares, Error, TData>(
|
||||
marsCreditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTotalDebtShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerTotalDebtSharesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<DebtShares, TData> {}
|
||||
export function useMarsCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsCreditManagerTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<DebtShares, Error, TData>(
|
||||
marsCreditManagerQueryKeys.totalDebtShares(client?.contractAddress),
|
||||
() => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAllDebtSharesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
marsCreditManagerQueryKeys.allDebtShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allDebtShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAllCoinBalancesQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAllCoinBalancesQuery<TData = ArrayOfCoinBalanceResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAllCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
|
||||
marsCreditManagerQueryKeys.allCoinBalances(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allCoinBalances({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerPositionsQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<Positions, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerPositionsQuery<TData = Positions>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerPositionsQuery<TData>) {
|
||||
return useQuery<Positions, Error, TData>(
|
||||
marsCreditManagerQueryKeys.positions(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.positions({
|
||||
accountId: args.accountId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerVaultUtilizationQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<VaultUtilizationResponse, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerVaultUtilizationQuery<TData = VaultUtilizationResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerVaultUtilizationQuery<TData>) {
|
||||
return useQuery<VaultUtilizationResponse, Error, TData>(
|
||||
marsCreditManagerQueryKeys.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 MarsCreditManagerConfigQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsCreditManagerConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsCreditManagerConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
marsCreditManagerQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerAccountKindQuery<TData>
|
||||
extends MarsCreditManagerReactQuery<AccountKind, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerAccountKindQuery<TData = AccountKind>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsCreditManagerAccountKindQuery<TData>) {
|
||||
return useQuery<AccountKind, Error, TData>(
|
||||
marsCreditManagerQueryKeys.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 MarsCreditManagerCallbackMutation {
|
||||
client: MarsCreditManagerClient
|
||||
msg: CallbackMsg
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerCallbackMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerCallbackMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerCallbackMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerUpdateNftConfigMutation {
|
||||
client: MarsCreditManagerClient
|
||||
msg: {
|
||||
config?: NftConfigUpdates
|
||||
ownership?: Action
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerUpdateNftConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerUpdateNftConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateNftConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateNftConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerUpdateOwnerMutation {
|
||||
client: MarsCreditManagerClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerUpdateConfigMutation {
|
||||
client: MarsCreditManagerClient
|
||||
msg: {
|
||||
updates: ConfigUpdates
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerRepayFromWalletMutation {
|
||||
client: MarsCreditManagerClient
|
||||
msg: {
|
||||
accountId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerRepayFromWalletMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerRepayFromWalletMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerRepayFromWalletMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.repayFromWallet(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerUpdateCreditAccountMutation {
|
||||
client: MarsCreditManagerClient
|
||||
msg: {
|
||||
accountId: string
|
||||
actions: Action[]
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerUpdateCreditAccountMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerUpdateCreditAccountMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerUpdateCreditAccountMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateCreditAccount(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsCreditManagerCreateCreditAccountMutation {
|
||||
client: MarsCreditManagerClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsCreditManagerCreateCreditAccountMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsCreditManagerCreateCreditAccountMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsCreditManagerCreateCreditAccountMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.createCreditAccount(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,50 +1,30 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 type HealthContractBaseForString = string
|
||||
export type Decimal = string
|
||||
export type Uint128 = string
|
||||
export type OracleBaseForString = string
|
||||
export type ParamsBaseForString = string
|
||||
export type RedBankBaseForString = string
|
||||
export type SwapperBaseForString = string
|
||||
export type ZapperBaseForString = string
|
||||
export interface InstantiateMsg {
|
||||
allowed_coins: string[]
|
||||
health_contract: HealthContractBaseForString
|
||||
max_close_factor: Decimal
|
||||
max_unlocking_positions: Uint128
|
||||
oracle: OracleBaseForString
|
||||
owner: string
|
||||
params: ParamsBaseForString
|
||||
red_bank: RedBankBaseForString
|
||||
swapper: SwapperBaseForString
|
||||
vault_configs: VaultInstantiateConfig[]
|
||||
zapper: ZapperBaseForString
|
||||
}
|
||||
export interface VaultInstantiateConfig {
|
||||
config: VaultConfig
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
export interface VaultConfig {
|
||||
deposit_cap: Coin
|
||||
liquidation_threshold: Decimal
|
||||
max_ltv: Decimal
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface VaultBaseForString {
|
||||
address: string
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
create_credit_account: {}
|
||||
create_credit_account: AccountKind
|
||||
}
|
||||
| {
|
||||
update_credit_account: {
|
||||
@ -52,6 +32,11 @@ export type ExecuteMsg =
|
||||
actions: Action[]
|
||||
}
|
||||
}
|
||||
| {
|
||||
repay_from_wallet: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
update_config: {
|
||||
updates: ConfigUpdates
|
||||
@ -62,12 +47,14 @@ export type ExecuteMsg =
|
||||
}
|
||||
| {
|
||||
update_nft_config: {
|
||||
updates: NftConfigUpdates
|
||||
config?: NftConfigUpdates | null
|
||||
ownership?: Action | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
callback: CallbackMsg
|
||||
}
|
||||
export type AccountKind = 'default' | 'high_levered_strategy'
|
||||
export type Action =
|
||||
| {
|
||||
deposit: Coin
|
||||
@ -82,7 +69,13 @@ export type Action =
|
||||
lend: Coin
|
||||
}
|
||||
| {
|
||||
repay: ActionCoin
|
||||
reclaim: ActionCoin
|
||||
}
|
||||
| {
|
||||
repay: {
|
||||
coin: ActionCoin
|
||||
recipient_account_id?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
enter_vault: {
|
||||
@ -109,18 +102,10 @@ export type Action =
|
||||
}
|
||||
}
|
||||
| {
|
||||
liquidate_coin: {
|
||||
liquidate: {
|
||||
debt_coin: Coin
|
||||
liquidatee_account_id: string
|
||||
request_coin_denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
liquidate_vault: {
|
||||
debt_coin: Coin
|
||||
liquidatee_account_id: string
|
||||
position_type: VaultPositionType
|
||||
request_vault: VaultBaseForString
|
||||
request: LiquidateRequestForVaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
@ -140,6 +125,7 @@ export type Action =
|
||||
| {
|
||||
withdraw_liquidity: {
|
||||
lp_token: ActionCoin
|
||||
minimum_receive: Coin[]
|
||||
}
|
||||
}
|
||||
| {
|
||||
@ -150,7 +136,22 @@ export type ActionAmount =
|
||||
| {
|
||||
exact: Uint128
|
||||
}
|
||||
export type LiquidateRequestForVaultBaseForString =
|
||||
| {
|
||||
deposit: string
|
||||
}
|
||||
| {
|
||||
lend: string
|
||||
}
|
||||
| {
|
||||
vault: {
|
||||
position_type: VaultPositionType
|
||||
request_vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g'
|
||||
export type Decimal = string
|
||||
export type AccountNftBaseForString = string
|
||||
export type OwnerUpdate =
|
||||
| {
|
||||
propose_new_owner: {
|
||||
@ -160,6 +161,12 @@ export type OwnerUpdate =
|
||||
| 'clear_proposed'
|
||||
| 'accept_proposed'
|
||||
| 'abolish_owner_role'
|
||||
| {
|
||||
set_emergency_owner: {
|
||||
emergency_owner: string
|
||||
}
|
||||
}
|
||||
| 'clear_emergency_owner'
|
||||
export type CallbackMsg =
|
||||
| {
|
||||
withdraw: {
|
||||
@ -180,12 +187,25 @@ export type CallbackMsg =
|
||||
coin: ActionCoin
|
||||
}
|
||||
}
|
||||
| {
|
||||
repay_for_recipient: {
|
||||
benefactor_account_id: string
|
||||
coin: ActionCoin
|
||||
recipient_account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
lend: {
|
||||
account_id: string
|
||||
coin: Coin
|
||||
}
|
||||
}
|
||||
| {
|
||||
reclaim: {
|
||||
account_id: string
|
||||
coin: ActionCoin
|
||||
}
|
||||
}
|
||||
| {
|
||||
assert_max_ltv: {
|
||||
account_id: string
|
||||
@ -228,20 +248,11 @@ export type CallbackMsg =
|
||||
}
|
||||
}
|
||||
| {
|
||||
liquidate_coin: {
|
||||
liquidate: {
|
||||
debt_coin: Coin
|
||||
liquidatee_account_id: string
|
||||
liquidator_account_id: string
|
||||
request_coin_denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
liquidate_vault: {
|
||||
debt_coin: Coin
|
||||
liquidatee_account_id: string
|
||||
liquidator_account_id: string
|
||||
position_type: VaultPositionType
|
||||
request_vault: VaultBaseForAddr
|
||||
request: LiquidateRequestForVaultBaseForAddr
|
||||
}
|
||||
}
|
||||
| {
|
||||
@ -270,6 +281,7 @@ export type CallbackMsg =
|
||||
withdraw_liquidity: {
|
||||
account_id: string
|
||||
lp_token: ActionCoin
|
||||
minimum_receive: Coin[]
|
||||
}
|
||||
}
|
||||
| {
|
||||
@ -277,51 +289,67 @@ export type CallbackMsg =
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
assert_account_reqs: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
export type Addr = string
|
||||
export type LiquidateRequestForVaultBaseForAddr =
|
||||
| {
|
||||
deposit: string
|
||||
}
|
||||
| {
|
||||
lend: string
|
||||
}
|
||||
| {
|
||||
vault: {
|
||||
position_type: VaultPositionType
|
||||
request_vault: VaultBaseForAddr
|
||||
}
|
||||
}
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface ActionCoin {
|
||||
amount: ActionAmount
|
||||
denom: string
|
||||
}
|
||||
export interface VaultBaseForString {
|
||||
address: string
|
||||
}
|
||||
export interface ConfigUpdates {
|
||||
account_nft?: string | null
|
||||
allowed_coins?: string[] | null
|
||||
account_nft?: AccountNftBaseForString | null
|
||||
health_contract?: HealthContractBaseForString | null
|
||||
max_close_factor?: Decimal | null
|
||||
max_unlocking_positions?: Uint128 | null
|
||||
oracle?: OracleBaseForString | null
|
||||
red_bank?: RedBankBaseForString | null
|
||||
swapper?: SwapperBaseForString | null
|
||||
vault_configs?: VaultInstantiateConfig[] | null
|
||||
zapper?: ZapperBaseForString | null
|
||||
}
|
||||
export interface NftConfigUpdates {
|
||||
health_contract_addr?: string | null
|
||||
max_value_for_burn?: Uint128 | null
|
||||
proposed_new_minter?: string | null
|
||||
}
|
||||
export interface VaultBaseForAddr {
|
||||
address: Addr
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
account_kind: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
config: {}
|
||||
}
|
||||
| {
|
||||
vault_info: {
|
||||
vault_utilization: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
vaults_info: {
|
||||
limit?: number | null
|
||||
start_after?: VaultBaseForString | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
allowed_coins: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
positions: {
|
||||
account_id: string
|
||||
@ -369,17 +397,6 @@ export type QueryMsg =
|
||||
start_after?: [string, string] | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
total_vault_coin_balance: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_total_vault_coin_balances: {
|
||||
limit?: number | null
|
||||
start_after?: VaultBaseForString | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
estimate_provide_liquidity: {
|
||||
coins_in: Coin[]
|
||||
@ -440,29 +457,29 @@ export interface LentShares {
|
||||
denom: string
|
||||
shares: Uint128
|
||||
}
|
||||
export type ArrayOfVaultWithBalance = VaultWithBalance[]
|
||||
export interface VaultWithBalance {
|
||||
balance: Uint128
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
|
||||
export interface VaultPositionResponseItem {
|
||||
account_id: string
|
||||
position: VaultPosition
|
||||
}
|
||||
export type ArrayOfString = string[]
|
||||
export interface ConfigResponse {
|
||||
account_nft?: string | null
|
||||
health_contract: string
|
||||
max_close_factor: Decimal
|
||||
max_unlocking_positions: Uint128
|
||||
oracle: string
|
||||
owner?: string | null
|
||||
proposed_new_owner?: string | null
|
||||
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 Positions {
|
||||
account_id: string
|
||||
@ -481,11 +498,6 @@ export interface LentAmount {
|
||||
denom: string
|
||||
shares: Uint128
|
||||
}
|
||||
export interface VaultInfoResponse {
|
||||
config: VaultConfig
|
||||
utilization: Coin
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
export interface VaultPositionValue {
|
||||
base_coin: CoinValue
|
||||
vault_coin: CoinValue
|
||||
@ -495,4 +507,7 @@ export interface CoinValue {
|
||||
denom: string
|
||||
value: Uint128
|
||||
}
|
||||
export type ArrayOfVaultInfoResponse = VaultInfoResponse[]
|
||||
export interface VaultUtilizationResponse {
|
||||
utilization: Coin
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -9,28 +9,26 @@ import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/co
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
Addr,
|
||||
ArrayOfCoin,
|
||||
ArrayOfCoinBalanceResponseItem,
|
||||
ArrayOfDebtShares,
|
||||
ArrayOfLentShares,
|
||||
ArrayOfSharesResponseItem,
|
||||
ArrayOfString,
|
||||
ArrayOfVaultInfoResponse,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
ArrayOfVaultWithBalance,
|
||||
Coin,
|
||||
CoinBalanceResponseItem,
|
||||
CoinValue,
|
||||
ConfigResponse,
|
||||
DebtAmount,
|
||||
DebtShares,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
LentAmount,
|
||||
LentShares,
|
||||
LockingVaultAmount,
|
||||
OwnerResponse,
|
||||
Positions,
|
||||
QueryMsg,
|
||||
SharesResponseItem,
|
||||
@ -40,33 +38,18 @@ import {
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultBaseForString,
|
||||
VaultConfig,
|
||||
VaultInfoResponse,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionResponseItem,
|
||||
VaultPositionValue,
|
||||
VaultUnlockingPosition,
|
||||
VaultWithBalance,
|
||||
VaultUtilizationResponse,
|
||||
} from './MarsMockCreditManager.types'
|
||||
export interface MarsMockCreditManagerReadOnlyInterface {
|
||||
contractAddress: string
|
||||
accountKind: ({ accountId }: { accountId: string }) => Promise<AccountKind>
|
||||
config: () => Promise<ConfigResponse>
|
||||
vaultInfo: ({ vault }: { vault: VaultBaseForString }) => Promise<VaultInfoResponse>
|
||||
vaultsInfo: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}) => Promise<ArrayOfVaultInfoResponse>
|
||||
allowedCoins: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfString>
|
||||
vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise<VaultUtilizationResponse>
|
||||
positions: ({ accountId }: { accountId: string }) => Promise<Positions>
|
||||
allCoinBalances: ({
|
||||
limit,
|
||||
@ -112,14 +95,6 @@ export interface MarsMockCreditManagerReadOnlyInterface {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}) => Promise<ArrayOfVaultPositionResponseItem>
|
||||
totalVaultCoinBalance: ({ vault }: { vault: VaultBaseForString }) => Promise<Uint128>
|
||||
allTotalVaultCoinBalances: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}) => Promise<ArrayOfVaultWithBalance>
|
||||
estimateProvideLiquidity: ({
|
||||
coinsIn,
|
||||
lpTokenOut,
|
||||
@ -141,10 +116,9 @@ export class MarsMockCreditManagerQueryClient implements MarsMockCreditManagerRe
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.accountKind = this.accountKind.bind(this)
|
||||
this.config = this.config.bind(this)
|
||||
this.vaultInfo = this.vaultInfo.bind(this)
|
||||
this.vaultsInfo = this.vaultsInfo.bind(this)
|
||||
this.allowedCoins = this.allowedCoins.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)
|
||||
@ -154,53 +128,34 @@ export class MarsMockCreditManagerQueryClient implements MarsMockCreditManagerRe
|
||||
this.totalLentShares = this.totalLentShares.bind(this)
|
||||
this.allTotalLentShares = this.allTotalLentShares.bind(this)
|
||||
this.allVaultPositions = this.allVaultPositions.bind(this)
|
||||
this.totalVaultCoinBalance = this.totalVaultCoinBalance.bind(this)
|
||||
this.allTotalVaultCoinBalances = this.allTotalVaultCoinBalances.bind(this)
|
||||
this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this)
|
||||
this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this)
|
||||
this.vaultPositionValue = this.vaultPositionValue.bind(this)
|
||||
}
|
||||
|
||||
accountKind = async ({ accountId }: { accountId: string }): Promise<AccountKind> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
account_kind: {
|
||||
account_id: accountId,
|
||||
},
|
||||
})
|
||||
}
|
||||
config = async (): Promise<ConfigResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
vaultInfo = async ({ vault }: { vault: VaultBaseForString }): Promise<VaultInfoResponse> => {
|
||||
vaultUtilization = async ({
|
||||
vault,
|
||||
}: {
|
||||
vault: VaultBaseForString
|
||||
}): Promise<VaultUtilizationResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
vault_info: {
|
||||
vault_utilization: {
|
||||
vault,
|
||||
},
|
||||
})
|
||||
}
|
||||
vaultsInfo = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}): Promise<ArrayOfVaultInfoResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
vaults_info: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
allowedCoins = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<ArrayOfString> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
allowed_coins: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
positions = async ({ accountId }: { accountId: string }): Promise<Positions> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
positions: {
|
||||
@ -302,27 +257,6 @@ export class MarsMockCreditManagerQueryClient implements MarsMockCreditManagerRe
|
||||
},
|
||||
})
|
||||
}
|
||||
totalVaultCoinBalance = async ({ vault }: { vault: VaultBaseForString }): Promise<Uint128> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
total_vault_coin_balance: {
|
||||
vault,
|
||||
},
|
||||
})
|
||||
}
|
||||
allTotalVaultCoinBalances = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}): Promise<ArrayOfVaultWithBalance> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_total_vault_coin_balances: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
estimateProvideLiquidity = async ({
|
||||
coinsIn,
|
||||
lpTokenOut,
|
||||
@ -369,24 +303,7 @@ export interface MarsMockCreditManagerInterface extends MarsMockCreditManagerRea
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
setAllowedCoins: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
setVaultConfig: (
|
||||
{
|
||||
address,
|
||||
config,
|
||||
}: {
|
||||
address: string
|
||||
config: VaultConfig
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsMockCreditManagerClient
|
||||
@ -403,8 +320,6 @@ export class MarsMockCreditManagerClient
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.setPositionsResponse = this.setPositionsResponse.bind(this)
|
||||
this.setAllowedCoins = this.setAllowedCoins.bind(this)
|
||||
this.setVaultConfig = this.setVaultConfig.bind(this)
|
||||
}
|
||||
|
||||
setPositionsResponse = async (
|
||||
@ -417,7 +332,7 @@ export class MarsMockCreditManagerClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -430,49 +345,7 @@ export class MarsMockCreditManagerClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
setAllowedCoins = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
set_allowed_coins: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
setVaultConfig = async (
|
||||
{
|
||||
address,
|
||||
config,
|
||||
}: {
|
||||
address: string
|
||||
config: VaultConfig
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
set_vault_config: {
|
||||
address,
|
||||
config,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +1,35 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
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,
|
||||
ArrayOfString,
|
||||
ArrayOfVaultInfoResponse,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
ArrayOfVaultWithBalance,
|
||||
Coin,
|
||||
CoinBalanceResponseItem,
|
||||
CoinValue,
|
||||
ConfigResponse,
|
||||
DebtAmount,
|
||||
DebtShares,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
LentAmount,
|
||||
LentShares,
|
||||
LockingVaultAmount,
|
||||
OwnerResponse,
|
||||
Positions,
|
||||
QueryMsg,
|
||||
SharesResponseItem,
|
||||
@ -41,14 +39,12 @@ import {
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultBaseForString,
|
||||
VaultConfig,
|
||||
VaultInfoResponse,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionResponseItem,
|
||||
VaultPositionValue,
|
||||
VaultUnlockingPosition,
|
||||
VaultWithBalance,
|
||||
VaultUtilizationResponse,
|
||||
} from './MarsMockCreditManager.types'
|
||||
export interface MarsMockCreditManagerMessage {
|
||||
contractAddress: string
|
||||
@ -61,18 +57,7 @@ export interface MarsMockCreditManagerMessage {
|
||||
accountId: string
|
||||
positions: Positions
|
||||
},
|
||||
funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
setAllowedCoins: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
setVaultConfig: (
|
||||
{
|
||||
address,
|
||||
config,
|
||||
}: {
|
||||
address: string
|
||||
config: VaultConfig
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsMockCreditManagerMessageComposer implements MarsMockCreditManagerMessage {
|
||||
@ -83,8 +68,6 @@ export class MarsMockCreditManagerMessageComposer implements MarsMockCreditManag
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.setPositionsResponse = this.setPositionsResponse.bind(this)
|
||||
this.setAllowedCoins = this.setAllowedCoins.bind(this)
|
||||
this.setVaultConfig = this.setVaultConfig.bind(this)
|
||||
}
|
||||
|
||||
setPositionsResponse = (
|
||||
@ -95,7 +78,7 @@ export class MarsMockCreditManagerMessageComposer implements MarsMockCreditManag
|
||||
accountId: string
|
||||
positions: Positions
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -110,49 +93,7 @@ export class MarsMockCreditManagerMessageComposer implements MarsMockCreditManag
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
setAllowedCoins = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
set_allowed_coins: {},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
setVaultConfig = (
|
||||
{
|
||||
address,
|
||||
config,
|
||||
}: {
|
||||
address: string
|
||||
config: VaultConfig
|
||||
},
|
||||
funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
set_vault_config: {
|
||||
address,
|
||||
config,
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,519 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
Addr,
|
||||
ArrayOfCoin,
|
||||
ArrayOfCoinBalanceResponseItem,
|
||||
ArrayOfDebtShares,
|
||||
ArrayOfLentShares,
|
||||
ArrayOfSharesResponseItem,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
Coin,
|
||||
CoinBalanceResponseItem,
|
||||
CoinValue,
|
||||
ConfigResponse,
|
||||
DebtAmount,
|
||||
DebtShares,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
LentAmount,
|
||||
LentShares,
|
||||
LockingVaultAmount,
|
||||
OwnerResponse,
|
||||
Positions,
|
||||
QueryMsg,
|
||||
SharesResponseItem,
|
||||
Uint128,
|
||||
UnlockingPositions,
|
||||
VaultAmount,
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultBaseForString,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionResponseItem,
|
||||
VaultPositionValue,
|
||||
VaultUnlockingPosition,
|
||||
VaultUtilizationResponse,
|
||||
} from './MarsMockCreditManager.types'
|
||||
import {
|
||||
MarsMockCreditManagerClient,
|
||||
MarsMockCreditManagerQueryClient,
|
||||
} from './MarsMockCreditManager.client'
|
||||
export const marsMockCreditManagerQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsMockCreditManager',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsMockCreditManagerQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
accountKind: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'account_kind',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
vaultUtilization: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_utilization',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args },
|
||||
] as const,
|
||||
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalLentShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_lent_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_vault_positions',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_provide_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateWithdrawLiquidity: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_withdraw_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
vaultPositionValue: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockCreditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_position_value',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsMockCreditManagerReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockCreditManagerQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockCreditManagerVaultPositionValueQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<VaultPositionValue, TData> {
|
||||
args: {
|
||||
vaultPosition: VaultPosition
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerVaultPositionValueQuery<TData = VaultPositionValue>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerVaultPositionValueQuery<TData>) {
|
||||
return useQuery<VaultPositionValue, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.vaultPositionValue({
|
||||
vaultPosition: args.vaultPosition,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
lpToken: Coin
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerEstimateWithdrawLiquidityQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateWithdrawLiquidity({
|
||||
lpToken: args.lpToken,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerEstimateProvideLiquidityQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
coinsIn: Coin[]
|
||||
lpTokenOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerEstimateProvideLiquidityQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.estimateProvideLiquidity(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateProvideLiquidity({
|
||||
coinsIn: args.coinsIn,
|
||||
lpTokenOut: args.lpTokenOut,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAllVaultPositionsQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllVaultPositionsQuery<
|
||||
TData = ArrayOfVaultPositionResponseItem,
|
||||
>({ client, args, options }: MarsMockCreditManagerAllVaultPositionsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.allVaultPositions(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allVaultPositions({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAllTotalLentSharesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfLentShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllTotalLentSharesQuery<TData = ArrayOfLentShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllTotalLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfLentShares, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTotalLentShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerTotalLentSharesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<LentShares, TData> {}
|
||||
export function useMarsMockCreditManagerTotalLentSharesQuery<TData = LentShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockCreditManagerTotalLentSharesQuery<TData>) {
|
||||
return useQuery<LentShares, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.totalLentShares(client?.contractAddress),
|
||||
() => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAllLentSharesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllLentSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllLentSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.allLentShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allLentShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAllTotalDebtSharesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfDebtShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfDebtShares, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTotalDebtShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerTotalDebtSharesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<DebtShares, TData> {}
|
||||
export function useMarsMockCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockCreditManagerTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<DebtShares, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.totalDebtShares(client?.contractAddress),
|
||||
() => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAllDebtSharesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAllDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.allDebtShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allDebtShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAllCoinBalancesQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAllCoinBalancesQuery<
|
||||
TData = ArrayOfCoinBalanceResponseItem,
|
||||
>({ client, args, options }: MarsMockCreditManagerAllCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.allCoinBalances(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allCoinBalances({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerPositionsQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<Positions, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerPositionsQuery<TData = Positions>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerPositionsQuery<TData>) {
|
||||
return useQuery<Positions, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.positions(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.positions({
|
||||
accountId: args.accountId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerVaultUtilizationQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<VaultUtilizationResponse, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerVaultUtilizationQuery<TData = VaultUtilizationResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerVaultUtilizationQuery<TData>) {
|
||||
return useQuery<VaultUtilizationResponse, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.vaultUtilization(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.vaultUtilization({
|
||||
vault: args.vault,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerConfigQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsMockCreditManagerConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockCreditManagerConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerAccountKindQuery<TData>
|
||||
extends MarsMockCreditManagerReactQuery<AccountKind, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerAccountKindQuery<TData = AccountKind>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockCreditManagerAccountKindQuery<TData>) {
|
||||
return useQuery<AccountKind, Error, TData>(
|
||||
marsMockCreditManagerQueryKeys.accountKind(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.accountKind({
|
||||
accountId: args.accountId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockCreditManagerSetPositionsResponseMutation {
|
||||
client: MarsMockCreditManagerClient
|
||||
msg: {
|
||||
accountId: string
|
||||
positions: Positions
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockCreditManagerSetPositionsResponseMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockCreditManagerSetPositionsResponseMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockCreditManagerSetPositionsResponseMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.setPositionsResponse(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -8,22 +8,12 @@
|
||||
export interface InstantiateMsg {
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
set_positions_response: {
|
||||
account_id: string
|
||||
positions: Positions
|
||||
}
|
||||
}
|
||||
| {
|
||||
set_allowed_coins: string[]
|
||||
}
|
||||
| {
|
||||
set_vault_config: {
|
||||
address: string
|
||||
config: VaultConfig
|
||||
}
|
||||
}
|
||||
export type ExecuteMsg = {
|
||||
set_positions_response: {
|
||||
account_id: string
|
||||
positions: Positions
|
||||
}
|
||||
}
|
||||
export type Uint128 = string
|
||||
export type VaultPositionAmount =
|
||||
| {
|
||||
@ -36,7 +26,6 @@ export type VaultAmount = string
|
||||
export type VaultAmount1 = string
|
||||
export type UnlockingPositions = VaultUnlockingPosition[]
|
||||
export type Addr = string
|
||||
export type Decimal = string
|
||||
export interface Positions {
|
||||
account_id: string
|
||||
debts: DebtAmount[]
|
||||
@ -74,33 +63,20 @@ export interface VaultUnlockingPosition {
|
||||
export interface VaultBaseForAddr {
|
||||
address: Addr
|
||||
}
|
||||
export interface VaultConfig {
|
||||
deposit_cap: Coin
|
||||
liquidation_threshold: Decimal
|
||||
max_ltv: Decimal
|
||||
whitelisted: boolean
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
account_kind: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
config: {}
|
||||
}
|
||||
| {
|
||||
vault_info: {
|
||||
vault_utilization: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
vaults_info: {
|
||||
limit?: number | null
|
||||
start_after?: VaultBaseForString | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
allowed_coins: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
positions: {
|
||||
account_id: string
|
||||
@ -148,17 +124,6 @@ export type QueryMsg =
|
||||
start_after?: [string, string] | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
total_vault_coin_balance: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_total_vault_coin_balances: {
|
||||
limit?: number | null
|
||||
start_after?: VaultBaseForString | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
estimate_provide_liquidity: {
|
||||
coins_in: Coin[]
|
||||
@ -178,6 +143,7 @@ export type QueryMsg =
|
||||
export interface VaultBaseForString {
|
||||
address: string
|
||||
}
|
||||
export type AccountKind = 'default' | 'high_levered_strategy'
|
||||
export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[]
|
||||
export interface CoinBalanceResponseItem {
|
||||
account_id: string
|
||||
@ -200,35 +166,30 @@ export interface LentShares {
|
||||
denom: string
|
||||
shares: Uint128
|
||||
}
|
||||
export type ArrayOfVaultWithBalance = VaultWithBalance[]
|
||||
export interface VaultWithBalance {
|
||||
balance: Uint128
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
|
||||
export interface VaultPositionResponseItem {
|
||||
account_id: string
|
||||
position: VaultPosition
|
||||
}
|
||||
export type ArrayOfString = string[]
|
||||
export interface ConfigResponse {
|
||||
account_nft?: string | null
|
||||
health_contract: string
|
||||
max_close_factor: Decimal
|
||||
max_unlocking_positions: Uint128
|
||||
oracle: string
|
||||
owner?: string | null
|
||||
proposed_new_owner?: string | null
|
||||
ownership: OwnerResponse
|
||||
params: string
|
||||
red_bank: string
|
||||
swapper: string
|
||||
zapper: string
|
||||
}
|
||||
export type ArrayOfCoin = Coin[]
|
||||
export interface VaultInfoResponse {
|
||||
config: VaultConfig
|
||||
utilization: Coin
|
||||
vault: VaultBaseForString
|
||||
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
|
||||
@ -238,4 +199,7 @@ export interface CoinValue {
|
||||
denom: string
|
||||
value: Uint128
|
||||
}
|
||||
export type ArrayOfVaultInfoResponse = VaultInfoResponse[]
|
||||
export interface VaultUtilizationResponse {
|
||||
utilization: Coin
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -51,7 +51,7 @@ export interface MarsMockOracleInterface extends MarsMockOracleReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsMockOracleClient
|
||||
@ -80,7 +80,7 @@ export class MarsMockOracleClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -93,7 +93,7 @@ export class MarsMockOracleClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { Coin } from '@cosmjs/amino'
|
||||
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
@ -29,7 +29,7 @@ export interface MarsMockOracleMessage {
|
||||
denom: string
|
||||
price: Decimal
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsMockOracleMessageComposer implements MarsMockOracleMessage {
|
||||
@ -50,7 +50,7 @@ export class MarsMockOracleMessageComposer implements MarsMockOracleMessage {
|
||||
denom: string
|
||||
price: Decimal
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -65,7 +65,7 @@ export class MarsMockOracleMessageComposer implements MarsMockOracleMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
// @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 {
|
||||
CoinPrice,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
PriceResponse,
|
||||
QueryMsg,
|
||||
} from './MarsMockOracle.types'
|
||||
import { MarsMockOracleClient, MarsMockOracleQueryClient } from './MarsMockOracle.client'
|
||||
export const marsMockOracleQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsMockOracle',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsMockOracleQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockOracleQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
||||
}
|
||||
export interface MarsMockOracleReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockOracleQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockOraclePriceQuery<TData>
|
||||
extends MarsMockOracleReactQuery<PriceResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockOraclePriceQuery<TData = PriceResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockOraclePriceQuery<TData>) {
|
||||
return useQuery<PriceResponse, Error, TData>(
|
||||
marsMockOracleQueryKeys.price(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.price({
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockOracleChangePriceMutation {
|
||||
client: MarsMockOracleClient
|
||||
msg: {
|
||||
denom: string
|
||||
price: Decimal
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockOracleChangePriceMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockOracleChangePriceMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockOracleChangePriceMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.changePrice(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -13,7 +13,6 @@ import {
|
||||
ArrayOfUncollateralizedLoanLimitResponse,
|
||||
ArrayOfUserCollateralResponse,
|
||||
ArrayOfUserDebtResponse,
|
||||
CoinMarketInfo,
|
||||
ConfigResponse,
|
||||
CreateOrUpdateConfig,
|
||||
Decimal,
|
||||
@ -312,14 +311,16 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateEmergencyOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateConfig: (
|
||||
{
|
||||
@ -329,7 +330,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
initAsset: (
|
||||
{
|
||||
@ -341,7 +342,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateAsset: (
|
||||
{
|
||||
@ -353,7 +354,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateUncollateralizedLoanLimit: (
|
||||
{
|
||||
@ -367,7 +368,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
deposit: (
|
||||
{
|
||||
@ -377,7 +378,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
withdraw: (
|
||||
{
|
||||
@ -391,7 +392,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
borrow: (
|
||||
{
|
||||
@ -405,7 +406,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
repay: (
|
||||
{
|
||||
@ -415,7 +416,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
liquidate: (
|
||||
{
|
||||
@ -429,7 +430,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateAssetCollateralStatus: (
|
||||
{
|
||||
@ -441,7 +442,7 @@ export interface MarsMockRedBankInterface extends MarsMockRedBankReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsMockRedBankClient
|
||||
@ -472,35 +473,37 @@ export class MarsMockRedBankClient
|
||||
}
|
||||
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateEmergencyOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_emergency_owner: {},
|
||||
update_emergency_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateConfig = async (
|
||||
@ -511,7 +514,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -523,7 +526,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
initAsset = async (
|
||||
@ -536,7 +539,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -549,7 +552,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateAsset = async (
|
||||
@ -562,7 +565,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -575,7 +578,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateUncollateralizedLoanLimit = async (
|
||||
@ -590,7 +593,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -604,7 +607,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
deposit = async (
|
||||
@ -615,7 +618,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -627,7 +630,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
withdraw = async (
|
||||
@ -642,7 +645,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -656,7 +659,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
borrow = async (
|
||||
@ -671,7 +674,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -685,7 +688,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
repay = async (
|
||||
@ -696,7 +699,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -708,7 +711,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
liquidate = async (
|
||||
@ -723,7 +726,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -737,7 +740,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateAssetCollateralStatus = async (
|
||||
@ -750,7 +753,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -763,7 +766,7 @@ export class MarsMockRedBankClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { Coin } from '@cosmjs/amino'
|
||||
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
@ -15,7 +15,6 @@ import {
|
||||
ArrayOfUncollateralizedLoanLimitResponse,
|
||||
ArrayOfUserCollateralResponse,
|
||||
ArrayOfUserDebtResponse,
|
||||
CoinMarketInfo,
|
||||
ConfigResponse,
|
||||
CreateOrUpdateConfig,
|
||||
Decimal,
|
||||
@ -36,15 +35,18 @@ import {
|
||||
export interface MarsMockRedBankMessage {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateEmergencyOwner: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateEmergencyOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateConfig: (
|
||||
{
|
||||
config,
|
||||
}: {
|
||||
config: CreateOrUpdateConfig
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
initAsset: (
|
||||
{
|
||||
@ -54,7 +56,7 @@ export interface MarsMockRedBankMessage {
|
||||
denom: string
|
||||
params: InitOrUpdateAssetParams
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateAsset: (
|
||||
{
|
||||
@ -64,7 +66,7 @@ export interface MarsMockRedBankMessage {
|
||||
denom: string
|
||||
params: InitOrUpdateAssetParams
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateUncollateralizedLoanLimit: (
|
||||
{
|
||||
@ -76,7 +78,7 @@ export interface MarsMockRedBankMessage {
|
||||
newLimit: Uint128
|
||||
user: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
deposit: (
|
||||
{
|
||||
@ -84,7 +86,7 @@ export interface MarsMockRedBankMessage {
|
||||
}: {
|
||||
onBehalfOf?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
withdraw: (
|
||||
{
|
||||
@ -96,7 +98,7 @@ export interface MarsMockRedBankMessage {
|
||||
denom: string
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
borrow: (
|
||||
{
|
||||
@ -108,7 +110,7 @@ export interface MarsMockRedBankMessage {
|
||||
denom: string
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
repay: (
|
||||
{
|
||||
@ -116,7 +118,7 @@ export interface MarsMockRedBankMessage {
|
||||
}: {
|
||||
onBehalfOf?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
liquidate: (
|
||||
{
|
||||
@ -128,7 +130,7 @@ export interface MarsMockRedBankMessage {
|
||||
recipient?: string
|
||||
user: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateAssetCollateralStatus: (
|
||||
{
|
||||
@ -138,7 +140,7 @@ export interface MarsMockRedBankMessage {
|
||||
denom: string
|
||||
enable: boolean
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
@ -162,7 +164,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
this.updateAssetCollateralStatus = this.updateAssetCollateralStatus.bind(this)
|
||||
}
|
||||
|
||||
updateOwner = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -170,14 +172,17 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateEmergencyOwner = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
updateEmergencyOwner = (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -185,10 +190,10 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_emergency_owner: {},
|
||||
update_emergency_owner: ownerUpdate,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -198,7 +203,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
}: {
|
||||
config: CreateOrUpdateConfig
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -212,7 +217,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -224,7 +229,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
denom: string
|
||||
params: InitOrUpdateAssetParams
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -239,7 +244,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -251,7 +256,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
denom: string
|
||||
params: InitOrUpdateAssetParams
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -266,7 +271,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -280,7 +285,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
newLimit: Uint128
|
||||
user: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -296,7 +301,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -306,7 +311,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
}: {
|
||||
onBehalfOf?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -320,7 +325,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -334,7 +339,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
denom: string
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -350,7 +355,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -364,7 +369,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
denom: string
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -380,7 +385,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -390,7 +395,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
}: {
|
||||
onBehalfOf?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -404,7 +409,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -418,7 +423,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
recipient?: string
|
||||
user: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -434,7 +439,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -446,7 +451,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
denom: string
|
||||
enable: boolean
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -461,7 +466,7 @@ export class MarsMockRedBankMessageComposer implements MarsMockRedBankMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,736 @@
|
||||
// @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 {
|
||||
ArrayOfMarket,
|
||||
ArrayOfUncollateralizedLoanLimitResponse,
|
||||
ArrayOfUserCollateralResponse,
|
||||
ArrayOfUserDebtResponse,
|
||||
ConfigResponse,
|
||||
CreateOrUpdateConfig,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
InitOrUpdateAssetParams,
|
||||
InstantiateMsg,
|
||||
InterestRateModel,
|
||||
Market,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
UncollateralizedLoanLimitResponse,
|
||||
UserCollateralResponse,
|
||||
UserDebtResponse,
|
||||
UserHealthStatus,
|
||||
UserPositionResponse,
|
||||
} from './MarsMockRedBank.types'
|
||||
import { MarsMockRedBankClient, MarsMockRedBankQueryClient } from './MarsMockRedBank.client'
|
||||
export const marsMockRedBankQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsMockRedBank',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsMockRedBankQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
market: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const,
|
||||
markets: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'markets', args }] as const,
|
||||
uncollateralizedLoanLimit: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'uncollateralized_loan_limit',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
uncollateralizedLoanLimits: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'uncollateralized_loan_limits',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
userDebt: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_debt', args },
|
||||
] as const,
|
||||
userDebts: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_debts', args },
|
||||
] as const,
|
||||
userCollateral: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collateral', args },
|
||||
] as const,
|
||||
userCollaterals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args },
|
||||
] as const,
|
||||
userPosition: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args },
|
||||
] as const,
|
||||
scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'scaled_liquidity_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
scaledDebtAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'scaled_debt_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
underlyingLiquidityAmount: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'underlying_liquidity_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
underlyingDebtAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockRedBankQueryKeys.address(contractAddress)[0],
|
||||
method: 'underlying_debt_amount',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsMockRedBankReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockRedBankQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockRedBankUnderlyingDebtAmountQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amountScaled: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUnderlyingDebtAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUnderlyingDebtAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockRedBankQueryKeys.underlyingDebtAmount(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.underlyingDebtAmount({
|
||||
amountScaled: args.amountScaled,
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUnderlyingLiquidityAmountQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amountScaled: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUnderlyingLiquidityAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUnderlyingLiquidityAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockRedBankQueryKeys.underlyingLiquidityAmount(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.underlyingLiquidityAmount({
|
||||
amountScaled: args.amountScaled,
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankScaledDebtAmountQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankScaledDebtAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankScaledDebtAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockRedBankQueryKeys.scaledDebtAmount(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.scaledDebtAmount({
|
||||
amount: args.amount,
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankScaledLiquidityAmountQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankScaledLiquidityAmountQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankScaledLiquidityAmountQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockRedBankQueryKeys.scaledLiquidityAmount(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.scaledLiquidityAmount({
|
||||
amount: args.amount,
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUserPositionQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<UserPositionResponse, TData> {
|
||||
args: {
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserPositionQuery<TData = UserPositionResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserPositionQuery<TData>) {
|
||||
return useQuery<UserPositionResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.userPosition(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.userPosition({
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUserCollateralsQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfUserCollateralResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserCollateralsQuery<TData = ArrayOfUserCollateralResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserCollateralsQuery<TData>) {
|
||||
return useQuery<ArrayOfUserCollateralResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.userCollaterals(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.userCollaterals({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUserCollateralQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<UserCollateralResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserCollateralQuery<TData = UserCollateralResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserCollateralQuery<TData>) {
|
||||
return useQuery<UserCollateralResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.userCollateral(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.userCollateral({
|
||||
denom: args.denom,
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUserDebtsQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfUserDebtResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserDebtsQuery<TData = ArrayOfUserDebtResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserDebtsQuery<TData>) {
|
||||
return useQuery<ArrayOfUserDebtResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.userDebts(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.userDebts({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUserDebtQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<UserDebtResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUserDebtQuery<TData = UserDebtResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankUserDebtQuery<TData>) {
|
||||
return useQuery<UserDebtResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.userDebt(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.userDebt({
|
||||
denom: args.denom,
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUncollateralizedLoanLimitsQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfUncollateralizedLoanLimitResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUncollateralizedLoanLimitsQuery<
|
||||
TData = ArrayOfUncollateralizedLoanLimitResponse,
|
||||
>({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitsQuery<TData>) {
|
||||
return useQuery<ArrayOfUncollateralizedLoanLimitResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.uncollateralizedLoanLimits(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.uncollateralizedLoanLimits({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUncollateralizedLoanLimitQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<UncollateralizedLoanLimitResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
user: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUncollateralizedLoanLimitQuery<
|
||||
TData = UncollateralizedLoanLimitResponse,
|
||||
>({ client, args, options }: MarsMockRedBankUncollateralizedLoanLimitQuery<TData>) {
|
||||
return useQuery<UncollateralizedLoanLimitResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.uncollateralizedLoanLimit(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.uncollateralizedLoanLimit({
|
||||
denom: args.denom,
|
||||
user: args.user,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankMarketsQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<ArrayOfMarket, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankMarketsQuery<TData = ArrayOfMarket>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankMarketsQuery<TData>) {
|
||||
return useQuery<ArrayOfMarket, Error, TData>(
|
||||
marsMockRedBankQueryKeys.markets(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.markets({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankMarketQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<Market, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankMarketQuery<TData = Market>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockRedBankMarketQuery<TData>) {
|
||||
return useQuery<Market, Error, TData>(
|
||||
marsMockRedBankQueryKeys.market(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.market({
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankConfigQuery<TData>
|
||||
extends MarsMockRedBankReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsMockRedBankConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockRedBankConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
marsMockRedBankQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUpdateAssetCollateralStatusMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
denom: string
|
||||
enable: boolean
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUpdateAssetCollateralStatusMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateAssetCollateralStatusMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateAssetCollateralStatusMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateAssetCollateralStatus(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankLiquidateMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
collateralDenom: string
|
||||
recipient?: string
|
||||
user: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankLiquidateMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankLiquidateMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankLiquidateMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.liquidate(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankRepayMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
onBehalfOf?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankRepayMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankRepayMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankRepayMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.repay(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankBorrowMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankBorrowMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankBorrowMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankBorrowMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.borrow(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankWithdrawMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
amount?: Uint128
|
||||
denom: string
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankWithdrawMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankWithdrawMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankWithdrawMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.withdraw(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankDepositMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
onBehalfOf?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankDepositMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankDepositMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankDepositMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.deposit(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUpdateUncollateralizedLoanLimitMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
denom: string
|
||||
newLimit: Uint128
|
||||
user: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUpdateUncollateralizedLoanLimitMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<
|
||||
ExecuteResult,
|
||||
Error,
|
||||
MarsMockRedBankUpdateUncollateralizedLoanLimitMutation
|
||||
>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateUncollateralizedLoanLimitMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateUncollateralizedLoanLimit(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUpdateAssetMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
denom: string
|
||||
params: InitOrUpdateAssetParams
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUpdateAssetMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateAssetMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateAssetMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateAsset(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankInitAssetMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
denom: string
|
||||
params: InitOrUpdateAssetParams
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankInitAssetMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankInitAssetMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankInitAssetMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.initAsset(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUpdateConfigMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: {
|
||||
config: CreateOrUpdateConfig
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUpdateEmergencyOwnerMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUpdateEmergencyOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateEmergencyOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateEmergencyOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateEmergencyOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockRedBankUpdateOwnerMutation {
|
||||
client: MarsMockRedBankClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockRedBankUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockRedBankUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockRedBankUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,19 +1,12 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 type Decimal = string
|
||||
export interface InstantiateMsg {
|
||||
coins: CoinMarketInfo[]
|
||||
}
|
||||
export interface CoinMarketInfo {
|
||||
denom: string
|
||||
liquidation_bonus: Decimal
|
||||
liquidation_threshold: Decimal
|
||||
max_ltv: Decimal
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
@ -92,6 +85,7 @@ export type OwnerUpdate =
|
||||
| 'clear_proposed'
|
||||
| 'accept_proposed'
|
||||
| 'abolish_owner_role'
|
||||
export type Decimal = string
|
||||
export type Uint128 = string
|
||||
export interface CreateOrUpdateConfig {
|
||||
address_provider?: string | null
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -34,7 +34,7 @@ export interface MarsMockVaultReadOnlyInterface {
|
||||
totalVaultTokenSupply: () => Promise<Uint128>
|
||||
convertToShares: ({ amount }: { amount: Uint128 }) => Promise<Uint128>
|
||||
convertToAssets: ({ amount }: { amount: Uint128 }) => Promise<Uint128>
|
||||
vaultExtension: () => Promise<Empty>
|
||||
vaultExtension: (extensionQueryMsg: ExtensionQueryMsg) => Promise<Empty>
|
||||
}
|
||||
export class MarsMockVaultQueryClient implements MarsMockVaultReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
@ -102,9 +102,9 @@ export class MarsMockVaultQueryClient implements MarsMockVaultReadOnlyInterface
|
||||
},
|
||||
})
|
||||
}
|
||||
vaultExtension = async (): Promise<Empty> => {
|
||||
vaultExtension = async (extensionQueryMsg: ExtensionQueryMsg): Promise<Empty> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
vault_extension: {},
|
||||
vault_extension: extensionQueryMsg,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ export interface MarsMockVaultInterface extends MarsMockVaultReadOnlyInterface {
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
redeem: (
|
||||
{
|
||||
@ -133,12 +133,13 @@ export interface MarsMockVaultInterface extends MarsMockVaultReadOnlyInterface {
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
vaultExtension: (
|
||||
extensionExecuteMsg: ExtensionExecuteMsg,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsMockVaultClient
|
||||
@ -169,7 +170,7 @@ export class MarsMockVaultClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -182,7 +183,7 @@ export class MarsMockVaultClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
redeem = async (
|
||||
@ -195,7 +196,7 @@ export class MarsMockVaultClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -208,23 +209,24 @@ export class MarsMockVaultClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
vaultExtension = async (
|
||||
extensionExecuteMsg: ExtensionExecuteMsg,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
vault_extension: {},
|
||||
vault_extension: extensionExecuteMsg,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { Coin } from '@cosmjs/amino'
|
||||
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
@ -37,7 +37,7 @@ export interface MarsMockVaultMessage {
|
||||
amount: Uint128
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
redeem: (
|
||||
{
|
||||
@ -47,9 +47,12 @@ export interface MarsMockVaultMessage {
|
||||
amount: Uint128
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
vaultExtension: (
|
||||
extensionExecuteMsg: ExtensionExecuteMsg,
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
vaultExtension: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||
sender: string
|
||||
@ -71,7 +74,7 @@ export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||
amount: Uint128
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -86,7 +89,7 @@ export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -98,7 +101,7 @@ export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||
amount: Uint128
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -113,11 +116,14 @@ export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
vaultExtension = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
vaultExtension = (
|
||||
extensionExecuteMsg: ExtensionExecuteMsg,
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -125,10 +131,10 @@ export class MarsMockVaultMessageComposer implements MarsMockVaultMessage {
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
vault_extension: {},
|
||||
vault_extension: extensionExecuteMsg,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
303
src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts
Normal file
303
src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts
Normal file
@ -0,0 +1,303 @@
|
||||
// @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 {
|
||||
Duration,
|
||||
Empty,
|
||||
ExecuteMsg,
|
||||
ExtensionExecuteMsg,
|
||||
ExtensionQueryMsg,
|
||||
ForceUnlockExecuteMsg,
|
||||
InstantiateMsg,
|
||||
LockupExecuteMsg,
|
||||
LockupQueryMsg,
|
||||
OracleBaseForString,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
VaultInfoResponse,
|
||||
VaultStandardInfoResponse,
|
||||
} from './MarsMockVault.types'
|
||||
import { MarsMockVaultClient, MarsMockVaultQueryClient } from './MarsMockVault.client'
|
||||
export const marsMockVaultQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsMockVault',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsMockVaultQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
vaultStandardInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockVaultQueryKeys.address(contractAddress)[0],
|
||||
method: 'vault_standard_info',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
info: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'info', args }] as const,
|
||||
previewDeposit: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'preview_deposit', args },
|
||||
] as const,
|
||||
previewRedeem: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'preview_redeem', args },
|
||||
] as const,
|
||||
totalAssets: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'total_assets', args },
|
||||
] as const,
|
||||
totalVaultTokenSupply: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsMockVaultQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_vault_token_supply',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
convertToShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'convert_to_shares', args },
|
||||
] as const,
|
||||
convertToAssets: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'convert_to_assets', args },
|
||||
] as const,
|
||||
vaultExtension: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsMockVaultQueryKeys.address(contractAddress)[0], method: 'vault_extension', args },
|
||||
] as const,
|
||||
}
|
||||
export interface MarsMockVaultReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsMockVaultQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsMockVaultVaultExtensionQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Empty, TData> {}
|
||||
export function useMarsMockVaultVaultExtensionQuery<TData = Empty>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultVaultExtensionQuery<TData>) {
|
||||
return useQuery<Empty, Error, TData>(
|
||||
marsMockVaultQueryKeys.vaultExtension(client?.contractAddress),
|
||||
() => (client ? client.vaultExtension() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultConvertToAssetsQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultConvertToAssetsQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultConvertToAssetsQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockVaultQueryKeys.convertToAssets(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.convertToAssets({
|
||||
amount: args.amount,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultConvertToSharesQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultConvertToSharesQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultConvertToSharesQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockVaultQueryKeys.convertToShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.convertToShares({
|
||||
amount: args.amount,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultTotalVaultTokenSupplyQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {}
|
||||
export function useMarsMockVaultTotalVaultTokenSupplyQuery<TData = Uint128>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultTotalVaultTokenSupplyQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockVaultQueryKeys.totalVaultTokenSupply(client?.contractAddress),
|
||||
() => (client ? client.totalVaultTokenSupply() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultTotalAssetsQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {}
|
||||
export function useMarsMockVaultTotalAssetsQuery<TData = Uint128>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultTotalAssetsQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockVaultQueryKeys.totalAssets(client?.contractAddress),
|
||||
() => (client ? client.totalAssets() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultPreviewRedeemQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultPreviewRedeemQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultPreviewRedeemQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockVaultQueryKeys.previewRedeem(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.previewRedeem({
|
||||
amount: args.amount,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultPreviewDepositQuery<TData>
|
||||
extends MarsMockVaultReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultPreviewDepositQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsMockVaultPreviewDepositQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsMockVaultQueryKeys.previewDeposit(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.previewDeposit({
|
||||
amount: args.amount,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultInfoQuery<TData>
|
||||
extends MarsMockVaultReactQuery<VaultInfoResponse, TData> {}
|
||||
export function useMarsMockVaultInfoQuery<TData = VaultInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultInfoQuery<TData>) {
|
||||
return useQuery<VaultInfoResponse, Error, TData>(
|
||||
marsMockVaultQueryKeys.info(client?.contractAddress),
|
||||
() => (client ? client.info() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultVaultStandardInfoQuery<TData>
|
||||
extends MarsMockVaultReactQuery<VaultStandardInfoResponse, TData> {}
|
||||
export function useMarsMockVaultVaultStandardInfoQuery<TData = VaultStandardInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsMockVaultVaultStandardInfoQuery<TData>) {
|
||||
return useQuery<VaultStandardInfoResponse, Error, TData>(
|
||||
marsMockVaultQueryKeys.vaultStandardInfo(client?.contractAddress),
|
||||
() => (client ? client.vaultStandardInfo() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultVaultExtensionMutation {
|
||||
client: MarsMockVaultClient
|
||||
msg: ExtensionExecuteMsg
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultVaultExtensionMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockVaultVaultExtensionMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockVaultVaultExtensionMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.vaultExtension(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultRedeemMutation {
|
||||
client: MarsMockVaultClient
|
||||
msg: {
|
||||
amount: Uint128
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultRedeemMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockVaultRedeemMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockVaultRedeemMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.redeem(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsMockVaultDepositMutation {
|
||||
client: MarsMockVaultClient
|
||||
msg: {
|
||||
amount: Uint128
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsMockVaultDepositMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsMockVaultDepositMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsMockVaultDepositMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.deposit(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -49,6 +49,11 @@ export type LockupExecuteMsg =
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
| {
|
||||
emergency_unlock: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
| {
|
||||
withdraw_unlocked: {
|
||||
lockup_id: number
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
|
263
src/types/generated/mars-params/MarsParams.client.ts
Normal file
263
src/types/generated/mars-params/MarsParams.client.ts
Normal file
@ -0,0 +1,263 @@
|
||||
// @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,
|
||||
ArrayOfAssetParamsBaseForAddr,
|
||||
ArrayOfVaultConfigBaseForAddr,
|
||||
AssetParamsBaseForAddr,
|
||||
AssetParamsBaseForString,
|
||||
AssetParamsUpdate,
|
||||
CmEmergencyUpdate,
|
||||
CmSettingsForAddr,
|
||||
CmSettingsForString,
|
||||
Coin,
|
||||
Decimal,
|
||||
EmergencyUpdate,
|
||||
ExecuteMsg,
|
||||
HlsAssetTypeForAddr,
|
||||
HlsAssetTypeForString,
|
||||
HlsParamsBaseForAddr,
|
||||
HlsParamsBaseForString,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
RedBankEmergencyUpdate,
|
||||
RedBankSettings,
|
||||
Uint128,
|
||||
VaultConfigBaseForAddr,
|
||||
VaultConfigBaseForString,
|
||||
VaultConfigUpdate,
|
||||
} from './MarsParams.types'
|
||||
export interface MarsParamsReadOnlyInterface {
|
||||
contractAddress: string
|
||||
owner: () => Promise<OwnerResponse>
|
||||
assetParams: ({ denom }: { denom: string }) => Promise<AssetParamsBaseForAddr>
|
||||
allAssetParams: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfAssetParamsBaseForAddr>
|
||||
vaultConfig: ({ address }: { address: string }) => Promise<VaultConfigBaseForAddr>
|
||||
allVaultConfigs: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfVaultConfigBaseForAddr>
|
||||
maxCloseFactor: () => Promise<Decimal>
|
||||
}
|
||||
export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.owner = this.owner.bind(this)
|
||||
this.assetParams = this.assetParams.bind(this)
|
||||
this.allAssetParams = this.allAssetParams.bind(this)
|
||||
this.vaultConfig = this.vaultConfig.bind(this)
|
||||
this.allVaultConfigs = this.allVaultConfigs.bind(this)
|
||||
this.maxCloseFactor = this.maxCloseFactor.bind(this)
|
||||
}
|
||||
|
||||
owner = async (): Promise<OwnerResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
owner: {},
|
||||
})
|
||||
}
|
||||
assetParams = async ({ denom }: { denom: string }): Promise<AssetParamsBaseForAddr> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
asset_params: {
|
||||
denom,
|
||||
},
|
||||
})
|
||||
}
|
||||
allAssetParams = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<ArrayOfAssetParamsBaseForAddr> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_asset_params: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
vaultConfig = async ({ address }: { address: string }): Promise<VaultConfigBaseForAddr> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
vault_config: {
|
||||
address,
|
||||
},
|
||||
})
|
||||
}
|
||||
allVaultConfigs = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<ArrayOfVaultConfigBaseForAddr> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_vault_configs: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
maxCloseFactor = async (): Promise<Decimal> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
max_close_factor: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsParamsInterface extends MarsParamsReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateMaxCloseFactor: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateAssetParams: (
|
||||
assetParamsUpdate: AssetParamsUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateVaultConfig: (
|
||||
vaultConfigUpdate: VaultConfigUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
emergencyUpdate: (
|
||||
emergencyUpdate: EmergencyUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsParamsClient extends MarsParamsQueryClient implements MarsParamsInterface {
|
||||
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.updateMaxCloseFactor = this.updateMaxCloseFactor.bind(this)
|
||||
this.updateAssetParams = this.updateAssetParams.bind(this)
|
||||
this.updateVaultConfig = this.updateVaultConfig.bind(this)
|
||||
this.emergencyUpdate = this.emergencyUpdate.bind(this)
|
||||
}
|
||||
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateMaxCloseFactor = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_max_close_factor: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateAssetParams = async (
|
||||
assetParamsUpdate: AssetParamsUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_asset_params: assetParamsUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateVaultConfig = async (
|
||||
vaultConfigUpdate: VaultConfigUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_vault_config: vaultConfigUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
emergencyUpdate = async (
|
||||
emergencyUpdate: EmergencyUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
emergency_update: emergencyUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
157
src/types/generated/mars-params/MarsParams.message-composer.ts
Normal file
157
src/types/generated/mars-params/MarsParams.message-composer.ts
Normal file
@ -0,0 +1,157 @@
|
||||
// @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,
|
||||
ArrayOfAssetParamsBaseForAddr,
|
||||
ArrayOfVaultConfigBaseForAddr,
|
||||
AssetParamsBaseForAddr,
|
||||
AssetParamsBaseForString,
|
||||
AssetParamsUpdate,
|
||||
CmEmergencyUpdate,
|
||||
CmSettingsForAddr,
|
||||
CmSettingsForString,
|
||||
Coin,
|
||||
Decimal,
|
||||
EmergencyUpdate,
|
||||
ExecuteMsg,
|
||||
HlsAssetTypeForAddr,
|
||||
HlsAssetTypeForString,
|
||||
HlsParamsBaseForAddr,
|
||||
HlsParamsBaseForString,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
RedBankEmergencyUpdate,
|
||||
RedBankSettings,
|
||||
Uint128,
|
||||
VaultConfigBaseForAddr,
|
||||
VaultConfigBaseForString,
|
||||
VaultConfigUpdate,
|
||||
} from './MarsParams.types'
|
||||
export interface MarsParamsMessage {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateMaxCloseFactor: (_funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateAssetParams: (
|
||||
assetParamsUpdate: AssetParamsUpdate,
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
updateVaultConfig: (
|
||||
vaultConfigUpdate: VaultConfigUpdate,
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
emergencyUpdate: (
|
||||
emergencyUpdate: EmergencyUpdate,
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsParamsMessageComposer implements MarsParamsMessage {
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(sender: string, contractAddress: string) {
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateOwner = this.updateOwner.bind(this)
|
||||
this.updateMaxCloseFactor = this.updateMaxCloseFactor.bind(this)
|
||||
this.updateAssetParams = this.updateAssetParams.bind(this)
|
||||
this.updateVaultConfig = this.updateVaultConfig.bind(this)
|
||||
this.emergencyUpdate = this.emergencyUpdate.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,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateMaxCloseFactor = (_funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_max_close_factor: {},
|
||||
}),
|
||||
),
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateAssetParams = (
|
||||
assetParamsUpdate: AssetParamsUpdate,
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_asset_params: assetParamsUpdate,
|
||||
}),
|
||||
),
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateVaultConfig = (
|
||||
vaultConfigUpdate: VaultConfigUpdate,
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_vault_config: vaultConfigUpdate,
|
||||
}),
|
||||
),
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
emergencyUpdate = (
|
||||
emergencyUpdate: EmergencyUpdate,
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
sender: this.sender,
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
emergency_update: emergencyUpdate,
|
||||
}),
|
||||
),
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
295
src/types/generated/mars-params/MarsParams.react-query.ts
Normal file
295
src/types/generated/mars-params/MarsParams.react-query.ts
Normal file
@ -0,0 +1,295 @@
|
||||
// @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,
|
||||
ArrayOfAssetParamsBaseForAddr,
|
||||
ArrayOfVaultConfigBaseForAddr,
|
||||
AssetParamsBaseForAddr,
|
||||
AssetParamsBaseForString,
|
||||
AssetParamsUpdate,
|
||||
CmEmergencyUpdate,
|
||||
CmSettingsForAddr,
|
||||
CmSettingsForString,
|
||||
Coin,
|
||||
Decimal,
|
||||
EmergencyUpdate,
|
||||
ExecuteMsg,
|
||||
HlsAssetTypeForAddr,
|
||||
HlsAssetTypeForString,
|
||||
HlsParamsBaseForAddr,
|
||||
HlsParamsBaseForString,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
RedBankEmergencyUpdate,
|
||||
RedBankSettings,
|
||||
Uint128,
|
||||
VaultConfigBaseForAddr,
|
||||
VaultConfigBaseForString,
|
||||
VaultConfigUpdate,
|
||||
} from './MarsParams.types'
|
||||
import { MarsParamsClient, MarsParamsQueryClient } from './MarsParams.client'
|
||||
export const marsParamsQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsParams',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsParamsQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||
assetParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'asset_params', args }] as const,
|
||||
allAssetParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_asset_params', args },
|
||||
] as const,
|
||||
vaultConfig: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'vault_config', args }] as const,
|
||||
allVaultConfigs: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_vault_configs', args },
|
||||
] as const,
|
||||
maxCloseFactor: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'max_close_factor', args },
|
||||
] as const,
|
||||
}
|
||||
export interface MarsParamsReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsParamsQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsParamsMaxCloseFactorQuery<TData>
|
||||
extends MarsParamsReactQuery<Decimal, TData> {}
|
||||
export function useMarsParamsMaxCloseFactorQuery<TData = Decimal>({
|
||||
client,
|
||||
options,
|
||||
}: MarsParamsMaxCloseFactorQuery<TData>) {
|
||||
return useQuery<Decimal, Error, TData>(
|
||||
marsParamsQueryKeys.maxCloseFactor(client?.contractAddress),
|
||||
() => (client ? client.maxCloseFactor() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsParamsAllVaultConfigsQuery<TData>
|
||||
extends MarsParamsReactQuery<ArrayOfVaultConfigBaseForAddr, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsParamsAllVaultConfigsQuery<TData = ArrayOfVaultConfigBaseForAddr>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsParamsAllVaultConfigsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultConfigBaseForAddr, Error, TData>(
|
||||
marsParamsQueryKeys.allVaultConfigs(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allVaultConfigs({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsParamsVaultConfigQuery<TData>
|
||||
extends MarsParamsReactQuery<VaultConfigBaseForAddr, TData> {
|
||||
args: {
|
||||
address: string
|
||||
}
|
||||
}
|
||||
export function useMarsParamsVaultConfigQuery<TData = VaultConfigBaseForAddr>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsParamsVaultConfigQuery<TData>) {
|
||||
return useQuery<VaultConfigBaseForAddr, Error, TData>(
|
||||
marsParamsQueryKeys.vaultConfig(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.vaultConfig({
|
||||
address: args.address,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsParamsAllAssetParamsQuery<TData>
|
||||
extends MarsParamsReactQuery<ArrayOfAssetParamsBaseForAddr, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsParamsAllAssetParamsQuery<TData = ArrayOfAssetParamsBaseForAddr>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsParamsAllAssetParamsQuery<TData>) {
|
||||
return useQuery<ArrayOfAssetParamsBaseForAddr, Error, TData>(
|
||||
marsParamsQueryKeys.allAssetParams(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allAssetParams({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsParamsAssetParamsQuery<TData>
|
||||
extends MarsParamsReactQuery<AssetParamsBaseForAddr, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsParamsAssetParamsQuery<TData = AssetParamsBaseForAddr>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsParamsAssetParamsQuery<TData>) {
|
||||
return useQuery<AssetParamsBaseForAddr, Error, TData>(
|
||||
marsParamsQueryKeys.assetParams(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.assetParams({
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsParamsOwnerQuery<TData> extends MarsParamsReactQuery<OwnerResponse, TData> {}
|
||||
export function useMarsParamsOwnerQuery<TData = OwnerResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsParamsOwnerQuery<TData>) {
|
||||
return useQuery<OwnerResponse, Error, TData>(
|
||||
marsParamsQueryKeys.owner(client?.contractAddress),
|
||||
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsParamsEmergencyUpdateMutation {
|
||||
client: MarsParamsClient
|
||||
msg: EmergencyUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsParamsEmergencyUpdateMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsParamsEmergencyUpdateMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsParamsEmergencyUpdateMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.emergencyUpdate(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsParamsUpdateVaultConfigMutation {
|
||||
client: MarsParamsClient
|
||||
msg: VaultConfigUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsParamsUpdateVaultConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateVaultConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsParamsUpdateVaultConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateVaultConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsParamsUpdateAssetParamsMutation {
|
||||
client: MarsParamsClient
|
||||
msg: AssetParamsUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsParamsUpdateAssetParamsMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateAssetParamsMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsParamsUpdateAssetParamsMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateAssetParams(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsParamsUpdateMaxCloseFactorMutation {
|
||||
client: MarsParamsClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsParamsUpdateMaxCloseFactorMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateMaxCloseFactorMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsParamsUpdateMaxCloseFactorMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateMaxCloseFactor(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsParamsUpdateOwnerMutation {
|
||||
client: MarsParamsClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsParamsUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsParamsUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
195
src/types/generated/mars-params/MarsParams.types.ts
Normal file
195
src/types/generated/mars-params/MarsParams.types.ts
Normal file
@ -0,0 +1,195 @@
|
||||
// @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 type Decimal = string
|
||||
export interface InstantiateMsg {
|
||||
max_close_factor: Decimal
|
||||
owner: string
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
update_owner: OwnerUpdate
|
||||
}
|
||||
| {
|
||||
update_max_close_factor: Decimal
|
||||
}
|
||||
| {
|
||||
update_asset_params: AssetParamsUpdate
|
||||
}
|
||||
| {
|
||||
update_vault_config: VaultConfigUpdate
|
||||
}
|
||||
| {
|
||||
emergency_update: EmergencyUpdate
|
||||
}
|
||||
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 AssetParamsUpdate = {
|
||||
add_or_update: {
|
||||
params: AssetParamsBaseForString
|
||||
}
|
||||
}
|
||||
export type HlsAssetTypeForString =
|
||||
| {
|
||||
coin: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault: {
|
||||
addr: string
|
||||
}
|
||||
}
|
||||
export type Uint128 = string
|
||||
export type VaultConfigUpdate = {
|
||||
add_or_update: {
|
||||
config: VaultConfigBaseForString
|
||||
}
|
||||
}
|
||||
export type EmergencyUpdate =
|
||||
| {
|
||||
credit_manager: CmEmergencyUpdate
|
||||
}
|
||||
| {
|
||||
red_bank: RedBankEmergencyUpdate
|
||||
}
|
||||
export type CmEmergencyUpdate =
|
||||
| {
|
||||
set_zero_max_ltv_on_vault: string
|
||||
}
|
||||
| {
|
||||
set_zero_deposit_cap_on_vault: string
|
||||
}
|
||||
| {
|
||||
disallow_coin: string
|
||||
}
|
||||
export type RedBankEmergencyUpdate = {
|
||||
disable_borrowing: string
|
||||
}
|
||||
export interface AssetParamsBaseForString {
|
||||
credit_manager: CmSettingsForString
|
||||
denom: string
|
||||
liquidation_bonus: Decimal
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
red_bank: RedBankSettings
|
||||
}
|
||||
export interface CmSettingsForString {
|
||||
hls?: HlsParamsBaseForString | null
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface HlsParamsBaseForString {
|
||||
correlations: HlsAssetTypeForString[]
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
}
|
||||
export interface RedBankSettings {
|
||||
borrow_enabled: boolean
|
||||
deposit_cap: Uint128
|
||||
deposit_enabled: boolean
|
||||
}
|
||||
export interface VaultConfigBaseForString {
|
||||
addr: string
|
||||
deposit_cap: Coin
|
||||
hls?: HlsParamsBaseForString | null
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
owner: {}
|
||||
}
|
||||
| {
|
||||
asset_params: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_asset_params: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault_config: {
|
||||
address: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_vault_configs: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
max_close_factor: {}
|
||||
}
|
||||
export type HlsAssetTypeForAddr =
|
||||
| {
|
||||
coin: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault: {
|
||||
addr: Addr
|
||||
}
|
||||
}
|
||||
export type Addr = string
|
||||
export type ArrayOfAssetParamsBaseForAddr = AssetParamsBaseForAddr[]
|
||||
export interface AssetParamsBaseForAddr {
|
||||
credit_manager: CmSettingsForAddr
|
||||
denom: string
|
||||
liquidation_bonus: Decimal
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
red_bank: RedBankSettings
|
||||
}
|
||||
export interface CmSettingsForAddr {
|
||||
hls?: HlsParamsBaseForAddr | null
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface HlsParamsBaseForAddr {
|
||||
correlations: HlsAssetTypeForAddr[]
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
}
|
||||
export type ArrayOfVaultConfigBaseForAddr = VaultConfigBaseForAddr[]
|
||||
export interface VaultConfigBaseForAddr {
|
||||
addr: Addr
|
||||
deposit_cap: Coin
|
||||
hls?: HlsParamsBaseForAddr | null
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface OwnerResponse {
|
||||
abolished: boolean
|
||||
emergency_owner?: string | null
|
||||
initialized: boolean
|
||||
owner?: string | null
|
||||
proposed?: string | null
|
||||
}
|
14
src/types/generated/mars-params/bundle.ts
Normal file
14
src/types/generated/mars-params/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// @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 _24 from './MarsParams.types'
|
||||
import * as _25 from './MarsParams.client'
|
||||
import * as _26 from './MarsParams.message-composer'
|
||||
import * as _27 from './MarsParams.react-query'
|
||||
export namespace contracts {
|
||||
export const MarsParams = { ..._24, ..._25, ..._26, ..._27 }
|
||||
}
|
@ -1,29 +1,33 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 {
|
||||
AccountKind,
|
||||
Addr,
|
||||
AssetParamsBaseForAddr,
|
||||
CmSettingsForAddr,
|
||||
Coin,
|
||||
CoinValue,
|
||||
DebtAmount,
|
||||
Decimal,
|
||||
DenomsData,
|
||||
HealthComputer,
|
||||
InterestRateModel,
|
||||
HlsAssetTypeForAddr,
|
||||
HlsParamsBaseForAddr,
|
||||
LentAmount,
|
||||
LockingVaultAmount,
|
||||
Market,
|
||||
Positions,
|
||||
RedBankSettings,
|
||||
Uint128,
|
||||
UnlockingPositions,
|
||||
VaultAmount,
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultConfig,
|
||||
VaultConfigBaseForAddr,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionValue,
|
||||
|
@ -1,29 +1,33 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 {
|
||||
AccountKind,
|
||||
Addr,
|
||||
AssetParamsBaseForAddr,
|
||||
CmSettingsForAddr,
|
||||
Coin,
|
||||
CoinValue,
|
||||
DebtAmount,
|
||||
Decimal,
|
||||
DenomsData,
|
||||
HealthComputer,
|
||||
InterestRateModel,
|
||||
HlsAssetTypeForAddr,
|
||||
HlsParamsBaseForAddr,
|
||||
LentAmount,
|
||||
LockingVaultAmount,
|
||||
Market,
|
||||
Positions,
|
||||
RedBankSettings,
|
||||
Uint128,
|
||||
UnlockingPositions,
|
||||
VaultAmount,
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultConfig,
|
||||
VaultConfigBaseForAddr,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionValue,
|
||||
|
@ -0,0 +1,37 @@
|
||||
// @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 {
|
||||
AccountKind,
|
||||
Addr,
|
||||
AssetParamsBaseForAddr,
|
||||
CmSettingsForAddr,
|
||||
Coin,
|
||||
CoinValue,
|
||||
DebtAmount,
|
||||
Decimal,
|
||||
DenomsData,
|
||||
HealthComputer,
|
||||
HlsAssetTypeForAddr,
|
||||
HlsParamsBaseForAddr,
|
||||
LentAmount,
|
||||
LockingVaultAmount,
|
||||
Positions,
|
||||
RedBankSettings,
|
||||
Uint128,
|
||||
UnlockingPositions,
|
||||
VaultAmount,
|
||||
VaultAmount1,
|
||||
VaultBaseForAddr,
|
||||
VaultConfigBaseForAddr,
|
||||
VaultPosition,
|
||||
VaultPositionAmount,
|
||||
VaultPositionValue,
|
||||
VaultsData,
|
||||
VaultUnlockingPosition,
|
||||
} from './MarsRoverHealthComputer.types'
|
||||
import './MarsRoverHealthComputer.client'
|
@ -1,12 +1,25 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 type HlsAssetTypeForAddr =
|
||||
| {
|
||||
coin: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault: {
|
||||
addr: Addr
|
||||
}
|
||||
}
|
||||
export type Addr = string
|
||||
export type Decimal = string
|
||||
export type Uint128 = string
|
||||
export type AccountKind = 'default' | 'high_levered_strategy'
|
||||
export type VaultPositionAmount =
|
||||
| {
|
||||
unlocked: VaultAmount
|
||||
@ -17,44 +30,41 @@ export type VaultPositionAmount =
|
||||
export type VaultAmount = string
|
||||
export type VaultAmount1 = string
|
||||
export type UnlockingPositions = VaultUnlockingPosition[]
|
||||
export type Addr = string
|
||||
export interface HealthComputer {
|
||||
allowed_coins: string[]
|
||||
denoms_data: DenomsData
|
||||
kind: AccountKind
|
||||
positions: Positions
|
||||
vaults_data: VaultsData
|
||||
}
|
||||
export interface DenomsData {
|
||||
markets: {
|
||||
[k: string]: Market
|
||||
params: {
|
||||
[k: string]: AssetParamsBaseForAddr
|
||||
}
|
||||
prices: {
|
||||
[k: string]: Decimal
|
||||
}
|
||||
}
|
||||
export interface Market {
|
||||
borrow_enabled: boolean
|
||||
borrow_index: Decimal
|
||||
borrow_rate: Decimal
|
||||
collateral_total_scaled: Uint128
|
||||
debt_total_scaled: Uint128
|
||||
export interface AssetParamsBaseForAddr {
|
||||
credit_manager: CmSettingsForAddr
|
||||
denom: string
|
||||
deposit_cap: Uint128
|
||||
deposit_enabled: boolean
|
||||
indexes_last_updated: number
|
||||
interest_rate_model: InterestRateModel
|
||||
liquidation_bonus: Decimal
|
||||
liquidation_threshold: Decimal
|
||||
liquidity_index: Decimal
|
||||
liquidity_rate: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
reserve_factor: Decimal
|
||||
red_bank: RedBankSettings
|
||||
}
|
||||
export interface InterestRateModel {
|
||||
base: Decimal
|
||||
optimal_utilization_rate: Decimal
|
||||
slope_1: Decimal
|
||||
slope_2: Decimal
|
||||
export interface CmSettingsForAddr {
|
||||
hls?: HlsParamsBaseForAddr | null
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface HlsParamsBaseForAddr {
|
||||
correlations: HlsAssetTypeForAddr[]
|
||||
liquidation_threshold: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
}
|
||||
export interface RedBankSettings {
|
||||
borrow_enabled: boolean
|
||||
deposit_cap: Uint128
|
||||
deposit_enabled: boolean
|
||||
}
|
||||
export interface Positions {
|
||||
account_id: string
|
||||
@ -95,16 +105,18 @@ export interface VaultBaseForAddr {
|
||||
}
|
||||
export interface VaultsData {
|
||||
vault_configs: {
|
||||
[k: string]: VaultConfig
|
||||
[k: string]: VaultConfigBaseForAddr
|
||||
}
|
||||
vault_values: {
|
||||
[k: string]: VaultPositionValue
|
||||
}
|
||||
}
|
||||
export interface VaultConfig {
|
||||
export interface VaultConfigBaseForAddr {
|
||||
addr: Addr
|
||||
deposit_cap: Coin
|
||||
hls?: HlsParamsBaseForAddr | null
|
||||
liquidation_threshold: Decimal
|
||||
max_ltv: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
whitelisted: boolean
|
||||
}
|
||||
export interface VaultPositionValue {
|
||||
|
@ -1,14 +1,14 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 * as _24 from './MarsRoverHealthComputer.types'
|
||||
import * as _25 from './MarsRoverHealthComputer.client'
|
||||
import * as _26 from './MarsRoverHealthComputer.message-composer'
|
||||
import * as _27 from './MarsRoverHealthComputer.react-query'
|
||||
import * as _32 from './MarsRoverHealthComputer.types'
|
||||
import * as _33 from './MarsRoverHealthComputer.client'
|
||||
import * as _34 from './MarsRoverHealthComputer.message-composer'
|
||||
import * as _35 from './MarsRoverHealthComputer.react-query'
|
||||
export namespace contracts {
|
||||
export const MarsRoverHealthComputer = { ..._24, ..._25, ..._26, ..._27 }
|
||||
export const MarsRoverHealthComputer = { ..._32, ..._33, ..._34, ..._35 }
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -9,6 +9,7 @@ import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/co
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
ConfigResponse,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
@ -21,7 +22,7 @@ import {
|
||||
} from './MarsRoverHealthTypes.types'
|
||||
export interface MarsRoverHealthTypesReadOnlyInterface {
|
||||
contractAddress: string
|
||||
health: ({ accountId }: { accountId: string }) => Promise<HealthResponse>
|
||||
health: ({ accountId, kind }: { accountId: string; kind: AccountKind }) => Promise<HealthResponse>
|
||||
config: () => Promise<ConfigResponse>
|
||||
}
|
||||
export class MarsRoverHealthTypesQueryClient implements MarsRoverHealthTypesReadOnlyInterface {
|
||||
@ -35,10 +36,17 @@ export class MarsRoverHealthTypesQueryClient implements MarsRoverHealthTypesRead
|
||||
this.config = this.config.bind(this)
|
||||
}
|
||||
|
||||
health = async ({ accountId }: { accountId: string }): Promise<HealthResponse> => {
|
||||
health = async ({
|
||||
accountId,
|
||||
kind,
|
||||
}: {
|
||||
accountId: string
|
||||
kind: AccountKind
|
||||
}): Promise<HealthResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
health: {
|
||||
account_id: accountId,
|
||||
kind,
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -52,19 +60,22 @@ export interface MarsRoverHealthTypesInterface extends MarsRoverHealthTypesReadO
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateConfig: (
|
||||
{
|
||||
creditManager,
|
||||
params,
|
||||
}: {
|
||||
creditManager: string
|
||||
creditManager?: string
|
||||
params?: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsRoverHealthTypesClient
|
||||
@ -85,30 +96,33 @@ export class MarsRoverHealthTypesClient
|
||||
}
|
||||
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateConfig = async (
|
||||
{
|
||||
creditManager,
|
||||
params,
|
||||
}: {
|
||||
creditManager: string
|
||||
creditManager?: string
|
||||
params?: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -116,11 +130,12 @@ export class MarsRoverHealthTypesClient
|
||||
{
|
||||
update_config: {
|
||||
credit_manager: creditManager,
|
||||
params,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { Coin } from '@cosmjs/amino'
|
||||
import { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
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,
|
||||
@ -24,14 +25,16 @@ import {
|
||||
export interface MarsRoverHealthTypesMessage {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateConfig: (
|
||||
{
|
||||
creditManager,
|
||||
params,
|
||||
}: {
|
||||
creditManager: string
|
||||
creditManager?: string
|
||||
params?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsRoverHealthTypesMessageComposer implements MarsRoverHealthTypesMessage {
|
||||
@ -45,7 +48,7 @@ export class MarsRoverHealthTypesMessageComposer implements MarsRoverHealthTypes
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
}
|
||||
|
||||
updateOwner = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -53,20 +56,22 @@ export class MarsRoverHealthTypesMessageComposer implements MarsRoverHealthTypes
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
updateConfig = (
|
||||
{
|
||||
creditManager,
|
||||
params,
|
||||
}: {
|
||||
creditManager: string
|
||||
creditManager?: string
|
||||
params?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -77,10 +82,11 @@ export class MarsRoverHealthTypesMessageComposer implements MarsRoverHealthTypes
|
||||
JSON.stringify({
|
||||
update_config: {
|
||||
credit_manager: creditManager,
|
||||
params,
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,133 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
ConfigResponse,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
HealthResponse,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsRoverHealthTypes.types'
|
||||
import {
|
||||
MarsRoverHealthTypesClient,
|
||||
MarsRoverHealthTypesQueryClient,
|
||||
} from './MarsRoverHealthTypes.client'
|
||||
export const marsRoverHealthTypesQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsRoverHealthTypes',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsRoverHealthTypesQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'health', args },
|
||||
] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsRoverHealthTypesQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
}
|
||||
export interface MarsRoverHealthTypesReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsRoverHealthTypesQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsRoverHealthTypesConfigQuery<TData>
|
||||
extends MarsRoverHealthTypesReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsRoverHealthTypesConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsRoverHealthTypesConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
marsRoverHealthTypesQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsRoverHealthTypesHealthQuery<TData>
|
||||
extends MarsRoverHealthTypesReactQuery<HealthResponse, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
kind: AccountKind
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthTypesHealthQuery<TData = HealthResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsRoverHealthTypesHealthQuery<TData>) {
|
||||
return useQuery<HealthResponse, Error, TData>(
|
||||
marsRoverHealthTypesQueryKeys.health(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.health({
|
||||
accountId: args.accountId,
|
||||
kind: args.kind,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsRoverHealthTypesUpdateConfigMutation {
|
||||
client: MarsRoverHealthTypesClient
|
||||
msg: {
|
||||
creditManager?: string
|
||||
params?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthTypesUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthTypesUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsRoverHealthTypesUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsRoverHealthTypesUpdateOwnerMutation {
|
||||
client: MarsRoverHealthTypesClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthTypesUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthTypesUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsRoverHealthTypesUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -14,7 +14,8 @@ export type ExecuteMsg =
|
||||
}
|
||||
| {
|
||||
update_config: {
|
||||
credit_manager: string
|
||||
credit_manager?: string | null
|
||||
params?: string | null
|
||||
}
|
||||
}
|
||||
export type OwnerUpdate =
|
||||
@ -26,21 +27,31 @@ export type OwnerUpdate =
|
||||
| '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_addr?: string | null
|
||||
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
|
||||
|
@ -1,14 +1,14 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 * as _28 from './MarsRoverHealthTypes.types'
|
||||
import * as _29 from './MarsRoverHealthTypes.client'
|
||||
import * as _30 from './MarsRoverHealthTypes.message-composer'
|
||||
import * as _31 from './MarsRoverHealthTypes.react-query'
|
||||
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 = { ..._28, ..._29, ..._30, ..._31 }
|
||||
export const MarsRoverHealthTypes = { ..._36, ..._37, ..._38, ..._39 }
|
||||
}
|
||||
|
141
src/types/generated/mars-rover-health/MarsRoverHealth.client.ts
Normal file
141
src/types/generated/mars-rover-health/MarsRoverHealth.client.ts
Normal file
@ -0,0 +1,141 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
ConfigResponse,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
HealthResponse,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsRoverHealth.types'
|
||||
export interface MarsRoverHealthReadOnlyInterface {
|
||||
contractAddress: string
|
||||
health: ({ accountId, kind }: { accountId: string; kind: AccountKind }) => Promise<HealthResponse>
|
||||
config: () => Promise<ConfigResponse>
|
||||
}
|
||||
export class MarsRoverHealthQueryClient implements MarsRoverHealthReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.health = this.health.bind(this)
|
||||
this.config = this.config.bind(this)
|
||||
}
|
||||
|
||||
health = async ({
|
||||
accountId,
|
||||
kind,
|
||||
}: {
|
||||
accountId: string
|
||||
kind: AccountKind
|
||||
}): Promise<HealthResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
health: {
|
||||
account_id: accountId,
|
||||
kind,
|
||||
},
|
||||
})
|
||||
}
|
||||
config = async (): Promise<ConfigResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsRoverHealthInterface extends MarsRoverHealthReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateConfig: (
|
||||
{
|
||||
creditManager,
|
||||
params,
|
||||
}: {
|
||||
creditManager?: string
|
||||
params?: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsRoverHealthClient
|
||||
extends MarsRoverHealthQueryClient
|
||||
implements MarsRoverHealthInterface
|
||||
{
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||
super(client, contractAddress)
|
||||
this.client = client
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateOwner = this.updateOwner.bind(this)
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
}
|
||||
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateConfig = async (
|
||||
{
|
||||
creditManager,
|
||||
params,
|
||||
}: {
|
||||
creditManager?: string
|
||||
params?: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_config: {
|
||||
credit_manager: creditManager,
|
||||
params,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
// @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,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
AccountKind,
|
||||
ConfigResponse,
|
||||
Decimal,
|
||||
ExecuteMsg,
|
||||
HealthResponse,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsRoverHealth.types'
|
||||
import { MarsRoverHealthClient, MarsRoverHealthQueryClient } from './MarsRoverHealth.client'
|
||||
export const marsRoverHealthQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsRoverHealth',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsRoverHealthQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsRoverHealthQueryKeys.address(contractAddress)[0], method: 'health', args }] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsRoverHealthQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
}
|
||||
export interface MarsRoverHealthReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsRoverHealthQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsRoverHealthConfigQuery<TData>
|
||||
extends MarsRoverHealthReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsRoverHealthConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsRoverHealthConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
marsRoverHealthQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsRoverHealthHealthQuery<TData>
|
||||
extends MarsRoverHealthReactQuery<HealthResponse, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
kind: AccountKind
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthHealthQuery<TData = HealthResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsRoverHealthHealthQuery<TData>) {
|
||||
return useQuery<HealthResponse, Error, TData>(
|
||||
marsRoverHealthQueryKeys.health(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.health({
|
||||
accountId: args.accountId,
|
||||
kind: args.kind,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsRoverHealthUpdateConfigMutation {
|
||||
client: MarsRoverHealthClient
|
||||
msg: {
|
||||
creditManager?: string
|
||||
params?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsRoverHealthUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsRoverHealthUpdateOwnerMutation {
|
||||
client: MarsRoverHealthClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsRoverHealthUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsRoverHealthUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsRoverHealthUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
// @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
|
||||
}
|
14
src/types/generated/mars-rover-health/bundle.ts
Normal file
14
src/types/generated/mars-rover-health/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// @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 }
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -113,9 +113,10 @@ export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterfa
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
setRoute: (
|
||||
{
|
||||
@ -129,7 +130,7 @@ export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
swapExactIn: (
|
||||
{
|
||||
@ -143,7 +144,7 @@ export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
transferResult: (
|
||||
{
|
||||
@ -157,7 +158,7 @@ export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterfa
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsSwapperBaseClient
|
||||
@ -180,19 +181,20 @@ export class MarsSwapperBaseClient
|
||||
}
|
||||
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
setRoute = async (
|
||||
@ -207,7 +209,7 @@ export class MarsSwapperBaseClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -221,7 +223,7 @@ export class MarsSwapperBaseClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
swapExactIn = async (
|
||||
@ -236,7 +238,7 @@ export class MarsSwapperBaseClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -250,7 +252,7 @@ export class MarsSwapperBaseClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
transferResult = async (
|
||||
@ -265,7 +267,7 @@ export class MarsSwapperBaseClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -279,7 +281,7 @@ export class MarsSwapperBaseClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
@ -27,7 +27,7 @@ import {
|
||||
export interface MarsSwapperBaseMessage {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
setRoute: (
|
||||
{
|
||||
denomIn,
|
||||
@ -38,7 +38,7 @@ export interface MarsSwapperBaseMessage {
|
||||
denomOut: string
|
||||
route: Empty
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
swapExactIn: (
|
||||
{
|
||||
@ -50,7 +50,7 @@ export interface MarsSwapperBaseMessage {
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
transferResult: (
|
||||
{
|
||||
@ -62,7 +62,7 @@ export interface MarsSwapperBaseMessage {
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
@ -78,7 +78,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
this.transferResult = this.transferResult.bind(this)
|
||||
}
|
||||
|
||||
updateOwner = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -86,10 +86,10 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
update_owner: {},
|
||||
update_owner: ownerUpdate,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
denomOut: string
|
||||
route: Empty
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -119,7 +119,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -149,7 +149,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -163,7 +163,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -179,7 +179,7 @@ export class MarsSwapperBaseMessageComposer implements MarsSwapperBaseMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,236 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
Addr,
|
||||
ArrayOfRouteResponseForEmpty,
|
||||
Coin,
|
||||
Decimal,
|
||||
Empty,
|
||||
EstimateExactInSwapResponse,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
RouteResponseForEmpty,
|
||||
Uint128,
|
||||
} from './MarsSwapperBase.types'
|
||||
import { MarsSwapperBaseClient, MarsSwapperBaseQueryClient } from './MarsSwapperBase.client'
|
||||
export const marsSwapperBaseQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsSwapperBase',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
|
||||
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
|
||||
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsSwapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_exact_in_swap',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsSwapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsSwapperBaseQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsSwapperBaseEstimateExactInSwapQuery<TData>
|
||||
extends MarsSwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
|
||||
args: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperBaseEstimateExactInSwapQuery<TData>) {
|
||||
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||
marsSwapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateExactInSwap({
|
||||
coinIn: args.coinIn,
|
||||
denomOut: args.denomOut,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseRoutesQuery<TData>
|
||||
extends MarsSwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperBaseRoutesQuery<TData>) {
|
||||
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||
marsSwapperBaseQueryKeys.routes(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.routes({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseRouteQuery<TData>
|
||||
extends MarsSwapperBaseReactQuery<RouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperBaseRouteQuery<TData>) {
|
||||
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||
marsSwapperBaseQueryKeys.route(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.route({
|
||||
denomIn: args.denomIn,
|
||||
denomOut: args.denomOut,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseOwnerQuery<TData>
|
||||
extends MarsSwapperBaseReactQuery<OwnerResponse, TData> {}
|
||||
export function useMarsSwapperBaseOwnerQuery<TData = OwnerResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsSwapperBaseOwnerQuery<TData>) {
|
||||
return useQuery<OwnerResponse, Error, TData>(
|
||||
marsSwapperBaseQueryKeys.owner(client?.contractAddress),
|
||||
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseTransferResultMutation {
|
||||
client: MarsSwapperBaseClient
|
||||
msg: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseTransferResultMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.transferResult(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseSwapExactInMutation {
|
||||
client: MarsSwapperBaseClient
|
||||
msg: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseSwapExactInMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseSetRouteMutation {
|
||||
client: MarsSwapperBaseClient
|
||||
msg: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: Empty
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseSetRouteMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperBaseUpdateOwnerMutation {
|
||||
client: MarsSwapperBaseClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperBaseUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -42,6 +42,12 @@ export type OwnerUpdate =
|
||||
| '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
|
||||
@ -80,6 +86,7 @@ export interface EstimateExactInSwapResponse {
|
||||
}
|
||||
export interface OwnerResponse {
|
||||
abolished: boolean
|
||||
emergency_owner?: string | null
|
||||
initialized: boolean
|
||||
owner?: string | null
|
||||
proposed?: string | null
|
||||
|
@ -1,14 +1,14 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 * as _32 from './MarsSwapperBase.types'
|
||||
import * as _33 from './MarsSwapperBase.client'
|
||||
import * as _34 from './MarsSwapperBase.message-composer'
|
||||
import * as _35 from './MarsSwapperBase.react-query'
|
||||
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'
|
||||
export namespace contracts {
|
||||
export const MarsSwapperBase = { ..._32, ..._33, ..._34, ..._35 }
|
||||
export const MarsSwapperBase = { ..._40, ..._41, ..._42, ..._43 }
|
||||
}
|
||||
|
@ -0,0 +1,289 @@
|
||||
// @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,
|
||||
OsmosisRoute,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
RouteResponseForEmpty,
|
||||
SwapAmountInRoute,
|
||||
Uint128,
|
||||
} from './MarsSwapperOsmosis.types'
|
||||
export interface MarsSwapperOsmosisReadOnlyInterface {
|
||||
contractAddress: string
|
||||
owner: () => Promise<OwnerResponse>
|
||||
route: ({
|
||||
denomIn,
|
||||
denomOut,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
}) => Promise<RouteResponseForEmpty>
|
||||
routes: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}) => Promise<ArrayOfRouteResponseForEmpty>
|
||||
estimateExactInSwap: ({
|
||||
coinIn,
|
||||
denomOut,
|
||||
}: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
}) => Promise<EstimateExactInSwapResponse>
|
||||
}
|
||||
export class MarsSwapperOsmosisQueryClient implements MarsSwapperOsmosisReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.owner = this.owner.bind(this)
|
||||
this.route = this.route.bind(this)
|
||||
this.routes = this.routes.bind(this)
|
||||
this.estimateExactInSwap = this.estimateExactInSwap.bind(this)
|
||||
}
|
||||
|
||||
owner = async (): Promise<OwnerResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
owner: {},
|
||||
})
|
||||
}
|
||||
route = async ({
|
||||
denomIn,
|
||||
denomOut,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
}): Promise<RouteResponseForEmpty> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
route: {
|
||||
denom_in: denomIn,
|
||||
denom_out: denomOut,
|
||||
},
|
||||
})
|
||||
}
|
||||
routes = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}): Promise<ArrayOfRouteResponseForEmpty> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
routes: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
estimateExactInSwap = async ({
|
||||
coinIn,
|
||||
denomOut,
|
||||
}: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
}): Promise<EstimateExactInSwapResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
estimate_exact_in_swap: {
|
||||
coin_in: coinIn,
|
||||
denom_out: denomOut,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsSwapperOsmosisInterface extends MarsSwapperOsmosisReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
setRoute: (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
route,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: OsmosisRoute
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
swapExactIn: (
|
||||
{
|
||||
coinIn,
|
||||
denomOut,
|
||||
slippage,
|
||||
}: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
transferResult: (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
recipient,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsSwapperOsmosisClient
|
||||
extends MarsSwapperOsmosisQueryClient
|
||||
implements MarsSwapperOsmosisInterface
|
||||
{
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||
super(client, contractAddress)
|
||||
this.client = client
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateOwner = this.updateOwner.bind(this)
|
||||
this.setRoute = this.setRoute.bind(this)
|
||||
this.swapExactIn = this.swapExactIn.bind(this)
|
||||
this.transferResult = this.transferResult.bind(this)
|
||||
}
|
||||
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
setRoute = async (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
route,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: OsmosisRoute
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
set_route: {
|
||||
denom_in: denomIn,
|
||||
denom_out: denomOut,
|
||||
route,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
swapExactIn = async (
|
||||
{
|
||||
coinIn,
|
||||
denomOut,
|
||||
slippage,
|
||||
}: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
swap_exact_in: {
|
||||
coin_in: coinIn,
|
||||
denom_out: denomOut,
|
||||
slippage,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
transferResult = async (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
recipient,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
transfer_result: {
|
||||
denom_in: denomIn,
|
||||
denom_out: denomOut,
|
||||
recipient,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
// @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,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,247 @@
|
||||
// @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,
|
||||
OsmosisRoute,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
RouteResponseForEmpty,
|
||||
SwapAmountInRoute,
|
||||
Uint128,
|
||||
} from './MarsSwapperOsmosis.types'
|
||||
import {
|
||||
MarsSwapperOsmosisClient,
|
||||
MarsSwapperOsmosisQueryClient,
|
||||
} from './MarsSwapperOsmosis.client'
|
||||
export const marsSwapperOsmosisQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsSwapperOsmosis',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsSwapperOsmosisQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsSwapperOsmosisQueryKeys.address(contractAddress)[0], method: 'owner', args },
|
||||
] as const,
|
||||
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsSwapperOsmosisQueryKeys.address(contractAddress)[0], method: 'route', args },
|
||||
] as const,
|
||||
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsSwapperOsmosisQueryKeys.address(contractAddress)[0], method: 'routes', args },
|
||||
] as const,
|
||||
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsSwapperOsmosisQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_exact_in_swap',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsSwapperOsmosisReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsSwapperOsmosisQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsSwapperOsmosisEstimateExactInSwapQuery<TData>
|
||||
extends MarsSwapperOsmosisReactQuery<EstimateExactInSwapResponse, TData> {
|
||||
args: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperOsmosisEstimateExactInSwapQuery<TData>) {
|
||||
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||
marsSwapperOsmosisQueryKeys.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 MarsSwapperOsmosisRoutesQuery<TData>
|
||||
extends MarsSwapperOsmosisReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperOsmosisRoutesQuery<TData>) {
|
||||
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||
marsSwapperOsmosisQueryKeys.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 MarsSwapperOsmosisRouteQuery<TData>
|
||||
extends MarsSwapperOsmosisReactQuery<RouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisRouteQuery<TData = RouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsSwapperOsmosisRouteQuery<TData>) {
|
||||
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||
marsSwapperOsmosisQueryKeys.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 MarsSwapperOsmosisOwnerQuery<TData>
|
||||
extends MarsSwapperOsmosisReactQuery<OwnerResponse, TData> {}
|
||||
export function useMarsSwapperOsmosisOwnerQuery<TData = OwnerResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsSwapperOsmosisOwnerQuery<TData>) {
|
||||
return useQuery<OwnerResponse, Error, TData>(
|
||||
marsSwapperOsmosisQueryKeys.owner(client?.contractAddress),
|
||||
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperOsmosisTransferResultMutation {
|
||||
client: MarsSwapperOsmosisClient
|
||||
msg: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisTransferResultMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperOsmosisTransferResultMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperOsmosisTransferResultMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.transferResult(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperOsmosisSwapExactInMutation {
|
||||
client: MarsSwapperOsmosisClient
|
||||
msg: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisSwapExactInMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperOsmosisSwapExactInMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperOsmosisSwapExactInMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperOsmosisSetRouteMutation {
|
||||
client: MarsSwapperOsmosisClient
|
||||
msg: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: OsmosisRoute
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisSetRouteMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperOsmosisSetRouteMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperOsmosisSetRouteMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsSwapperOsmosisUpdateOwnerMutation {
|
||||
client: MarsSwapperOsmosisClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsSwapperOsmosisUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsSwapperOsmosisUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsSwapperOsmosisUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
// @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: OsmosisRoute
|
||||
}
|
||||
}
|
||||
| {
|
||||
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 OsmosisRoute = SwapAmountInRoute[]
|
||||
export type Uint128 = string
|
||||
export type Decimal = string
|
||||
export type Addr = string
|
||||
export interface SwapAmountInRoute {
|
||||
pool_id: number
|
||||
token_out_denom: string
|
||||
[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 interface Empty {
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type ArrayOfRouteResponseForEmpty = RouteResponseForEmpty[]
|
14
src/types/generated/mars-swapper-osmosis/bundle.ts
Normal file
14
src/types/generated/mars-swapper-osmosis/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// @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 _44 from './MarsSwapperOsmosis.types'
|
||||
import * as _45 from './MarsSwapperOsmosis.client'
|
||||
import * as _46 from './MarsSwapperOsmosis.message-composer'
|
||||
import * as _47 from './MarsSwapperOsmosis.react-query'
|
||||
export namespace contracts {
|
||||
export const MarsSwapperOsmosis = { ..._44, ..._45, ..._46, ..._47 }
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -17,8 +17,8 @@ import {
|
||||
InstantiateMsg,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsZapperBase.types'
|
||||
export interface MarsZapperBaseReadOnlyInterface {
|
||||
} from './MarsV2ZapperBase.types'
|
||||
export interface MarsV2ZapperBaseReadOnlyInterface {
|
||||
contractAddress: string
|
||||
estimateProvideLiquidity: ({
|
||||
coinsIn,
|
||||
@ -29,7 +29,7 @@ export interface MarsZapperBaseReadOnlyInterface {
|
||||
}) => Promise<Uint128>
|
||||
estimateWithdrawLiquidity: ({ coinIn }: { coinIn: Coin }) => Promise<ArrayOfCoin>
|
||||
}
|
||||
export class MarsZapperBaseQueryClient implements MarsZapperBaseReadOnlyInterface {
|
||||
export class MarsV2ZapperBaseQueryClient implements MarsV2ZapperBaseReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
@ -62,7 +62,7 @@ export class MarsZapperBaseQueryClient implements MarsZapperBaseReadOnlyInterfac
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsZapperBaseInterface extends MarsZapperBaseReadOnlyInterface {
|
||||
export interface MarsV2ZapperBaseInterface extends MarsV2ZapperBaseReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
provideLiquidity: (
|
||||
@ -77,27 +77,30 @@ export interface MarsZapperBaseInterface extends MarsZapperBaseReadOnlyInterface
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
withdrawLiquidity: (
|
||||
{
|
||||
minimumReceive,
|
||||
recipient,
|
||||
}: {
|
||||
minimumReceive: Coin[]
|
||||
recipient?: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
callback: (
|
||||
callbackMsg: CallbackMsg,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsZapperBaseClient
|
||||
extends MarsZapperBaseQueryClient
|
||||
implements MarsZapperBaseInterface
|
||||
export class MarsV2ZapperBaseClient
|
||||
extends MarsV2ZapperBaseQueryClient
|
||||
implements MarsV2ZapperBaseInterface
|
||||
{
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
@ -125,7 +128,7 @@ export class MarsZapperBaseClient
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
@ -139,46 +142,50 @@ export class MarsZapperBaseClient
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
withdrawLiquidity = async (
|
||||
{
|
||||
minimumReceive,
|
||||
recipient,
|
||||
}: {
|
||||
minimumReceive: Coin[]
|
||||
recipient?: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
withdraw_liquidity: {
|
||||
minimum_receive: minimumReceive,
|
||||
recipient,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
callback = async (
|
||||
callbackMsg: CallbackMsg,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
callback: {},
|
||||
callback: callbackMsg,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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 { MsgExecuteContractEncodeObject } from 'cosmwasm'
|
||||
import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate'
|
||||
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'
|
||||
import { toUtf8 } from '@cosmjs/encoding'
|
||||
|
||||
@ -18,8 +18,8 @@ import {
|
||||
InstantiateMsg,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsZapperBase.types'
|
||||
export interface MarsZapperBaseMessage {
|
||||
} from './MarsV2ZapperBase.types'
|
||||
export interface MarsV2ZapperBaseMessage {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
provideLiquidity: (
|
||||
@ -32,19 +32,21 @@ export interface MarsZapperBaseMessage {
|
||||
minimumReceive: Uint128
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
withdrawLiquidity: (
|
||||
{
|
||||
minimumReceive,
|
||||
recipient,
|
||||
}: {
|
||||
minimumReceive: Coin[]
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
) => MsgExecuteContractEncodeObject
|
||||
callback: (funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
callback: (callbackMsg: CallbackMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject
|
||||
}
|
||||
export class MarsZapperBaseMessageComposer implements MarsZapperBaseMessage {
|
||||
export class MarsV2ZapperBaseMessageComposer implements MarsV2ZapperBaseMessage {
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
@ -66,7 +68,7 @@ export class MarsZapperBaseMessageComposer implements MarsZapperBaseMessage {
|
||||
minimumReceive: Uint128
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -82,17 +84,19 @@ export class MarsZapperBaseMessageComposer implements MarsZapperBaseMessage {
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
withdrawLiquidity = (
|
||||
{
|
||||
minimumReceive,
|
||||
recipient,
|
||||
}: {
|
||||
minimumReceive: Coin[]
|
||||
recipient?: string
|
||||
},
|
||||
funds?: Coin[],
|
||||
_funds?: Coin[],
|
||||
): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
@ -102,15 +106,16 @@ export class MarsZapperBaseMessageComposer implements MarsZapperBaseMessage {
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
withdraw_liquidity: {
|
||||
minimum_receive: minimumReceive,
|
||||
recipient,
|
||||
},
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
||||
callback = (funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
callback = (callbackMsg: CallbackMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => {
|
||||
return {
|
||||
typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
|
||||
value: MsgExecuteContract.fromPartial({
|
||||
@ -118,10 +123,10 @@ export class MarsZapperBaseMessageComposer implements MarsZapperBaseMessage {
|
||||
contract: this.contractAddress,
|
||||
msg: toUtf8(
|
||||
JSON.stringify({
|
||||
callback: {},
|
||||
callback: callbackMsg,
|
||||
}),
|
||||
),
|
||||
funds,
|
||||
funds: _funds,
|
||||
}),
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
Addr,
|
||||
ArrayOfCoin,
|
||||
CallbackMsg,
|
||||
Coin,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsV2ZapperBase.types'
|
||||
import { MarsV2ZapperBaseClient, MarsV2ZapperBaseQueryClient } from './MarsV2ZapperBase.client'
|
||||
export const marsV2ZapperBaseQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsV2ZapperBase',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsV2ZapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsV2ZapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_provide_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
estimateWithdrawLiquidity: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...marsV2ZapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_withdraw_liquidity',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsV2ZapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsV2ZapperBaseQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsV2ZapperBaseEstimateWithdrawLiquidityQuery<TData>
|
||||
extends MarsV2ZapperBaseReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
coinIn: Coin
|
||||
}
|
||||
}
|
||||
export function useMarsV2ZapperBaseEstimateWithdrawLiquidityQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsV2ZapperBaseEstimateWithdrawLiquidityQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
marsV2ZapperBaseQueryKeys.estimateWithdrawLiquidity(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateWithdrawLiquidity({
|
||||
coinIn: args.coinIn,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsV2ZapperBaseEstimateProvideLiquidityQuery<TData>
|
||||
extends MarsV2ZapperBaseReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
coinsIn: Coin[]
|
||||
lpTokenOut: string
|
||||
}
|
||||
}
|
||||
export function useMarsV2ZapperBaseEstimateProvideLiquidityQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsV2ZapperBaseEstimateProvideLiquidityQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
marsV2ZapperBaseQueryKeys.estimateProvideLiquidity(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.estimateProvideLiquidity({
|
||||
coinsIn: args.coinsIn,
|
||||
lpTokenOut: args.lpTokenOut,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsV2ZapperBaseCallbackMutation {
|
||||
client: MarsV2ZapperBaseClient
|
||||
msg: CallbackMsg
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsV2ZapperBaseCallbackMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsV2ZapperBaseCallbackMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsV2ZapperBaseCallbackMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsV2ZapperBaseWithdrawLiquidityMutation {
|
||||
client: MarsV2ZapperBaseClient
|
||||
msg: {
|
||||
minimumReceive: Coin[]
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsV2ZapperBaseWithdrawLiquidityMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsV2ZapperBaseWithdrawLiquidityMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsV2ZapperBaseWithdrawLiquidityMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.withdrawLiquidity(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsV2ZapperBaseProvideLiquidityMutation {
|
||||
client: MarsV2ZapperBaseClient
|
||||
msg: {
|
||||
lpTokenOut: string
|
||||
minimumReceive: Uint128
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsV2ZapperBaseProvideLiquidityMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsV2ZapperBaseProvideLiquidityMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsV2ZapperBaseProvideLiquidityMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.provideLiquidity(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.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.
|
||||
*/
|
||||
@ -16,6 +16,7 @@ export type ExecuteMsg =
|
||||
}
|
||||
| {
|
||||
withdraw_liquidity: {
|
||||
minimum_receive: Coin[]
|
||||
recipient?: string | null
|
||||
}
|
||||
}
|
14
src/types/generated/mars-v2-zapper-base/bundle.ts
Normal file
14
src/types/generated/mars-v2-zapper-base/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// @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 }
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
Addr,
|
||||
CallbackMsg,
|
||||
Coin,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
NewPositionRequest,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsV3ZapperBase.types'
|
||||
export interface MarsV3ZapperBaseReadOnlyInterface {
|
||||
contractAddress: string
|
||||
owner: () => Promise<OwnerResponse>
|
||||
}
|
||||
export class MarsV3ZapperBaseQueryClient implements MarsV3ZapperBaseReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.owner = this.owner.bind(this)
|
||||
}
|
||||
|
||||
owner = async (): Promise<OwnerResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
owner: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsV3ZapperBaseInterface extends MarsV3ZapperBaseReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
createPosition: (
|
||||
{
|
||||
lowerTick,
|
||||
poolId,
|
||||
tokenMinAmount0,
|
||||
tokenMinAmount1,
|
||||
tokensProvided,
|
||||
upperTick,
|
||||
}: {
|
||||
lowerTick: number
|
||||
poolId: number
|
||||
tokenMinAmount0: string
|
||||
tokenMinAmount1: string
|
||||
tokensProvided: Coin[]
|
||||
upperTick: number
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateOwner: (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
callback: (
|
||||
callbackMsg: CallbackMsg,
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsV3ZapperBaseClient
|
||||
extends MarsV3ZapperBaseQueryClient
|
||||
implements MarsV3ZapperBaseInterface
|
||||
{
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||
super(client, contractAddress)
|
||||
this.client = client
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.createPosition = this.createPosition.bind(this)
|
||||
this.updateOwner = this.updateOwner.bind(this)
|
||||
this.callback = this.callback.bind(this)
|
||||
}
|
||||
|
||||
createPosition = async (
|
||||
{
|
||||
lowerTick,
|
||||
poolId,
|
||||
tokenMinAmount0,
|
||||
tokenMinAmount1,
|
||||
tokensProvided,
|
||||
upperTick,
|
||||
}: {
|
||||
lowerTick: number
|
||||
poolId: number
|
||||
tokenMinAmount0: string
|
||||
tokenMinAmount1: string
|
||||
tokensProvided: Coin[]
|
||||
upperTick: number
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
create_position: {
|
||||
lower_tick: lowerTick,
|
||||
pool_id: poolId,
|
||||
token_min_amount0: tokenMinAmount0,
|
||||
token_min_amount1: tokenMinAmount1,
|
||||
tokens_provided: tokensProvided,
|
||||
upper_tick: upperTick,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
updateOwner = async (
|
||||
ownerUpdate: OwnerUpdate,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_owner: ownerUpdate,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
callback = async (
|
||||
callbackMsg: CallbackMsg,
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
_funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
callback: callbackMsg,
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
_funds,
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
// @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,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
|
||||
import {
|
||||
Addr,
|
||||
CallbackMsg,
|
||||
Coin,
|
||||
ExecuteMsg,
|
||||
InstantiateMsg,
|
||||
NewPositionRequest,
|
||||
OwnerResponse,
|
||||
OwnerUpdate,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
} from './MarsV3ZapperBase.types'
|
||||
import { MarsV3ZapperBaseClient, MarsV3ZapperBaseQueryClient } from './MarsV3ZapperBase.client'
|
||||
export const marsV3ZapperBaseQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsV3ZapperBase',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsV3ZapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsV3ZapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||
}
|
||||
export interface MarsV3ZapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsV3ZapperBaseQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsV3ZapperBaseOwnerQuery<TData>
|
||||
extends MarsV3ZapperBaseReactQuery<OwnerResponse, TData> {}
|
||||
export function useMarsV3ZapperBaseOwnerQuery<TData = OwnerResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsV3ZapperBaseOwnerQuery<TData>) {
|
||||
return useQuery<OwnerResponse, Error, TData>(
|
||||
marsV3ZapperBaseQueryKeys.owner(client?.contractAddress),
|
||||
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsV3ZapperBaseCallbackMutation {
|
||||
client: MarsV3ZapperBaseClient
|
||||
msg: CallbackMsg
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsV3ZapperBaseCallbackMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsV3ZapperBaseCallbackMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsV3ZapperBaseCallbackMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsV3ZapperBaseUpdateOwnerMutation {
|
||||
client: MarsV3ZapperBaseClient
|
||||
msg: OwnerUpdate
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsV3ZapperBaseUpdateOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsV3ZapperBaseUpdateOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsV3ZapperBaseUpdateOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MarsV3ZapperBaseCreatePositionMutation {
|
||||
client: MarsV3ZapperBaseClient
|
||||
msg: {
|
||||
lowerTick: number
|
||||
poolId: number
|
||||
tokenMinAmount0: string
|
||||
tokenMinAmount1: string
|
||||
tokensProvided: Coin[]
|
||||
upperTick: number
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsV3ZapperBaseCreatePositionMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsV3ZapperBaseCreatePositionMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsV3ZapperBaseCreatePositionMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.createPosition(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// @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
|
||||
}
|
14
src/types/generated/mars-v3-zapper-base/bundle.ts
Normal file
14
src/types/generated/mars-v3-zapper-base/bundle.ts
Normal file
@ -0,0 +1,14 @@
|
||||
// @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 }
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.24.0.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _36 from './MarsZapperBase.types'
|
||||
import * as _37 from './MarsZapperBase.client'
|
||||
import * as _38 from './MarsZapperBase.message-composer'
|
||||
import * as _39 from './MarsZapperBase.react-query'
|
||||
export namespace contracts {
|
||||
export const MarsZapperBase = { ..._36, ..._37, ..._38, ..._39 }
|
||||
}
|
36
src/types/interfaces/responses.d.ts
vendored
36
src/types/interfaces/responses.d.ts
vendored
@ -1,36 +0,0 @@
|
||||
interface AccountResponse {
|
||||
account_id: string
|
||||
deposits: Coin[]
|
||||
debts: Coin[]
|
||||
lends: Coin[]
|
||||
vaults: import('types/generated/mars-mock-credit-manager/MarsMockCreditManager.types').ArrayOfVaultInfoResponse
|
||||
}
|
||||
|
||||
interface MarketResponse {
|
||||
denom: string
|
||||
max_loan_to_value: string
|
||||
liquidation_threshold: string
|
||||
liquidation_bonus: string
|
||||
reserve_factor: string
|
||||
interest_rate_model: {
|
||||
optimal_utilization_rate: string
|
||||
base: string
|
||||
slope_1: string
|
||||
slope_2: string
|
||||
}
|
||||
borrow_index: string
|
||||
liquidity_index: string
|
||||
borrow_rate: string
|
||||
liquidity_rate: string
|
||||
indexes_last_updated: number
|
||||
collateral_total_scaled: string
|
||||
debt_total_scaled: string
|
||||
deposit_enabled: boolean
|
||||
borrow_enabled: boolean
|
||||
deposit_cap: string
|
||||
}
|
||||
|
||||
interface PriceResult {
|
||||
denom: string
|
||||
price: string
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
export function resolvePositionResponses(responses: AccountResponse[]): Account[] {
|
||||
import { Positions as CreditManagerPosition } from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
||||
import { Market as RedBankMarket } from 'types/generated/mars-mock-red-bank/MarsMockRedBank.types'
|
||||
|
||||
export function resolvePositionResponses(responses: CreditManagerPosition[]): Account[] {
|
||||
return responses.map(resolvePositionResponse)
|
||||
}
|
||||
|
||||
export function resolvePositionResponse(response: AccountResponse): Account {
|
||||
export function resolvePositionResponse(response: CreditManagerPosition): Account {
|
||||
return {
|
||||
id: response.account_id,
|
||||
deposits: response.deposits,
|
||||
@ -12,7 +15,7 @@ export function resolvePositionResponse(response: AccountResponse): Account {
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveMarketResponses(responses: MarketResponse[]): Market[] {
|
||||
export function resolveMarketResponses(responses: RedBankMarket[]): Market[] {
|
||||
return responses.map((response) => ({
|
||||
denom: response.denom,
|
||||
borrowRate: Number(response.borrow_rate),
|
||||
|
@ -1,13 +1,11 @@
|
||||
import BigNumber from 'bignumber.js'
|
||||
|
||||
import { IS_TESTNET } from 'constants/env'
|
||||
import { TESTNET_VAULTS, VAULTS } from 'constants/vaults'
|
||||
import { TESTNET_VAULTS_META_DATA, VAULTS_META_DATA } from 'constants/vaults'
|
||||
import { BN } from 'utils/helpers'
|
||||
import { getNetCollateralValue } from 'utils/accounts'
|
||||
import { BNCoin } from 'types/classes/BNCoin'
|
||||
|
||||
export function getVaultMetaData(address: string) {
|
||||
const vaults = IS_TESTNET ? TESTNET_VAULTS : VAULTS
|
||||
const vaults = IS_TESTNET ? TESTNET_VAULTS_META_DATA : VAULTS_META_DATA
|
||||
return vaults.find((vault) => vault.address === address)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user