WIP (#12)
* osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
This commit is contained in:
@@ -0,0 +1,635 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
InstantiateMsg,
|
||||
ExecuteMsg,
|
||||
Binary,
|
||||
Expiration,
|
||||
Timestamp,
|
||||
Uint64,
|
||||
QueryMsg,
|
||||
AllNftInfoResponseForEmpty,
|
||||
OwnerOfResponse,
|
||||
Approval,
|
||||
NftInfoResponseForEmpty,
|
||||
Empty,
|
||||
OperatorsResponse,
|
||||
TokensResponse,
|
||||
ApprovalResponse,
|
||||
ApprovalsResponse,
|
||||
ContractInfoResponse,
|
||||
MinterResponse,
|
||||
NumTokensResponse,
|
||||
String,
|
||||
} from './AccountNft.types'
|
||||
export interface AccountNftReadOnlyInterface {
|
||||
contractAddress: string
|
||||
proposedNewOwner: () => Promise<String>
|
||||
ownerOf: ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}) => Promise<OwnerOfResponse>
|
||||
approval: ({
|
||||
includeExpired,
|
||||
spender,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
spender: string
|
||||
tokenId: string
|
||||
}) => Promise<ApprovalResponse>
|
||||
approvals: ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}) => Promise<ApprovalsResponse>
|
||||
allOperators: ({
|
||||
includeExpired,
|
||||
limit,
|
||||
owner,
|
||||
startAfter,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}) => Promise<OperatorsResponse>
|
||||
numTokens: () => Promise<NumTokensResponse>
|
||||
contractInfo: () => Promise<ContractInfoResponse>
|
||||
nftInfo: ({ tokenId }: { tokenId: string }) => Promise<NftInfoResponseForEmpty>
|
||||
allNftInfo: ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}) => Promise<AllNftInfoResponseForEmpty>
|
||||
tokens: ({
|
||||
limit,
|
||||
owner,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}) => Promise<TokensResponse>
|
||||
allTokens: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<TokensResponse>
|
||||
minter: () => Promise<MinterResponse>
|
||||
}
|
||||
export class AccountNftQueryClient implements AccountNftReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.proposedNewOwner = this.proposedNewOwner.bind(this)
|
||||
this.ownerOf = this.ownerOf.bind(this)
|
||||
this.approval = this.approval.bind(this)
|
||||
this.approvals = this.approvals.bind(this)
|
||||
this.allOperators = this.allOperators.bind(this)
|
||||
this.numTokens = this.numTokens.bind(this)
|
||||
this.contractInfo = this.contractInfo.bind(this)
|
||||
this.nftInfo = this.nftInfo.bind(this)
|
||||
this.allNftInfo = this.allNftInfo.bind(this)
|
||||
this.tokens = this.tokens.bind(this)
|
||||
this.allTokens = this.allTokens.bind(this)
|
||||
this.minter = this.minter.bind(this)
|
||||
}
|
||||
|
||||
proposedNewOwner = async (): Promise<String> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
proposed_new_owner: {},
|
||||
})
|
||||
}
|
||||
ownerOf = async ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}): Promise<OwnerOfResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
owner_of: {
|
||||
include_expired: includeExpired,
|
||||
token_id: tokenId,
|
||||
},
|
||||
})
|
||||
}
|
||||
approval = async ({
|
||||
includeExpired,
|
||||
spender,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
spender: string
|
||||
tokenId: string
|
||||
}): Promise<ApprovalResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
approval: {
|
||||
include_expired: includeExpired,
|
||||
spender,
|
||||
token_id: tokenId,
|
||||
},
|
||||
})
|
||||
}
|
||||
approvals = async ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}): Promise<ApprovalsResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
approvals: {
|
||||
include_expired: includeExpired,
|
||||
token_id: tokenId,
|
||||
},
|
||||
})
|
||||
}
|
||||
allOperators = async ({
|
||||
includeExpired,
|
||||
limit,
|
||||
owner,
|
||||
startAfter,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}): Promise<OperatorsResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_operators: {
|
||||
include_expired: includeExpired,
|
||||
limit,
|
||||
owner,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
numTokens = async (): Promise<NumTokensResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
num_tokens: {},
|
||||
})
|
||||
}
|
||||
contractInfo = async (): Promise<ContractInfoResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
contract_info: {},
|
||||
})
|
||||
}
|
||||
nftInfo = async ({ tokenId }: { tokenId: string }): Promise<NftInfoResponseForEmpty> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
nft_info: {
|
||||
token_id: tokenId,
|
||||
},
|
||||
})
|
||||
}
|
||||
allNftInfo = async ({
|
||||
includeExpired,
|
||||
tokenId,
|
||||
}: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}): Promise<AllNftInfoResponseForEmpty> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_nft_info: {
|
||||
include_expired: includeExpired,
|
||||
token_id: tokenId,
|
||||
},
|
||||
})
|
||||
}
|
||||
tokens = async ({
|
||||
limit,
|
||||
owner,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}): Promise<TokensResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
tokens: {
|
||||
limit,
|
||||
owner,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
allTokens = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<TokensResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_tokens: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
minter = async (): Promise<MinterResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
minter: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface AccountNftInterface extends AccountNftReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
proposeNewOwner: (
|
||||
{
|
||||
newOwner,
|
||||
}: {
|
||||
newOwner: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
acceptOwnership: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
mint: (
|
||||
{
|
||||
user,
|
||||
}: {
|
||||
user: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
transferNft: (
|
||||
{
|
||||
recipient,
|
||||
tokenId,
|
||||
}: {
|
||||
recipient: string
|
||||
tokenId: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
sendNft: (
|
||||
{
|
||||
contract,
|
||||
msg,
|
||||
tokenId,
|
||||
}: {
|
||||
contract: string
|
||||
msg: Binary
|
||||
tokenId: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
approve: (
|
||||
{
|
||||
expires,
|
||||
spender,
|
||||
tokenId,
|
||||
}: {
|
||||
expires?: Expiration
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
revoke: (
|
||||
{
|
||||
spender,
|
||||
tokenId,
|
||||
}: {
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
approveAll: (
|
||||
{
|
||||
expires,
|
||||
operator,
|
||||
}: {
|
||||
expires?: Expiration
|
||||
operator: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
revokeAll: (
|
||||
{
|
||||
operator,
|
||||
}: {
|
||||
operator: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
burn: (
|
||||
{
|
||||
tokenId,
|
||||
}: {
|
||||
tokenId: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class AccountNftClient extends AccountNftQueryClient implements AccountNftInterface {
|
||||
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.proposeNewOwner = this.proposeNewOwner.bind(this)
|
||||
this.acceptOwnership = this.acceptOwnership.bind(this)
|
||||
this.mint = this.mint.bind(this)
|
||||
this.transferNft = this.transferNft.bind(this)
|
||||
this.sendNft = this.sendNft.bind(this)
|
||||
this.approve = this.approve.bind(this)
|
||||
this.revoke = this.revoke.bind(this)
|
||||
this.approveAll = this.approveAll.bind(this)
|
||||
this.revokeAll = this.revokeAll.bind(this)
|
||||
this.burn = this.burn.bind(this)
|
||||
}
|
||||
|
||||
proposeNewOwner = async (
|
||||
{
|
||||
newOwner,
|
||||
}: {
|
||||
newOwner: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
propose_new_owner: {
|
||||
new_owner: newOwner,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
acceptOwnership = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
accept_ownership: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
mint = async (
|
||||
{
|
||||
user,
|
||||
}: {
|
||||
user: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
mint: {
|
||||
user,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
transferNft = async (
|
||||
{
|
||||
recipient,
|
||||
tokenId,
|
||||
}: {
|
||||
recipient: string
|
||||
tokenId: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
transfer_nft: {
|
||||
recipient,
|
||||
token_id: tokenId,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
sendNft = async (
|
||||
{
|
||||
contract,
|
||||
msg,
|
||||
tokenId,
|
||||
}: {
|
||||
contract: string
|
||||
msg: Binary
|
||||
tokenId: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
send_nft: {
|
||||
contract,
|
||||
msg,
|
||||
token_id: tokenId,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
approve = async (
|
||||
{
|
||||
expires,
|
||||
spender,
|
||||
tokenId,
|
||||
}: {
|
||||
expires?: Expiration
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
approve: {
|
||||
expires,
|
||||
spender,
|
||||
token_id: tokenId,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
revoke = async (
|
||||
{
|
||||
spender,
|
||||
tokenId,
|
||||
}: {
|
||||
spender: string
|
||||
tokenId: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
revoke: {
|
||||
spender,
|
||||
token_id: tokenId,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
approveAll = async (
|
||||
{
|
||||
expires,
|
||||
operator,
|
||||
}: {
|
||||
expires?: Expiration
|
||||
operator: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
approve_all: {
|
||||
expires,
|
||||
operator,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
revokeAll = async (
|
||||
{
|
||||
operator,
|
||||
}: {
|
||||
operator: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
revoke_all: {
|
||||
operator,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
burn = async (
|
||||
{
|
||||
tokenId,
|
||||
}: {
|
||||
tokenId: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
burn: {
|
||||
token_id: tokenId,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,535 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee, Coin } from '@cosmjs/amino'
|
||||
import {
|
||||
InstantiateMsg,
|
||||
ExecuteMsg,
|
||||
Binary,
|
||||
Expiration,
|
||||
Timestamp,
|
||||
Uint64,
|
||||
QueryMsg,
|
||||
AllNftInfoResponseForEmpty,
|
||||
OwnerOfResponse,
|
||||
Approval,
|
||||
NftInfoResponseForEmpty,
|
||||
Empty,
|
||||
OperatorsResponse,
|
||||
TokensResponse,
|
||||
ApprovalResponse,
|
||||
ApprovalsResponse,
|
||||
ContractInfoResponse,
|
||||
MinterResponse,
|
||||
NumTokensResponse,
|
||||
String,
|
||||
} from './AccountNft.types'
|
||||
import { AccountNftQueryClient, AccountNftClient } from './AccountNft.client'
|
||||
export const accountNftQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'accountNft',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...accountNftQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
proposedNewOwner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'proposed_new_owner', args },
|
||||
] as const,
|
||||
ownerOf: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'owner_of', args }] as const,
|
||||
approval: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'approval', args }] as const,
|
||||
approvals: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'approvals', args }] as const,
|
||||
allOperators: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'all_operators', args },
|
||||
] as const,
|
||||
numTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'num_tokens', args }] as const,
|
||||
contractInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'contract_info', args },
|
||||
] as const,
|
||||
nftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'nft_info', args }] as const,
|
||||
allNftInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'all_nft_info', args }] as const,
|
||||
tokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'tokens', args }] as const,
|
||||
allTokens: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'all_tokens', args }] as const,
|
||||
minter: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...accountNftQueryKeys.address(contractAddress)[0], method: 'minter', args }] as const,
|
||||
}
|
||||
export interface AccountNftReactQuery<TResponse, TData = TResponse> {
|
||||
client: AccountNftQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface AccountNftMinterQuery<TData> extends AccountNftReactQuery<MinterResponse, TData> {}
|
||||
export function useAccountNftMinterQuery<TData = MinterResponse>({
|
||||
client,
|
||||
options,
|
||||
}: AccountNftMinterQuery<TData>) {
|
||||
return useQuery<MinterResponse, Error, TData>(
|
||||
accountNftQueryKeys.minter(client?.contractAddress),
|
||||
() => (client ? client.minter() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface AccountNftAllTokensQuery<TData>
|
||||
extends AccountNftReactQuery<TokensResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftAllTokensQuery<TData = TokensResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftAllTokensQuery<TData>) {
|
||||
return useQuery<TokensResponse, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftTokensQuery<TData> extends AccountNftReactQuery<TokensResponse, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftTokensQuery<TData = TokensResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftTokensQuery<TData>) {
|
||||
return useQuery<TokensResponse, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftAllNftInfoQuery<TData>
|
||||
extends AccountNftReactQuery<AllNftInfoResponseForEmpty, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftAllNftInfoQuery<TData = AllNftInfoResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftAllNftInfoQuery<TData>) {
|
||||
return useQuery<AllNftInfoResponseForEmpty, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftNftInfoQuery<TData>
|
||||
extends AccountNftReactQuery<NftInfoResponseForEmpty, TData> {
|
||||
args: {
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftNftInfoQuery<TData = NftInfoResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftNftInfoQuery<TData>) {
|
||||
return useQuery<NftInfoResponseForEmpty, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftContractInfoQuery<TData>
|
||||
extends AccountNftReactQuery<ContractInfoResponse, TData> {}
|
||||
export function useAccountNftContractInfoQuery<TData = ContractInfoResponse>({
|
||||
client,
|
||||
options,
|
||||
}: AccountNftContractInfoQuery<TData>) {
|
||||
return useQuery<ContractInfoResponse, Error, TData>(
|
||||
accountNftQueryKeys.contractInfo(client?.contractAddress),
|
||||
() => (client ? client.contractInfo() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface AccountNftNumTokensQuery<TData>
|
||||
extends AccountNftReactQuery<NumTokensResponse, TData> {}
|
||||
export function useAccountNftNumTokensQuery<TData = NumTokensResponse>({
|
||||
client,
|
||||
options,
|
||||
}: AccountNftNumTokensQuery<TData>) {
|
||||
return useQuery<NumTokensResponse, Error, TData>(
|
||||
accountNftQueryKeys.numTokens(client?.contractAddress),
|
||||
() => (client ? client.numTokens() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface AccountNftAllOperatorsQuery<TData>
|
||||
extends AccountNftReactQuery<OperatorsResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
limit?: number
|
||||
owner: string
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftAllOperatorsQuery<TData = OperatorsResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftAllOperatorsQuery<TData>) {
|
||||
return useQuery<OperatorsResponse, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftApprovalsQuery<TData>
|
||||
extends AccountNftReactQuery<ApprovalsResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftApprovalsQuery<TData = ApprovalsResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftApprovalsQuery<TData>) {
|
||||
return useQuery<ApprovalsResponse, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftApprovalQuery<TData>
|
||||
extends AccountNftReactQuery<ApprovalResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftApprovalQuery<TData = ApprovalResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftApprovalQuery<TData>) {
|
||||
return useQuery<ApprovalResponse, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftOwnerOfQuery<TData>
|
||||
extends AccountNftReactQuery<OwnerOfResponse, TData> {
|
||||
args: {
|
||||
includeExpired?: boolean
|
||||
tokenId: string
|
||||
}
|
||||
}
|
||||
export function useAccountNftOwnerOfQuery<TData = OwnerOfResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: AccountNftOwnerOfQuery<TData>) {
|
||||
return useQuery<OwnerOfResponse, Error, TData>(
|
||||
accountNftQueryKeys.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 AccountNftProposedNewOwnerQuery<TData>
|
||||
extends AccountNftReactQuery<String, TData> {}
|
||||
export function useAccountNftProposedNewOwnerQuery<TData = String>({
|
||||
client,
|
||||
options,
|
||||
}: AccountNftProposedNewOwnerQuery<TData>) {
|
||||
return useQuery<String, Error, TData>(
|
||||
accountNftQueryKeys.proposedNewOwner(client?.contractAddress),
|
||||
() => (client ? client.proposedNewOwner() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface AccountNftBurnMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftBurnMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftBurnMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftBurnMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.burn(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftRevokeAllMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
operator: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftRevokeAllMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, AccountNftRevokeAllMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftRevokeAllMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.revokeAll(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftApproveAllMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
expires?: Expiration
|
||||
operator: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftApproveAllMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, AccountNftApproveAllMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftApproveAllMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.approveAll(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftRevokeMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftRevokeMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftRevokeMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftRevokeMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.revoke(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftApproveMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
expires?: Expiration
|
||||
spender: string
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftApproveMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftApproveMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftApproveMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.approve(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftSendNftMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
contract: string
|
||||
msg: Binary
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftSendNftMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftSendNftMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftSendNftMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.sendNft(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftTransferNftMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
recipient: string
|
||||
tokenId: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftTransferNftMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, AccountNftTransferNftMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftTransferNftMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.transferNft(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftMintMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
user: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftMintMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, AccountNftMintMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftMintMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.mint(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftAcceptOwnershipMutation {
|
||||
client: AccountNftClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftAcceptOwnershipMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, AccountNftAcceptOwnershipMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftAcceptOwnershipMutation>(
|
||||
({ client, args: { fee, memo, funds } = {} }) => client.acceptOwnership(fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface AccountNftProposeNewOwnerMutation {
|
||||
client: AccountNftClient
|
||||
msg: {
|
||||
newOwner: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useAccountNftProposeNewOwnerMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, AccountNftProposeNewOwnerMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, AccountNftProposeNewOwnerMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.proposeNewOwner(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface InstantiateMsg {
|
||||
minter: string
|
||||
name: string
|
||||
symbol: string
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
propose_new_owner: {
|
||||
new_owner: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
accept_ownership: {}
|
||||
}
|
||||
| {
|
||||
mint: {
|
||||
user: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
transfer_nft: {
|
||||
recipient: string
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
send_nft: {
|
||||
contract: string
|
||||
msg: Binary
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
approve: {
|
||||
expires?: Expiration | null
|
||||
spender: string
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
revoke: {
|
||||
spender: string
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
approve_all: {
|
||||
expires?: Expiration | null
|
||||
operator: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
revoke_all: {
|
||||
operator: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
burn: {
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
export type Binary = string
|
||||
export type Expiration =
|
||||
| {
|
||||
at_height: number
|
||||
}
|
||||
| {
|
||||
at_time: Timestamp
|
||||
}
|
||||
| {
|
||||
never: {}
|
||||
}
|
||||
export type Timestamp = Uint64
|
||||
export type Uint64 = string
|
||||
export type QueryMsg =
|
||||
| {
|
||||
proposed_new_owner: {}
|
||||
}
|
||||
| {
|
||||
owner_of: {
|
||||
include_expired?: boolean | null
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
approval: {
|
||||
include_expired?: boolean | null
|
||||
spender: string
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
approvals: {
|
||||
include_expired?: boolean | null
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_operators: {
|
||||
include_expired?: boolean | null
|
||||
limit?: number | null
|
||||
owner: string
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
num_tokens: {}
|
||||
}
|
||||
| {
|
||||
contract_info: {}
|
||||
}
|
||||
| {
|
||||
nft_info: {
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_nft_info: {
|
||||
include_expired?: boolean | null
|
||||
token_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
tokens: {
|
||||
limit?: number | null
|
||||
owner: string
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_tokens: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
minter: {}
|
||||
}
|
||||
export interface AllNftInfoResponseForEmpty {
|
||||
access: OwnerOfResponse
|
||||
info: NftInfoResponseForEmpty
|
||||
}
|
||||
export interface OwnerOfResponse {
|
||||
approvals: Approval[]
|
||||
owner: string
|
||||
}
|
||||
export interface Approval {
|
||||
expires: Expiration
|
||||
spender: string
|
||||
}
|
||||
export interface NftInfoResponseForEmpty {
|
||||
extension: Empty
|
||||
token_uri?: string | null
|
||||
}
|
||||
export interface Empty {
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface OperatorsResponse {
|
||||
operators: Approval[]
|
||||
}
|
||||
export interface TokensResponse {
|
||||
tokens: string[]
|
||||
}
|
||||
export interface ApprovalResponse {
|
||||
approval: Approval
|
||||
}
|
||||
export interface ApprovalsResponse {
|
||||
approvals: Approval[]
|
||||
}
|
||||
export interface ContractInfoResponse {
|
||||
name: string
|
||||
symbol: string
|
||||
}
|
||||
export interface MinterResponse {
|
||||
minter: string
|
||||
}
|
||||
export interface NumTokensResponse {
|
||||
count: number
|
||||
}
|
||||
export type String = string
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _0 from './AccountNft.types'
|
||||
import * as _1 from './AccountNft.client'
|
||||
import * as _2 from './AccountNft.react-query'
|
||||
export namespace contracts {
|
||||
export const AccountNft = { ..._0, ..._1, ..._2 }
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
Decimal,
|
||||
OracleBaseForString,
|
||||
RedBankBaseForString,
|
||||
SwapperBaseForString,
|
||||
InstantiateMsg,
|
||||
VaultBaseForString,
|
||||
ExecuteMsg,
|
||||
Action,
|
||||
Uint128,
|
||||
CallbackMsg,
|
||||
Addr,
|
||||
Coin,
|
||||
ConfigUpdates,
|
||||
VaultBaseForAddr,
|
||||
QueryMsg,
|
||||
ArrayOfCoinBalanceResponseItem,
|
||||
CoinBalanceResponseItem,
|
||||
ArrayOfSharesResponseItem,
|
||||
SharesResponseItem,
|
||||
ArrayOfDebtShares,
|
||||
DebtShares,
|
||||
ArrayOfVaultWithBalance,
|
||||
VaultWithBalance,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
VaultPositionResponseItem,
|
||||
VaultPosition,
|
||||
VaultPositionState,
|
||||
ArrayOfString,
|
||||
ArrayOfVaultBaseForString,
|
||||
ConfigResponse,
|
||||
HealthResponse,
|
||||
Positions,
|
||||
DebtAmount,
|
||||
} from './CreditManager.types'
|
||||
export interface CreditManagerReadOnlyInterface {
|
||||
contractAddress: string
|
||||
config: () => Promise<ConfigResponse>
|
||||
allowedVaults: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}) => Promise<ArrayOfVaultBaseForString>
|
||||
allowedCoins: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfString>
|
||||
positions: ({ accountId }: { accountId: string }) => Promise<Positions>
|
||||
health: ({ accountId }: { accountId: string }) => Promise<HealthResponse>
|
||||
allCoinBalances: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}) => Promise<ArrayOfCoinBalanceResponseItem>
|
||||
allDebtShares: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}) => Promise<ArrayOfSharesResponseItem>
|
||||
totalDebtShares: () => Promise<DebtShares>
|
||||
allTotalDebtShares: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfDebtShares>
|
||||
allVaultPositions: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}) => Promise<ArrayOfVaultPositionResponseItem>
|
||||
totalVaultCoinBalance: ({ vault }: { vault: VaultBaseForString }) => Promise<Uint128>
|
||||
allTotalVaultCoinBalances: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}) => Promise<ArrayOfVaultWithBalance>
|
||||
}
|
||||
export class CreditManagerQueryClient implements CreditManagerReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.config = this.config.bind(this)
|
||||
this.allowedVaults = this.allowedVaults.bind(this)
|
||||
this.allowedCoins = this.allowedCoins.bind(this)
|
||||
this.positions = this.positions.bind(this)
|
||||
this.health = this.health.bind(this)
|
||||
this.allCoinBalances = this.allCoinBalances.bind(this)
|
||||
this.allDebtShares = this.allDebtShares.bind(this)
|
||||
this.totalDebtShares = this.totalDebtShares.bind(this)
|
||||
this.allTotalDebtShares = this.allTotalDebtShares.bind(this)
|
||||
this.allVaultPositions = this.allVaultPositions.bind(this)
|
||||
this.totalVaultCoinBalance = this.totalVaultCoinBalance.bind(this)
|
||||
this.allTotalVaultCoinBalances = this.allTotalVaultCoinBalances.bind(this)
|
||||
}
|
||||
|
||||
config = async (): Promise<ConfigResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
allowedVaults = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}): Promise<ArrayOfVaultBaseForString> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
allowed_vaults: {
|
||||
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: {
|
||||
account_id: accountId,
|
||||
},
|
||||
})
|
||||
}
|
||||
health = async ({ accountId }: { accountId: string }): Promise<HealthResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
health: {
|
||||
account_id: accountId,
|
||||
},
|
||||
})
|
||||
}
|
||||
allCoinBalances = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}): Promise<ArrayOfCoinBalanceResponseItem> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_coin_balances: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
allDebtShares = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}): Promise<ArrayOfSharesResponseItem> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_debt_shares: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
totalDebtShares = async (): Promise<DebtShares> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
total_debt_shares: {},
|
||||
})
|
||||
}
|
||||
allTotalDebtShares = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<ArrayOfDebtShares> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_total_debt_shares: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
allVaultPositions = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}): Promise<ArrayOfVaultPositionResponseItem> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_vault_positions: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
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,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface CreditManagerInterface extends CreditManagerReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
createCreditAccount: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateCreditAccount: (
|
||||
{
|
||||
accountId,
|
||||
actions,
|
||||
}: {
|
||||
accountId: string
|
||||
actions: Action[]
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
updateConfig: (
|
||||
{
|
||||
newConfig,
|
||||
}: {
|
||||
newConfig: ConfigUpdates
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
callback: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class CreditManagerClient
|
||||
extends CreditManagerQueryClient
|
||||
implements CreditManagerInterface
|
||||
{
|
||||
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.createCreditAccount = this.createCreditAccount.bind(this)
|
||||
this.updateCreditAccount = this.updateCreditAccount.bind(this)
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
this.callback = this.callback.bind(this)
|
||||
}
|
||||
|
||||
createCreditAccount = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
create_credit_account: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
updateCreditAccount = async (
|
||||
{
|
||||
accountId,
|
||||
actions,
|
||||
}: {
|
||||
accountId: string
|
||||
actions: Action[]
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_credit_account: {
|
||||
account_id: accountId,
|
||||
actions,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
updateConfig = async (
|
||||
{
|
||||
newConfig,
|
||||
}: {
|
||||
newConfig: ConfigUpdates
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_config: {
|
||||
new_config: newConfig,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
callback = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
callback: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
Decimal,
|
||||
OracleBaseForString,
|
||||
RedBankBaseForString,
|
||||
SwapperBaseForString,
|
||||
InstantiateMsg,
|
||||
VaultBaseForString,
|
||||
ExecuteMsg,
|
||||
Action,
|
||||
Uint128,
|
||||
CallbackMsg,
|
||||
Addr,
|
||||
Coin,
|
||||
ConfigUpdates,
|
||||
VaultBaseForAddr,
|
||||
QueryMsg,
|
||||
ArrayOfCoinBalanceResponseItem,
|
||||
CoinBalanceResponseItem,
|
||||
ArrayOfSharesResponseItem,
|
||||
SharesResponseItem,
|
||||
ArrayOfDebtShares,
|
||||
DebtShares,
|
||||
ArrayOfVaultWithBalance,
|
||||
VaultWithBalance,
|
||||
ArrayOfVaultPositionResponseItem,
|
||||
VaultPositionResponseItem,
|
||||
VaultPosition,
|
||||
VaultPositionState,
|
||||
ArrayOfString,
|
||||
ArrayOfVaultBaseForString,
|
||||
ConfigResponse,
|
||||
HealthResponse,
|
||||
Positions,
|
||||
DebtAmount,
|
||||
} from './CreditManager.types'
|
||||
import { CreditManagerQueryClient, CreditManagerClient } from './CreditManager.client'
|
||||
export const creditManagerQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'creditManager',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...creditManagerQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
allowedVaults: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_vaults', args },
|
||||
] as const,
|
||||
allowedCoins: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_coins', args },
|
||||
] as const,
|
||||
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args }] as const,
|
||||
health: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'health', args }] as const,
|
||||
allCoinBalances: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'all_coin_balances', args },
|
||||
] as const,
|
||||
allDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'all_debt_shares', args },
|
||||
] as const,
|
||||
totalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...creditManagerQueryKeys.address(contractAddress)[0], method: 'total_debt_shares', args },
|
||||
] as const,
|
||||
allTotalDebtShares: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_debt_shares',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allVaultPositions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_vault_positions',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_vault_coin_balance',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
allTotalVaultCoinBalances: (
|
||||
contractAddress: string | undefined,
|
||||
args?: Record<string, unknown>,
|
||||
) =>
|
||||
[
|
||||
{
|
||||
...creditManagerQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_total_vault_coin_balances',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface CreditManagerReactQuery<TResponse, TData = TResponse> {
|
||||
client: CreditManagerQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface CreditManagerAllTotalVaultCoinBalancesQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfVaultWithBalance, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllTotalVaultCoinBalancesQuery<TData = ArrayOfVaultWithBalance>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllTotalVaultCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultWithBalance, Error, TData>(
|
||||
creditManagerQueryKeys.allTotalVaultCoinBalances(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTotalVaultCoinBalances({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerTotalVaultCoinBalanceQuery<TData>
|
||||
extends CreditManagerReactQuery<Uint128, TData> {
|
||||
args: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useCreditManagerTotalVaultCoinBalanceQuery<TData = Uint128>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerTotalVaultCoinBalanceQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
creditManagerQueryKeys.totalVaultCoinBalance(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.totalVaultCoinBalance({
|
||||
vault: args.vault,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerAllVaultPositionsQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfVaultPositionResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllVaultPositionsQuery<TData = ArrayOfVaultPositionResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllVaultPositionsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultPositionResponseItem, Error, TData>(
|
||||
creditManagerQueryKeys.allVaultPositions(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allVaultPositions({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerAllTotalDebtSharesQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfDebtShares, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllTotalDebtSharesQuery<TData = ArrayOfDebtShares>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfDebtShares, Error, TData>(
|
||||
creditManagerQueryKeys.allTotalDebtShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allTotalDebtShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerTotalDebtSharesQuery<TData>
|
||||
extends CreditManagerReactQuery<DebtShares, TData> {}
|
||||
export function useCreditManagerTotalDebtSharesQuery<TData = DebtShares>({
|
||||
client,
|
||||
options,
|
||||
}: CreditManagerTotalDebtSharesQuery<TData>) {
|
||||
return useQuery<DebtShares, Error, TData>(
|
||||
creditManagerQueryKeys.totalDebtShares(client?.contractAddress),
|
||||
() => (client ? client.totalDebtShares() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerAllDebtSharesQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfSharesResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllDebtSharesQuery<TData = ArrayOfSharesResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllDebtSharesQuery<TData>) {
|
||||
return useQuery<ArrayOfSharesResponseItem, Error, TData>(
|
||||
creditManagerQueryKeys.allDebtShares(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allDebtShares({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerAllCoinBalancesQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfCoinBalanceResponseItem, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllCoinBalancesQuery<TData = ArrayOfCoinBalanceResponseItem>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllCoinBalancesQuery<TData>) {
|
||||
return useQuery<ArrayOfCoinBalanceResponseItem, Error, TData>(
|
||||
creditManagerQueryKeys.allCoinBalances(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allCoinBalances({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerHealthQuery<TData>
|
||||
extends CreditManagerReactQuery<HealthResponse, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useCreditManagerHealthQuery<TData = HealthResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerHealthQuery<TData>) {
|
||||
return useQuery<HealthResponse, Error, TData>(
|
||||
creditManagerQueryKeys.health(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.health({
|
||||
accountId: args.accountId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerPositionsQuery<TData>
|
||||
extends CreditManagerReactQuery<Positions, TData> {
|
||||
args: {
|
||||
accountId: string
|
||||
}
|
||||
}
|
||||
export function useCreditManagerPositionsQuery<TData = Positions>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerPositionsQuery<TData>) {
|
||||
return useQuery<Positions, Error, TData>(
|
||||
creditManagerQueryKeys.positions(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.positions({
|
||||
accountId: args.accountId,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerAllowedCoinsQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfString, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllowedCoinsQuery<TData = ArrayOfString>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllowedCoinsQuery<TData>) {
|
||||
return useQuery<ArrayOfString, Error, TData>(
|
||||
creditManagerQueryKeys.allowedCoins(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allowedCoins({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerAllowedVaultsQuery<TData>
|
||||
extends CreditManagerReactQuery<ArrayOfVaultBaseForString, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: VaultBaseForString
|
||||
}
|
||||
}
|
||||
export function useCreditManagerAllowedVaultsQuery<TData = ArrayOfVaultBaseForString>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: CreditManagerAllowedVaultsQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultBaseForString, Error, TData>(
|
||||
creditManagerQueryKeys.allowedVaults(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allowedVaults({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerConfigQuery<TData>
|
||||
extends CreditManagerReactQuery<ConfigResponse, TData> {}
|
||||
export function useCreditManagerConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: CreditManagerConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
creditManagerQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface CreditManagerCallbackMutation {
|
||||
client: CreditManagerClient
|
||||
msg: CallbackMsg
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerCallbackMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, CreditManagerCallbackMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, CreditManagerCallbackMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.callback(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface CreditManagerUpdateConfigMutation {
|
||||
client: CreditManagerClient
|
||||
msg: {
|
||||
newConfig: ConfigUpdates
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, CreditManagerUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, CreditManagerUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface CreditManagerUpdateCreditAccountMutation {
|
||||
client: CreditManagerClient
|
||||
msg: {
|
||||
accountId: string
|
||||
actions: Action[]
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerUpdateCreditAccountMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, CreditManagerUpdateCreditAccountMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, CreditManagerUpdateCreditAccountMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateCreditAccount(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface CreditManagerCreateCreditAccountMutation {
|
||||
client: CreditManagerClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useCreditManagerCreateCreditAccountMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, CreditManagerCreateCreditAccountMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, CreditManagerCreateCreditAccountMutation>(
|
||||
({ client, args: { fee, memo, funds } = {} }) => client.createCreditAccount(fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export type Decimal = string
|
||||
export type OracleBaseForString = string
|
||||
export type RedBankBaseForString = string
|
||||
export type SwapperBaseForString = string
|
||||
export interface InstantiateMsg {
|
||||
allowed_coins: string[]
|
||||
allowed_vaults: VaultBaseForString[]
|
||||
max_close_factor: Decimal
|
||||
max_liquidation_bonus: Decimal
|
||||
oracle: OracleBaseForString
|
||||
owner: string
|
||||
red_bank: RedBankBaseForString
|
||||
swapper: SwapperBaseForString
|
||||
}
|
||||
export interface VaultBaseForString {
|
||||
address: string
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
create_credit_account: {}
|
||||
}
|
||||
| {
|
||||
update_credit_account: {
|
||||
account_id: string
|
||||
actions: Action[]
|
||||
}
|
||||
}
|
||||
| {
|
||||
update_config: {
|
||||
new_config: ConfigUpdates
|
||||
}
|
||||
}
|
||||
| {
|
||||
callback: CallbackMsg
|
||||
}
|
||||
export type Action =
|
||||
| {
|
||||
deposit: Coin
|
||||
}
|
||||
| {
|
||||
withdraw: Coin
|
||||
}
|
||||
| {
|
||||
borrow: Coin
|
||||
}
|
||||
| {
|
||||
repay: Coin
|
||||
}
|
||||
| {
|
||||
vault_deposit: {
|
||||
coins: Coin[]
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault_withdraw: {
|
||||
amount: Uint128
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
liquidate_coin: {
|
||||
debt_coin: Coin
|
||||
liquidatee_account_id: string
|
||||
request_coin_denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
swap_exact_in: {
|
||||
coin_in: Coin
|
||||
denom_out: string
|
||||
slippage: Decimal
|
||||
}
|
||||
}
|
||||
export type Uint128 = string
|
||||
export type CallbackMsg =
|
||||
| {
|
||||
withdraw: {
|
||||
account_id: string
|
||||
coin: Coin
|
||||
recipient: Addr
|
||||
}
|
||||
}
|
||||
| {
|
||||
borrow: {
|
||||
account_id: string
|
||||
coin: Coin
|
||||
}
|
||||
}
|
||||
| {
|
||||
repay: {
|
||||
account_id: string
|
||||
coin: Coin
|
||||
}
|
||||
}
|
||||
| {
|
||||
assert_below_max_l_t_v: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault_deposit: {
|
||||
account_id: string
|
||||
coins: Coin[]
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
}
|
||||
| {
|
||||
update_vault_coin_balance: {
|
||||
account_id: string
|
||||
previous_total_balance: Uint128
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault_withdraw: {
|
||||
account_id: string
|
||||
amount: Uint128
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
}
|
||||
| {
|
||||
vault_force_withdraw: {
|
||||
account_id: string
|
||||
amount: Uint128
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
}
|
||||
| {
|
||||
liquidate_coin: {
|
||||
debt_coin: Coin
|
||||
liquidatee_account_id: string
|
||||
liquidator_account_id: string
|
||||
request_coin_denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
assert_health_factor_improved: {
|
||||
account_id: string
|
||||
previous_health_factor: Decimal
|
||||
}
|
||||
}
|
||||
| {
|
||||
swap_exact_in: {
|
||||
account_id: string
|
||||
coin_in: Coin
|
||||
denom_out: string
|
||||
slippage: Decimal
|
||||
}
|
||||
}
|
||||
| {
|
||||
update_coin_balances: {
|
||||
account_id: string
|
||||
previous_balances: Coin[]
|
||||
}
|
||||
}
|
||||
export type Addr = string
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface ConfigUpdates {
|
||||
account_nft?: string | null
|
||||
allowed_coins?: string[] | null
|
||||
allowed_vaults?: VaultBaseForString[] | null
|
||||
max_close_factor?: Decimal | null
|
||||
max_liquidation_bonus?: Decimal | null
|
||||
oracle?: OracleBaseForString | null
|
||||
owner?: string | null
|
||||
red_bank?: RedBankBaseForString | null
|
||||
swapper?: SwapperBaseForString | null
|
||||
}
|
||||
export interface VaultBaseForAddr {
|
||||
address: Addr
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
config: {}
|
||||
}
|
||||
| {
|
||||
allowed_vaults: {
|
||||
limit?: number | null
|
||||
start_after?: VaultBaseForString | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
allowed_coins: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
positions: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
health: {
|
||||
account_id: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_coin_balances: {
|
||||
limit?: number | null
|
||||
start_after?: [string, string] | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_debt_shares: {
|
||||
limit?: number | null
|
||||
start_after?: [string, string] | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
total_debt_shares: string
|
||||
}
|
||||
| {
|
||||
all_total_debt_shares: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_vault_positions: {
|
||||
limit?: number | null
|
||||
start_after?: [string, string] | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
total_vault_coin_balance: {
|
||||
vault: VaultBaseForString
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_total_vault_coin_balances: {
|
||||
limit?: number | null
|
||||
start_after?: VaultBaseForString | null
|
||||
}
|
||||
}
|
||||
export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[]
|
||||
export interface CoinBalanceResponseItem {
|
||||
account_id: string
|
||||
amount: Uint128
|
||||
denom: string
|
||||
}
|
||||
export type ArrayOfSharesResponseItem = SharesResponseItem[]
|
||||
export interface SharesResponseItem {
|
||||
account_id: string
|
||||
denom: string
|
||||
shares: Uint128
|
||||
}
|
||||
export type ArrayOfDebtShares = DebtShares[]
|
||||
export interface DebtShares {
|
||||
denom: string
|
||||
shares: Uint128
|
||||
}
|
||||
export type ArrayOfVaultWithBalance = VaultWithBalance[]
|
||||
export interface VaultWithBalance {
|
||||
balance: Uint128
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[]
|
||||
export interface VaultPositionResponseItem {
|
||||
account_id: string
|
||||
position: VaultPosition
|
||||
}
|
||||
export interface VaultPosition {
|
||||
state: VaultPositionState
|
||||
vault: VaultBaseForAddr
|
||||
}
|
||||
export interface VaultPositionState {
|
||||
locked: Uint128
|
||||
unlocked: Uint128
|
||||
}
|
||||
export type ArrayOfString = string[]
|
||||
export type ArrayOfVaultBaseForString = VaultBaseForString[]
|
||||
export interface ConfigResponse {
|
||||
account_nft?: string | null
|
||||
max_close_factor: Decimal
|
||||
max_liquidation_bonus: Decimal
|
||||
oracle: string
|
||||
owner: string
|
||||
red_bank: string
|
||||
swapper: string
|
||||
}
|
||||
export interface HealthResponse {
|
||||
above_max_ltv: boolean
|
||||
liquidatable: boolean
|
||||
liquidation_health_factor?: Decimal | null
|
||||
liquidation_threshold_adjusted_collateral: Decimal
|
||||
max_ltv_adjusted_collateral: Decimal
|
||||
max_ltv_health_factor?: Decimal | null
|
||||
total_collateral_value: Decimal
|
||||
total_debt_value: Decimal
|
||||
}
|
||||
export interface Positions {
|
||||
account_id: string
|
||||
coins: Coin[]
|
||||
debts: DebtAmount[]
|
||||
vaults: VaultPosition[]
|
||||
}
|
||||
export interface DebtAmount {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
shares: Uint128
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _3 from './CreditManager.types'
|
||||
import * as _4 from './CreditManager.client'
|
||||
import * as _5 from './CreditManager.react-query'
|
||||
export namespace contracts {
|
||||
export const CreditManager = { ..._3, ..._4, ..._5 }
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
OracleBaseForString,
|
||||
Addr,
|
||||
PricingMethod,
|
||||
InstantiateMsg,
|
||||
VaultPricingInfo,
|
||||
ExecuteMsg,
|
||||
ConfigUpdates,
|
||||
QueryMsg,
|
||||
ArrayOfVaultPricingInfo,
|
||||
OracleBaseForAddr,
|
||||
ConfigResponse,
|
||||
Decimal,
|
||||
PriceResponse,
|
||||
} from './MarsOracleAdapter.types'
|
||||
export interface MarsOracleAdapterReadOnlyInterface {
|
||||
contractAddress: string
|
||||
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
||||
config: () => Promise<ConfigResponse>
|
||||
pricingInfo: ({ denom }: { denom: string }) => Promise<VaultPricingInfo>
|
||||
allPricingInfo: ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}) => Promise<ArrayOfVaultPricingInfo>
|
||||
}
|
||||
export class MarsOracleAdapterQueryClient implements MarsOracleAdapterReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.price = this.price.bind(this)
|
||||
this.config = this.config.bind(this)
|
||||
this.pricingInfo = this.pricingInfo.bind(this)
|
||||
this.allPricingInfo = this.allPricingInfo.bind(this)
|
||||
}
|
||||
|
||||
price = async ({ denom }: { denom: string }): Promise<PriceResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
price: {
|
||||
denom,
|
||||
},
|
||||
})
|
||||
}
|
||||
config = async (): Promise<ConfigResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
pricingInfo = async ({ denom }: { denom: string }): Promise<VaultPricingInfo> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
pricing_info: {
|
||||
denom,
|
||||
},
|
||||
})
|
||||
}
|
||||
allPricingInfo = async ({
|
||||
limit,
|
||||
startAfter,
|
||||
}: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}): Promise<ArrayOfVaultPricingInfo> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
all_pricing_info: {
|
||||
limit,
|
||||
start_after: startAfter,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MarsOracleAdapterInterface extends MarsOracleAdapterReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateConfig: (
|
||||
{
|
||||
newConfig,
|
||||
}: {
|
||||
newConfig: ConfigUpdates
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MarsOracleAdapterClient
|
||||
extends MarsOracleAdapterQueryClient
|
||||
implements MarsOracleAdapterInterface
|
||||
{
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||
super(client, contractAddress)
|
||||
this.client = client
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
}
|
||||
|
||||
updateConfig = async (
|
||||
{
|
||||
newConfig,
|
||||
}: {
|
||||
newConfig: ConfigUpdates
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_config: {
|
||||
new_config: newConfig,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee, Coin } from '@cosmjs/amino'
|
||||
import {
|
||||
OracleBaseForString,
|
||||
Addr,
|
||||
PricingMethod,
|
||||
InstantiateMsg,
|
||||
VaultPricingInfo,
|
||||
ExecuteMsg,
|
||||
ConfigUpdates,
|
||||
QueryMsg,
|
||||
ArrayOfVaultPricingInfo,
|
||||
OracleBaseForAddr,
|
||||
ConfigResponse,
|
||||
Decimal,
|
||||
PriceResponse,
|
||||
} from './MarsOracleAdapter.types'
|
||||
import { MarsOracleAdapterQueryClient, MarsOracleAdapterClient } from './MarsOracleAdapter.client'
|
||||
export const marsOracleAdapterQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'marsOracleAdapter',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...marsOracleAdapterQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'config', args },
|
||||
] as const,
|
||||
pricingInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...marsOracleAdapterQueryKeys.address(contractAddress)[0], method: 'pricing_info', args },
|
||||
] as const,
|
||||
allPricingInfo: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...marsOracleAdapterQueryKeys.address(contractAddress)[0],
|
||||
method: 'all_pricing_info',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MarsOracleAdapterReactQuery<TResponse, TData = TResponse> {
|
||||
client: MarsOracleAdapterQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MarsOracleAdapterAllPricingInfoQuery<TData>
|
||||
extends MarsOracleAdapterReactQuery<ArrayOfVaultPricingInfo, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string
|
||||
}
|
||||
}
|
||||
export function useMarsOracleAdapterAllPricingInfoQuery<TData = ArrayOfVaultPricingInfo>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsOracleAdapterAllPricingInfoQuery<TData>) {
|
||||
return useQuery<ArrayOfVaultPricingInfo, Error, TData>(
|
||||
marsOracleAdapterQueryKeys.allPricingInfo(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.allPricingInfo({
|
||||
limit: args.limit,
|
||||
startAfter: args.startAfter,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsOracleAdapterPricingInfoQuery<TData>
|
||||
extends MarsOracleAdapterReactQuery<VaultPricingInfo, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsOracleAdapterPricingInfoQuery<TData = VaultPricingInfo>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsOracleAdapterPricingInfoQuery<TData>) {
|
||||
return useQuery<VaultPricingInfo, Error, TData>(
|
||||
marsOracleAdapterQueryKeys.pricingInfo(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.pricingInfo({
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsOracleAdapterConfigQuery<TData>
|
||||
extends MarsOracleAdapterReactQuery<ConfigResponse, TData> {}
|
||||
export function useMarsOracleAdapterConfigQuery<TData = ConfigResponse>({
|
||||
client,
|
||||
options,
|
||||
}: MarsOracleAdapterConfigQuery<TData>) {
|
||||
return useQuery<ConfigResponse, Error, TData>(
|
||||
marsOracleAdapterQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MarsOracleAdapterPriceQuery<TData>
|
||||
extends MarsOracleAdapterReactQuery<PriceResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMarsOracleAdapterPriceQuery<TData = PriceResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MarsOracleAdapterPriceQuery<TData>) {
|
||||
return useQuery<PriceResponse, Error, TData>(
|
||||
marsOracleAdapterQueryKeys.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 MarsOracleAdapterUpdateConfigMutation {
|
||||
client: MarsOracleAdapterClient
|
||||
msg: {
|
||||
newConfig: ConfigUpdates
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMarsOracleAdapterUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MarsOracleAdapterUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MarsOracleAdapterUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export type OracleBaseForString = string
|
||||
export type Addr = string
|
||||
export type PricingMethod = 'preview_redeem'
|
||||
export interface InstantiateMsg {
|
||||
oracle: OracleBaseForString
|
||||
owner: string
|
||||
vault_pricing: VaultPricingInfo[]
|
||||
}
|
||||
export interface VaultPricingInfo {
|
||||
addr: Addr
|
||||
denom: string
|
||||
method: PricingMethod
|
||||
}
|
||||
export type ExecuteMsg = {
|
||||
update_config: {
|
||||
new_config: ConfigUpdates
|
||||
}
|
||||
}
|
||||
export interface ConfigUpdates {
|
||||
oracle?: OracleBaseForString | null
|
||||
owner?: string | null
|
||||
vault_pricing?: VaultPricingInfo[] | null
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
price: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
config: {}
|
||||
}
|
||||
| {
|
||||
pricing_info: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
all_pricing_info: {
|
||||
limit?: number | null
|
||||
start_after?: string | null
|
||||
}
|
||||
}
|
||||
export type ArrayOfVaultPricingInfo = VaultPricingInfo[]
|
||||
export type OracleBaseForAddr = string
|
||||
export interface ConfigResponse {
|
||||
oracle: OracleBaseForAddr
|
||||
owner: Addr
|
||||
}
|
||||
export type Decimal = string
|
||||
export interface PriceResponse {
|
||||
denom: string
|
||||
price: Decimal
|
||||
[k: string]: unknown
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _6 from './MarsOracleAdapter.types'
|
||||
import * as _7 from './MarsOracleAdapter.client'
|
||||
import * as _8 from './MarsOracleAdapter.react-query'
|
||||
export namespace contracts {
|
||||
export const MarsOracleAdapter = { ..._6, ..._7, ..._8 }
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { Coin, StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
Decimal,
|
||||
InstantiateMsg,
|
||||
CoinPrice,
|
||||
ExecuteMsg,
|
||||
QueryMsg,
|
||||
PriceResponse,
|
||||
} from './MockOracle.types'
|
||||
export interface MockOracleReadOnlyInterface {
|
||||
contractAddress: string
|
||||
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
||||
}
|
||||
export class MockOracleQueryClient implements MockOracleReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.price = this.price.bind(this)
|
||||
}
|
||||
|
||||
price = async ({ denom }: { denom: string }): Promise<PriceResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
price: {
|
||||
denom,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MockOracleInterface extends MockOracleReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
changePrice: (
|
||||
{
|
||||
denom,
|
||||
price,
|
||||
}: {
|
||||
denom: string
|
||||
price: Decimal
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MockOracleClient extends MockOracleQueryClient implements MockOracleInterface {
|
||||
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.changePrice = this.changePrice.bind(this)
|
||||
}
|
||||
|
||||
changePrice = async (
|
||||
{
|
||||
denom,
|
||||
price,
|
||||
}: {
|
||||
denom: string
|
||||
price: Decimal
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
change_price: {
|
||||
denom,
|
||||
price,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee, Coin } from '@cosmjs/amino'
|
||||
import {
|
||||
Decimal,
|
||||
InstantiateMsg,
|
||||
CoinPrice,
|
||||
ExecuteMsg,
|
||||
QueryMsg,
|
||||
PriceResponse,
|
||||
} from './MockOracle.types'
|
||||
import { MockOracleQueryClient, MockOracleClient } from './MockOracle.client'
|
||||
export const mockOracleQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'mockOracle',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...mockOracleQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
price: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...mockOracleQueryKeys.address(contractAddress)[0], method: 'price', args }] as const,
|
||||
}
|
||||
export interface MockOracleReactQuery<TResponse, TData = TResponse> {
|
||||
client: MockOracleQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MockOraclePriceQuery<TData> extends MockOracleReactQuery<PriceResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMockOraclePriceQuery<TData = PriceResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MockOraclePriceQuery<TData>) {
|
||||
return useQuery<PriceResponse, Error, TData>(
|
||||
mockOracleQueryKeys.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 MockOracleChangePriceMutation {
|
||||
client: MockOracleClient
|
||||
msg: CoinPrice
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMockOracleChangePriceMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MockOracleChangePriceMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MockOracleChangePriceMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.changePrice(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export type Decimal = string
|
||||
export interface InstantiateMsg {
|
||||
coins: CoinPrice[]
|
||||
}
|
||||
export interface CoinPrice {
|
||||
denom: string
|
||||
price: Decimal
|
||||
}
|
||||
export type ExecuteMsg = {
|
||||
change_price: CoinPrice
|
||||
}
|
||||
export type QueryMsg = {
|
||||
price: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export interface PriceResponse {
|
||||
denom: string
|
||||
price: Decimal
|
||||
[k: string]: unknown
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _9 from './MockOracle.types'
|
||||
import * as _10 from './MockOracle.client'
|
||||
import * as _11 from './MockOracle.react-query'
|
||||
export namespace contracts {
|
||||
export const MockOracle = { ..._9, ..._10, ..._11 }
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
Decimal,
|
||||
InstantiateMsg,
|
||||
CoinMarketInfo,
|
||||
ExecuteMsg,
|
||||
Uint128,
|
||||
Coin,
|
||||
QueryMsg,
|
||||
Market,
|
||||
InterestRateModel,
|
||||
UserAssetDebtResponse,
|
||||
} from './MockRedBank.types'
|
||||
export interface MockRedBankReadOnlyInterface {
|
||||
contractAddress: string
|
||||
userAssetDebt: ({
|
||||
denom,
|
||||
userAddress,
|
||||
}: {
|
||||
denom: string
|
||||
userAddress: string
|
||||
}) => Promise<UserAssetDebtResponse>
|
||||
market: ({ denom }: { denom: string }) => Promise<Market>
|
||||
}
|
||||
export class MockRedBankQueryClient implements MockRedBankReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.userAssetDebt = this.userAssetDebt.bind(this)
|
||||
this.market = this.market.bind(this)
|
||||
}
|
||||
|
||||
userAssetDebt = async ({
|
||||
denom,
|
||||
userAddress,
|
||||
}: {
|
||||
denom: string
|
||||
userAddress: string
|
||||
}): Promise<UserAssetDebtResponse> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
user_asset_debt: {
|
||||
denom,
|
||||
user_address: userAddress,
|
||||
},
|
||||
})
|
||||
}
|
||||
market = async ({ denom }: { denom: string }): Promise<Market> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
market: {
|
||||
denom,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MockRedBankInterface extends MockRedBankReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
borrow: (
|
||||
{
|
||||
coin,
|
||||
recipient,
|
||||
}: {
|
||||
coin: Coin
|
||||
recipient?: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
repay: (
|
||||
{
|
||||
denom,
|
||||
onBehalfOf,
|
||||
}: {
|
||||
denom: string
|
||||
onBehalfOf?: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MockRedBankClient extends MockRedBankQueryClient implements MockRedBankInterface {
|
||||
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.borrow = this.borrow.bind(this)
|
||||
this.repay = this.repay.bind(this)
|
||||
}
|
||||
|
||||
borrow = async (
|
||||
{
|
||||
coin,
|
||||
recipient,
|
||||
}: {
|
||||
coin: Coin
|
||||
recipient?: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
borrow: {
|
||||
coin,
|
||||
recipient,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
repay = async (
|
||||
{
|
||||
denom,
|
||||
onBehalfOf,
|
||||
}: {
|
||||
denom: string
|
||||
onBehalfOf?: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
repay: {
|
||||
denom,
|
||||
on_behalf_of: onBehalfOf,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
Decimal,
|
||||
InstantiateMsg,
|
||||
CoinMarketInfo,
|
||||
ExecuteMsg,
|
||||
Uint128,
|
||||
Coin,
|
||||
QueryMsg,
|
||||
Market,
|
||||
InterestRateModel,
|
||||
UserAssetDebtResponse,
|
||||
} from './MockRedBank.types'
|
||||
import { MockRedBankQueryClient, MockRedBankClient } from './MockRedBank.client'
|
||||
export const mockRedBankQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'mockRedBank',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...mockRedBankQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
userAssetDebt: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...mockRedBankQueryKeys.address(contractAddress)[0], method: 'user_asset_debt', args },
|
||||
] as const,
|
||||
market: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...mockRedBankQueryKeys.address(contractAddress)[0], method: 'market', args }] as const,
|
||||
}
|
||||
export interface MockRedBankReactQuery<TResponse, TData = TResponse> {
|
||||
client: MockRedBankQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MockRedBankMarketQuery<TData> extends MockRedBankReactQuery<Market, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export function useMockRedBankMarketQuery<TData = Market>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MockRedBankMarketQuery<TData>) {
|
||||
return useQuery<Market, Error, TData>(
|
||||
mockRedBankQueryKeys.market(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.market({
|
||||
denom: args.denom,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MockRedBankUserAssetDebtQuery<TData>
|
||||
extends MockRedBankReactQuery<UserAssetDebtResponse, TData> {
|
||||
args: {
|
||||
denom: string
|
||||
userAddress: string
|
||||
}
|
||||
}
|
||||
export function useMockRedBankUserAssetDebtQuery<TData = UserAssetDebtResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MockRedBankUserAssetDebtQuery<TData>) {
|
||||
return useQuery<UserAssetDebtResponse, Error, TData>(
|
||||
mockRedBankQueryKeys.userAssetDebt(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.userAssetDebt({
|
||||
denom: args.denom,
|
||||
userAddress: args.userAddress,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MockRedBankRepayMutation {
|
||||
client: MockRedBankClient
|
||||
msg: {
|
||||
denom: string
|
||||
onBehalfOf?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMockRedBankRepayMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockRedBankRepayMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MockRedBankRepayMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.repay(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MockRedBankBorrowMutation {
|
||||
client: MockRedBankClient
|
||||
msg: {
|
||||
coin: Coin
|
||||
recipient?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMockRedBankBorrowMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockRedBankBorrowMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MockRedBankBorrowMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.borrow(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export type Decimal = string
|
||||
export interface InstantiateMsg {
|
||||
coins: CoinMarketInfo[]
|
||||
}
|
||||
export interface CoinMarketInfo {
|
||||
denom: string
|
||||
liquidation_threshold: Decimal
|
||||
max_ltv: Decimal
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
borrow: {
|
||||
coin: Coin
|
||||
recipient?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
repay: {
|
||||
denom: string
|
||||
on_behalf_of?: string | null
|
||||
}
|
||||
}
|
||||
export type Uint128 = string
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
user_asset_debt: {
|
||||
denom: string
|
||||
user_address: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
market: {
|
||||
denom: string
|
||||
}
|
||||
}
|
||||
export interface Market {
|
||||
borrow_enabled: boolean
|
||||
borrow_index: Decimal
|
||||
borrow_rate: Decimal
|
||||
collateral_total_scaled: Uint128
|
||||
debt_total_scaled: Uint128
|
||||
denom: string
|
||||
deposit_cap: Uint128
|
||||
deposit_enabled: boolean
|
||||
indexes_last_updated: number
|
||||
interest_rate_model: InterestRateModel
|
||||
liquidation_bonus: Decimal
|
||||
liquidation_threshold: Decimal
|
||||
liquidity_index: Decimal
|
||||
liquidity_rate: Decimal
|
||||
max_loan_to_value: Decimal
|
||||
reserve_factor: Decimal
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface InterestRateModel {
|
||||
base: Decimal
|
||||
optimal_utilization_rate: Decimal
|
||||
slope_1: Decimal
|
||||
slope_2: Decimal
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface UserAssetDebtResponse {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _12 from './MockRedBank.types'
|
||||
import * as _13 from './MockRedBank.client'
|
||||
import * as _14 from './MockRedBank.react-query'
|
||||
export namespace contracts {
|
||||
export const MockRedBank = { ..._12, ..._13, ..._14 }
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
OracleBaseForString,
|
||||
InstantiateMsg,
|
||||
ExecuteMsg,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
VaultInfo,
|
||||
Coin,
|
||||
ArrayOfCoin,
|
||||
} from './MockVault.types'
|
||||
export interface MockVaultReadOnlyInterface {
|
||||
contractAddress: string
|
||||
info: () => Promise<VaultInfo>
|
||||
previewRedeem: ({ amount }: { amount: Uint128 }) => Promise<ArrayOfCoin>
|
||||
totalVaultCoinsIssued: () => Promise<Uint128>
|
||||
}
|
||||
export class MockVaultQueryClient implements MockVaultReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.info = this.info.bind(this)
|
||||
this.previewRedeem = this.previewRedeem.bind(this)
|
||||
this.totalVaultCoinsIssued = this.totalVaultCoinsIssued.bind(this)
|
||||
}
|
||||
|
||||
info = async (): Promise<VaultInfo> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
info: {},
|
||||
})
|
||||
}
|
||||
previewRedeem = async ({ amount }: { amount: Uint128 }): Promise<ArrayOfCoin> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
preview_redeem: {
|
||||
amount,
|
||||
},
|
||||
})
|
||||
}
|
||||
totalVaultCoinsIssued = async (): Promise<Uint128> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
total_vault_coins_issued: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
export interface MockVaultInterface extends MockVaultReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
deposit: (fee?: number | StdFee | 'auto', memo?: string, funds?: Coin[]) => Promise<ExecuteResult>
|
||||
withdraw: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
forceWithdraw: (
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class MockVaultClient extends MockVaultQueryClient implements MockVaultInterface {
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||
super(client, contractAddress)
|
||||
this.client = client
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.deposit = this.deposit.bind(this)
|
||||
this.withdraw = this.withdraw.bind(this)
|
||||
this.forceWithdraw = this.forceWithdraw.bind(this)
|
||||
}
|
||||
|
||||
deposit = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
deposit: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
withdraw = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
withdraw: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
forceWithdraw = async (
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
force_withdraw: {},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
OracleBaseForString,
|
||||
InstantiateMsg,
|
||||
ExecuteMsg,
|
||||
QueryMsg,
|
||||
Uint128,
|
||||
VaultInfo,
|
||||
Coin,
|
||||
ArrayOfCoin,
|
||||
} from './MockVault.types'
|
||||
import { MockVaultQueryClient, MockVaultClient } from './MockVault.client'
|
||||
export const mockVaultQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'mockVault',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...mockVaultQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
info: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...mockVaultQueryKeys.address(contractAddress)[0], method: 'info', args }] as const,
|
||||
previewRedeem: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{ ...mockVaultQueryKeys.address(contractAddress)[0], method: 'preview_redeem', args },
|
||||
] as const,
|
||||
totalVaultCoinsIssued: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...mockVaultQueryKeys.address(contractAddress)[0],
|
||||
method: 'total_vault_coins_issued',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface MockVaultReactQuery<TResponse, TData = TResponse> {
|
||||
client: MockVaultQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface MockVaultTotalVaultCoinsIssuedQuery<TData>
|
||||
extends MockVaultReactQuery<Uint128, TData> {}
|
||||
export function useMockVaultTotalVaultCoinsIssuedQuery<TData = Uint128>({
|
||||
client,
|
||||
options,
|
||||
}: MockVaultTotalVaultCoinsIssuedQuery<TData>) {
|
||||
return useQuery<Uint128, Error, TData>(
|
||||
mockVaultQueryKeys.totalVaultCoinsIssued(client?.contractAddress),
|
||||
() => (client ? client.totalVaultCoinsIssued() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MockVaultPreviewRedeemQuery<TData>
|
||||
extends MockVaultReactQuery<ArrayOfCoin, TData> {
|
||||
args: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
export function useMockVaultPreviewRedeemQuery<TData = ArrayOfCoin>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: MockVaultPreviewRedeemQuery<TData>) {
|
||||
return useQuery<ArrayOfCoin, Error, TData>(
|
||||
mockVaultQueryKeys.previewRedeem(client?.contractAddress, args),
|
||||
() =>
|
||||
client
|
||||
? client.previewRedeem({
|
||||
amount: args.amount,
|
||||
})
|
||||
: Promise.reject(new Error('Invalid client')),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MockVaultInfoQuery<TData> extends MockVaultReactQuery<VaultInfo, TData> {}
|
||||
export function useMockVaultInfoQuery<TData = VaultInfo>({
|
||||
client,
|
||||
options,
|
||||
}: MockVaultInfoQuery<TData>) {
|
||||
return useQuery<VaultInfo, Error, TData>(
|
||||
mockVaultQueryKeys.info(client?.contractAddress),
|
||||
() => (client ? client.info() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface MockVaultForceWithdrawMutation {
|
||||
client: MockVaultClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMockVaultForceWithdrawMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, MockVaultForceWithdrawMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MockVaultForceWithdrawMutation>(
|
||||
({ client, args: { fee, memo, funds } = {} }) => client.forceWithdraw(fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MockVaultWithdrawMutation {
|
||||
client: MockVaultClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMockVaultWithdrawMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockVaultWithdrawMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MockVaultWithdrawMutation>(
|
||||
({ client, args: { fee, memo, funds } = {} }) => client.withdraw(fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface MockVaultDepositMutation {
|
||||
client: MockVaultClient
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useMockVaultDepositMutation(
|
||||
options?: Omit<UseMutationOptions<ExecuteResult, Error, MockVaultDepositMutation>, 'mutationFn'>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, MockVaultDepositMutation>(
|
||||
({ client, args: { fee, memo, funds } = {} }) => client.deposit(fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export type OracleBaseForString = string
|
||||
export interface InstantiateMsg {
|
||||
asset_denoms: string[]
|
||||
lockup?: number | null
|
||||
lp_token_denom: string
|
||||
oracle: OracleBaseForString
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
deposit: {}
|
||||
}
|
||||
| {
|
||||
withdraw: {}
|
||||
}
|
||||
| {
|
||||
force_withdraw: {}
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
info: {}
|
||||
}
|
||||
| {
|
||||
preview_redeem: {
|
||||
amount: Uint128
|
||||
}
|
||||
}
|
||||
| {
|
||||
total_vault_coins_issued: {}
|
||||
}
|
||||
export type Uint128 = string
|
||||
export interface VaultInfo {
|
||||
coins: Coin[]
|
||||
lockup?: number | null
|
||||
token_denom: string
|
||||
}
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type ArrayOfCoin = Coin[]
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _15 from './MockVault.types'
|
||||
import * as _16 from './MockVault.client'
|
||||
import * as _17 from './MockVault.react-query'
|
||||
export namespace contracts {
|
||||
export const MockVault = { ..._15, ..._16, ..._17 }
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
InstantiateMsg,
|
||||
ExecuteMsg,
|
||||
Uint128,
|
||||
Decimal,
|
||||
Addr,
|
||||
Empty,
|
||||
Coin,
|
||||
QueryMsg,
|
||||
ConfigForString,
|
||||
EstimateExactInSwapResponse,
|
||||
RouteResponseForEmpty,
|
||||
ArrayOfRouteResponseForEmpty,
|
||||
} from './SwapperBase.types'
|
||||
export interface SwapperBaseReadOnlyInterface {
|
||||
contractAddress: string
|
||||
config: () => Promise<ConfigForString>
|
||||
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 SwapperBaseQueryClient implements SwapperBaseReadOnlyInterface {
|
||||
client: CosmWasmClient
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||
this.client = client
|
||||
this.contractAddress = contractAddress
|
||||
this.config = this.config.bind(this)
|
||||
this.route = this.route.bind(this)
|
||||
this.routes = this.routes.bind(this)
|
||||
this.estimateExactInSwap = this.estimateExactInSwap.bind(this)
|
||||
}
|
||||
|
||||
config = async (): Promise<ConfigForString> => {
|
||||
return this.client.queryContractSmart(this.contractAddress, {
|
||||
config: {},
|
||||
})
|
||||
}
|
||||
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 SwapperBaseInterface extends SwapperBaseReadOnlyInterface {
|
||||
contractAddress: string
|
||||
sender: string
|
||||
updateConfig: (
|
||||
{
|
||||
owner,
|
||||
}: {
|
||||
owner?: string
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
setRoute: (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
route,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: Empty
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
swapExactIn: (
|
||||
{
|
||||
coinIn,
|
||||
denomOut,
|
||||
slippage,
|
||||
}: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
transferResult: (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
recipient,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
},
|
||||
fee?: number | StdFee | 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
) => Promise<ExecuteResult>
|
||||
}
|
||||
export class SwapperBaseClient extends SwapperBaseQueryClient implements SwapperBaseInterface {
|
||||
client: SigningCosmWasmClient
|
||||
sender: string
|
||||
contractAddress: string
|
||||
|
||||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||
super(client, contractAddress)
|
||||
this.client = client
|
||||
this.sender = sender
|
||||
this.contractAddress = contractAddress
|
||||
this.updateConfig = this.updateConfig.bind(this)
|
||||
this.setRoute = this.setRoute.bind(this)
|
||||
this.swapExactIn = this.swapExactIn.bind(this)
|
||||
this.transferResult = this.transferResult.bind(this)
|
||||
}
|
||||
|
||||
updateConfig = async (
|
||||
{
|
||||
owner,
|
||||
}: {
|
||||
owner?: string
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
update_config: {
|
||||
owner,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
setRoute = async (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
route,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: Empty
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
set_route: {
|
||||
denom_in: denomIn,
|
||||
denom_out: denomOut,
|
||||
route,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
swapExactIn = async (
|
||||
{
|
||||
coinIn,
|
||||
denomOut,
|
||||
slippage,
|
||||
}: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
swap_exact_in: {
|
||||
coin_in: coinIn,
|
||||
denom_out: denomOut,
|
||||
slippage,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
transferResult = async (
|
||||
{
|
||||
denomIn,
|
||||
denomOut,
|
||||
recipient,
|
||||
}: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
},
|
||||
fee: number | StdFee | 'auto' = 'auto',
|
||||
memo?: string,
|
||||
funds?: Coin[],
|
||||
): Promise<ExecuteResult> => {
|
||||
return await this.client.execute(
|
||||
this.sender,
|
||||
this.contractAddress,
|
||||
{
|
||||
transfer_result: {
|
||||
denom_in: denomIn,
|
||||
denom_out: denomOut,
|
||||
recipient,
|
||||
},
|
||||
},
|
||||
fee,
|
||||
memo,
|
||||
funds,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||
import { StdFee } from '@cosmjs/amino'
|
||||
import {
|
||||
InstantiateMsg,
|
||||
ExecuteMsg,
|
||||
Uint128,
|
||||
Decimal,
|
||||
Addr,
|
||||
Empty,
|
||||
Coin,
|
||||
QueryMsg,
|
||||
ConfigForString,
|
||||
EstimateExactInSwapResponse,
|
||||
RouteResponseForEmpty,
|
||||
ArrayOfRouteResponseForEmpty,
|
||||
} from './SwapperBase.types'
|
||||
import { SwapperBaseQueryClient, SwapperBaseClient } from './SwapperBase.client'
|
||||
export const swapperBaseQueryKeys = {
|
||||
contract: [
|
||||
{
|
||||
contract: 'swapperBase',
|
||||
},
|
||||
] as const,
|
||||
address: (contractAddress: string | undefined) =>
|
||||
[{ ...swapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
||||
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...swapperBaseQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...swapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
|
||||
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[{ ...swapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
|
||||
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||
[
|
||||
{
|
||||
...swapperBaseQueryKeys.address(contractAddress)[0],
|
||||
method: 'estimate_exact_in_swap',
|
||||
args,
|
||||
},
|
||||
] as const,
|
||||
}
|
||||
export interface SwapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||
client: SwapperBaseQueryClient | undefined
|
||||
options?: Omit<
|
||||
UseQueryOptions<TResponse, Error, TData>,
|
||||
"'queryKey' | 'queryFn' | 'initialData'"
|
||||
> & {
|
||||
initialData?: undefined
|
||||
}
|
||||
}
|
||||
export interface SwapperBaseEstimateExactInSwapQuery<TData>
|
||||
extends SwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
|
||||
args: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: SwapperBaseEstimateExactInSwapQuery<TData>) {
|
||||
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||
swapperBaseQueryKeys.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 SwapperBaseRoutesQuery<TData>
|
||||
extends SwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
limit?: number
|
||||
startAfter?: string[][]
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: SwapperBaseRoutesQuery<TData>) {
|
||||
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||
swapperBaseQueryKeys.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 SwapperBaseRouteQuery<TData>
|
||||
extends SwapperBaseReactQuery<RouteResponseForEmpty, TData> {
|
||||
args: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
||||
client,
|
||||
args,
|
||||
options,
|
||||
}: SwapperBaseRouteQuery<TData>) {
|
||||
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||
swapperBaseQueryKeys.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 SwapperBaseConfigQuery<TData>
|
||||
extends SwapperBaseReactQuery<ConfigForString, TData> {}
|
||||
export function useSwapperBaseConfigQuery<TData = ConfigForString>({
|
||||
client,
|
||||
options,
|
||||
}: SwapperBaseConfigQuery<TData>) {
|
||||
return useQuery<ConfigForString, Error, TData>(
|
||||
swapperBaseQueryKeys.config(client?.contractAddress),
|
||||
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||
)
|
||||
}
|
||||
export interface SwapperBaseTransferResultMutation {
|
||||
client: SwapperBaseClient
|
||||
msg: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
recipient: Addr
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseTransferResultMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseTransferResultMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, SwapperBaseTransferResultMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.transferResult(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface SwapperBaseSwapExactInMutation {
|
||||
client: SwapperBaseClient
|
||||
msg: {
|
||||
coinIn: Coin
|
||||
denomOut: string
|
||||
slippage: Decimal
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseSwapExactInMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseSwapExactInMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, SwapperBaseSwapExactInMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface SwapperBaseSetRouteMutation {
|
||||
client: SwapperBaseClient
|
||||
msg: {
|
||||
denomIn: string
|
||||
denomOut: string
|
||||
route: Empty
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseSetRouteMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseSetRouteMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, SwapperBaseSetRouteMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
export interface SwapperBaseUpdateConfigMutation {
|
||||
client: SwapperBaseClient
|
||||
msg: {
|
||||
owner?: string
|
||||
}
|
||||
args?: {
|
||||
fee?: number | StdFee | 'auto'
|
||||
memo?: string
|
||||
funds?: Coin[]
|
||||
}
|
||||
}
|
||||
export function useSwapperBaseUpdateConfigMutation(
|
||||
options?: Omit<
|
||||
UseMutationOptions<ExecuteResult, Error, SwapperBaseUpdateConfigMutation>,
|
||||
'mutationFn'
|
||||
>,
|
||||
) {
|
||||
return useMutation<ExecuteResult, Error, SwapperBaseUpdateConfigMutation>(
|
||||
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||
client.updateConfig(msg, fee, memo, funds),
|
||||
options,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface InstantiateMsg {
|
||||
owner: string
|
||||
}
|
||||
export type ExecuteMsg =
|
||||
| {
|
||||
update_config: {
|
||||
owner?: string | null
|
||||
}
|
||||
}
|
||||
| {
|
||||
set_route: {
|
||||
denom_in: string
|
||||
denom_out: string
|
||||
route: Empty
|
||||
}
|
||||
}
|
||||
| {
|
||||
swap_exact_in: {
|
||||
coin_in: Coin
|
||||
denom_out: string
|
||||
slippage: Decimal
|
||||
}
|
||||
}
|
||||
| {
|
||||
transfer_result: {
|
||||
denom_in: string
|
||||
denom_out: string
|
||||
recipient: Addr
|
||||
}
|
||||
}
|
||||
export type Uint128 = string
|
||||
export type Decimal = string
|
||||
export type Addr = string
|
||||
export interface Empty {
|
||||
[k: string]: unknown
|
||||
}
|
||||
export interface Coin {
|
||||
amount: Uint128
|
||||
denom: string
|
||||
[k: string]: unknown
|
||||
}
|
||||
export type QueryMsg =
|
||||
| {
|
||||
config: {}
|
||||
}
|
||||
| {
|
||||
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 ConfigForString {
|
||||
owner: string
|
||||
}
|
||||
export interface EstimateExactInSwapResponse {
|
||||
amount: Uint128
|
||||
}
|
||||
export interface RouteResponseForEmpty {
|
||||
denom_in: string
|
||||
denom_out: string
|
||||
route: Empty
|
||||
}
|
||||
export type ArrayOfRouteResponseForEmpty = RouteResponseForEmpty[]
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.16.5.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||
*/
|
||||
|
||||
import * as _18 from './SwapperBase.types'
|
||||
import * as _19 from './SwapperBase.client'
|
||||
import * as _20 from './SwapperBase.react-query'
|
||||
export namespace contracts {
|
||||
export const SwapperBase = { ..._18, ..._19, ..._20 }
|
||||
}
|
||||
+26
-26
@@ -11,43 +11,43 @@ export enum EthereumChainId {
|
||||
}
|
||||
|
||||
export enum ChainId {
|
||||
Mainnet = "injective-1",
|
||||
Testnet = "injective-888",
|
||||
Devnet = "injective-777",
|
||||
Mainnet = 'injective-1',
|
||||
Testnet = 'injective-888',
|
||||
Devnet = 'injective-777',
|
||||
}
|
||||
|
||||
export enum Wallet {
|
||||
Metamask = "metamask",
|
||||
Ledger = "ledger",
|
||||
LedgerLegacy = "ledger-legacy",
|
||||
Trezor = "trezor",
|
||||
Keplr = "keplr",
|
||||
Torus = "torus",
|
||||
WalletConnect = "wallet-connect",
|
||||
Metamask = 'metamask',
|
||||
Ledger = 'ledger',
|
||||
LedgerLegacy = 'ledger-legacy',
|
||||
Trezor = 'trezor',
|
||||
Keplr = 'keplr',
|
||||
Torus = 'torus',
|
||||
WalletConnect = 'wallet-connect',
|
||||
}
|
||||
|
||||
// COSMOS
|
||||
export enum CosmosChainId {
|
||||
Injective = "injective-1",
|
||||
Cosmoshub = "cosmoshub-4",
|
||||
Juno = "juno-1",
|
||||
Osmosis = "osmosis-1",
|
||||
Terra = "columbus-5",
|
||||
TerraUST = "columbus-5",
|
||||
Chihuahua = "chihuahua-1",
|
||||
Axelar = "axelar-dojo-1",
|
||||
Evmos = "evmos_9001-2",
|
||||
Persistence = "core-1",
|
||||
Secret = "secret-4",
|
||||
Stride = "stride-1",
|
||||
Injective = 'injective-1',
|
||||
Cosmoshub = 'cosmoshub-4',
|
||||
Juno = 'juno-1',
|
||||
Osmosis = 'osmosis-1',
|
||||
Terra = 'columbus-5',
|
||||
TerraUST = 'columbus-5',
|
||||
Chihuahua = 'chihuahua-1',
|
||||
Axelar = 'axelar-dojo-1',
|
||||
Evmos = 'evmos_9001-2',
|
||||
Persistence = 'core-1',
|
||||
Secret = 'secret-4',
|
||||
Stride = 'stride-1',
|
||||
}
|
||||
|
||||
export enum TestnetCosmosChainId {
|
||||
Injective = "injective-888",
|
||||
Cosmoshub = "cosmoshub-testnet",
|
||||
Injective = 'injective-888',
|
||||
Cosmoshub = 'cosmoshub-testnet',
|
||||
}
|
||||
|
||||
export enum DevnetCosmosChainId {
|
||||
Injective = "injective-777",
|
||||
Injective1 = "injective-777",
|
||||
Injective = 'injective-777',
|
||||
Injective1 = 'injective-777',
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { Window as KeplrWindow } from "@keplr-wallet/types";
|
||||
import type { Window as KeplrWindow } from '@keplr-wallet/types'
|
||||
|
||||
declare global {
|
||||
interface Window extends KeplrWindow {}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export const queryKeys = {
|
||||
allBalances: (address: string) => ['allBalances', address],
|
||||
allowedCoins: () => ['allowedCoins'],
|
||||
creditAccounts: (address: string) => ['creditAccounts', address],
|
||||
creditAccountsPositions: (accountId: string) => ['creditAccountPositions', accountId],
|
||||
tokenBalance: (address: string, denom: string) => ['tokenBalance', address, denom],
|
||||
}
|
||||
Reference in New Issue
Block a user