Perp queries (#711)
* update assets config and chains
* make clients dynamic
* feat: formatted ChainSelect
* fix infinite rerender on trade page
* feat: added NTRN icon
* fix: fixed ChainInfoID
* fix: fixed autoLendEnabled for NTRN
* fix: fixed the navigation and dependencies
* fix: fixed the pricefeed id
* fix: fixed the header menu
* fix: fixed the trading charts
* fix: fixed the healthbars
* fix: fixed naming of pion-1
* feast: updated xdefi image
* env: updated contracts
* make localStorage chain agnostic
* fix: made the selected chain persistant
* fix: fixed the wallet providers
* fix: updated auto connect
* fix: fixed auto connecting
* fix: added ChainSelect to focusMode
* store raw strings in localstorage
* 🔥 remnove tests
* update caching keys + disconnect wallet on change chain
* update contract types and add perps asset select overlay
* fix build + add perps positions to accounts
---------
Co-authored-by: Linkie Link <linkielink.dev@gmail.com>
This commit is contained in:
parent
2197dc917a
commit
a2b6acbccb
@ -29,6 +29,7 @@ export default async function getAccount(
|
|||||||
lends: accountPosition.lends.map((lend) => new BNCoin(lend)),
|
lends: accountPosition.lends.map((lend) => new BNCoin(lend)),
|
||||||
deposits: accountPosition.deposits.map((deposit) => new BNCoin(deposit)),
|
deposits: accountPosition.deposits.map((deposit) => new BNCoin(deposit)),
|
||||||
vaults: depositedVaults,
|
vaults: depositedVaults,
|
||||||
|
perps: accountPosition.perps,
|
||||||
kind: accountKind,
|
kind: accountKind,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ export default async function getICNS(
|
|||||||
chainConfig: ChainConfig,
|
chainConfig: ChainConfig,
|
||||||
address?: string,
|
address?: string,
|
||||||
): Promise<ICNSResult | undefined> {
|
): Promise<ICNSResult | undefined> {
|
||||||
// TODO: Make this also work for different chains?
|
|
||||||
if (!address || chainConfig.id !== ChainInfoID.Osmosis1) return
|
if (!address || chainConfig.id !== ChainInfoID.Osmosis1) return
|
||||||
try {
|
try {
|
||||||
const icnsQueryClient = await getICNSQueryClient(chainConfig)
|
const icnsQueryClient = await getICNSQueryClient(chainConfig)
|
||||||
|
@ -3,39 +3,35 @@ import { useState } from 'react'
|
|||||||
import Button from 'components/Button'
|
import Button from 'components/Button'
|
||||||
import Card from 'components/Card'
|
import Card from 'components/Card'
|
||||||
import { DirectionSelect } from 'components/DirectionSelect'
|
import { DirectionSelect } from 'components/DirectionSelect'
|
||||||
import { ChevronDown } from 'components/Icons'
|
|
||||||
import { LeverageButtons } from 'components/Perps/Module/LeverageButtons'
|
import { LeverageButtons } from 'components/Perps/Module/LeverageButtons'
|
||||||
import { Or } from 'components/Perps/Module/Or'
|
import { Or } from 'components/Perps/Module/Or'
|
||||||
import RangeInput from 'components/RangeInput'
|
import RangeInput from 'components/RangeInput'
|
||||||
import { Spacer } from 'components/Spacer'
|
import { Spacer } from 'components/Spacer'
|
||||||
import Text from 'components/Text'
|
import Text from 'components/Text'
|
||||||
|
import AssetSelectorPerps from 'components/Trade/TradeModule/AssetSelector/AssetSelectorPerps'
|
||||||
import AssetAmountInput from 'components/Trade/TradeModule/SwapForm/AssetAmountInput'
|
import AssetAmountInput from 'components/Trade/TradeModule/SwapForm/AssetAmountInput'
|
||||||
import OrderTypeSelector from 'components/Trade/TradeModule/SwapForm/OrderTypeSelector'
|
import OrderTypeSelector from 'components/Trade/TradeModule/SwapForm/OrderTypeSelector'
|
||||||
import { AvailableOrderType } from 'components/Trade/TradeModule/SwapForm/OrderTypeSelector/types'
|
import { AvailableOrderType } from 'components/Trade/TradeModule/SwapForm/OrderTypeSelector/types'
|
||||||
import { BN_ZERO } from 'constants/math'
|
import { BN_ZERO } from 'constants/math'
|
||||||
import useBaseAsset from 'hooks/assets/useBasetAsset'
|
import useBaseAsset from 'hooks/assets/useBasetAsset'
|
||||||
|
import usePerpsAsset from 'hooks/perps/usePerpsAsset'
|
||||||
|
|
||||||
export function PerpsModule() {
|
export function PerpsModule() {
|
||||||
const [selectedOrderType, setSelectedOrderType] = useState<AvailableOrderType>('Market')
|
const [selectedOrderType, setSelectedOrderType] = useState<AvailableOrderType>('Market')
|
||||||
const [selectedOrderDirection, setSelectedOrderDirection] = useState<OrderDirection>('long')
|
const [selectedOrderDirection, setSelectedOrderDirection] = useState<OrderDirection>('long')
|
||||||
|
|
||||||
const baseAsset = useBaseAsset()
|
const baseAsset = useBaseAsset()
|
||||||
|
const { perpsAsset } = usePerpsAsset()
|
||||||
|
|
||||||
|
if (!perpsAsset) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
contentClassName='px-4 gap-5 flex flex-col'
|
contentClassName='px-4 gap-5 flex flex-col'
|
||||||
title={
|
title={<AssetSelectorPerps asset={perpsAsset} />}
|
||||||
<div className='flex items-center justify-between py-4 pl-4 pr-2 bg-white/10'>
|
|
||||||
<Text>
|
|
||||||
ETH<span className='text-white/60'>/USD</span>
|
|
||||||
</Text>
|
|
||||||
<Button color='quaternary' variant='transparent' rightIcon={<ChevronDown />}>
|
|
||||||
All Markets
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
className='mb-4'
|
className='mb-4'
|
||||||
>
|
>
|
||||||
<OrderTypeSelector selected={selectedOrderType} onChange={setSelectedOrderType} />
|
<OrderTypeSelector selected={selectedOrderType} onChange={setSelectedOrderType} />
|
||||||
|
|
||||||
<DirectionSelect
|
<DirectionSelect
|
||||||
direction={selectedOrderDirection}
|
direction={selectedOrderDirection}
|
||||||
onChangeDirection={setSelectedOrderDirection}
|
onChangeDirection={setSelectedOrderDirection}
|
||||||
|
@ -2,12 +2,15 @@ import React from 'react'
|
|||||||
|
|
||||||
import TradeChart from 'components/Trade/TradeChart'
|
import TradeChart from 'components/Trade/TradeChart'
|
||||||
import useAllAssets from 'hooks/assets/useAllAssets'
|
import useAllAssets from 'hooks/assets/useAllAssets'
|
||||||
|
import usePerpsAsset from 'hooks/perps/usePerpsAsset'
|
||||||
|
|
||||||
export function PerpsChart() {
|
export function PerpsChart() {
|
||||||
const assets = useAllAssets()
|
const assets = useAllAssets()
|
||||||
|
const { perpsAsset } = usePerpsAsset()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='h-full'>
|
<div className='h-full'>
|
||||||
<TradeChart buyAsset={assets[0]} sellAsset={assets[1]} />
|
<TradeChart buyAsset={perpsAsset} sellAsset={assets[1]} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,10 @@ export function PerpsInfo() {
|
|||||||
const { data: market } = usePerpsMarket()
|
const { data: market } = usePerpsMarket()
|
||||||
const assetPrice = usePrice(market?.asset.denom || '')
|
const assetPrice = usePrice(market?.asset.denom || '')
|
||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(() => {
|
||||||
() => [
|
if (!market) return []
|
||||||
|
|
||||||
|
return [
|
||||||
...(!assetPrice.isZero()
|
...(!assetPrice.isZero()
|
||||||
? [<DisplayCurrency key='price' coin={BNCoin.fromDenomAndBigNumber('usd', assetPrice)} />]
|
? [<DisplayCurrency key='price' coin={BNCoin.fromDenomAndBigNumber('usd', assetPrice)} />]
|
||||||
: [<Loading key='price' className='w-14 h-4' />]),
|
: [<Loading key='price' className='w-14 h-4' />]),
|
||||||
@ -45,9 +47,8 @@ export function PerpsInfo() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>,
|
/>,
|
||||||
],
|
]
|
||||||
[assetPrice, market],
|
}, [assetPrice, market])
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card contentClassName='bg-white/10 py-3.5 px-4'>
|
<Card contentClassName='bg-white/10 py-3.5 px-4'>
|
||||||
|
@ -41,6 +41,7 @@ export default function PortfolioSummary() {
|
|||||||
lends: [],
|
lends: [],
|
||||||
debts: [],
|
debts: [],
|
||||||
vaults: [],
|
vaults: [],
|
||||||
|
perps: [],
|
||||||
kind: 'default',
|
kind: 'default',
|
||||||
} as Account,
|
} as Account,
|
||||||
)
|
)
|
||||||
|
@ -5,9 +5,9 @@ import DisplayCurrency from 'components/DisplayCurrency'
|
|||||||
import { FormattedNumber } from 'components/FormattedNumber'
|
import { FormattedNumber } from 'components/FormattedNumber'
|
||||||
import Loading from 'components/Loading'
|
import Loading from 'components/Loading'
|
||||||
import Text from 'components/Text'
|
import Text from 'components/Text'
|
||||||
|
import { disabledFeatures, enabledFeatures, overrides } from 'components/Trade/TradeChart/constants'
|
||||||
import { DataFeed, PAIR_SEPARATOR } from 'components/Trade/TradeChart/DataFeed'
|
import { DataFeed, PAIR_SEPARATOR } from 'components/Trade/TradeChart/DataFeed'
|
||||||
import PoweredByPyth from 'components/Trade/TradeChart/PoweredByPyth'
|
import PoweredByPyth from 'components/Trade/TradeChart/PoweredByPyth'
|
||||||
import { disabledFeatures, enabledFeatures, overrides } from 'components/Trade/TradeChart/constants'
|
|
||||||
import { BN_ZERO } from 'constants/math'
|
import { BN_ZERO } from 'constants/math'
|
||||||
import useAllAssets from 'hooks/assets/useAllAssets'
|
import useAllAssets from 'hooks/assets/useAllAssets'
|
||||||
import useBaseAsset from 'hooks/assets/useBasetAsset'
|
import useBaseAsset from 'hooks/assets/useBasetAsset'
|
||||||
|
@ -15,7 +15,7 @@ import { byDenom } from 'utils/array'
|
|||||||
import { sortAssetsOrPairs } from 'utils/assets'
|
import { sortAssetsOrPairs } from 'utils/assets'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
type: 'buy' | 'sell'
|
type: 'buy' | 'sell' | 'perps'
|
||||||
assets: Asset[]
|
assets: Asset[]
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
toggleOpen: () => void
|
toggleOpen: () => void
|
||||||
@ -42,13 +42,15 @@ export default function AssetList(props: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
<button
|
{type !== 'perps' && (
|
||||||
className='flex items-center justify-between w-full p-4 bg-black/20'
|
<button
|
||||||
onClick={toggleOpen}
|
className='flex items-center justify-between w-full p-4 bg-black/20'
|
||||||
>
|
onClick={toggleOpen}
|
||||||
<Text>{type === 'buy' ? 'Buy asset' : 'Sell asset'}</Text>
|
>
|
||||||
<ChevronDown className={classNames(isOpen && '-rotate-180', 'w-4')} />
|
<Text>{type === 'buy' ? 'Buy asset' : 'Sell asset'}</Text>
|
||||||
</button>
|
<ChevronDown className={classNames(isOpen && '-rotate-180', 'w-4')} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
{isOpen &&
|
{isOpen &&
|
||||||
(sortedAssets.length === 0 ? (
|
(sortedAssets.length === 0 ? (
|
||||||
<Text size='xs' className='p-4'>
|
<Text size='xs' className='p-4'>
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
import Button from 'components/Button'
|
||||||
|
import Divider from 'components/Divider'
|
||||||
|
|
||||||
|
interface StablesFilterProps {
|
||||||
|
onFilter: (stables: Asset[]) => void
|
||||||
|
selectedStables: Asset[]
|
||||||
|
stables: Asset[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function StablesFilter(props: StablesFilterProps) {
|
||||||
|
const { stables, selectedStables, onFilter } = props
|
||||||
|
const isAllSelected = selectedStables.length > 1
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Divider />
|
||||||
|
<div className='flex items-center w-full gap-2 p-2'>
|
||||||
|
{stables.map((stable) => {
|
||||||
|
const isCurrent = !isAllSelected && selectedStables[0].denom === stable.denom
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
key={stable.symbol}
|
||||||
|
onClick={() => onFilter([stable])}
|
||||||
|
text={stable.symbol}
|
||||||
|
color={isCurrent ? 'secondary' : 'quaternary'}
|
||||||
|
variant='transparent'
|
||||||
|
className={isCurrent ? '!text-white !bg-white/10 border-white' : ''}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
import { useCallback, useMemo, useState } from 'react'
|
import { useCallback, useMemo, useState } from 'react'
|
||||||
|
|
||||||
import Button from 'components/Button'
|
|
||||||
import EscButton from 'components/Button/EscButton'
|
import EscButton from 'components/Button/EscButton'
|
||||||
import Divider from 'components/Divider'
|
import Divider from 'components/Divider'
|
||||||
import Overlay from 'components/Overlay'
|
import Overlay from 'components/Overlay'
|
||||||
@ -11,50 +10,22 @@ import PairsList from 'components/Trade/TradeModule/AssetSelector/PairsList'
|
|||||||
import useAllAssets from 'hooks/assets/useAllAssets'
|
import useAllAssets from 'hooks/assets/useAllAssets'
|
||||||
import useFilteredAssets from 'hooks/useFilteredAssets'
|
import useFilteredAssets from 'hooks/useFilteredAssets'
|
||||||
|
|
||||||
|
import StablesFilter from './StablesFilter'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
state: OverlayState
|
state: OverlayState
|
||||||
buyAsset: Asset
|
buyAsset: Asset
|
||||||
sellAsset: Asset
|
sellAsset: Asset
|
||||||
|
buyAssets: Asset[]
|
||||||
onChangeBuyAsset?: (asset: Asset) => void
|
onChangeBuyAsset?: (asset: Asset) => void
|
||||||
onChangeSellAsset?: (asset: Asset) => void
|
onChangeSellAsset?: (asset: Asset) => void
|
||||||
onChangeTradingPair?: (tradingPair: TradingPair) => void
|
onChangeTradingPair?: (tradingPair: TradingPair) => void
|
||||||
onChangeState: (state: OverlayState) => void
|
onChangeState: (state: OverlayState) => void
|
||||||
}
|
type: 'pair' | 'single' | 'perps'
|
||||||
|
|
||||||
interface StablesFilterProps {
|
|
||||||
stables: Asset[]
|
|
||||||
selectedStables: Asset[]
|
|
||||||
onFilter: (stables: Asset[]) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
function StablesFilter(props: StablesFilterProps) {
|
|
||||||
const { stables, selectedStables, onFilter } = props
|
|
||||||
const isAllSelected = selectedStables.length > 1
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Divider />
|
|
||||||
<div className='flex items-center w-full gap-2 p-2'>
|
|
||||||
{stables.map((stable) => {
|
|
||||||
const isCurrent = !isAllSelected && selectedStables[0].denom === stable.denom
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
key={stable.symbol}
|
|
||||||
onClick={() => onFilter([stable])}
|
|
||||||
text={stable.symbol}
|
|
||||||
color={isCurrent ? 'secondary' : 'quaternary'}
|
|
||||||
variant='transparent'
|
|
||||||
className={isCurrent ? '!text-white !bg-white/10 border-white' : ''}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AssetOverlay(props: Props) {
|
export default function AssetOverlay(props: Props) {
|
||||||
const isPairSelector = !!props.onChangeTradingPair
|
const { assets, searchString, onChangeSearch } = useFilteredAssets(props.buyAssets)
|
||||||
const { assets, searchString, onChangeSearch } = useFilteredAssets()
|
|
||||||
const allAssets = useAllAssets()
|
const allAssets = useAllAssets()
|
||||||
const stableAssets = useMemo(() => allAssets.filter((asset) => asset.isStable), [allAssets])
|
const stableAssets = useMemo(() => allAssets.filter((asset) => asset.isStable), [allAssets])
|
||||||
const handleClose = useCallback(() => props.onChangeState('closed'), [props])
|
const handleClose = useCallback(() => props.onChangeState('closed'), [props])
|
||||||
@ -63,8 +34,10 @@ export default function AssetOverlay(props: Props) {
|
|||||||
|
|
||||||
const buyAssets = useMemo(
|
const buyAssets = useMemo(
|
||||||
() =>
|
() =>
|
||||||
isPairSelector ? assets : assets.filter((asset) => asset.denom !== props.sellAsset.denom),
|
props.type === 'pair'
|
||||||
[assets, props.sellAsset, isPairSelector],
|
? assets
|
||||||
|
: assets.filter((asset) => asset.denom !== props.sellAsset.denom),
|
||||||
|
[assets, props.sellAsset, props.type],
|
||||||
)
|
)
|
||||||
|
|
||||||
const sellAssets = useMemo(
|
const sellAssets = useMemo(
|
||||||
@ -111,10 +84,10 @@ export default function AssetOverlay(props: Props) {
|
|||||||
setShow={handleClose}
|
setShow={handleClose}
|
||||||
>
|
>
|
||||||
<div className='flex justify-between p-4 overflow-hidden'>
|
<div className='flex justify-between p-4 overflow-hidden'>
|
||||||
<Text>{isPairSelector ? 'Select a market' : 'Select asset'}</Text>
|
<Text>{props.type !== 'single' ? 'Select a market' : 'Select asset'}</Text>
|
||||||
<EscButton onClick={handleClose} enableKeyPress />
|
<EscButton onClick={handleClose} enableKeyPress />
|
||||||
</div>
|
</div>
|
||||||
{isPairSelector && (
|
{props.type === 'pair' && (
|
||||||
<StablesFilter
|
<StablesFilter
|
||||||
stables={stableAssets}
|
stables={stableAssets}
|
||||||
selectedStables={selectedStables}
|
selectedStables={selectedStables}
|
||||||
@ -132,7 +105,17 @@ export default function AssetOverlay(props: Props) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Divider />
|
<Divider />
|
||||||
{isPairSelector ? (
|
{props.type === 'perps' && (
|
||||||
|
<AssetList
|
||||||
|
assets={props.buyAssets}
|
||||||
|
type='perps'
|
||||||
|
onChangeAsset={onChangeBuyAsset}
|
||||||
|
isOpen
|
||||||
|
toggleOpen={() => {}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{props.type === 'pair' && (
|
||||||
<PairsList
|
<PairsList
|
||||||
assets={buyAssets}
|
assets={buyAssets}
|
||||||
stables={selectedStables}
|
stables={selectedStables}
|
||||||
@ -140,7 +123,9 @@ export default function AssetOverlay(props: Props) {
|
|||||||
toggleOpen={handleToggle}
|
toggleOpen={handleToggle}
|
||||||
onChangeAssetPair={onChangeAssetPair}
|
onChangeAssetPair={onChangeAssetPair}
|
||||||
/>
|
/>
|
||||||
) : (
|
)}
|
||||||
|
|
||||||
|
{props.type === 'single' && (
|
||||||
<>
|
<>
|
||||||
<AssetList
|
<AssetList
|
||||||
type='buy'
|
type='buy'
|
@ -13,17 +13,17 @@ import useStore from 'store'
|
|||||||
interface Props {
|
interface Props {
|
||||||
buyAsset: Asset
|
buyAsset: Asset
|
||||||
sellAsset: Asset
|
sellAsset: Asset
|
||||||
|
assets: Asset[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AssetSelectorPair(props: Props) {
|
export default function AssetSelectorPair(props: Props) {
|
||||||
const chainConfig = useChainConfig()
|
const chainConfig = useChainConfig()
|
||||||
const [tradingPairSimple, setTradingPairSimple] = useLocalStorage<Settings['tradingPairSimple']>(
|
const [_, setTradingPairSimple] = useLocalStorage<Settings['tradingPairSimple']>(
|
||||||
chainConfig.id + '/' + LocalStorageKeys.TRADING_PAIR_SIMPLE,
|
chainConfig.id + '/' + LocalStorageKeys.TRADING_PAIR_SIMPLE,
|
||||||
DEFAULT_SETTINGS.tradingPairSimple,
|
DEFAULT_SETTINGS.tradingPairSimple,
|
||||||
)
|
)
|
||||||
const { buyAsset, sellAsset } = props
|
const { buyAsset, sellAsset } = props
|
||||||
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
||||||
|
|
||||||
const onChangeTradingPair = useCallback(
|
const onChangeTradingPair = useCallback(
|
||||||
(tradingPair: TradingPair) => {
|
(tradingPair: TradingPair) => {
|
||||||
setTradingPairSimple(tradingPair)
|
setTradingPairSimple(tradingPair)
|
||||||
@ -57,6 +57,8 @@ export default function AssetSelectorPair(props: Props) {
|
|||||||
buyAsset={buyAsset}
|
buyAsset={buyAsset}
|
||||||
sellAsset={sellAsset}
|
sellAsset={sellAsset}
|
||||||
onChangeTradingPair={onChangeTradingPair}
|
onChangeTradingPair={onChangeTradingPair}
|
||||||
|
buyAssets={props.assets}
|
||||||
|
type='pair'
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
import { useCallback } from 'react'
|
||||||
|
|
||||||
|
import Button from 'components/Button'
|
||||||
|
import { ChevronDown } from 'components/Icons'
|
||||||
|
import Text from 'components/Text'
|
||||||
|
import AssetOverlay from 'components/Trade/TradeModule/AssetSelector/AssetOverlay'
|
||||||
|
import usePerpsEnabledAssets from 'hooks/assets/usePerpsEnabledAssets'
|
||||||
|
import usePerpsAsset from 'hooks/perps/usePerpsAsset'
|
||||||
|
import useStore from 'store'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
asset: Asset
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function AssetSelectorPerps(props: Props) {
|
||||||
|
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
||||||
|
const { perpsAsset, updatePerpsAsset } = usePerpsAsset()
|
||||||
|
|
||||||
|
const perpAssets = usePerpsEnabledAssets()
|
||||||
|
|
||||||
|
const onChangePerpsAsset = useCallback(
|
||||||
|
(asset: Asset) => {
|
||||||
|
updatePerpsAsset(asset.denom)
|
||||||
|
},
|
||||||
|
[updatePerpsAsset],
|
||||||
|
)
|
||||||
|
|
||||||
|
const handleChangeState = useCallback(() => {
|
||||||
|
useStore.setState({ assetOverlayState: 'closed' })
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
color='quaternary'
|
||||||
|
variant='transparent'
|
||||||
|
onClick={() => useStore.setState({ assetOverlayState: 'pair' })}
|
||||||
|
className='flex items-center justify-between w-full py-5 bg-white/5'
|
||||||
|
>
|
||||||
|
<Text size='sm' className='text-white/60'>
|
||||||
|
<span className='text-white'>{perpsAsset.symbol}</span>/USD
|
||||||
|
</Text>
|
||||||
|
<div className='flex items-center gap-2'>
|
||||||
|
<Text>All markets</Text>
|
||||||
|
<ChevronDown className='w-3 h-3' />
|
||||||
|
</div>
|
||||||
|
</Button>
|
||||||
|
<AssetOverlay
|
||||||
|
buyAssets={perpAssets}
|
||||||
|
state={assetOverlayState}
|
||||||
|
onChangeState={handleChangeState}
|
||||||
|
buyAsset={props.asset}
|
||||||
|
sellAsset={props.asset}
|
||||||
|
onChangeBuyAsset={onChangePerpsAsset}
|
||||||
|
type='perps'
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
@ -6,7 +6,9 @@ import AssetButton from 'components/Trade/TradeModule/AssetSelector/AssetButton'
|
|||||||
import AssetOverlay from 'components/Trade/TradeModule/AssetSelector/AssetOverlay'
|
import AssetOverlay from 'components/Trade/TradeModule/AssetSelector/AssetOverlay'
|
||||||
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
||||||
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
||||||
|
import useMarketEnabledAssets from 'hooks/assets/useMarketEnabledAssets'
|
||||||
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
||||||
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
import useStore from 'store'
|
import useStore from 'store'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -15,30 +17,33 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AssetSelectorSingle(props: Props) {
|
export default function AssetSelectorSingle(props: Props) {
|
||||||
const [tradingPairAdvanced, settradingPairAdvanced] = useLocalStorage<
|
const chainConfig = useChainConfig()
|
||||||
Settings['tradingPairAdvanced']
|
const [_, setTradingPairAdvanced] = useLocalStorage<Settings['tradingPairAdvanced']>(
|
||||||
>(LocalStorageKeys.TRADING_PAIR_ADVANCED, DEFAULT_SETTINGS.tradingPairAdvanced)
|
chainConfig.id + '/' + LocalStorageKeys.TRADING_PAIR_ADVANCED,
|
||||||
|
DEFAULT_SETTINGS.tradingPairAdvanced,
|
||||||
|
)
|
||||||
const { buyAsset, sellAsset } = props
|
const { buyAsset, sellAsset } = props
|
||||||
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
||||||
|
const allAssets = useMarketEnabledAssets()
|
||||||
|
|
||||||
const handleSwapAssets = useCallback(() => {
|
const handleSwapAssets = useCallback(() => {
|
||||||
settradingPairAdvanced({ buy: sellAsset.denom, sell: buyAsset.denom })
|
setTradingPairAdvanced({ buy: sellAsset.denom, sell: buyAsset.denom })
|
||||||
}, [settradingPairAdvanced, sellAsset, buyAsset])
|
}, [setTradingPairAdvanced, sellAsset, buyAsset])
|
||||||
|
|
||||||
const handleChangeBuyAsset = useCallback(
|
const handleChangeBuyAsset = useCallback(
|
||||||
(asset: Asset) => {
|
(asset: Asset) => {
|
||||||
settradingPairAdvanced({ buy: asset.denom, sell: sellAsset.denom })
|
setTradingPairAdvanced({ buy: asset.denom, sell: sellAsset.denom })
|
||||||
useStore.setState({ assetOverlayState: 'sell' })
|
useStore.setState({ assetOverlayState: 'sell' })
|
||||||
},
|
},
|
||||||
[settradingPairAdvanced, sellAsset],
|
[setTradingPairAdvanced, sellAsset],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleChangeSellAsset = useCallback(
|
const handleChangeSellAsset = useCallback(
|
||||||
(asset: Asset) => {
|
(asset: Asset) => {
|
||||||
settradingPairAdvanced({ buy: buyAsset.denom, sell: asset.denom })
|
setTradingPairAdvanced({ buy: buyAsset.denom, sell: asset.denom })
|
||||||
useStore.setState({ assetOverlayState: 'closed' })
|
useStore.setState({ assetOverlayState: 'closed' })
|
||||||
},
|
},
|
||||||
[settradingPairAdvanced, buyAsset],
|
[setTradingPairAdvanced, buyAsset],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleChangeState = useCallback((state: OverlayState) => {
|
const handleChangeState = useCallback((state: OverlayState) => {
|
||||||
@ -69,6 +74,8 @@ export default function AssetSelectorSingle(props: Props) {
|
|||||||
sellAsset={sellAsset}
|
sellAsset={sellAsset}
|
||||||
onChangeBuyAsset={handleChangeBuyAsset}
|
onChangeBuyAsset={handleChangeBuyAsset}
|
||||||
onChangeSellAsset={handleChangeSellAsset}
|
onChangeSellAsset={handleChangeSellAsset}
|
||||||
|
buyAssets={allAssets}
|
||||||
|
type='single'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -62,7 +62,8 @@ export default function TradeSummary(props: Props) {
|
|||||||
const [slippage] = useLocalStorage<number>(LocalStorageKeys.SLIPPAGE, DEFAULT_SETTINGS.slippage)
|
const [slippage] = useLocalStorage<number>(LocalStorageKeys.SLIPPAGE, DEFAULT_SETTINGS.slippage)
|
||||||
const assets = useAllAssets()
|
const assets = useAllAssets()
|
||||||
const sellAssetPrice = usePrice(sellAsset.denom)
|
const sellAssetPrice = usePrice(sellAsset.denom)
|
||||||
const swapFee = useSwapFee(route.map((r) => r.pool_id))
|
// FIXME: ⛓️ Swap fee needs to be chainagnostic!
|
||||||
|
const swapFee = useSwapFee([])
|
||||||
const [showSummary, setShowSummary] = useToggle()
|
const [showSummary, setShowSummary] = useToggle()
|
||||||
const { liquidationPrice, isUpdatingLiquidationPrice } = useLiquidationPrice(
|
const { liquidationPrice, isUpdatingLiquidationPrice } = useLiquidationPrice(
|
||||||
props.liquidationPrice,
|
props.liquidationPrice,
|
||||||
|
@ -19,6 +19,7 @@ import TradeSummary from 'components/Trade/TradeModule/SwapForm/TradeSummary'
|
|||||||
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
||||||
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
||||||
import { BN_ZERO } from 'constants/math'
|
import { BN_ZERO } from 'constants/math'
|
||||||
|
import useMarketEnabledAssets from 'hooks/assets/useMarketEnabledAssets'
|
||||||
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
||||||
import useMarketAssets from 'hooks/markets/useMarketAssets'
|
import useMarketAssets from 'hooks/markets/useMarketAssets'
|
||||||
import useMarketBorrowings from 'hooks/markets/useMarketBorrowings'
|
import useMarketBorrowings from 'hooks/markets/useMarketBorrowings'
|
||||||
@ -82,6 +83,7 @@ export default function SwapForm(props: Props) {
|
|||||||
const throttledEstimateExactIn = useMemo(() => asyncThrottle(estimateExactIn, 250), [])
|
const throttledEstimateExactIn = useMemo(() => asyncThrottle(estimateExactIn, 250), [])
|
||||||
const { computeLiquidationPrice } = useHealthComputer(updatedAccount)
|
const { computeLiquidationPrice } = useHealthComputer(updatedAccount)
|
||||||
const chainConfig = useChainConfig()
|
const chainConfig = useChainConfig()
|
||||||
|
const assets = useMarketEnabledAssets()
|
||||||
|
|
||||||
const depositCapReachedCoins: BNCoin[] = useMemo(() => {
|
const depositCapReachedCoins: BNCoin[] = useMemo(() => {
|
||||||
const outputMarketAsset = marketAssets.find(byDenom(outputAsset.denom))
|
const outputMarketAsset = marketAssets.find(byDenom(outputAsset.denom))
|
||||||
@ -340,7 +342,7 @@ export default function SwapForm(props: Props) {
|
|||||||
{isAdvanced ? (
|
{isAdvanced ? (
|
||||||
<AssetSelectorSingle buyAsset={outputAsset} sellAsset={inputAsset} />
|
<AssetSelectorSingle buyAsset={outputAsset} sellAsset={inputAsset} />
|
||||||
) : (
|
) : (
|
||||||
<AssetSelectorPair buyAsset={buyAsset} sellAsset={sellAsset} />
|
<AssetSelectorPair buyAsset={buyAsset} sellAsset={sellAsset} assets={assets} />
|
||||||
)}
|
)}
|
||||||
<Divider />
|
<Divider />
|
||||||
<MarginToggle
|
<MarginToggle
|
||||||
|
@ -9,9 +9,13 @@ import { ChainInfoID } from 'types/enums/wallet'
|
|||||||
|
|
||||||
const Pion1: ChainConfig = {
|
const Pion1: ChainConfig = {
|
||||||
assets: [
|
assets: [
|
||||||
{ ...NTRN, denom: 'untrn' },
|
{ ...NTRN, denom: 'untrn', isPerpsEnabled: true },
|
||||||
{ ...USDCaxl, denom: 'ibc/F91EA2C0A23697A1048E08C2F787E3A58AC6F706A1CD2257A504925158CFC0F3' },
|
{ ...USDCaxl, denom: 'ibc/F91EA2C0A23697A1048E08C2F787E3A58AC6F706A1CD2257A504925158CFC0F3' },
|
||||||
{ ...ATOM, denom: 'ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9' },
|
{
|
||||||
|
...ATOM,
|
||||||
|
denom: 'ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9',
|
||||||
|
isPerpsEnabled: true,
|
||||||
|
},
|
||||||
USDollar,
|
USDollar,
|
||||||
],
|
],
|
||||||
id: ChainInfoID.Pion1,
|
id: ChainInfoID.Pion1,
|
||||||
@ -33,7 +37,7 @@ const Pion1: ChainConfig = {
|
|||||||
swap: 'https://testnet-neutron.astroport.fi/swap',
|
swap: 'https://testnet-neutron.astroport.fi/swap',
|
||||||
pyth: 'https://hermes.pyth.network/api',
|
pyth: 'https://hermes.pyth.network/api',
|
||||||
pythCandles: 'https://benchmarks.pyth.network',
|
pythCandles: 'https://benchmarks.pyth.network',
|
||||||
pools: '', //TODO: Implement this
|
pools: '', //TODO: ⛓️ Implement this
|
||||||
explorer: 'https://testnet.mintscan.io/neutron-testnet',
|
explorer: 'https://testnet.mintscan.io/neutron-testnet',
|
||||||
aprs: {
|
aprs: {
|
||||||
vaults: 'https://api.marsprotocol.io/v1/vaults/neutron',
|
vaults: 'https://api.marsprotocol.io/v1/vaults/neutron',
|
||||||
@ -58,7 +62,7 @@ const Pion1: ChainConfig = {
|
|||||||
features: ['ibc-transfer', 'ibc-go'],
|
features: ['ibc-transfer', 'ibc-go'],
|
||||||
gasPrice: '0.025untrn',
|
gasPrice: '0.025untrn',
|
||||||
hls: false,
|
hls: false,
|
||||||
perps: false,
|
perps: true,
|
||||||
farm: false,
|
farm: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ const Osmosis1: ChainConfig = {
|
|||||||
swapper: 'osmo1wee0z8c7tcawyl647eapqs4a88q8jpa7ddy6nn2nrs7t47p2zhxswetwla',
|
swapper: 'osmo1wee0z8c7tcawyl647eapqs4a88q8jpa7ddy6nn2nrs7t47p2zhxswetwla',
|
||||||
params: 'osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent',
|
params: 'osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent',
|
||||||
pyth: 'osmo13ge29x4e2s63a8ytz2px8gurtyznmue4a69n5275692v3qn3ks8q7cwck7',
|
pyth: 'osmo13ge29x4e2s63a8ytz2px8gurtyznmue4a69n5275692v3qn3ks8q7cwck7',
|
||||||
|
perps: '',
|
||||||
},
|
},
|
||||||
defaultCurrency: {
|
defaultCurrency: {
|
||||||
coinDenom: 'OSMO',
|
coinDenom: 'OSMO',
|
||||||
|
@ -5,6 +5,7 @@ export const EMPTY_ACCOUNT: Account = {
|
|||||||
deposits: [],
|
deposits: [],
|
||||||
lends: [],
|
lends: [],
|
||||||
vaults: [],
|
vaults: [],
|
||||||
|
perps: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EMPTY_ACCOUNT_HLS: Account = {
|
export const EMPTY_ACCOUNT_HLS: Account = {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { ORACLE_DENOM } from 'constants/oracle'
|
import { ORACLE_DENOM } from 'constants/oracle'
|
||||||
import useStore from 'store'
|
import useStore from 'store'
|
||||||
|
|
||||||
// TODO: This does not work -> Needs to be inside a hook. Does not retrigger when changed
|
// This does not retrigger when chains are switched. Assets might not be present on the new chain, but
|
||||||
|
// This scenario is still caught.
|
||||||
const enabledMarketAssets = useStore
|
const enabledMarketAssets = useStore
|
||||||
.getState()
|
.getState()
|
||||||
.chainConfig.assets.filter((asset) => asset.isEnabled && asset.isMarket)
|
.chainConfig.assets.filter((asset) => asset.isEnabled && asset.isMarket)
|
||||||
@ -19,4 +20,5 @@ export const DEFAULT_SETTINGS: Settings = {
|
|||||||
slippage: 0.02,
|
slippage: 0.02,
|
||||||
tutorial: true,
|
tutorial: true,
|
||||||
migrationBanner: true,
|
migrationBanner: true,
|
||||||
|
perpsAsset: '',
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,5 @@ export enum LocalStorageKeys {
|
|||||||
MIGRATION_BANNER = 'migrationBanner',
|
MIGRATION_BANNER = 'migrationBanner',
|
||||||
HLS_INFORMATION = 'hlsInformation',
|
HLS_INFORMATION = 'hlsInformation',
|
||||||
CURRENT_CHAIN_ID = 'currentChainId',
|
CURRENT_CHAIN_ID = 'currentChainId',
|
||||||
|
PERPS_ASSET = 'perpsAsset',
|
||||||
}
|
}
|
||||||
|
7
src/hooks/assets/usePerpsEnabledAssets.ts
Normal file
7
src/hooks/assets/usePerpsEnabledAssets.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import useStore from 'store'
|
||||||
|
|
||||||
|
export default function usePerpsEnabledAssets() {
|
||||||
|
const assets = useStore((s) => s.chainConfig.assets)
|
||||||
|
|
||||||
|
return assets.filter((asset) => asset.isPerpsEnabled)
|
||||||
|
}
|
36
src/hooks/perps/usePerpsAsset.ts
Normal file
36
src/hooks/perps/usePerpsAsset.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { useCallback, useMemo } from 'react'
|
||||||
|
import { useSearchParams } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { DEFAULT_SETTINGS } from 'constants/defaultSettings'
|
||||||
|
import { LocalStorageKeys } from 'constants/localStorageKeys'
|
||||||
|
import usePerpsEnabledAssets from 'hooks/assets/usePerpsEnabledAssets'
|
||||||
|
import useLocalStorage from 'hooks/localStorage/useLocalStorage'
|
||||||
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
|
||||||
|
export default function usePerpsAsset() {
|
||||||
|
const chainConfig = useChainConfig()
|
||||||
|
const [searchParams] = useSearchParams()
|
||||||
|
const perpsAssets = usePerpsEnabledAssets()
|
||||||
|
const perpsAssetInParams = searchParams.get('perpsMarket')
|
||||||
|
const [perpsAssetInLocalStorage, setPerpsAssetInLocalStorage] = useLocalStorage<
|
||||||
|
Settings['perpsAsset']
|
||||||
|
>(chainConfig.id + '/' + LocalStorageKeys.PERPS_ASSET, DEFAULT_SETTINGS.perpsAsset)
|
||||||
|
|
||||||
|
const updatePerpsAsset = useCallback(
|
||||||
|
(denom: string) => {
|
||||||
|
setPerpsAssetInLocalStorage(denom)
|
||||||
|
},
|
||||||
|
[setPerpsAssetInLocalStorage],
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
perpsAsset: useMemo(
|
||||||
|
() =>
|
||||||
|
perpsAssets.find(
|
||||||
|
(asset) => asset.denom === (perpsAssetInParams || perpsAssetInLocalStorage),
|
||||||
|
) ?? perpsAssets[0],
|
||||||
|
[perpsAssetInLocalStorage, perpsAssetInParams, perpsAssets],
|
||||||
|
),
|
||||||
|
updatePerpsAsset,
|
||||||
|
}
|
||||||
|
}
|
14
src/hooks/perps/usePerpsConfig.ts
Normal file
14
src/hooks/perps/usePerpsConfig.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import useSWR from 'swr'
|
||||||
|
|
||||||
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
import useClients from 'hooks/useClients'
|
||||||
|
|
||||||
|
export default function usePerpsConfig() {
|
||||||
|
const chainConfig = useChainConfig()
|
||||||
|
const clients = useClients()
|
||||||
|
return useSWR(clients && `chains/${chainConfig.id}/perps/config`, () => getPerpsConfig(clients!))
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPerpsConfig(clients: ContractClients) {
|
||||||
|
return clients.perps.config()
|
||||||
|
}
|
@ -1,39 +1,29 @@
|
|||||||
import { useSearchParams } from 'react-router-dom'
|
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
|
|
||||||
import useAsset from 'hooks/assets/useAsset'
|
import { BN_ZERO } from 'constants/math'
|
||||||
import useBaseAsset from 'hooks/assets/useBasetAsset'
|
import usePerpsAsset from 'hooks/perps/usePerpsAsset'
|
||||||
import useChainConfig from 'hooks/useChainConfig'
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
import useClients from 'hooks/useClients'
|
||||||
import { BN } from 'utils/helpers'
|
import { BN } from 'utils/helpers'
|
||||||
|
|
||||||
export default function usePerpsMarket() {
|
export default function usePerpsMarket() {
|
||||||
const chainConfig = useChainConfig()
|
const chainConfig = useChainConfig()
|
||||||
const [searchParams] = useSearchParams()
|
const { perpsAsset } = usePerpsAsset()
|
||||||
const baseAsset = useBaseAsset()
|
const clients = useClients()
|
||||||
const perpsMarket = searchParams.get('perpsMarket') || baseAsset.symbol
|
|
||||||
|
|
||||||
const asset = useAsset(perpsMarket)
|
return useSWR(clients && perpsAsset && `chains/${chainConfig.id}/perps/${perpsAsset.denom}`, () =>
|
||||||
|
getPerpsMarket(clients!, perpsAsset!),
|
||||||
return useSWR(
|
|
||||||
`chains/${chainConfig.id}/perpsMarket/${perpsMarket}`,
|
|
||||||
async () => {
|
|
||||||
await delay(3000)
|
|
||||||
if (!asset) return null
|
|
||||||
return {
|
|
||||||
asset,
|
|
||||||
fundingRate: BN(0.001432),
|
|
||||||
openInterest: {
|
|
||||||
long: BN(92901203),
|
|
||||||
short: BN(129891203),
|
|
||||||
},
|
|
||||||
} as PerpsMarket
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fallbackData: null,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function delay(ms: number) {
|
async function getPerpsMarket(clients: ContractClients, asset: Asset) {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
const denomState = await clients.perps.perpDenomState({ denom: asset.denom })
|
||||||
|
return {
|
||||||
|
fundingRate: BN(denomState.rate.abs),
|
||||||
|
asset: asset,
|
||||||
|
openInterest: {
|
||||||
|
long: BN_ZERO,
|
||||||
|
short: BN_ZERO,
|
||||||
|
},
|
||||||
|
} as PerpsMarket
|
||||||
}
|
}
|
||||||
|
15
src/hooks/perps/usePerpsParams.ts
Normal file
15
src/hooks/perps/usePerpsParams.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import useSWR from 'swr'
|
||||||
|
|
||||||
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
import useClients from 'hooks/useClients'
|
||||||
|
import iterateContractQuery from 'utils/iterateContractQuery'
|
||||||
|
|
||||||
|
export default function usePerpsParams() {
|
||||||
|
const chainConfig = useChainConfig()
|
||||||
|
const clients = useClients()
|
||||||
|
return useSWR(clients && `chains/${chainConfig.id}/perps/params`, () => getPerpsParams(clients!))
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPerpsParams(clients: ContractClients) {
|
||||||
|
return iterateContractQuery(clients.params.allPerpParams, undefined, [])
|
||||||
|
}
|
16
src/hooks/perps/usePerpsVaultState.ts
Normal file
16
src/hooks/perps/usePerpsVaultState.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import useSWR from 'swr'
|
||||||
|
|
||||||
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
import useClients from 'hooks/useClients'
|
||||||
|
|
||||||
|
export default function usePerpsVaultState() {
|
||||||
|
const chainConfig = useChainConfig()
|
||||||
|
const clients = useClients()
|
||||||
|
return useSWR(clients && `chains/${chainConfig.id}/perps/vault-state`, () =>
|
||||||
|
getPerpsVaultState(clients!),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPerpsVaultState(clients: ContractClients) {
|
||||||
|
return clients.perps.vaultState()
|
||||||
|
}
|
42
src/hooks/useClients.ts
Normal file
42
src/hooks/useClients.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import useSWR from 'swr'
|
||||||
|
|
||||||
|
import useChainConfig from 'hooks/useChainConfig'
|
||||||
|
import { MarsAccountNftQueryClient } from 'types/generated/mars-account-nft/MarsAccountNft.client'
|
||||||
|
import { MarsCreditManagerQueryClient } from 'types/generated/mars-credit-manager/MarsCreditManager.client'
|
||||||
|
import { MarsIncentivesQueryClient } from 'types/generated/mars-incentives/MarsIncentives.client'
|
||||||
|
import { MarsOracleOsmosisQueryClient } from 'types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client'
|
||||||
|
import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client'
|
||||||
|
import { MarsPerpsQueryClient } from 'types/generated/mars-perps/MarsPerps.client'
|
||||||
|
import { MarsRedBankQueryClient } from 'types/generated/mars-red-bank/MarsRedBank.client'
|
||||||
|
import { MarsSwapperOsmosisQueryClient } from 'types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client'
|
||||||
|
|
||||||
|
export default function useClients() {
|
||||||
|
const chainConfig = useChainConfig()
|
||||||
|
|
||||||
|
const swr = useSWR(
|
||||||
|
`chains/${chainConfig.id}/clients`,
|
||||||
|
async () => {
|
||||||
|
const client = await CosmWasmClient.connect(chainConfig.endpoints.rpc)
|
||||||
|
|
||||||
|
return {
|
||||||
|
creditManager: new MarsCreditManagerQueryClient(
|
||||||
|
client,
|
||||||
|
chainConfig.contracts.creditManager,
|
||||||
|
),
|
||||||
|
accountNft: new MarsAccountNftQueryClient(client, chainConfig.contracts.accountNft),
|
||||||
|
oracle: new MarsOracleOsmosisQueryClient(client, chainConfig.contracts.oracle),
|
||||||
|
params: new MarsParamsQueryClient(client, chainConfig.contracts.params),
|
||||||
|
redBank: new MarsRedBankQueryClient(client, chainConfig.contracts.redBank),
|
||||||
|
swapper: new MarsSwapperOsmosisQueryClient(client, chainConfig.contracts.swapper),
|
||||||
|
incentives: new MarsIncentivesQueryClient(client, chainConfig.contracts.incentives),
|
||||||
|
perps: new MarsPerpsQueryClient(client, chainConfig.contracts.perps),
|
||||||
|
} as ContractClients
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keepPreviousData: false,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
return swr.data
|
||||||
|
}
|
@ -1,21 +1,17 @@
|
|||||||
import { useCallback, useMemo, useState } from 'react'
|
import { useCallback, useMemo, useState } from 'react'
|
||||||
|
|
||||||
import useAssets from 'hooks/useAssets'
|
export default function useFilteredAssets(assets: Asset[]) {
|
||||||
|
|
||||||
export default function useFilteredAssets() {
|
|
||||||
const [searchString, setSearchString] = useState('')
|
const [searchString, setSearchString] = useState('')
|
||||||
|
|
||||||
const allAssets = useAssets()
|
const filteredAssets = useMemo(
|
||||||
|
|
||||||
const assets = useMemo(
|
|
||||||
() =>
|
() =>
|
||||||
allAssets.filter(
|
assets.filter(
|
||||||
(asset) =>
|
(asset) =>
|
||||||
asset.denom.toLocaleLowerCase().includes(searchString.toLowerCase()) ||
|
asset.denom.toLocaleLowerCase().includes(searchString.toLowerCase()) ||
|
||||||
asset.symbol.toLocaleLowerCase().includes(searchString.toLowerCase()) ||
|
asset.symbol.toLocaleLowerCase().includes(searchString.toLowerCase()) ||
|
||||||
asset.name.toLocaleLowerCase().includes(searchString.toLowerCase()),
|
asset.name.toLocaleLowerCase().includes(searchString.toLowerCase()),
|
||||||
),
|
),
|
||||||
[searchString, allAssets],
|
[searchString, assets],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onChangeSearch = useCallback(
|
const onChangeSearch = useCallback(
|
||||||
@ -25,5 +21,5 @@ export default function useFilteredAssets() {
|
|||||||
[setSearchString],
|
[setSearchString],
|
||||||
)
|
)
|
||||||
|
|
||||||
return { assets, searchString, onChangeSearch }
|
return { assets: filteredAssets, searchString, onChangeSearch }
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ export default function TradePage() {
|
|||||||
|
|
||||||
const enabledMarketAssets = useMarketEnabledAssets()
|
const enabledMarketAssets = useMarketEnabledAssets()
|
||||||
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
const assetOverlayState = useStore((s) => s.assetOverlayState)
|
||||||
|
|
||||||
const buyAsset = useMemo(
|
const buyAsset = useMemo(
|
||||||
() =>
|
() =>
|
||||||
enabledMarketAssets.find(
|
enabledMarketAssets.find(
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { BrowserRouter } from 'react-router-dom'
|
import { BrowserRouter } from 'react-router-dom'
|
||||||
|
|
||||||
import { WalletConnectProvider } from 'components/Wallet/WalletConnectProvider'
|
|
||||||
import Routes from 'components/Routes'
|
import Routes from 'components/Routes'
|
||||||
|
import { WalletConnectProvider } from 'components/Wallet/WalletConnectProvider'
|
||||||
|
|
||||||
export default function Router() {
|
export default function Router() {
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -11,6 +11,7 @@ import {
|
|||||||
Uint128,
|
Uint128,
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
ExecuteMsg,
|
ExecuteMsg,
|
||||||
|
MigrateV1ToV2,
|
||||||
Binary,
|
Binary,
|
||||||
Expiration,
|
Expiration,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
@ -306,6 +307,12 @@ export interface MarsAccountNftInterface extends MarsAccountNftReadOnlyInterface
|
|||||||
memo?: string,
|
memo?: string,
|
||||||
_funds?: Coin[],
|
_funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
|
migrate: (
|
||||||
|
migrateV1ToV2: MigrateV1ToV2,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
transferNft: (
|
transferNft: (
|
||||||
{
|
{
|
||||||
recipient,
|
recipient,
|
||||||
@ -403,6 +410,7 @@ export class MarsAccountNftClient
|
|||||||
this.updateConfig = this.updateConfig.bind(this)
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
this.mint = this.mint.bind(this)
|
this.mint = this.mint.bind(this)
|
||||||
this.burn = this.burn.bind(this)
|
this.burn = this.burn.bind(this)
|
||||||
|
this.migrate = this.migrate.bind(this)
|
||||||
this.transferNft = this.transferNft.bind(this)
|
this.transferNft = this.transferNft.bind(this)
|
||||||
this.sendNft = this.sendNft.bind(this)
|
this.sendNft = this.sendNft.bind(this)
|
||||||
this.approve = this.approve.bind(this)
|
this.approve = this.approve.bind(this)
|
||||||
@ -481,6 +489,23 @@ export class MarsAccountNftClient
|
|||||||
_funds,
|
_funds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
migrate = async (
|
||||||
|
migrateV1ToV2: MigrateV1ToV2,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
migrate: migrateV1ToV2,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
transferNft = async (
|
transferNft = async (
|
||||||
{
|
{
|
||||||
recipient,
|
recipient,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -12,6 +12,7 @@ import {
|
|||||||
Uint128,
|
Uint128,
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
ExecuteMsg,
|
ExecuteMsg,
|
||||||
|
MigrateV1ToV2,
|
||||||
Binary,
|
Binary,
|
||||||
Expiration,
|
Expiration,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
@ -526,6 +527,26 @@ export function useMarsAccountNftTransferNftMutation(
|
|||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsAccountNftMigrateMutation {
|
||||||
|
client: MarsAccountNftClient
|
||||||
|
msg: MigrateV1ToV2
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsAccountNftMigrateMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsAccountNftMigrateMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsAccountNftMigrateMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.migrate(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsAccountNftBurnMutation {
|
export interface MarsAccountNftBurnMutation {
|
||||||
client: MarsAccountNftClient
|
client: MarsAccountNftClient
|
||||||
msg: {
|
msg: {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type Uint128 = string
|
export type Uint128 = string
|
||||||
export interface InstantiateMsg {
|
export interface InstantiateMsg {
|
||||||
|
credit_manager_contract?: string | null
|
||||||
health_contract?: string | null
|
health_contract?: string | null
|
||||||
max_value_for_burn: Uint128
|
max_value_for_burn: Uint128
|
||||||
minter: string
|
minter: string
|
||||||
@ -29,6 +30,9 @@ export type ExecuteMsg =
|
|||||||
token_id: string
|
token_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
migrate: MigrateV1ToV2
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
transfer_nft: {
|
transfer_nft: {
|
||||||
recipient: string
|
recipient: string
|
||||||
@ -69,6 +73,11 @@ export type ExecuteMsg =
|
|||||||
| {
|
| {
|
||||||
update_ownership: Action
|
update_ownership: Action
|
||||||
}
|
}
|
||||||
|
export type MigrateV1ToV2 = {
|
||||||
|
burn_empty_accounts: {
|
||||||
|
limit?: number | null
|
||||||
|
}
|
||||||
|
}
|
||||||
export type Binary = string
|
export type Binary = string
|
||||||
export type Expiration =
|
export type Expiration =
|
||||||
| {
|
| {
|
||||||
@ -92,6 +101,7 @@ export type Action =
|
|||||||
| 'accept_ownership'
|
| 'accept_ownership'
|
||||||
| 'renounce_ownership'
|
| 'renounce_ownership'
|
||||||
export interface NftConfigUpdates {
|
export interface NftConfigUpdates {
|
||||||
|
credit_manager_contract_addr?: string | null
|
||||||
health_contract_addr?: string | null
|
health_contract_addr?: string | null
|
||||||
max_value_for_burn?: Uint128 | null
|
max_value_for_burn?: Uint128 | null
|
||||||
}
|
}
|
||||||
@ -197,6 +207,7 @@ export interface ApprovalsResponse {
|
|||||||
approvals: Approval[]
|
approvals: Approval[]
|
||||||
}
|
}
|
||||||
export interface NftConfigBaseForString {
|
export interface NftConfigBaseForString {
|
||||||
|
credit_manager_contract_addr?: string | null
|
||||||
health_contract_addr?: string | null
|
health_contract_addr?: string | null
|
||||||
max_value_for_burn: Uint128
|
max_value_for_burn: Uint128
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _0 from './MarsAccountNft.types'
|
import * as _0 from './MarsAccountNft.types'
|
||||||
import * as _1 from './MarsAccountNft.client'
|
import * as _1 from './MarsAccountNft.client'
|
||||||
import * as _2 from './MarsAccountNft.message-composer'
|
import * as _2 from './MarsAccountNft.react-query'
|
||||||
import * as _3 from './MarsAccountNft.react-query'
|
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsAccountNft = { ..._0, ..._1, ..._2, ..._3 }
|
export const MarsAccountNft = { ..._0, ..._1, ..._2 }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -25,7 +25,12 @@ import {
|
|||||||
LiquidateRequestForVaultBaseForString,
|
LiquidateRequestForVaultBaseForString,
|
||||||
VaultPositionType,
|
VaultPositionType,
|
||||||
AccountNftBaseForString,
|
AccountNftBaseForString,
|
||||||
|
PerpsBaseForString,
|
||||||
OwnerUpdate,
|
OwnerUpdate,
|
||||||
|
Action2,
|
||||||
|
Expiration,
|
||||||
|
Timestamp,
|
||||||
|
Uint64,
|
||||||
CallbackMsg,
|
CallbackMsg,
|
||||||
Addr,
|
Addr,
|
||||||
HealthState,
|
HealthState,
|
||||||
@ -33,6 +38,7 @@ import {
|
|||||||
ChangeExpected,
|
ChangeExpected,
|
||||||
Coin,
|
Coin,
|
||||||
ActionCoin,
|
ActionCoin,
|
||||||
|
SignedDecimal,
|
||||||
VaultBaseForString,
|
VaultBaseForString,
|
||||||
ConfigUpdates,
|
ConfigUpdates,
|
||||||
NftConfigUpdates,
|
NftConfigUpdates,
|
||||||
@ -59,8 +65,13 @@ import {
|
|||||||
OwnerResponse,
|
OwnerResponse,
|
||||||
RewardsCollector,
|
RewardsCollector,
|
||||||
ArrayOfCoin,
|
ArrayOfCoin,
|
||||||
|
PnL,
|
||||||
Positions,
|
Positions,
|
||||||
DebtAmount,
|
DebtAmount,
|
||||||
|
PerpPosition,
|
||||||
|
PositionPnl,
|
||||||
|
PnlCoins,
|
||||||
|
PnlValues,
|
||||||
VaultPositionValue,
|
VaultPositionValue,
|
||||||
CoinValue,
|
CoinValue,
|
||||||
VaultUtilizationResponse,
|
VaultUtilizationResponse,
|
||||||
@ -338,7 +349,7 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt
|
|||||||
ownership,
|
ownership,
|
||||||
}: {
|
}: {
|
||||||
config?: NftConfigUpdates
|
config?: NftConfigUpdates
|
||||||
ownership?: Action
|
ownership?: Action2
|
||||||
},
|
},
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
@ -484,7 +495,7 @@ export class MarsCreditManagerClient
|
|||||||
ownership,
|
ownership,
|
||||||
}: {
|
}: {
|
||||||
config?: NftConfigUpdates
|
config?: NftConfigUpdates
|
||||||
ownership?: Action
|
ownership?: Action2
|
||||||
},
|
},
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,12 @@ import {
|
|||||||
LiquidateRequestForVaultBaseForString,
|
LiquidateRequestForVaultBaseForString,
|
||||||
VaultPositionType,
|
VaultPositionType,
|
||||||
AccountNftBaseForString,
|
AccountNftBaseForString,
|
||||||
|
PerpsBaseForString,
|
||||||
OwnerUpdate,
|
OwnerUpdate,
|
||||||
|
Action2,
|
||||||
|
Expiration,
|
||||||
|
Timestamp,
|
||||||
|
Uint64,
|
||||||
CallbackMsg,
|
CallbackMsg,
|
||||||
Addr,
|
Addr,
|
||||||
HealthState,
|
HealthState,
|
||||||
@ -34,6 +39,7 @@ import {
|
|||||||
ChangeExpected,
|
ChangeExpected,
|
||||||
Coin,
|
Coin,
|
||||||
ActionCoin,
|
ActionCoin,
|
||||||
|
SignedDecimal,
|
||||||
VaultBaseForString,
|
VaultBaseForString,
|
||||||
ConfigUpdates,
|
ConfigUpdates,
|
||||||
NftConfigUpdates,
|
NftConfigUpdates,
|
||||||
@ -60,8 +66,13 @@ import {
|
|||||||
OwnerResponse,
|
OwnerResponse,
|
||||||
RewardsCollector,
|
RewardsCollector,
|
||||||
ArrayOfCoin,
|
ArrayOfCoin,
|
||||||
|
PnL,
|
||||||
Positions,
|
Positions,
|
||||||
DebtAmount,
|
DebtAmount,
|
||||||
|
PerpPosition,
|
||||||
|
PositionPnl,
|
||||||
|
PnlCoins,
|
||||||
|
PnlValues,
|
||||||
VaultPositionValue,
|
VaultPositionValue,
|
||||||
CoinValue,
|
CoinValue,
|
||||||
VaultUtilizationResponse,
|
VaultUtilizationResponse,
|
||||||
@ -478,7 +489,7 @@ export interface MarsCreditManagerUpdateNftConfigMutation {
|
|||||||
client: MarsCreditManagerClient
|
client: MarsCreditManagerClient
|
||||||
msg: {
|
msg: {
|
||||||
config?: NftConfigUpdates
|
config?: NftConfigUpdates
|
||||||
ownership?: Action
|
ownership?: Action2
|
||||||
}
|
}
|
||||||
args?: {
|
args?: {
|
||||||
fee?: number | StdFee | 'auto'
|
fee?: number | StdFee | 'auto'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -52,7 +52,7 @@ export type ExecuteMsg =
|
|||||||
| {
|
| {
|
||||||
update_nft_config: {
|
update_nft_config: {
|
||||||
config?: NftConfigUpdates | null
|
config?: NftConfigUpdates | null
|
||||||
ownership?: Action | null
|
ownership?: Action2 | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@ -84,6 +84,17 @@ export type Action =
|
|||||||
recipient_account_id?: string | null
|
recipient_account_id?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
open_perp: {
|
||||||
|
denom: string
|
||||||
|
size: SignedDecimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
close_perp: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
enter_vault: {
|
enter_vault: {
|
||||||
coin: ActionCoin
|
coin: ActionCoin
|
||||||
@ -158,6 +169,7 @@ export type LiquidateRequestForVaultBaseForString =
|
|||||||
}
|
}
|
||||||
export type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g'
|
export type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g'
|
||||||
export type AccountNftBaseForString = string
|
export type AccountNftBaseForString = string
|
||||||
|
export type PerpsBaseForString = string
|
||||||
export type OwnerUpdate =
|
export type OwnerUpdate =
|
||||||
| {
|
| {
|
||||||
propose_new_owner: {
|
propose_new_owner: {
|
||||||
@ -173,6 +185,27 @@ export type OwnerUpdate =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| 'clear_emergency_owner'
|
| 'clear_emergency_owner'
|
||||||
|
export type Action2 =
|
||||||
|
| {
|
||||||
|
transfer_ownership: {
|
||||||
|
expiry?: Expiration | null
|
||||||
|
new_owner: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'accept_ownership'
|
||||||
|
| 'renounce_ownership'
|
||||||
|
export type Expiration =
|
||||||
|
| {
|
||||||
|
at_height: number
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
at_time: Timestamp
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
never: {}
|
||||||
|
}
|
||||||
|
export type Timestamp = Uint64
|
||||||
|
export type Uint64 = string
|
||||||
export type CallbackMsg =
|
export type CallbackMsg =
|
||||||
| {
|
| {
|
||||||
withdraw: {
|
withdraw: {
|
||||||
@ -229,6 +262,19 @@ export type CallbackMsg =
|
|||||||
denoms: string[]
|
denoms: string[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
open_perp: {
|
||||||
|
account_id: string
|
||||||
|
denom: string
|
||||||
|
size: SignedDecimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
close_perp: {
|
||||||
|
account_id: string
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
enter_vault: {
|
enter_vault: {
|
||||||
account_id: string
|
account_id: string
|
||||||
@ -360,6 +406,11 @@ export interface ActionCoin {
|
|||||||
amount: ActionAmount
|
amount: ActionAmount
|
||||||
denom: string
|
denom: string
|
||||||
}
|
}
|
||||||
|
export interface SignedDecimal {
|
||||||
|
abs: Decimal
|
||||||
|
negative: boolean
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
export interface VaultBaseForString {
|
export interface VaultBaseForString {
|
||||||
address: string
|
address: string
|
||||||
}
|
}
|
||||||
@ -370,6 +421,8 @@ export interface ConfigUpdates {
|
|||||||
max_slippage?: Decimal | null
|
max_slippage?: Decimal | null
|
||||||
max_unlocking_positions?: Uint128 | null
|
max_unlocking_positions?: Uint128 | null
|
||||||
oracle?: OracleBaseForString | null
|
oracle?: OracleBaseForString | null
|
||||||
|
params?: ParamsBaseForString | null
|
||||||
|
perps?: PerpsBaseForString | null
|
||||||
red_bank?: RedBankUnchecked | null
|
red_bank?: RedBankUnchecked | null
|
||||||
rewards_collector?: string | null
|
rewards_collector?: string | null
|
||||||
swapper?: SwapperBaseForString | null
|
swapper?: SwapperBaseForString | null
|
||||||
@ -510,6 +563,7 @@ export interface ConfigResponse {
|
|||||||
oracle: string
|
oracle: string
|
||||||
ownership: OwnerResponse
|
ownership: OwnerResponse
|
||||||
params: string
|
params: string
|
||||||
|
perps: string
|
||||||
red_bank: string
|
red_bank: string
|
||||||
rewards_collector?: RewardsCollector | null
|
rewards_collector?: RewardsCollector | null
|
||||||
swapper: string
|
swapper: string
|
||||||
@ -527,11 +581,20 @@ export interface RewardsCollector {
|
|||||||
address: string
|
address: string
|
||||||
}
|
}
|
||||||
export type ArrayOfCoin = Coin[]
|
export type ArrayOfCoin = Coin[]
|
||||||
|
export type PnL =
|
||||||
|
| 'break_even'
|
||||||
|
| {
|
||||||
|
profit: Coin
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
loss: Coin
|
||||||
|
}
|
||||||
export interface Positions {
|
export interface Positions {
|
||||||
account_id: string
|
account_id: string
|
||||||
debts: DebtAmount[]
|
debts: DebtAmount[]
|
||||||
deposits: Coin[]
|
deposits: Coin[]
|
||||||
lends: Coin[]
|
lends: Coin[]
|
||||||
|
perps: PerpPosition[]
|
||||||
vaults: VaultPosition[]
|
vaults: VaultPosition[]
|
||||||
}
|
}
|
||||||
export interface DebtAmount {
|
export interface DebtAmount {
|
||||||
@ -539,6 +602,29 @@ export interface DebtAmount {
|
|||||||
denom: string
|
denom: string
|
||||||
shares: Uint128
|
shares: Uint128
|
||||||
}
|
}
|
||||||
|
export interface PerpPosition {
|
||||||
|
base_denom: string
|
||||||
|
closing_fee_rate: Decimal
|
||||||
|
current_price: Decimal
|
||||||
|
denom: string
|
||||||
|
entry_price: Decimal
|
||||||
|
pnl: PositionPnl
|
||||||
|
size: SignedDecimal
|
||||||
|
}
|
||||||
|
export interface PositionPnl {
|
||||||
|
coins: PnlCoins
|
||||||
|
values: PnlValues
|
||||||
|
}
|
||||||
|
export interface PnlCoins {
|
||||||
|
closing_fee: Coin
|
||||||
|
pnl: PnL
|
||||||
|
}
|
||||||
|
export interface PnlValues {
|
||||||
|
accrued_funding: SignedDecimal
|
||||||
|
closing_fee: SignedDecimal
|
||||||
|
pnl: SignedDecimal
|
||||||
|
price_pnl: SignedDecimal
|
||||||
|
}
|
||||||
export interface VaultPositionValue {
|
export interface VaultPositionValue {
|
||||||
base_coin: CoinValue
|
base_coin: CoinValue
|
||||||
vault_coin: CoinValue
|
vault_coin: CoinValue
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _4 from './MarsCreditManager.types'
|
import * as _6 from './MarsCreditManager.types'
|
||||||
import * as _5 from './MarsCreditManager.client'
|
import * as _7 from './MarsCreditManager.client'
|
||||||
import * as _6 from './MarsCreditManager.message-composer'
|
import * as _8 from './MarsCreditManager.react-query'
|
||||||
import * as _7 from './MarsCreditManager.react-query'
|
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsCreditManager = { ..._4, ..._5, ..._6, ..._7 }
|
export const MarsCreditManager = { ..._6, ..._7, ..._8 }
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { StdFee } from '@cosmjs/amino'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActiveEmission,
|
|
||||||
Addr,
|
|
||||||
ArrayOfActiveEmission,
|
|
||||||
ArrayOfCoin,
|
|
||||||
ArrayOfEmissionResponse,
|
|
||||||
ArrayOfIncentiveStateResponse,
|
|
||||||
ArrayOfWhitelistEntry,
|
|
||||||
Coin,
|
|
||||||
ConfigResponse,
|
|
||||||
Decimal,
|
|
||||||
EmissionResponse,
|
|
||||||
ExecuteMsg,
|
|
||||||
IncentiveStateResponse,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
OwnerUpdate,
|
ExecuteMsg,
|
||||||
QueryMsg,
|
|
||||||
Uint128,
|
Uint128,
|
||||||
|
Addr,
|
||||||
|
OwnerUpdate,
|
||||||
|
MigrateV1ToV2,
|
||||||
WhitelistEntry,
|
WhitelistEntry,
|
||||||
|
QueryMsg,
|
||||||
|
ArrayOfActiveEmission,
|
||||||
|
ActiveEmission,
|
||||||
|
ConfigResponse,
|
||||||
|
ArrayOfEmissionResponse,
|
||||||
|
EmissionResponse,
|
||||||
|
Decimal,
|
||||||
|
IncentiveStateResponse,
|
||||||
|
ArrayOfIncentiveStateResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
|
Coin,
|
||||||
|
ArrayOfWhitelistEntry,
|
||||||
} from './MarsIncentives.types'
|
} from './MarsIncentives.types'
|
||||||
export interface MarsIncentivesReadOnlyInterface {
|
export interface MarsIncentivesReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
@ -302,6 +302,12 @@ export interface MarsIncentivesInterface extends MarsIncentivesReadOnlyInterface
|
|||||||
memo?: string,
|
memo?: string,
|
||||||
_funds?: Coin[],
|
_funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
|
migrate: (
|
||||||
|
migrateV1ToV2: MigrateV1ToV2,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class MarsIncentivesClient
|
export class MarsIncentivesClient
|
||||||
extends MarsIncentivesQueryClient
|
extends MarsIncentivesQueryClient
|
||||||
@ -322,6 +328,7 @@ export class MarsIncentivesClient
|
|||||||
this.claimRewards = this.claimRewards.bind(this)
|
this.claimRewards = this.claimRewards.bind(this)
|
||||||
this.updateConfig = this.updateConfig.bind(this)
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
this.updateOwner = this.updateOwner.bind(this)
|
this.updateOwner = this.updateOwner.bind(this)
|
||||||
|
this.migrate = this.migrate.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWhitelist = async (
|
updateWhitelist = async (
|
||||||
@ -495,4 +502,21 @@ export class MarsIncentivesClient
|
|||||||
_funds,
|
_funds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
migrate = async (
|
||||||
|
migrateV1ToV2: MigrateV1ToV2,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
migrate: migrateV1ToV2,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { StdFee } from '@cosmjs/amino'
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActiveEmission,
|
|
||||||
Addr,
|
|
||||||
ArrayOfActiveEmission,
|
|
||||||
ArrayOfCoin,
|
|
||||||
ArrayOfEmissionResponse,
|
|
||||||
ArrayOfIncentiveStateResponse,
|
|
||||||
ArrayOfWhitelistEntry,
|
|
||||||
Coin,
|
|
||||||
ConfigResponse,
|
|
||||||
Decimal,
|
|
||||||
EmissionResponse,
|
|
||||||
ExecuteMsg,
|
|
||||||
IncentiveStateResponse,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
OwnerUpdate,
|
ExecuteMsg,
|
||||||
QueryMsg,
|
|
||||||
Uint128,
|
Uint128,
|
||||||
|
Addr,
|
||||||
|
OwnerUpdate,
|
||||||
|
MigrateV1ToV2,
|
||||||
WhitelistEntry,
|
WhitelistEntry,
|
||||||
|
QueryMsg,
|
||||||
|
ArrayOfActiveEmission,
|
||||||
|
ActiveEmission,
|
||||||
|
ConfigResponse,
|
||||||
|
ArrayOfEmissionResponse,
|
||||||
|
EmissionResponse,
|
||||||
|
Decimal,
|
||||||
|
IncentiveStateResponse,
|
||||||
|
ArrayOfIncentiveStateResponse,
|
||||||
|
ArrayOfCoin,
|
||||||
|
Coin,
|
||||||
|
ArrayOfWhitelistEntry,
|
||||||
} from './MarsIncentives.types'
|
} from './MarsIncentives.types'
|
||||||
import { MarsIncentivesClient, MarsIncentivesQueryClient } from './MarsIncentives.client'
|
import { MarsIncentivesQueryClient, MarsIncentivesClient } from './MarsIncentives.client'
|
||||||
export const marsIncentivesQueryKeys = {
|
export const marsIncentivesQueryKeys = {
|
||||||
contract: [
|
contract: [
|
||||||
{
|
{
|
||||||
@ -260,6 +260,26 @@ export function useMarsIncentivesActiveEmissionsQuery<TData = ArrayOfActiveEmiss
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsIncentivesMigrateMutation {
|
||||||
|
client: MarsIncentivesClient
|
||||||
|
msg: MigrateV1ToV2
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsIncentivesMigrateMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsIncentivesMigrateMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsIncentivesMigrateMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.migrate(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsIncentivesUpdateOwnerMutation {
|
export interface MarsIncentivesUpdateOwnerMutation {
|
||||||
client: MarsIncentivesClient
|
client: MarsIncentivesClient
|
||||||
msg: OwnerUpdate
|
msg: OwnerUpdate
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -8,6 +8,7 @@
|
|||||||
export interface InstantiateMsg {
|
export interface InstantiateMsg {
|
||||||
address_provider: string
|
address_provider: string
|
||||||
epoch_duration: number
|
epoch_duration: number
|
||||||
|
mars_denom: string
|
||||||
max_whitelisted_denoms: number
|
max_whitelisted_denoms: number
|
||||||
owner: string
|
owner: string
|
||||||
}
|
}
|
||||||
@ -53,6 +54,9 @@ export type ExecuteMsg =
|
|||||||
| {
|
| {
|
||||||
update_owner: OwnerUpdate
|
update_owner: OwnerUpdate
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
migrate: MigrateV1ToV2
|
||||||
|
}
|
||||||
export type Uint128 = string
|
export type Uint128 = string
|
||||||
export type Addr = string
|
export type Addr = string
|
||||||
export type OwnerUpdate =
|
export type OwnerUpdate =
|
||||||
@ -70,6 +74,15 @@ export type OwnerUpdate =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| 'clear_emergency_owner'
|
| 'clear_emergency_owner'
|
||||||
|
export type MigrateV1ToV2 =
|
||||||
|
| {
|
||||||
|
users_indexes_and_rewards: {
|
||||||
|
limit: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
clear_v1_state: {}
|
||||||
|
}
|
||||||
export interface WhitelistEntry {
|
export interface WhitelistEntry {
|
||||||
denom: string
|
denom: string
|
||||||
min_emission_rate: Uint128
|
min_emission_rate: Uint128
|
||||||
@ -134,6 +147,7 @@ export interface ConfigResponse {
|
|||||||
max_whitelisted_denoms: number
|
max_whitelisted_denoms: number
|
||||||
owner?: string | null
|
owner?: string | null
|
||||||
proposed_new_owner?: string | null
|
proposed_new_owner?: string | null
|
||||||
|
whitelist_count: number
|
||||||
}
|
}
|
||||||
export type ArrayOfEmissionResponse = EmissionResponse[]
|
export type ArrayOfEmissionResponse = EmissionResponse[]
|
||||||
export interface EmissionResponse {
|
export interface EmissionResponse {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _3 from './MarsIncentives.types'
|
import * as _9 from './MarsIncentives.types'
|
||||||
import * as _4 from './MarsIncentives.client'
|
import * as _10 from './MarsIncentives.client'
|
||||||
import * as _5 from './MarsIncentives.react-query'
|
import * as _11 from './MarsIncentives.react-query'
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsIncentives = { ..._3, ..._4, ..._5 }
|
export const MarsIncentives = { ..._9, ..._10, ..._11 }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -20,6 +20,7 @@ import {
|
|||||||
GeometricTwap,
|
GeometricTwap,
|
||||||
RedemptionRateForString,
|
RedemptionRateForString,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
|
ActionKind,
|
||||||
ConfigResponse,
|
ConfigResponse,
|
||||||
PriceResponse,
|
PriceResponse,
|
||||||
PriceSourceResponseForString,
|
PriceSourceResponseForString,
|
||||||
@ -37,11 +38,13 @@ export interface MarsOracleOsmosisReadOnlyInterface {
|
|||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}) => Promise<ArrayOfPriceSourceResponseForString>
|
}) => Promise<ArrayOfPriceSourceResponseForString>
|
||||||
price: ({ denom }: { denom: string }) => Promise<PriceResponse>
|
price: ({ denom, kind }: { denom: string; kind?: ActionKind }) => Promise<PriceResponse>
|
||||||
prices: ({
|
prices: ({
|
||||||
|
kind,
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
}: {
|
}: {
|
||||||
|
kind?: ActionKind
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}) => Promise<ArrayOfPriceResponse>
|
}) => Promise<ArrayOfPriceResponse>
|
||||||
@ -86,22 +89,26 @@ export class MarsOracleOsmosisQueryClient implements MarsOracleOsmosisReadOnlyIn
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
price = async ({ denom }: { denom: string }): Promise<PriceResponse> => {
|
price = async ({ denom, kind }: { denom: string; kind?: ActionKind }): Promise<PriceResponse> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
price: {
|
price: {
|
||||||
denom,
|
denom,
|
||||||
|
kind,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
prices = async ({
|
prices = async ({
|
||||||
|
kind,
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
}: {
|
}: {
|
||||||
|
kind?: ActionKind
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}): Promise<ArrayOfPriceResponse> => {
|
}): Promise<ArrayOfPriceResponse> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
prices: {
|
prices: {
|
||||||
|
kind,
|
||||||
limit,
|
limit,
|
||||||
start_after: startAfter,
|
start_after: startAfter,
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -21,6 +21,7 @@ import {
|
|||||||
GeometricTwap,
|
GeometricTwap,
|
||||||
RedemptionRateForString,
|
RedemptionRateForString,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
|
ActionKind,
|
||||||
ConfigResponse,
|
ConfigResponse,
|
||||||
PriceResponse,
|
PriceResponse,
|
||||||
PriceSourceResponseForString,
|
PriceSourceResponseForString,
|
||||||
@ -67,6 +68,7 @@ export interface MarsOracleOsmosisReactQuery<TResponse, TData = TResponse> {
|
|||||||
export interface MarsOracleOsmosisPricesQuery<TData>
|
export interface MarsOracleOsmosisPricesQuery<TData>
|
||||||
extends MarsOracleOsmosisReactQuery<ArrayOfPriceResponse, TData> {
|
extends MarsOracleOsmosisReactQuery<ArrayOfPriceResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
|
kind?: ActionKind
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}
|
}
|
||||||
@ -81,6 +83,7 @@ export function useMarsOracleOsmosisPricesQuery<TData = ArrayOfPriceResponse>({
|
|||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.prices({
|
? client.prices({
|
||||||
|
kind: args.kind,
|
||||||
limit: args.limit,
|
limit: args.limit,
|
||||||
startAfter: args.startAfter,
|
startAfter: args.startAfter,
|
||||||
})
|
})
|
||||||
@ -92,6 +95,7 @@ export interface MarsOracleOsmosisPriceQuery<TData>
|
|||||||
extends MarsOracleOsmosisReactQuery<PriceResponse, TData> {
|
extends MarsOracleOsmosisReactQuery<PriceResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
denom: string
|
denom: string
|
||||||
|
kind?: ActionKind
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function useMarsOracleOsmosisPriceQuery<TData = PriceResponse>({
|
export function useMarsOracleOsmosisPriceQuery<TData = PriceResponse>({
|
||||||
@ -105,6 +109,7 @@ export function useMarsOracleOsmosisPriceQuery<TData = PriceResponse>({
|
|||||||
client
|
client
|
||||||
? client.price({
|
? client.price({
|
||||||
denom: args.denom,
|
denom: args.denom,
|
||||||
|
kind: args.kind,
|
||||||
})
|
})
|
||||||
: Promise.reject(new Error('Invalid client')),
|
: Promise.reject(new Error('Invalid client')),
|
||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -40,13 +40,11 @@ export type OsmosisPriceSourceForString =
|
|||||||
| {
|
| {
|
||||||
fixed: {
|
fixed: {
|
||||||
price: Decimal
|
price: Decimal
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
spot: {
|
spot: {
|
||||||
pool_id: number
|
pool_id: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@ -54,7 +52,6 @@ export type OsmosisPriceSourceForString =
|
|||||||
downtime_detector?: DowntimeDetector | null
|
downtime_detector?: DowntimeDetector | null
|
||||||
pool_id: number
|
pool_id: number
|
||||||
window_size: number
|
window_size: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@ -62,13 +59,11 @@ export type OsmosisPriceSourceForString =
|
|||||||
downtime_detector?: DowntimeDetector | null
|
downtime_detector?: DowntimeDetector | null
|
||||||
pool_id: number
|
pool_id: number
|
||||||
window_size: number
|
window_size: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
xyk_liquidity_token: {
|
xyk_liquidity_token: {
|
||||||
pool_id: number
|
pool_id: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@ -77,16 +72,16 @@ export type OsmosisPriceSourceForString =
|
|||||||
pool_id: number
|
pool_id: number
|
||||||
transitive_denom: string
|
transitive_denom: string
|
||||||
window_size: number
|
window_size: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
pyth: {
|
pyth: {
|
||||||
contract_addr: string
|
contract_addr: string
|
||||||
denom_decimals: number
|
denom_decimals: number
|
||||||
|
max_confidence: Decimal
|
||||||
|
max_deviation: Decimal
|
||||||
max_staleness: number
|
max_staleness: number
|
||||||
price_feed_id: Identifier
|
price_feed_id: Identifier
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@ -94,36 +89,35 @@ export type OsmosisPriceSourceForString =
|
|||||||
geometric_twap: GeometricTwap
|
geometric_twap: GeometricTwap
|
||||||
redemption_rate: RedemptionRateForString
|
redemption_rate: RedemptionRateForString
|
||||||
transitive_denom: string
|
transitive_denom: string
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type Decimal = string
|
export type Decimal = string
|
||||||
export type Downtime =
|
export type Downtime =
|
||||||
| 'duration30s'
|
| 'Duration30s'
|
||||||
| 'duration1m'
|
| 'Duration1m'
|
||||||
| 'duration2m'
|
| 'Duration2m'
|
||||||
| 'duration3m'
|
| 'Duration3m'
|
||||||
| 'duration4m'
|
| 'Duration4m'
|
||||||
| 'duration5m'
|
| 'Duration5m'
|
||||||
| 'duration10m'
|
| 'Duration10m'
|
||||||
| 'duration20m'
|
| 'Duration20m'
|
||||||
| 'duration30m'
|
| 'Duration30m'
|
||||||
| 'duration40m'
|
| 'Duration40m'
|
||||||
| 'duration50m'
|
| 'Duration50m'
|
||||||
| 'duration1h'
|
| 'Duration1h'
|
||||||
| 'duration15h'
|
| 'Duration15h'
|
||||||
| 'duration2h'
|
| 'Duration2h'
|
||||||
| 'duration25h'
|
| 'Duration25h'
|
||||||
| 'duration3h'
|
| 'Duration3h'
|
||||||
| 'duration4h'
|
| 'Duration4h'
|
||||||
| 'duration5h'
|
| 'Duration5h'
|
||||||
| 'duration6h'
|
| 'Duration6h'
|
||||||
| 'duration9h'
|
| 'Duration9h'
|
||||||
| 'duration12h'
|
| 'Duration12h'
|
||||||
| 'duration18h'
|
| 'Duration18h'
|
||||||
| 'duration24h'
|
| 'Duration24h'
|
||||||
| 'duration36h'
|
| 'Duration36h'
|
||||||
| 'duration48h'
|
| 'Duration48h'
|
||||||
export type Identifier = string
|
export type Identifier = string
|
||||||
export type OwnerUpdate =
|
export type OwnerUpdate =
|
||||||
| {
|
| {
|
||||||
@ -143,18 +137,15 @@ export type OwnerUpdate =
|
|||||||
export interface DowntimeDetector {
|
export interface DowntimeDetector {
|
||||||
downtime: Downtime
|
downtime: Downtime
|
||||||
recovery: number
|
recovery: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
export interface GeometricTwap {
|
export interface GeometricTwap {
|
||||||
downtime_detector?: DowntimeDetector | null
|
downtime_detector?: DowntimeDetector | null
|
||||||
pool_id: number
|
pool_id: number
|
||||||
window_size: number
|
window_size: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
export interface RedemptionRateForString {
|
export interface RedemptionRateForString {
|
||||||
contract_addr: string
|
contract_addr: string
|
||||||
max_staleness: number
|
max_staleness: number
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
export type QueryMsg =
|
export type QueryMsg =
|
||||||
| {
|
| {
|
||||||
@ -174,14 +165,17 @@ export type QueryMsg =
|
|||||||
| {
|
| {
|
||||||
price: {
|
price: {
|
||||||
denom: string
|
denom: string
|
||||||
|
kind?: ActionKind | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
prices: {
|
prices: {
|
||||||
|
kind?: ActionKind | null
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: string | null
|
start_after?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export type ActionKind = 'default' | 'liquidation'
|
||||||
export interface ConfigResponse {
|
export interface ConfigResponse {
|
||||||
base_denom: string
|
base_denom: string
|
||||||
owner?: string | null
|
owner?: string | null
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _6 from './MarsOracleOsmosis.types'
|
import * as _15 from './MarsOracleOsmosis.types'
|
||||||
import * as _7 from './MarsOracleOsmosis.client'
|
import * as _16 from './MarsOracleOsmosis.client'
|
||||||
import * as _8 from './MarsOracleOsmosis.react-query'
|
import * as _17 from './MarsOracleOsmosis.react-query'
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsOracleOsmosis = { ..._6, ..._7, ..._8 }
|
export const MarsOracleOsmosis = { ..._15, ..._16, ..._17 }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -16,6 +16,7 @@ import {
|
|||||||
HlsAssetTypeForString,
|
HlsAssetTypeForString,
|
||||||
Uint128,
|
Uint128,
|
||||||
VaultConfigUpdate,
|
VaultConfigUpdate,
|
||||||
|
PerpParamsUpdate,
|
||||||
EmergencyUpdate,
|
EmergencyUpdate,
|
||||||
CmEmergencyUpdate,
|
CmEmergencyUpdate,
|
||||||
RedBankEmergencyUpdate,
|
RedBankEmergencyUpdate,
|
||||||
@ -26,6 +27,7 @@ import {
|
|||||||
RedBankSettings,
|
RedBankSettings,
|
||||||
VaultConfigBaseForString,
|
VaultConfigBaseForString,
|
||||||
Coin,
|
Coin,
|
||||||
|
PerpParams,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
HlsAssetTypeForAddr,
|
HlsAssetTypeForAddr,
|
||||||
Addr,
|
Addr,
|
||||||
@ -33,14 +35,17 @@ import {
|
|||||||
AssetParamsBaseForAddr,
|
AssetParamsBaseForAddr,
|
||||||
CmSettingsForAddr,
|
CmSettingsForAddr,
|
||||||
HlsParamsBaseForAddr,
|
HlsParamsBaseForAddr,
|
||||||
|
ArrayOfPerpParams,
|
||||||
ArrayOfVaultConfigBaseForAddr,
|
ArrayOfVaultConfigBaseForAddr,
|
||||||
VaultConfigBaseForAddr,
|
VaultConfigBaseForAddr,
|
||||||
|
ConfigResponse,
|
||||||
OwnerResponse,
|
OwnerResponse,
|
||||||
TotalDepositResponse,
|
TotalDepositResponse,
|
||||||
} from './MarsParams.types'
|
} from './MarsParams.types'
|
||||||
export interface MarsParamsReadOnlyInterface {
|
export interface MarsParamsReadOnlyInterface {
|
||||||
contractAddress: string
|
contractAddress: string
|
||||||
owner: () => Promise<OwnerResponse>
|
owner: () => Promise<OwnerResponse>
|
||||||
|
config: () => Promise<ConfigResponse>
|
||||||
assetParams: ({ denom }: { denom: string }) => Promise<AssetParamsBaseForAddr>
|
assetParams: ({ denom }: { denom: string }) => Promise<AssetParamsBaseForAddr>
|
||||||
allAssetParams: ({
|
allAssetParams: ({
|
||||||
limit,
|
limit,
|
||||||
@ -57,6 +62,14 @@ export interface MarsParamsReadOnlyInterface {
|
|||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
}) => Promise<ArrayOfVaultConfigBaseForAddr>
|
}) => Promise<ArrayOfVaultConfigBaseForAddr>
|
||||||
|
perpParams: ({ denom }: { denom: string }) => Promise<PerpParams>
|
||||||
|
allPerpParams: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}) => Promise<ArrayOfPerpParams>
|
||||||
targetHealthFactor: () => Promise<Decimal>
|
targetHealthFactor: () => Promise<Decimal>
|
||||||
totalDeposit: ({ denom }: { denom: string }) => Promise<TotalDepositResponse>
|
totalDeposit: ({ denom }: { denom: string }) => Promise<TotalDepositResponse>
|
||||||
}
|
}
|
||||||
@ -68,10 +81,13 @@ export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
|
|||||||
this.client = client
|
this.client = client
|
||||||
this.contractAddress = contractAddress
|
this.contractAddress = contractAddress
|
||||||
this.owner = this.owner.bind(this)
|
this.owner = this.owner.bind(this)
|
||||||
|
this.config = this.config.bind(this)
|
||||||
this.assetParams = this.assetParams.bind(this)
|
this.assetParams = this.assetParams.bind(this)
|
||||||
this.allAssetParams = this.allAssetParams.bind(this)
|
this.allAssetParams = this.allAssetParams.bind(this)
|
||||||
this.vaultConfig = this.vaultConfig.bind(this)
|
this.vaultConfig = this.vaultConfig.bind(this)
|
||||||
this.allVaultConfigs = this.allVaultConfigs.bind(this)
|
this.allVaultConfigs = this.allVaultConfigs.bind(this)
|
||||||
|
this.perpParams = this.perpParams.bind(this)
|
||||||
|
this.allPerpParams = this.allPerpParams.bind(this)
|
||||||
this.targetHealthFactor = this.targetHealthFactor.bind(this)
|
this.targetHealthFactor = this.targetHealthFactor.bind(this)
|
||||||
this.totalDeposit = this.totalDeposit.bind(this)
|
this.totalDeposit = this.totalDeposit.bind(this)
|
||||||
}
|
}
|
||||||
@ -81,6 +97,11 @@ export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
|
|||||||
owner: {},
|
owner: {},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
config = async (): Promise<ConfigResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
config: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
assetParams = async ({ denom }: { denom: string }): Promise<AssetParamsBaseForAddr> => {
|
assetParams = async ({ denom }: { denom: string }): Promise<AssetParamsBaseForAddr> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
asset_params: {
|
asset_params: {
|
||||||
@ -123,6 +144,27 @@ export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
perpParams = async ({ denom }: { denom: string }): Promise<PerpParams> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
perp_params: {
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
allPerpParams = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}): Promise<ArrayOfPerpParams> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
all_perp_params: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
targetHealthFactor = async (): Promise<Decimal> => {
|
targetHealthFactor = async (): Promise<Decimal> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
target_health_factor: {},
|
target_health_factor: {},
|
||||||
@ -145,6 +187,16 @@ export interface MarsParamsInterface extends MarsParamsReadOnlyInterface {
|
|||||||
memo?: string,
|
memo?: string,
|
||||||
_funds?: Coin[],
|
_funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
|
updateConfig: (
|
||||||
|
{
|
||||||
|
addressProvider,
|
||||||
|
}: {
|
||||||
|
addressProvider?: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
updateTargetHealthFactor: (
|
updateTargetHealthFactor: (
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
@ -162,6 +214,12 @@ export interface MarsParamsInterface extends MarsParamsReadOnlyInterface {
|
|||||||
memo?: string,
|
memo?: string,
|
||||||
_funds?: Coin[],
|
_funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
|
updatePerpParams: (
|
||||||
|
perpParamsUpdate: PerpParamsUpdate,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
emergencyUpdate: (
|
emergencyUpdate: (
|
||||||
emergencyUpdate: EmergencyUpdate,
|
emergencyUpdate: EmergencyUpdate,
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
@ -180,9 +238,11 @@ export class MarsParamsClient extends MarsParamsQueryClient implements MarsParam
|
|||||||
this.sender = sender
|
this.sender = sender
|
||||||
this.contractAddress = contractAddress
|
this.contractAddress = contractAddress
|
||||||
this.updateOwner = this.updateOwner.bind(this)
|
this.updateOwner = this.updateOwner.bind(this)
|
||||||
|
this.updateConfig = this.updateConfig.bind(this)
|
||||||
this.updateTargetHealthFactor = this.updateTargetHealthFactor.bind(this)
|
this.updateTargetHealthFactor = this.updateTargetHealthFactor.bind(this)
|
||||||
this.updateAssetParams = this.updateAssetParams.bind(this)
|
this.updateAssetParams = this.updateAssetParams.bind(this)
|
||||||
this.updateVaultConfig = this.updateVaultConfig.bind(this)
|
this.updateVaultConfig = this.updateVaultConfig.bind(this)
|
||||||
|
this.updatePerpParams = this.updatePerpParams.bind(this)
|
||||||
this.emergencyUpdate = this.emergencyUpdate.bind(this)
|
this.emergencyUpdate = this.emergencyUpdate.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +263,29 @@ export class MarsParamsClient extends MarsParamsQueryClient implements MarsParam
|
|||||||
_funds,
|
_funds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
updateConfig = async (
|
||||||
|
{
|
||||||
|
addressProvider,
|
||||||
|
}: {
|
||||||
|
addressProvider?: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_config: {
|
||||||
|
address_provider: addressProvider,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
updateTargetHealthFactor = async (
|
updateTargetHealthFactor = async (
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
memo?: string,
|
memo?: string,
|
||||||
@ -253,6 +336,23 @@ export class MarsParamsClient extends MarsParamsQueryClient implements MarsParam
|
|||||||
_funds,
|
_funds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
updatePerpParams = async (
|
||||||
|
perpParamsUpdate: PerpParamsUpdate,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_perp_params: perpParamsUpdate,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
emergencyUpdate = async (
|
emergencyUpdate = async (
|
||||||
emergencyUpdate: EmergencyUpdate,
|
emergencyUpdate: EmergencyUpdate,
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -17,6 +17,7 @@ import {
|
|||||||
HlsAssetTypeForString,
|
HlsAssetTypeForString,
|
||||||
Uint128,
|
Uint128,
|
||||||
VaultConfigUpdate,
|
VaultConfigUpdate,
|
||||||
|
PerpParamsUpdate,
|
||||||
EmergencyUpdate,
|
EmergencyUpdate,
|
||||||
CmEmergencyUpdate,
|
CmEmergencyUpdate,
|
||||||
RedBankEmergencyUpdate,
|
RedBankEmergencyUpdate,
|
||||||
@ -27,6 +28,7 @@ import {
|
|||||||
RedBankSettings,
|
RedBankSettings,
|
||||||
VaultConfigBaseForString,
|
VaultConfigBaseForString,
|
||||||
Coin,
|
Coin,
|
||||||
|
PerpParams,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
HlsAssetTypeForAddr,
|
HlsAssetTypeForAddr,
|
||||||
Addr,
|
Addr,
|
||||||
@ -34,8 +36,10 @@ import {
|
|||||||
AssetParamsBaseForAddr,
|
AssetParamsBaseForAddr,
|
||||||
CmSettingsForAddr,
|
CmSettingsForAddr,
|
||||||
HlsParamsBaseForAddr,
|
HlsParamsBaseForAddr,
|
||||||
|
ArrayOfPerpParams,
|
||||||
ArrayOfVaultConfigBaseForAddr,
|
ArrayOfVaultConfigBaseForAddr,
|
||||||
VaultConfigBaseForAddr,
|
VaultConfigBaseForAddr,
|
||||||
|
ConfigResponse,
|
||||||
OwnerResponse,
|
OwnerResponse,
|
||||||
TotalDepositResponse,
|
TotalDepositResponse,
|
||||||
} from './MarsParams.types'
|
} from './MarsParams.types'
|
||||||
@ -50,6 +54,8 @@ export const marsParamsQueryKeys = {
|
|||||||
[{ ...marsParamsQueryKeys.contract[0], address: contractAddress }] as const,
|
[{ ...marsParamsQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||||
|
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||||
assetParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
assetParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'asset_params', args }] as const,
|
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'asset_params', args }] as const,
|
||||||
allAssetParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
allAssetParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
@ -62,6 +68,12 @@ export const marsParamsQueryKeys = {
|
|||||||
[
|
[
|
||||||
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_vault_configs', args },
|
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_vault_configs', args },
|
||||||
] as const,
|
] as const,
|
||||||
|
perpParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'perp_params', args }] as const,
|
||||||
|
allPerpParams: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_perp_params', args },
|
||||||
|
] as const,
|
||||||
targetHealthFactor: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
targetHealthFactor: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'target_health_factor', args },
|
{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'target_health_factor', args },
|
||||||
@ -114,6 +126,51 @@ export function useMarsParamsTargetHealthFactorQuery<TData = Decimal>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsParamsAllPerpParamsQuery<TData>
|
||||||
|
extends MarsParamsReactQuery<ArrayOfPerpParams, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsParamsAllPerpParamsQuery<TData = ArrayOfPerpParams>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsParamsAllPerpParamsQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfPerpParams, Error, TData>(
|
||||||
|
marsParamsQueryKeys.allPerpParams(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.allPerpParams({
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsParamsPerpParamsQuery<TData> extends MarsParamsReactQuery<PerpParams, TData> {
|
||||||
|
args: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsParamsPerpParamsQuery<TData = PerpParams>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsParamsPerpParamsQuery<TData>) {
|
||||||
|
return useQuery<PerpParams, Error, TData>(
|
||||||
|
marsParamsQueryKeys.perpParams(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.perpParams({
|
||||||
|
denom: args.denom,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsParamsAllVaultConfigsQuery<TData>
|
export interface MarsParamsAllVaultConfigsQuery<TData>
|
||||||
extends MarsParamsReactQuery<ArrayOfVaultConfigBaseForAddr, TData> {
|
extends MarsParamsReactQuery<ArrayOfVaultConfigBaseForAddr, TData> {
|
||||||
args: {
|
args: {
|
||||||
@ -206,6 +263,17 @@ export function useMarsParamsAssetParamsQuery<TData = AssetParamsBaseForAddr>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsParamsConfigQuery<TData> extends MarsParamsReactQuery<ConfigResponse, TData> {}
|
||||||
|
export function useMarsParamsConfigQuery<TData = ConfigResponse>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsParamsConfigQuery<TData>) {
|
||||||
|
return useQuery<ConfigResponse, Error, TData>(
|
||||||
|
marsParamsQueryKeys.config(client?.contractAddress),
|
||||||
|
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsParamsOwnerQuery<TData> extends MarsParamsReactQuery<OwnerResponse, TData> {}
|
export interface MarsParamsOwnerQuery<TData> extends MarsParamsReactQuery<OwnerResponse, TData> {}
|
||||||
export function useMarsParamsOwnerQuery<TData = OwnerResponse>({
|
export function useMarsParamsOwnerQuery<TData = OwnerResponse>({
|
||||||
client,
|
client,
|
||||||
@ -238,6 +306,27 @@ export function useMarsParamsEmergencyUpdateMutation(
|
|||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsParamsUpdatePerpParamsMutation {
|
||||||
|
client: MarsParamsClient
|
||||||
|
msg: PerpParamsUpdate
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsParamsUpdatePerpParamsMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdatePerpParamsMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsParamsUpdatePerpParamsMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.updatePerpParams(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsParamsUpdateVaultConfigMutation {
|
export interface MarsParamsUpdateVaultConfigMutation {
|
||||||
client: MarsParamsClient
|
client: MarsParamsClient
|
||||||
msg: VaultConfigUpdate
|
msg: VaultConfigUpdate
|
||||||
@ -300,6 +389,29 @@ export function useMarsParamsUpdateTargetHealthFactorMutation(
|
|||||||
options,
|
options,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsParamsUpdateConfigMutation {
|
||||||
|
client: MarsParamsClient
|
||||||
|
msg: {
|
||||||
|
addressProvider?: string
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsParamsUpdateConfigMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsParamsUpdateConfigMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsParamsUpdateConfigMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.updateConfig(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsParamsUpdateOwnerMutation {
|
export interface MarsParamsUpdateOwnerMutation {
|
||||||
client: MarsParamsClient
|
client: MarsParamsClient
|
||||||
msg: OwnerUpdate
|
msg: OwnerUpdate
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -15,6 +15,11 @@ export type ExecuteMsg =
|
|||||||
| {
|
| {
|
||||||
update_owner: OwnerUpdate
|
update_owner: OwnerUpdate
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
update_config: {
|
||||||
|
address_provider?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
update_target_health_factor: Decimal
|
update_target_health_factor: Decimal
|
||||||
}
|
}
|
||||||
@ -24,6 +29,9 @@ export type ExecuteMsg =
|
|||||||
| {
|
| {
|
||||||
update_vault_config: VaultConfigUpdate
|
update_vault_config: VaultConfigUpdate
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
update_perp_params: PerpParamsUpdate
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
emergency_update: EmergencyUpdate
|
emergency_update: EmergencyUpdate
|
||||||
}
|
}
|
||||||
@ -64,6 +72,11 @@ export type VaultConfigUpdate = {
|
|||||||
config: VaultConfigBaseForString
|
config: VaultConfigBaseForString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export type PerpParamsUpdate = {
|
||||||
|
add_or_update: {
|
||||||
|
params: PerpParams
|
||||||
|
}
|
||||||
|
}
|
||||||
export type EmergencyUpdate =
|
export type EmergencyUpdate =
|
||||||
| {
|
| {
|
||||||
credit_manager: CmEmergencyUpdate
|
credit_manager: CmEmergencyUpdate
|
||||||
@ -126,10 +139,18 @@ export interface Coin {
|
|||||||
denom: string
|
denom: string
|
||||||
[k: string]: unknown
|
[k: string]: unknown
|
||||||
}
|
}
|
||||||
|
export interface PerpParams {
|
||||||
|
denom: string
|
||||||
|
max_long_oi: Uint128
|
||||||
|
max_short_oi: Uint128
|
||||||
|
}
|
||||||
export type QueryMsg =
|
export type QueryMsg =
|
||||||
| {
|
| {
|
||||||
owner: {}
|
owner: {}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
config: {}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
asset_params: {
|
asset_params: {
|
||||||
denom: string
|
denom: string
|
||||||
@ -152,6 +173,17 @@ export type QueryMsg =
|
|||||||
start_after?: string | null
|
start_after?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
perp_params: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
all_perp_params: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
target_health_factor: {}
|
target_health_factor: {}
|
||||||
}
|
}
|
||||||
@ -192,6 +224,7 @@ export interface HlsParamsBaseForAddr {
|
|||||||
liquidation_threshold: Decimal
|
liquidation_threshold: Decimal
|
||||||
max_loan_to_value: Decimal
|
max_loan_to_value: Decimal
|
||||||
}
|
}
|
||||||
|
export type ArrayOfPerpParams = PerpParams[]
|
||||||
export type ArrayOfVaultConfigBaseForAddr = VaultConfigBaseForAddr[]
|
export type ArrayOfVaultConfigBaseForAddr = VaultConfigBaseForAddr[]
|
||||||
export interface VaultConfigBaseForAddr {
|
export interface VaultConfigBaseForAddr {
|
||||||
addr: Addr
|
addr: Addr
|
||||||
@ -201,6 +234,9 @@ export interface VaultConfigBaseForAddr {
|
|||||||
max_loan_to_value: Decimal
|
max_loan_to_value: Decimal
|
||||||
whitelisted: boolean
|
whitelisted: boolean
|
||||||
}
|
}
|
||||||
|
export interface ConfigResponse {
|
||||||
|
address_provider: string
|
||||||
|
}
|
||||||
export interface OwnerResponse {
|
export interface OwnerResponse {
|
||||||
abolished: boolean
|
abolished: boolean
|
||||||
emergency_owner?: string | null
|
emergency_owner?: string | null
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _24 from './MarsParams.types'
|
import * as _21 from './MarsParams.types'
|
||||||
import * as _25 from './MarsParams.client'
|
import * as _22 from './MarsParams.client'
|
||||||
import * as _26 from './MarsParams.message-composer'
|
import * as _23 from './MarsParams.react-query'
|
||||||
import * as _27 from './MarsParams.react-query'
|
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsParams = { ..._24, ..._25, ..._26, ..._27 }
|
export const MarsParams = { ..._21, ..._22, ..._23 }
|
||||||
}
|
}
|
||||||
|
529
src/types/generated/mars-perps/MarsPerps.client.ts
Normal file
529
src/types/generated/mars-perps/MarsPerps.client.ts
Normal file
@ -0,0 +1,529 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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 {
|
||||||
|
Uint128,
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
OwnerUpdate,
|
||||||
|
Decimal,
|
||||||
|
SignedDecimal,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
DenomStateResponse,
|
||||||
|
Funding,
|
||||||
|
ArrayOfDenomStateResponse,
|
||||||
|
DepositResponse,
|
||||||
|
ArrayOfDepositResponse,
|
||||||
|
OwnerResponse,
|
||||||
|
PerpDenomState,
|
||||||
|
PnlValues,
|
||||||
|
PnL,
|
||||||
|
PositionResponse,
|
||||||
|
PerpPosition,
|
||||||
|
Coin,
|
||||||
|
ArrayOfPositionResponse,
|
||||||
|
PositionsByAccountResponse,
|
||||||
|
ArrayOfUnlockState,
|
||||||
|
UnlockState,
|
||||||
|
VaultState,
|
||||||
|
} from './MarsPerps.types'
|
||||||
|
export interface MarsPerpsReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
owner: () => Promise<OwnerResponse>
|
||||||
|
config: () => Promise<ConfigForString>
|
||||||
|
vaultState: () => Promise<VaultState>
|
||||||
|
denomState: ({ denom }: { denom: string }) => Promise<DenomStateResponse>
|
||||||
|
perpDenomState: ({ denom }: { denom: string }) => Promise<PerpDenomState>
|
||||||
|
denomStates: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}) => Promise<ArrayOfDenomStateResponse>
|
||||||
|
deposit: ({ depositor }: { depositor: string }) => Promise<DepositResponse>
|
||||||
|
deposits: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}) => Promise<ArrayOfDepositResponse>
|
||||||
|
unlocks: ({ depositor }: { depositor: string }) => Promise<ArrayOfUnlockState>
|
||||||
|
position: ({
|
||||||
|
accountId,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
}) => Promise<PositionResponse>
|
||||||
|
positions: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}) => Promise<ArrayOfPositionResponse>
|
||||||
|
positionsByAccount: ({ accountId }: { accountId: string }) => Promise<PositionsByAccountResponse>
|
||||||
|
totalPnl: () => Promise<SignedDecimal>
|
||||||
|
}
|
||||||
|
export class MarsPerpsQueryClient implements MarsPerpsReadOnlyInterface {
|
||||||
|
client: CosmWasmClient
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||||
|
this.client = client
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.owner = this.owner.bind(this)
|
||||||
|
this.config = this.config.bind(this)
|
||||||
|
this.vaultState = this.vaultState.bind(this)
|
||||||
|
this.denomState = this.denomState.bind(this)
|
||||||
|
this.perpDenomState = this.perpDenomState.bind(this)
|
||||||
|
this.denomStates = this.denomStates.bind(this)
|
||||||
|
this.deposit = this.deposit.bind(this)
|
||||||
|
this.deposits = this.deposits.bind(this)
|
||||||
|
this.unlocks = this.unlocks.bind(this)
|
||||||
|
this.position = this.position.bind(this)
|
||||||
|
this.positions = this.positions.bind(this)
|
||||||
|
this.positionsByAccount = this.positionsByAccount.bind(this)
|
||||||
|
this.totalPnl = this.totalPnl.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
owner = async (): Promise<OwnerResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
owner: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
config = async (): Promise<ConfigForString> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
config: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
vaultState = async (): Promise<VaultState> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
vault_state: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
denomState = async ({ denom }: { denom: string }): Promise<DenomStateResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
denom_state: {
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
perpDenomState = async ({ denom }: { denom: string }): Promise<PerpDenomState> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
perp_denom_state: {
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
denomStates = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}): Promise<ArrayOfDenomStateResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
denom_states: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
deposit = async ({ depositor }: { depositor: string }): Promise<DepositResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
deposit: {
|
||||||
|
depositor,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
deposits = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}): Promise<ArrayOfDepositResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
deposits: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
unlocks = async ({ depositor }: { depositor: string }): Promise<ArrayOfUnlockState> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
unlocks: {
|
||||||
|
depositor,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
position = async ({
|
||||||
|
accountId,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
}): Promise<PositionResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
position: {
|
||||||
|
account_id: accountId,
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
positions = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}): Promise<ArrayOfPositionResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
positions: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
positionsByAccount = async ({
|
||||||
|
accountId,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
}): Promise<PositionsByAccountResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
positions_by_account: {
|
||||||
|
account_id: accountId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
totalPnl = async (): Promise<SignedDecimal> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
total_pnl: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsPerpsInterface extends MarsPerpsReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateOwner: (
|
||||||
|
ownerUpdate: OwnerUpdate,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
initDenom: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
maxFundingVelocity,
|
||||||
|
skewScale,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
maxFundingVelocity: Decimal
|
||||||
|
skewScale: Decimal
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
enableDenom: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
disableDenom: (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
deposit: (
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
unlock: (
|
||||||
|
{
|
||||||
|
shares,
|
||||||
|
}: {
|
||||||
|
shares: Uint128
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
withdraw: (
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
openPosition: (
|
||||||
|
{
|
||||||
|
accountId,
|
||||||
|
denom,
|
||||||
|
size,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
size: SignedDecimal
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
closePosition: (
|
||||||
|
{
|
||||||
|
accountId,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
}
|
||||||
|
export class MarsPerpsClient extends MarsPerpsQueryClient implements MarsPerpsInterface {
|
||||||
|
client: SigningCosmWasmClient
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||||
|
super(client, contractAddress)
|
||||||
|
this.client = client
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateOwner = this.updateOwner.bind(this)
|
||||||
|
this.initDenom = this.initDenom.bind(this)
|
||||||
|
this.enableDenom = this.enableDenom.bind(this)
|
||||||
|
this.disableDenom = this.disableDenom.bind(this)
|
||||||
|
this.deposit = this.deposit.bind(this)
|
||||||
|
this.unlock = this.unlock.bind(this)
|
||||||
|
this.withdraw = this.withdraw.bind(this)
|
||||||
|
this.openPosition = this.openPosition.bind(this)
|
||||||
|
this.closePosition = this.closePosition.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOwner = async (
|
||||||
|
ownerUpdate: OwnerUpdate,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_owner: ownerUpdate,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
initDenom = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
maxFundingVelocity,
|
||||||
|
skewScale,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
maxFundingVelocity: Decimal
|
||||||
|
skewScale: Decimal
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
init_denom: {
|
||||||
|
denom,
|
||||||
|
max_funding_velocity: maxFundingVelocity,
|
||||||
|
skew_scale: skewScale,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
enableDenom = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
enable_denom: {
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
disableDenom = async (
|
||||||
|
{
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
denom: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
disable_denom: {
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
unlock = async (
|
||||||
|
{
|
||||||
|
shares,
|
||||||
|
}: {
|
||||||
|
shares: Uint128
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
unlock: {
|
||||||
|
shares,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
openPosition = async (
|
||||||
|
{
|
||||||
|
accountId,
|
||||||
|
denom,
|
||||||
|
size,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
size: SignedDecimal
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
open_position: {
|
||||||
|
account_id: accountId,
|
||||||
|
denom,
|
||||||
|
size,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
closePosition = async (
|
||||||
|
{
|
||||||
|
accountId,
|
||||||
|
denom,
|
||||||
|
}: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
close_position: {
|
||||||
|
account_id: accountId,
|
||||||
|
denom,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
525
src/types/generated/mars-perps/MarsPerps.react-query.ts
Normal file
525
src/types/generated/mars-perps/MarsPerps.react-query.ts
Normal file
@ -0,0 +1,525 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
|
import { StdFee } from '@cosmjs/amino'
|
||||||
|
import {
|
||||||
|
Uint128,
|
||||||
|
OracleBaseForString,
|
||||||
|
InstantiateMsg,
|
||||||
|
ExecuteMsg,
|
||||||
|
OwnerUpdate,
|
||||||
|
Decimal,
|
||||||
|
SignedDecimal,
|
||||||
|
QueryMsg,
|
||||||
|
ConfigForString,
|
||||||
|
DenomStateResponse,
|
||||||
|
Funding,
|
||||||
|
ArrayOfDenomStateResponse,
|
||||||
|
DepositResponse,
|
||||||
|
ArrayOfDepositResponse,
|
||||||
|
OwnerResponse,
|
||||||
|
PerpDenomState,
|
||||||
|
PnlValues,
|
||||||
|
PnL,
|
||||||
|
PositionResponse,
|
||||||
|
PerpPosition,
|
||||||
|
Coin,
|
||||||
|
ArrayOfPositionResponse,
|
||||||
|
PositionsByAccountResponse,
|
||||||
|
ArrayOfUnlockState,
|
||||||
|
UnlockState,
|
||||||
|
VaultState,
|
||||||
|
} from './MarsPerps.types'
|
||||||
|
import { MarsPerpsQueryClient, MarsPerpsClient } from './MarsPerps.client'
|
||||||
|
export const marsPerpsQueryKeys = {
|
||||||
|
contract: [
|
||||||
|
{
|
||||||
|
contract: 'marsPerps',
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
address: (contractAddress: string | undefined) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
|
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||||
|
config: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'config', args }] as const,
|
||||||
|
vaultState: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'vault_state', args }] as const,
|
||||||
|
denomState: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'denom_state', args }] as const,
|
||||||
|
perpDenomState: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'perp_denom_state', args },
|
||||||
|
] as const,
|
||||||
|
denomStates: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'denom_states', args }] as const,
|
||||||
|
deposit: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'deposit', args }] as const,
|
||||||
|
deposits: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'deposits', args }] as const,
|
||||||
|
unlocks: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'unlocks', args }] as const,
|
||||||
|
position: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'position', args }] as const,
|
||||||
|
positions: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'positions', args }] as const,
|
||||||
|
positionsByAccount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'positions_by_account', args },
|
||||||
|
] as const,
|
||||||
|
totalPnl: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsPerpsQueryKeys.address(contractAddress)[0], method: 'total_pnl', args }] as const,
|
||||||
|
}
|
||||||
|
export interface MarsPerpsReactQuery<TResponse, TData = TResponse> {
|
||||||
|
client: MarsPerpsQueryClient | undefined
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
|
> & {
|
||||||
|
initialData?: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsPerpsTotalPnlQuery<TData> extends MarsPerpsReactQuery<SignedDecimal, TData> {}
|
||||||
|
export function useMarsPerpsTotalPnlQuery<TData = SignedDecimal>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsTotalPnlQuery<TData>) {
|
||||||
|
return useQuery<SignedDecimal, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.totalPnl(client?.contractAddress),
|
||||||
|
() => (client ? client.totalPnl() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsPositionsByAccountQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<PositionsByAccountResponse, TData> {
|
||||||
|
args: {
|
||||||
|
accountId: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsPositionsByAccountQuery<TData = PositionsByAccountResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsPositionsByAccountQuery<TData>) {
|
||||||
|
return useQuery<PositionsByAccountResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.positionsByAccount(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.positionsByAccount({
|
||||||
|
accountId: args.accountId,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsPositionsQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<ArrayOfPositionResponse, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsPositionsQuery<TData = ArrayOfPositionResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsPositionsQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfPositionResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.positions(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.positions({
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsPositionQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<PositionResponse, TData> {
|
||||||
|
args: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsPositionQuery<TData = PositionResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsPositionQuery<TData>) {
|
||||||
|
return useQuery<PositionResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.position(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.position({
|
||||||
|
accountId: args.accountId,
|
||||||
|
denom: args.denom,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsUnlocksQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<ArrayOfUnlockState, TData> {
|
||||||
|
args: {
|
||||||
|
depositor: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsUnlocksQuery<TData = ArrayOfUnlockState>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsUnlocksQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfUnlockState, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.unlocks(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.unlocks({
|
||||||
|
depositor: args.depositor,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsDepositsQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<ArrayOfDepositResponse, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsDepositsQuery<TData = ArrayOfDepositResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsDepositsQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfDepositResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.deposits(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.deposits({
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsDepositQuery<TData> extends MarsPerpsReactQuery<DepositResponse, TData> {
|
||||||
|
args: {
|
||||||
|
depositor: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsDepositQuery<TData = DepositResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsDepositQuery<TData>) {
|
||||||
|
return useQuery<DepositResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.deposit(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.deposit({
|
||||||
|
depositor: args.depositor,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsDenomStatesQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<ArrayOfDenomStateResponse, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsDenomStatesQuery<TData = ArrayOfDenomStateResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsDenomStatesQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfDenomStateResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.denomStates(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.denomStates({
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsPerpDenomStateQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<PerpDenomState, TData> {
|
||||||
|
args: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsPerpDenomStateQuery<TData = PerpDenomState>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsPerpDenomStateQuery<TData>) {
|
||||||
|
return useQuery<PerpDenomState, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.perpDenomState(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.perpDenomState({
|
||||||
|
denom: args.denom,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsDenomStateQuery<TData>
|
||||||
|
extends MarsPerpsReactQuery<DenomStateResponse, TData> {
|
||||||
|
args: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsDenomStateQuery<TData = DenomStateResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsDenomStateQuery<TData>) {
|
||||||
|
return useQuery<DenomStateResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.denomState(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.denomState({
|
||||||
|
denom: args.denom,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsVaultStateQuery<TData> extends MarsPerpsReactQuery<VaultState, TData> {}
|
||||||
|
export function useMarsPerpsVaultStateQuery<TData = VaultState>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsVaultStateQuery<TData>) {
|
||||||
|
return useQuery<VaultState, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.vaultState(client?.contractAddress),
|
||||||
|
() => (client ? client.vaultState() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsConfigQuery<TData> extends MarsPerpsReactQuery<ConfigForString, TData> {}
|
||||||
|
export function useMarsPerpsConfigQuery<TData = ConfigForString>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsConfigQuery<TData>) {
|
||||||
|
return useQuery<ConfigForString, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.config(client?.contractAddress),
|
||||||
|
() => (client ? client.config() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsOwnerQuery<TData> extends MarsPerpsReactQuery<OwnerResponse, TData> {}
|
||||||
|
export function useMarsPerpsOwnerQuery<TData = OwnerResponse>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsPerpsOwnerQuery<TData>) {
|
||||||
|
return useQuery<OwnerResponse, Error, TData>(
|
||||||
|
marsPerpsQueryKeys.owner(client?.contractAddress),
|
||||||
|
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsClosePositionMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsClosePositionMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsPerpsClosePositionMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsClosePositionMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.closePosition(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsOpenPositionMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: {
|
||||||
|
accountId: string
|
||||||
|
denom: string
|
||||||
|
size: SignedDecimal
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsOpenPositionMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsPerpsOpenPositionMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsOpenPositionMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.openPosition(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsWithdrawMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsWithdrawMutation(
|
||||||
|
options?: Omit<UseMutationOptions<ExecuteResult, Error, MarsPerpsWithdrawMutation>, 'mutationFn'>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsWithdrawMutation>(
|
||||||
|
({ client, args: { fee, memo, funds } = {} }) => client.withdraw(fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsUnlockMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: {
|
||||||
|
shares: Uint128
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsUnlockMutation(
|
||||||
|
options?: Omit<UseMutationOptions<ExecuteResult, Error, MarsPerpsUnlockMutation>, 'mutationFn'>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsUnlockMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.unlock(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsDepositMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsDepositMutation(
|
||||||
|
options?: Omit<UseMutationOptions<ExecuteResult, Error, MarsPerpsDepositMutation>, 'mutationFn'>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsDepositMutation>(
|
||||||
|
({ client, args: { fee, memo, funds } = {} }) => client.deposit(fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsDisableDenomMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsDisableDenomMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsPerpsDisableDenomMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsDisableDenomMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.disableDenom(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsEnableDenomMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsEnableDenomMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsPerpsEnableDenomMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsEnableDenomMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.enableDenom(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsInitDenomMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: {
|
||||||
|
denom: string
|
||||||
|
maxFundingVelocity: Decimal
|
||||||
|
skewScale: Decimal
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsInitDenomMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsPerpsInitDenomMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsInitDenomMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.initDenom(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsPerpsUpdateOwnerMutation {
|
||||||
|
client: MarsPerpsClient
|
||||||
|
msg: OwnerUpdate
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsPerpsUpdateOwnerMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsPerpsUpdateOwnerMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsPerpsUpdateOwnerMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
238
src/types/generated/mars-perps/MarsPerps.types.ts
Normal file
238
src/types/generated/mars-perps/MarsPerps.types.ts
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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 Uint128 = string
|
||||||
|
export type OracleBaseForString = string
|
||||||
|
export interface InstantiateMsg {
|
||||||
|
base_denom: string
|
||||||
|
cooldown_period: number
|
||||||
|
credit_manager: string
|
||||||
|
min_position_value: Uint128
|
||||||
|
oracle: OracleBaseForString
|
||||||
|
}
|
||||||
|
export type ExecuteMsg =
|
||||||
|
| {
|
||||||
|
update_owner: OwnerUpdate
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
init_denom: {
|
||||||
|
denom: string
|
||||||
|
max_funding_velocity: Decimal
|
||||||
|
skew_scale: Decimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
enable_denom: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
disable_denom: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
deposit: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
unlock: {
|
||||||
|
shares: Uint128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
withdraw: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
open_position: {
|
||||||
|
account_id: string
|
||||||
|
denom: string
|
||||||
|
size: SignedDecimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
close_position: {
|
||||||
|
account_id: string
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type OwnerUpdate =
|
||||||
|
| {
|
||||||
|
propose_new_owner: {
|
||||||
|
proposed: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'clear_proposed'
|
||||||
|
| 'accept_proposed'
|
||||||
|
| 'abolish_owner_role'
|
||||||
|
| {
|
||||||
|
set_emergency_owner: {
|
||||||
|
emergency_owner: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'clear_emergency_owner'
|
||||||
|
export type Decimal = string
|
||||||
|
export interface SignedDecimal {
|
||||||
|
abs: Decimal
|
||||||
|
negative: boolean
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export type QueryMsg =
|
||||||
|
| {
|
||||||
|
owner: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
config: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
vault_state: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
denom_state: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
perp_denom_state: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
denom_states: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
deposit: {
|
||||||
|
depositor: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
deposits: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
unlocks: {
|
||||||
|
depositor: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
position: {
|
||||||
|
account_id: string
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
positions: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: [string, string] | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
positions_by_account: {
|
||||||
|
account_id: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
total_pnl: {}
|
||||||
|
}
|
||||||
|
export interface ConfigForString {
|
||||||
|
base_denom: string
|
||||||
|
cooldown_period: number
|
||||||
|
credit_manager: string
|
||||||
|
min_position_value: Uint128
|
||||||
|
oracle: OracleBaseForString
|
||||||
|
}
|
||||||
|
export interface DenomStateResponse {
|
||||||
|
denom: string
|
||||||
|
enabled: boolean
|
||||||
|
funding: Funding
|
||||||
|
last_updated: number
|
||||||
|
total_cost_base: SignedDecimal
|
||||||
|
total_size: SignedDecimal
|
||||||
|
}
|
||||||
|
export interface Funding {
|
||||||
|
accumulated_size_weighted_by_index: SignedDecimal
|
||||||
|
constant_factor: SignedDecimal
|
||||||
|
index: SignedDecimal
|
||||||
|
max_funding_velocity: Decimal
|
||||||
|
rate: SignedDecimal
|
||||||
|
skew_scale: Decimal
|
||||||
|
}
|
||||||
|
export type ArrayOfDenomStateResponse = DenomStateResponse[]
|
||||||
|
export interface DepositResponse {
|
||||||
|
amount: Uint128
|
||||||
|
depositor: string
|
||||||
|
shares: Uint128
|
||||||
|
}
|
||||||
|
export type ArrayOfDepositResponse = DepositResponse[]
|
||||||
|
export interface OwnerResponse {
|
||||||
|
abolished: boolean
|
||||||
|
emergency_owner?: string | null
|
||||||
|
initialized: boolean
|
||||||
|
owner?: string | null
|
||||||
|
proposed?: string | null
|
||||||
|
}
|
||||||
|
export interface PerpDenomState {
|
||||||
|
constant_factor: SignedDecimal
|
||||||
|
denom: string
|
||||||
|
enabled: boolean
|
||||||
|
index: SignedDecimal
|
||||||
|
pnl_values: PnlValues
|
||||||
|
rate: SignedDecimal
|
||||||
|
total_cost_base: SignedDecimal
|
||||||
|
total_size: SignedDecimal
|
||||||
|
}
|
||||||
|
export interface PnlValues {
|
||||||
|
accrued_funding: SignedDecimal
|
||||||
|
pnl: SignedDecimal
|
||||||
|
unrealized_pnl: SignedDecimal
|
||||||
|
}
|
||||||
|
export type PnL =
|
||||||
|
| 'break_even'
|
||||||
|
| {
|
||||||
|
profit: Coin
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
loss: Coin
|
||||||
|
}
|
||||||
|
export interface PositionResponse {
|
||||||
|
account_id: string
|
||||||
|
position: PerpPosition
|
||||||
|
}
|
||||||
|
export interface PerpPosition {
|
||||||
|
base_denom: string
|
||||||
|
closing_fee_rate: Decimal
|
||||||
|
current_price: Decimal
|
||||||
|
denom: string
|
||||||
|
entry_price: Decimal
|
||||||
|
pnl: PnL
|
||||||
|
size: SignedDecimal
|
||||||
|
unrealised_funding_accrued: SignedDecimal
|
||||||
|
}
|
||||||
|
export interface Coin {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export type ArrayOfPositionResponse = PositionResponse[]
|
||||||
|
export interface PositionsByAccountResponse {
|
||||||
|
account_id: string
|
||||||
|
positions: PerpPosition[]
|
||||||
|
}
|
||||||
|
export type ArrayOfUnlockState = UnlockState[]
|
||||||
|
export interface UnlockState {
|
||||||
|
amount: Uint128
|
||||||
|
cooldown_end: number
|
||||||
|
created_at: number
|
||||||
|
}
|
||||||
|
export interface VaultState {
|
||||||
|
total_liquidity: Uint128
|
||||||
|
total_shares: Uint128
|
||||||
|
}
|
13
src/types/generated/mars-perps/bundle.ts
Normal file
13
src/types/generated/mars-perps/bundle.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as _24 from './MarsPerps.types'
|
||||||
|
import * as _25 from './MarsPerps.client'
|
||||||
|
import * as _26 from './MarsPerps.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsPerps = { ..._24, ..._25, ..._26 }
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -8,12 +8,13 @@
|
|||||||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { Coin, StdFee } from '@cosmjs/amino'
|
import { Coin, StdFee } from '@cosmjs/amino'
|
||||||
import {
|
import {
|
||||||
Decimal,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
CreateOrUpdateConfig,
|
CreateOrUpdateConfig,
|
||||||
ExecuteMsg,
|
ExecuteMsg,
|
||||||
OwnerUpdate,
|
OwnerUpdate,
|
||||||
|
Decimal,
|
||||||
Uint128,
|
Uint128,
|
||||||
|
MigrateV1ToV2,
|
||||||
InitOrUpdateAssetParams,
|
InitOrUpdateAssetParams,
|
||||||
InterestRateModel,
|
InterestRateModel,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
@ -24,6 +25,8 @@ import {
|
|||||||
ArrayOfUncollateralizedLoanLimitResponse,
|
ArrayOfUncollateralizedLoanLimitResponse,
|
||||||
UserCollateralResponse,
|
UserCollateralResponse,
|
||||||
ArrayOfUserCollateralResponse,
|
ArrayOfUserCollateralResponse,
|
||||||
|
PaginationResponseForUserCollateralResponse,
|
||||||
|
Metadata,
|
||||||
UserDebtResponse,
|
UserDebtResponse,
|
||||||
ArrayOfUserDebtResponse,
|
ArrayOfUserDebtResponse,
|
||||||
UserHealthStatus,
|
UserHealthStatus,
|
||||||
@ -67,22 +70,50 @@ export interface MarsRedBankReadOnlyInterface {
|
|||||||
user: string
|
user: string
|
||||||
}) => Promise<ArrayOfUserDebtResponse>
|
}) => Promise<ArrayOfUserDebtResponse>
|
||||||
userCollateral: ({
|
userCollateral: ({
|
||||||
|
accountId,
|
||||||
denom,
|
denom,
|
||||||
user,
|
user,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
denom: string
|
denom: string
|
||||||
user: string
|
user: string
|
||||||
}) => Promise<UserCollateralResponse>
|
}) => Promise<UserCollateralResponse>
|
||||||
userCollaterals: ({
|
userCollaterals: ({
|
||||||
|
accountId,
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
user,
|
user,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
user: string
|
user: string
|
||||||
}) => Promise<ArrayOfUserCollateralResponse>
|
}) => Promise<ArrayOfUserCollateralResponse>
|
||||||
userPosition: ({ user }: { user: string }) => Promise<UserPositionResponse>
|
userCollateralsV2: ({
|
||||||
|
accountId,
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
accountId?: string
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<PaginationResponseForUserCollateralResponse>
|
||||||
|
userPosition: ({
|
||||||
|
accountId,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
accountId?: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<UserPositionResponse>
|
||||||
|
userPositionLiquidationPricing: ({
|
||||||
|
accountId,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
accountId?: string
|
||||||
|
user: string
|
||||||
|
}) => Promise<UserPositionResponse>
|
||||||
scaledLiquidityAmount: ({ amount, denom }: { amount: Uint128; denom: string }) => Promise<Uint128>
|
scaledLiquidityAmount: ({ amount, denom }: { amount: Uint128; denom: string }) => Promise<Uint128>
|
||||||
scaledDebtAmount: ({ amount, denom }: { amount: Uint128; denom: string }) => Promise<Uint128>
|
scaledDebtAmount: ({ amount, denom }: { amount: Uint128; denom: string }) => Promise<Uint128>
|
||||||
underlyingLiquidityAmount: ({
|
underlyingLiquidityAmount: ({
|
||||||
@ -116,7 +147,9 @@ export class MarsRedBankQueryClient implements MarsRedBankReadOnlyInterface {
|
|||||||
this.userDebts = this.userDebts.bind(this)
|
this.userDebts = this.userDebts.bind(this)
|
||||||
this.userCollateral = this.userCollateral.bind(this)
|
this.userCollateral = this.userCollateral.bind(this)
|
||||||
this.userCollaterals = this.userCollaterals.bind(this)
|
this.userCollaterals = this.userCollaterals.bind(this)
|
||||||
|
this.userCollateralsV2 = this.userCollateralsV2.bind(this)
|
||||||
this.userPosition = this.userPosition.bind(this)
|
this.userPosition = this.userPosition.bind(this)
|
||||||
|
this.userPositionLiquidationPricing = this.userPositionLiquidationPricing.bind(this)
|
||||||
this.scaledLiquidityAmount = this.scaledLiquidityAmount.bind(this)
|
this.scaledLiquidityAmount = this.scaledLiquidityAmount.bind(this)
|
||||||
this.scaledDebtAmount = this.scaledDebtAmount.bind(this)
|
this.scaledDebtAmount = this.scaledDebtAmount.bind(this)
|
||||||
this.underlyingLiquidityAmount = this.underlyingLiquidityAmount.bind(this)
|
this.underlyingLiquidityAmount = this.underlyingLiquidityAmount.bind(this)
|
||||||
@ -212,39 +245,86 @@ export class MarsRedBankQueryClient implements MarsRedBankReadOnlyInterface {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
userCollateral = async ({
|
userCollateral = async ({
|
||||||
|
accountId,
|
||||||
denom,
|
denom,
|
||||||
user,
|
user,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
denom: string
|
denom: string
|
||||||
user: string
|
user: string
|
||||||
}): Promise<UserCollateralResponse> => {
|
}): Promise<UserCollateralResponse> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
user_collateral: {
|
user_collateral: {
|
||||||
|
account_id: accountId,
|
||||||
denom,
|
denom,
|
||||||
user,
|
user,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
userCollaterals = async ({
|
userCollaterals = async ({
|
||||||
|
accountId,
|
||||||
limit,
|
limit,
|
||||||
startAfter,
|
startAfter,
|
||||||
user,
|
user,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
user: string
|
user: string
|
||||||
}): Promise<ArrayOfUserCollateralResponse> => {
|
}): Promise<ArrayOfUserCollateralResponse> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
user_collaterals: {
|
user_collaterals: {
|
||||||
|
account_id: accountId,
|
||||||
limit,
|
limit,
|
||||||
start_after: startAfter,
|
start_after: startAfter,
|
||||||
user,
|
user,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
userPosition = async ({ user }: { user: string }): Promise<UserPositionResponse> => {
|
userCollateralsV2 = async ({
|
||||||
|
accountId,
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
accountId?: string
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}): Promise<PaginationResponseForUserCollateralResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_collaterals_v2: {
|
||||||
|
account_id: accountId,
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userPosition = async ({
|
||||||
|
accountId,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
accountId?: string
|
||||||
|
user: string
|
||||||
|
}): Promise<UserPositionResponse> => {
|
||||||
return this.client.queryContractSmart(this.contractAddress, {
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
user_position: {
|
user_position: {
|
||||||
|
account_id: accountId,
|
||||||
|
user,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
userPositionLiquidationPricing = async ({
|
||||||
|
accountId,
|
||||||
|
user,
|
||||||
|
}: {
|
||||||
|
accountId?: string
|
||||||
|
user: string
|
||||||
|
}): Promise<UserPositionResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
user_position_liquidation_pricing: {
|
||||||
|
account_id: accountId,
|
||||||
user,
|
user,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -365,8 +445,10 @@ export interface MarsRedBankInterface extends MarsRedBankReadOnlyInterface {
|
|||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
deposit: (
|
deposit: (
|
||||||
{
|
{
|
||||||
|
accountId,
|
||||||
onBehalfOf,
|
onBehalfOf,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
onBehalfOf?: string
|
onBehalfOf?: string
|
||||||
},
|
},
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
@ -375,12 +457,16 @@ export interface MarsRedBankInterface extends MarsRedBankReadOnlyInterface {
|
|||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
withdraw: (
|
withdraw: (
|
||||||
{
|
{
|
||||||
|
accountId,
|
||||||
amount,
|
amount,
|
||||||
denom,
|
denom,
|
||||||
|
liquidationRelated,
|
||||||
recipient,
|
recipient,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
amount?: Uint128
|
amount?: Uint128
|
||||||
denom: string
|
denom: string
|
||||||
|
liquidationRelated?: boolean
|
||||||
recipient?: string
|
recipient?: string
|
||||||
},
|
},
|
||||||
fee?: number | StdFee | 'auto',
|
fee?: number | StdFee | 'auto',
|
||||||
@ -437,6 +523,12 @@ export interface MarsRedBankInterface extends MarsRedBankReadOnlyInterface {
|
|||||||
memo?: string,
|
memo?: string,
|
||||||
_funds?: Coin[],
|
_funds?: Coin[],
|
||||||
) => Promise<ExecuteResult>
|
) => Promise<ExecuteResult>
|
||||||
|
migrate: (
|
||||||
|
migrateV1ToV2: MigrateV1ToV2,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
}
|
}
|
||||||
export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRedBankInterface {
|
export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRedBankInterface {
|
||||||
client: SigningCosmWasmClient
|
client: SigningCosmWasmClient
|
||||||
@ -459,6 +551,7 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
|
|||||||
this.repay = this.repay.bind(this)
|
this.repay = this.repay.bind(this)
|
||||||
this.liquidate = this.liquidate.bind(this)
|
this.liquidate = this.liquidate.bind(this)
|
||||||
this.updateAssetCollateralStatus = this.updateAssetCollateralStatus.bind(this)
|
this.updateAssetCollateralStatus = this.updateAssetCollateralStatus.bind(this)
|
||||||
|
this.migrate = this.migrate.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOwner = async (
|
updateOwner = async (
|
||||||
@ -584,8 +677,10 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
|
|||||||
}
|
}
|
||||||
deposit = async (
|
deposit = async (
|
||||||
{
|
{
|
||||||
|
accountId,
|
||||||
onBehalfOf,
|
onBehalfOf,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
onBehalfOf?: string
|
onBehalfOf?: string
|
||||||
},
|
},
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
@ -597,6 +692,7 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
|
|||||||
this.contractAddress,
|
this.contractAddress,
|
||||||
{
|
{
|
||||||
deposit: {
|
deposit: {
|
||||||
|
account_id: accountId,
|
||||||
on_behalf_of: onBehalfOf,
|
on_behalf_of: onBehalfOf,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -607,12 +703,16 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
|
|||||||
}
|
}
|
||||||
withdraw = async (
|
withdraw = async (
|
||||||
{
|
{
|
||||||
|
accountId,
|
||||||
amount,
|
amount,
|
||||||
denom,
|
denom,
|
||||||
|
liquidationRelated,
|
||||||
recipient,
|
recipient,
|
||||||
}: {
|
}: {
|
||||||
|
accountId?: string
|
||||||
amount?: Uint128
|
amount?: Uint128
|
||||||
denom: string
|
denom: string
|
||||||
|
liquidationRelated?: boolean
|
||||||
recipient?: string
|
recipient?: string
|
||||||
},
|
},
|
||||||
fee: number | StdFee | 'auto' = 'auto',
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
@ -624,8 +724,10 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
|
|||||||
this.contractAddress,
|
this.contractAddress,
|
||||||
{
|
{
|
||||||
withdraw: {
|
withdraw: {
|
||||||
|
account_id: accountId,
|
||||||
amount,
|
amount,
|
||||||
denom,
|
denom,
|
||||||
|
liquidation_related: liquidationRelated,
|
||||||
recipient,
|
recipient,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -741,4 +843,21 @@ export class MarsRedBankClient extends MarsRedBankQueryClient implements MarsRed
|
|||||||
_funds,
|
_funds,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
migrate = async (
|
||||||
|
migrateV1ToV2: MigrateV1ToV2,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
migrate: migrateV1ToV2,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -9,12 +9,13 @@ import { UseQueryOptions, useQuery, useMutation, UseMutationOptions } from '@tan
|
|||||||
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
import { ExecuteResult } from '@cosmjs/cosmwasm-stargate'
|
||||||
import { StdFee, Coin } from '@cosmjs/amino'
|
import { StdFee, Coin } from '@cosmjs/amino'
|
||||||
import {
|
import {
|
||||||
Decimal,
|
|
||||||
InstantiateMsg,
|
InstantiateMsg,
|
||||||
CreateOrUpdateConfig,
|
CreateOrUpdateConfig,
|
||||||
ExecuteMsg,
|
ExecuteMsg,
|
||||||
OwnerUpdate,
|
OwnerUpdate,
|
||||||
|
Decimal,
|
||||||
Uint128,
|
Uint128,
|
||||||
|
MigrateV1ToV2,
|
||||||
InitOrUpdateAssetParams,
|
InitOrUpdateAssetParams,
|
||||||
InterestRateModel,
|
InterestRateModel,
|
||||||
QueryMsg,
|
QueryMsg,
|
||||||
@ -25,6 +26,8 @@ import {
|
|||||||
ArrayOfUncollateralizedLoanLimitResponse,
|
ArrayOfUncollateralizedLoanLimitResponse,
|
||||||
UserCollateralResponse,
|
UserCollateralResponse,
|
||||||
ArrayOfUserCollateralResponse,
|
ArrayOfUserCollateralResponse,
|
||||||
|
PaginationResponseForUserCollateralResponse,
|
||||||
|
Metadata,
|
||||||
UserDebtResponse,
|
UserDebtResponse,
|
||||||
ArrayOfUserDebtResponse,
|
ArrayOfUserDebtResponse,
|
||||||
UserHealthStatus,
|
UserHealthStatus,
|
||||||
@ -79,10 +82,25 @@ export const marsRedBankQueryKeys = {
|
|||||||
[
|
[
|
||||||
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args },
|
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals', args },
|
||||||
] as const,
|
] as const,
|
||||||
|
userCollateralsV2: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_collaterals_v2', args },
|
||||||
|
] as const,
|
||||||
userPosition: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
userPosition: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args },
|
{ ...marsRedBankQueryKeys.address(contractAddress)[0], method: 'user_position', args },
|
||||||
] as const,
|
] as const,
|
||||||
|
userPositionLiquidationPricing: (
|
||||||
|
contractAddress: string | undefined,
|
||||||
|
args?: Record<string, unknown>,
|
||||||
|
) =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...marsRedBankQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'user_position_liquidation_pricing',
|
||||||
|
args,
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
scaledLiquidityAmount: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -220,9 +238,34 @@ export function useMarsRedBankScaledLiquidityAmountQuery<TData = Uint128>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsRedBankUserPositionLiquidationPricingQuery<TData>
|
||||||
|
extends MarsRedBankReactQuery<UserPositionResponse, TData> {
|
||||||
|
args: {
|
||||||
|
accountId?: string
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsRedBankUserPositionLiquidationPricingQuery<TData = UserPositionResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsRedBankUserPositionLiquidationPricingQuery<TData>) {
|
||||||
|
return useQuery<UserPositionResponse, Error, TData>(
|
||||||
|
marsRedBankQueryKeys.userPositionLiquidationPricing(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.userPositionLiquidationPricing({
|
||||||
|
accountId: args.accountId,
|
||||||
|
user: args.user,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsRedBankUserPositionQuery<TData>
|
export interface MarsRedBankUserPositionQuery<TData>
|
||||||
extends MarsRedBankReactQuery<UserPositionResponse, TData> {
|
extends MarsRedBankReactQuery<UserPositionResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
|
accountId?: string
|
||||||
user: string
|
user: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,6 +279,33 @@ export function useMarsRedBankUserPositionQuery<TData = UserPositionResponse>({
|
|||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.userPosition({
|
? client.userPosition({
|
||||||
|
accountId: args.accountId,
|
||||||
|
user: args.user,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsRedBankUserCollateralsV2Query<TData>
|
||||||
|
extends MarsRedBankReactQuery<PaginationResponseForUserCollateralResponse, TData> {
|
||||||
|
args: {
|
||||||
|
accountId?: string
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsRedBankUserCollateralsV2Query<
|
||||||
|
TData = PaginationResponseForUserCollateralResponse,
|
||||||
|
>({ client, args, options }: MarsRedBankUserCollateralsV2Query<TData>) {
|
||||||
|
return useQuery<PaginationResponseForUserCollateralResponse, Error, TData>(
|
||||||
|
marsRedBankQueryKeys.userCollateralsV2(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.userCollateralsV2({
|
||||||
|
accountId: args.accountId,
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
user: args.user,
|
user: args.user,
|
||||||
})
|
})
|
||||||
: Promise.reject(new Error('Invalid client')),
|
: Promise.reject(new Error('Invalid client')),
|
||||||
@ -245,6 +315,7 @@ export function useMarsRedBankUserPositionQuery<TData = UserPositionResponse>({
|
|||||||
export interface MarsRedBankUserCollateralsQuery<TData>
|
export interface MarsRedBankUserCollateralsQuery<TData>
|
||||||
extends MarsRedBankReactQuery<ArrayOfUserCollateralResponse, TData> {
|
extends MarsRedBankReactQuery<ArrayOfUserCollateralResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
|
accountId?: string
|
||||||
limit?: number
|
limit?: number
|
||||||
startAfter?: string
|
startAfter?: string
|
||||||
user: string
|
user: string
|
||||||
@ -260,6 +331,7 @@ export function useMarsRedBankUserCollateralsQuery<TData = ArrayOfUserCollateral
|
|||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.userCollaterals({
|
? client.userCollaterals({
|
||||||
|
accountId: args.accountId,
|
||||||
limit: args.limit,
|
limit: args.limit,
|
||||||
startAfter: args.startAfter,
|
startAfter: args.startAfter,
|
||||||
user: args.user,
|
user: args.user,
|
||||||
@ -271,6 +343,7 @@ export function useMarsRedBankUserCollateralsQuery<TData = ArrayOfUserCollateral
|
|||||||
export interface MarsRedBankUserCollateralQuery<TData>
|
export interface MarsRedBankUserCollateralQuery<TData>
|
||||||
extends MarsRedBankReactQuery<UserCollateralResponse, TData> {
|
extends MarsRedBankReactQuery<UserCollateralResponse, TData> {
|
||||||
args: {
|
args: {
|
||||||
|
accountId?: string
|
||||||
denom: string
|
denom: string
|
||||||
user: string
|
user: string
|
||||||
}
|
}
|
||||||
@ -285,6 +358,7 @@ export function useMarsRedBankUserCollateralQuery<TData = UserCollateralResponse
|
|||||||
() =>
|
() =>
|
||||||
client
|
client
|
||||||
? client.userCollateral({
|
? client.userCollateral({
|
||||||
|
accountId: args.accountId,
|
||||||
denom: args.denom,
|
denom: args.denom,
|
||||||
user: args.user,
|
user: args.user,
|
||||||
})
|
})
|
||||||
@ -445,6 +519,26 @@ export function useMarsRedBankConfigQuery<TData = ConfigResponse>({
|
|||||||
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
export interface MarsRedBankMigrateMutation {
|
||||||
|
client: MarsRedBankClient
|
||||||
|
msg: MigrateV1ToV2
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsRedBankMigrateMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsRedBankMigrateMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsRedBankMigrateMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.migrate(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
export interface MarsRedBankUpdateAssetCollateralStatusMutation {
|
export interface MarsRedBankUpdateAssetCollateralStatusMutation {
|
||||||
client: MarsRedBankClient
|
client: MarsRedBankClient
|
||||||
msg: {
|
msg: {
|
||||||
@ -536,8 +630,10 @@ export function useMarsRedBankBorrowMutation(
|
|||||||
export interface MarsRedBankWithdrawMutation {
|
export interface MarsRedBankWithdrawMutation {
|
||||||
client: MarsRedBankClient
|
client: MarsRedBankClient
|
||||||
msg: {
|
msg: {
|
||||||
|
accountId?: string
|
||||||
amount?: Uint128
|
amount?: Uint128
|
||||||
denom: string
|
denom: string
|
||||||
|
liquidationRelated?: boolean
|
||||||
recipient?: string
|
recipient?: string
|
||||||
}
|
}
|
||||||
args?: {
|
args?: {
|
||||||
@ -560,6 +656,7 @@ export function useMarsRedBankWithdrawMutation(
|
|||||||
export interface MarsRedBankDepositMutation {
|
export interface MarsRedBankDepositMutation {
|
||||||
client: MarsRedBankClient
|
client: MarsRedBankClient
|
||||||
msg: {
|
msg: {
|
||||||
|
accountId?: string
|
||||||
onBehalfOf?: string
|
onBehalfOf?: string
|
||||||
}
|
}
|
||||||
args?: {
|
args?: {
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type Decimal = string
|
|
||||||
export interface InstantiateMsg {
|
export interface InstantiateMsg {
|
||||||
config: CreateOrUpdateConfig
|
config: CreateOrUpdateConfig
|
||||||
owner: string
|
owner: string
|
||||||
}
|
}
|
||||||
export interface CreateOrUpdateConfig {
|
export interface CreateOrUpdateConfig {
|
||||||
address_provider?: string | null
|
address_provider?: string | null
|
||||||
close_factor?: Decimal | null
|
|
||||||
}
|
}
|
||||||
export type ExecuteMsg =
|
export type ExecuteMsg =
|
||||||
| {
|
| {
|
||||||
@ -44,13 +42,16 @@ export type ExecuteMsg =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
deposit: {
|
deposit: {
|
||||||
|
account_id?: string | null
|
||||||
on_behalf_of?: string | null
|
on_behalf_of?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
withdraw: {
|
withdraw: {
|
||||||
|
account_id?: string | null
|
||||||
amount?: Uint128 | null
|
amount?: Uint128 | null
|
||||||
denom: string
|
denom: string
|
||||||
|
liquidation_related?: boolean | null
|
||||||
recipient?: string | null
|
recipient?: string | null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,6 +80,9 @@ export type ExecuteMsg =
|
|||||||
enable: boolean
|
enable: boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
migrate: MigrateV1ToV2
|
||||||
|
}
|
||||||
export type OwnerUpdate =
|
export type OwnerUpdate =
|
||||||
| {
|
| {
|
||||||
propose_new_owner: {
|
propose_new_owner: {
|
||||||
@ -94,15 +98,19 @@ export type OwnerUpdate =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
| 'clear_emergency_owner'
|
| 'clear_emergency_owner'
|
||||||
|
export type Decimal = string
|
||||||
export type Uint128 = string
|
export type Uint128 = string
|
||||||
|
export type MigrateV1ToV2 =
|
||||||
|
| {
|
||||||
|
collaterals: {
|
||||||
|
limit: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
clear_v1_state: {}
|
||||||
|
}
|
||||||
export interface InitOrUpdateAssetParams {
|
export interface InitOrUpdateAssetParams {
|
||||||
borrow_enabled?: boolean | null
|
|
||||||
deposit_cap?: Uint128 | null
|
|
||||||
deposit_enabled?: boolean | null
|
|
||||||
interest_rate_model?: InterestRateModel | null
|
interest_rate_model?: InterestRateModel | null
|
||||||
liquidation_bonus?: Decimal | null
|
|
||||||
liquidation_threshold?: Decimal | null
|
|
||||||
max_loan_to_value?: Decimal | null
|
|
||||||
reserve_factor?: Decimal | null
|
reserve_factor?: Decimal | null
|
||||||
}
|
}
|
||||||
export interface InterestRateModel {
|
export interface InterestRateModel {
|
||||||
@ -154,12 +162,22 @@ export type QueryMsg =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
user_collateral: {
|
user_collateral: {
|
||||||
|
account_id?: string | null
|
||||||
denom: string
|
denom: string
|
||||||
user: string
|
user: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
user_collaterals: {
|
user_collaterals: {
|
||||||
|
account_id?: string | null
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: string | null
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_collaterals_v2: {
|
||||||
|
account_id?: string | null
|
||||||
limit?: number | null
|
limit?: number | null
|
||||||
start_after?: string | null
|
start_after?: string | null
|
||||||
user: string
|
user: string
|
||||||
@ -167,6 +185,13 @@ export type QueryMsg =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
user_position: {
|
user_position: {
|
||||||
|
account_id?: string | null
|
||||||
|
user: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
user_position_liquidation_pricing: {
|
||||||
|
account_id?: string | null
|
||||||
user: string
|
user: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,27 +221,19 @@ export type QueryMsg =
|
|||||||
}
|
}
|
||||||
export interface ConfigResponse {
|
export interface ConfigResponse {
|
||||||
address_provider: string
|
address_provider: string
|
||||||
close_factor: Decimal
|
|
||||||
emergency_owner?: string | null
|
|
||||||
owner?: string | null
|
owner?: string | null
|
||||||
proposed_new_owner?: string | null
|
proposed_new_owner?: string | null
|
||||||
}
|
}
|
||||||
export interface Market {
|
export interface Market {
|
||||||
borrow_enabled: boolean
|
|
||||||
borrow_index: Decimal
|
borrow_index: Decimal
|
||||||
borrow_rate: Decimal
|
borrow_rate: Decimal
|
||||||
collateral_total_scaled: Uint128
|
collateral_total_scaled: Uint128
|
||||||
debt_total_scaled: Uint128
|
debt_total_scaled: Uint128
|
||||||
denom: string
|
denom: string
|
||||||
deposit_cap: Uint128
|
|
||||||
deposit_enabled: boolean
|
|
||||||
indexes_last_updated: number
|
indexes_last_updated: number
|
||||||
interest_rate_model: InterestRateModel
|
interest_rate_model: InterestRateModel
|
||||||
liquidation_bonus: Decimal
|
|
||||||
liquidation_threshold: Decimal
|
|
||||||
liquidity_index: Decimal
|
liquidity_index: Decimal
|
||||||
liquidity_rate: Decimal
|
liquidity_rate: Decimal
|
||||||
max_loan_to_value: Decimal
|
|
||||||
reserve_factor: Decimal
|
reserve_factor: Decimal
|
||||||
}
|
}
|
||||||
export type ArrayOfMarket = Market[]
|
export type ArrayOfMarket = Market[]
|
||||||
@ -232,6 +249,13 @@ export interface UserCollateralResponse {
|
|||||||
enabled: boolean
|
enabled: boolean
|
||||||
}
|
}
|
||||||
export type ArrayOfUserCollateralResponse = UserCollateralResponse[]
|
export type ArrayOfUserCollateralResponse = UserCollateralResponse[]
|
||||||
|
export interface PaginationResponseForUserCollateralResponse {
|
||||||
|
data: UserCollateralResponse[]
|
||||||
|
metadata: Metadata
|
||||||
|
}
|
||||||
|
export interface Metadata {
|
||||||
|
has_more: boolean
|
||||||
|
}
|
||||||
export interface UserDebtResponse {
|
export interface UserDebtResponse {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
amount_scaled: Uint128
|
amount_scaled: Uint128
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _12 from './MarsRedBank.types'
|
import * as _27 from './MarsRedBank.types'
|
||||||
import * as _13 from './MarsRedBank.client'
|
import * as _28 from './MarsRedBank.client'
|
||||||
import * as _14 from './MarsRedBank.react-query'
|
import * as _29 from './MarsRedBank.react-query'
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsRedBank = { ..._12, ..._13, ..._14 }
|
export const MarsRedBank = { ..._27, ..._28, ..._29 }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -11,6 +11,7 @@ import {
|
|||||||
Decimal,
|
Decimal,
|
||||||
Uint128,
|
Uint128,
|
||||||
AccountKind,
|
AccountKind,
|
||||||
|
PnL,
|
||||||
VaultPositionAmount,
|
VaultPositionAmount,
|
||||||
VaultAmount,
|
VaultAmount,
|
||||||
VaultAmount1,
|
VaultAmount1,
|
||||||
@ -25,6 +26,11 @@ import {
|
|||||||
Positions,
|
Positions,
|
||||||
DebtAmount,
|
DebtAmount,
|
||||||
Coin,
|
Coin,
|
||||||
|
PerpPosition,
|
||||||
|
PositionPnl,
|
||||||
|
PnlCoins,
|
||||||
|
PnlValues,
|
||||||
|
SignedDecimal,
|
||||||
VaultPosition,
|
VaultPosition,
|
||||||
LockingVaultAmount,
|
LockingVaultAmount,
|
||||||
VaultUnlockingPosition,
|
VaultUnlockingPosition,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -11,6 +11,7 @@ import {
|
|||||||
Decimal,
|
Decimal,
|
||||||
Uint128,
|
Uint128,
|
||||||
AccountKind,
|
AccountKind,
|
||||||
|
PnL,
|
||||||
VaultPositionAmount,
|
VaultPositionAmount,
|
||||||
VaultAmount,
|
VaultAmount,
|
||||||
VaultAmount1,
|
VaultAmount1,
|
||||||
@ -25,6 +26,11 @@ import {
|
|||||||
Positions,
|
Positions,
|
||||||
DebtAmount,
|
DebtAmount,
|
||||||
Coin,
|
Coin,
|
||||||
|
PerpPosition,
|
||||||
|
PositionPnl,
|
||||||
|
PnlCoins,
|
||||||
|
PnlValues,
|
||||||
|
SignedDecimal,
|
||||||
VaultPosition,
|
VaultPosition,
|
||||||
LockingVaultAmount,
|
LockingVaultAmount,
|
||||||
VaultUnlockingPosition,
|
VaultUnlockingPosition,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -20,6 +20,14 @@ export type Addr = string
|
|||||||
export type Decimal = string
|
export type Decimal = string
|
||||||
export type Uint128 = string
|
export type Uint128 = string
|
||||||
export type AccountKind = 'default' | 'high_levered_strategy'
|
export type AccountKind = 'default' | 'high_levered_strategy'
|
||||||
|
export type PnL =
|
||||||
|
| 'break_even'
|
||||||
|
| {
|
||||||
|
profit: Coin
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
loss: Coin
|
||||||
|
}
|
||||||
export type VaultPositionAmount =
|
export type VaultPositionAmount =
|
||||||
| {
|
| {
|
||||||
unlocked: VaultAmount
|
unlocked: VaultAmount
|
||||||
@ -78,6 +86,7 @@ export interface Positions {
|
|||||||
debts: DebtAmount[]
|
debts: DebtAmount[]
|
||||||
deposits: Coin[]
|
deposits: Coin[]
|
||||||
lends: Coin[]
|
lends: Coin[]
|
||||||
|
perps: PerpPosition[]
|
||||||
vaults: VaultPosition[]
|
vaults: VaultPosition[]
|
||||||
}
|
}
|
||||||
export interface DebtAmount {
|
export interface DebtAmount {
|
||||||
@ -90,6 +99,34 @@ export interface Coin {
|
|||||||
denom: string
|
denom: string
|
||||||
[k: string]: unknown
|
[k: string]: unknown
|
||||||
}
|
}
|
||||||
|
export interface PerpPosition {
|
||||||
|
base_denom: string
|
||||||
|
closing_fee_rate: Decimal
|
||||||
|
current_price: Decimal
|
||||||
|
denom: string
|
||||||
|
entry_price: Decimal
|
||||||
|
pnl: PositionPnl
|
||||||
|
size: SignedDecimal
|
||||||
|
}
|
||||||
|
export interface PositionPnl {
|
||||||
|
coins: PnlCoins
|
||||||
|
values: PnlValues
|
||||||
|
}
|
||||||
|
export interface PnlCoins {
|
||||||
|
closing_fee: Coin
|
||||||
|
pnl: PnL
|
||||||
|
}
|
||||||
|
export interface PnlValues {
|
||||||
|
accrued_funding: SignedDecimal
|
||||||
|
closing_fee: SignedDecimal
|
||||||
|
pnl: SignedDecimal
|
||||||
|
price_pnl: SignedDecimal
|
||||||
|
}
|
||||||
|
export interface SignedDecimal {
|
||||||
|
abs: Decimal
|
||||||
|
negative: boolean
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
export interface VaultPosition {
|
export interface VaultPosition {
|
||||||
amount: VaultPositionAmount
|
amount: VaultPositionAmount
|
||||||
vault: VaultBaseForAddr
|
vault: VaultBaseForAddr
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.33.0.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _32 from './MarsRoverHealthComputer.types'
|
import * as _36 from './MarsRoverHealthComputer.types'
|
||||||
import * as _33 from './MarsRoverHealthComputer.client'
|
import * as _37 from './MarsRoverHealthComputer.client'
|
||||||
import * as _34 from './MarsRoverHealthComputer.message-composer'
|
import * as _38 from './MarsRoverHealthComputer.react-query'
|
||||||
import * as _35 from './MarsRoverHealthComputer.react-query'
|
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsRoverHealthComputer = { ..._32, ..._33, ..._34, ..._35 }
|
export const MarsRoverHealthComputer = { ..._36, ..._37, ..._38 }
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,289 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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,
|
||||||
|
OwnerUpdate,
|
||||||
|
SwapOperation,
|
||||||
|
AssetInfo,
|
||||||
|
Addr,
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
AstroportRoute,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
OwnerResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
Empty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperAstroport.types'
|
||||||
|
export interface MarsSwapperAstroportReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
owner: () => Promise<OwnerResponse>
|
||||||
|
route: ({
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
}) => Promise<RouteResponseForEmpty>
|
||||||
|
routes: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}) => Promise<ArrayOfRouteResponseForEmpty>
|
||||||
|
estimateExactInSwap: ({
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
}) => Promise<EstimateExactInSwapResponse>
|
||||||
|
}
|
||||||
|
export class MarsSwapperAstroportQueryClient implements MarsSwapperAstroportReadOnlyInterface {
|
||||||
|
client: CosmWasmClient
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||||
|
this.client = client
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.owner = this.owner.bind(this)
|
||||||
|
this.route = this.route.bind(this)
|
||||||
|
this.routes = this.routes.bind(this)
|
||||||
|
this.estimateExactInSwap = this.estimateExactInSwap.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
owner = async (): Promise<OwnerResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
owner: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
route = async ({
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
}): Promise<RouteResponseForEmpty> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
route: {
|
||||||
|
denom_in: denomIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
routes = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}): Promise<ArrayOfRouteResponseForEmpty> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
routes: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
estimateExactInSwap = async ({
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
}): Promise<EstimateExactInSwapResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
estimate_exact_in_swap: {
|
||||||
|
coin_in: coinIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportInterface extends MarsSwapperAstroportReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateOwner: (
|
||||||
|
ownerUpdate: OwnerUpdate,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
setRoute: (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
route,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: AstroportRoute
|
||||||
|
},
|
||||||
|
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 MarsSwapperAstroportClient
|
||||||
|
extends MarsSwapperAstroportQueryClient
|
||||||
|
implements MarsSwapperAstroportInterface
|
||||||
|
{
|
||||||
|
client: SigningCosmWasmClient
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||||
|
super(client, contractAddress)
|
||||||
|
this.client = client
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateOwner = this.updateOwner.bind(this)
|
||||||
|
this.setRoute = this.setRoute.bind(this)
|
||||||
|
this.swapExactIn = this.swapExactIn.bind(this)
|
||||||
|
this.transferResult = this.transferResult.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOwner = async (
|
||||||
|
ownerUpdate: OwnerUpdate,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_owner: ownerUpdate,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
setRoute = async (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
route,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: AstroportRoute
|
||||||
|
},
|
||||||
|
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,245 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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,
|
||||||
|
OwnerUpdate,
|
||||||
|
SwapOperation,
|
||||||
|
AssetInfo,
|
||||||
|
Addr,
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
AstroportRoute,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
OwnerResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
Empty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperAstroport.types'
|
||||||
|
import {
|
||||||
|
MarsSwapperAstroportQueryClient,
|
||||||
|
MarsSwapperAstroportClient,
|
||||||
|
} from './MarsSwapperAstroport.client'
|
||||||
|
export const marsSwapperAstroportQueryKeys = {
|
||||||
|
contract: [
|
||||||
|
{
|
||||||
|
contract: 'marsSwapperAstroport',
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
address: (contractAddress: string | undefined) =>
|
||||||
|
[{ ...marsSwapperAstroportQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
|
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsSwapperAstroportQueryKeys.address(contractAddress)[0], method: 'owner', args },
|
||||||
|
] as const,
|
||||||
|
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsSwapperAstroportQueryKeys.address(contractAddress)[0], method: 'route', args },
|
||||||
|
] as const,
|
||||||
|
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{ ...marsSwapperAstroportQueryKeys.address(contractAddress)[0], method: 'routes', args },
|
||||||
|
] as const,
|
||||||
|
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...marsSwapperAstroportQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'estimate_exact_in_swap',
|
||||||
|
args,
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportReactQuery<TResponse, TData = TResponse> {
|
||||||
|
client: MarsSwapperAstroportQueryClient | undefined
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
|
> & {
|
||||||
|
initialData?: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportEstimateExactInSwapQuery<TData>
|
||||||
|
extends MarsSwapperAstroportReactQuery<EstimateExactInSwapResponse, TData> {
|
||||||
|
args: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportEstimateExactInSwapQuery<
|
||||||
|
TData = EstimateExactInSwapResponse,
|
||||||
|
>({ client, args, options }: MarsSwapperAstroportEstimateExactInSwapQuery<TData>) {
|
||||||
|
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||||
|
marsSwapperAstroportQueryKeys.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 MarsSwapperAstroportRoutesQuery<TData>
|
||||||
|
extends MarsSwapperAstroportReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperAstroportRoutesQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||||
|
marsSwapperAstroportQueryKeys.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 MarsSwapperAstroportRouteQuery<TData>
|
||||||
|
extends MarsSwapperAstroportReactQuery<RouteResponseForEmpty, TData> {
|
||||||
|
args: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportRouteQuery<TData = RouteResponseForEmpty>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperAstroportRouteQuery<TData>) {
|
||||||
|
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||||
|
marsSwapperAstroportQueryKeys.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 MarsSwapperAstroportOwnerQuery<TData>
|
||||||
|
extends MarsSwapperAstroportReactQuery<OwnerResponse, TData> {}
|
||||||
|
export function useMarsSwapperAstroportOwnerQuery<TData = OwnerResponse>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperAstroportOwnerQuery<TData>) {
|
||||||
|
return useQuery<OwnerResponse, Error, TData>(
|
||||||
|
marsSwapperAstroportQueryKeys.owner(client?.contractAddress),
|
||||||
|
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportTransferResultMutation {
|
||||||
|
client: MarsSwapperAstroportClient
|
||||||
|
msg: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
recipient: Addr
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportTransferResultMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperAstroportTransferResultMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperAstroportTransferResultMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.transferResult(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportSwapExactInMutation {
|
||||||
|
client: MarsSwapperAstroportClient
|
||||||
|
msg: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
slippage: Decimal
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportSwapExactInMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperAstroportSwapExactInMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperAstroportSwapExactInMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportSetRouteMutation {
|
||||||
|
client: MarsSwapperAstroportClient
|
||||||
|
msg: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: AstroportRoute
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportSetRouteMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperAstroportSetRouteMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperAstroportSetRouteMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperAstroportUpdateOwnerMutation {
|
||||||
|
client: MarsSwapperAstroportClient
|
||||||
|
msg: OwnerUpdate
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperAstroportUpdateOwnerMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperAstroportUpdateOwnerMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperAstroportUpdateOwnerMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface InstantiateMsg {
|
||||||
|
owner: string
|
||||||
|
}
|
||||||
|
export type ExecuteMsg =
|
||||||
|
| {
|
||||||
|
update_owner: OwnerUpdate
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
set_route: {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
route: AstroportRoute
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
swap_exact_in: {
|
||||||
|
coin_in: Coin
|
||||||
|
denom_out: string
|
||||||
|
slippage: Decimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
transfer_result: {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
recipient: Addr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type OwnerUpdate =
|
||||||
|
| {
|
||||||
|
propose_new_owner: {
|
||||||
|
proposed: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'clear_proposed'
|
||||||
|
| 'accept_proposed'
|
||||||
|
| 'abolish_owner_role'
|
||||||
|
| {
|
||||||
|
set_emergency_owner: {
|
||||||
|
emergency_owner: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'clear_emergency_owner'
|
||||||
|
export type SwapOperation =
|
||||||
|
| {
|
||||||
|
native_swap: {
|
||||||
|
ask_denom: string
|
||||||
|
offer_denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
astro_swap: {
|
||||||
|
ask_asset_info: AssetInfo
|
||||||
|
offer_asset_info: AssetInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type AssetInfo =
|
||||||
|
| {
|
||||||
|
token: {
|
||||||
|
contract_addr: Addr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
native_token: {
|
||||||
|
denom: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type Addr = string
|
||||||
|
export type Uint128 = string
|
||||||
|
export type Decimal = string
|
||||||
|
export interface AstroportRoute {
|
||||||
|
factory: string
|
||||||
|
operations: SwapOperation[]
|
||||||
|
oracle: string
|
||||||
|
router: string
|
||||||
|
}
|
||||||
|
export interface Coin {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export type QueryMsg =
|
||||||
|
| {
|
||||||
|
owner: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
route: {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
routes: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: [string, string] | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
estimate_exact_in_swap: {
|
||||||
|
coin_in: Coin
|
||||||
|
denom_out: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface EstimateExactInSwapResponse {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
export interface OwnerResponse {
|
||||||
|
abolished: boolean
|
||||||
|
emergency_owner?: string | null
|
||||||
|
initialized: boolean
|
||||||
|
owner?: string | null
|
||||||
|
proposed?: string | null
|
||||||
|
}
|
||||||
|
export interface RouteResponseForEmpty {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
route: Empty
|
||||||
|
}
|
||||||
|
export interface Empty {
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export type ArrayOfRouteResponseForEmpty = RouteResponseForEmpty[]
|
13
src/types/generated/mars-swapper-astroport/bundle.ts
Normal file
13
src/types/generated/mars-swapper-astroport/bundle.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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 _39 from './MarsSwapperAstroport.types'
|
||||||
|
import * as _40 from './MarsSwapperAstroport.client'
|
||||||
|
import * as _41 from './MarsSwapperAstroport.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsSwapperAstroport = { ..._39, ..._40, ..._41 }
|
||||||
|
}
|
286
src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts
Normal file
286
src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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,
|
||||||
|
OwnerUpdate,
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
Addr,
|
||||||
|
Empty,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
OwnerResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperBase.types'
|
||||||
|
export interface MarsSwapperBaseReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
owner: () => Promise<OwnerResponse>
|
||||||
|
route: ({
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
}) => Promise<RouteResponseForEmpty>
|
||||||
|
routes: ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}) => Promise<ArrayOfRouteResponseForEmpty>
|
||||||
|
estimateExactInSwap: ({
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
}) => Promise<EstimateExactInSwapResponse>
|
||||||
|
}
|
||||||
|
export class MarsSwapperBaseQueryClient implements MarsSwapperBaseReadOnlyInterface {
|
||||||
|
client: CosmWasmClient
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: CosmWasmClient, contractAddress: string) {
|
||||||
|
this.client = client
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.owner = this.owner.bind(this)
|
||||||
|
this.route = this.route.bind(this)
|
||||||
|
this.routes = this.routes.bind(this)
|
||||||
|
this.estimateExactInSwap = this.estimateExactInSwap.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
owner = async (): Promise<OwnerResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
owner: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
route = async ({
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
}): Promise<RouteResponseForEmpty> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
route: {
|
||||||
|
denom_in: denomIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
routes = async ({
|
||||||
|
limit,
|
||||||
|
startAfter,
|
||||||
|
}: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}): Promise<ArrayOfRouteResponseForEmpty> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
routes: {
|
||||||
|
limit,
|
||||||
|
start_after: startAfter,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
estimateExactInSwap = async ({
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
}): Promise<EstimateExactInSwapResponse> => {
|
||||||
|
return this.client.queryContractSmart(this.contractAddress, {
|
||||||
|
estimate_exact_in_swap: {
|
||||||
|
coin_in: coinIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseInterface extends MarsSwapperBaseReadOnlyInterface {
|
||||||
|
contractAddress: string
|
||||||
|
sender: string
|
||||||
|
updateOwner: (
|
||||||
|
ownerUpdate: OwnerUpdate,
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
setRoute: (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
route,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: Empty
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
swapExactIn: (
|
||||||
|
{
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
slippage,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
slippage: Decimal
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
transferResult: (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
recipient: Addr
|
||||||
|
},
|
||||||
|
fee?: number | StdFee | 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
) => Promise<ExecuteResult>
|
||||||
|
}
|
||||||
|
export class MarsSwapperBaseClient
|
||||||
|
extends MarsSwapperBaseQueryClient
|
||||||
|
implements MarsSwapperBaseInterface
|
||||||
|
{
|
||||||
|
client: SigningCosmWasmClient
|
||||||
|
sender: string
|
||||||
|
contractAddress: string
|
||||||
|
|
||||||
|
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
|
||||||
|
super(client, contractAddress)
|
||||||
|
this.client = client
|
||||||
|
this.sender = sender
|
||||||
|
this.contractAddress = contractAddress
|
||||||
|
this.updateOwner = this.updateOwner.bind(this)
|
||||||
|
this.setRoute = this.setRoute.bind(this)
|
||||||
|
this.swapExactIn = this.swapExactIn.bind(this)
|
||||||
|
this.transferResult = this.transferResult.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOwner = async (
|
||||||
|
ownerUpdate: OwnerUpdate,
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
update_owner: ownerUpdate,
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
setRoute = async (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
route,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: Empty
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
set_route: {
|
||||||
|
denom_in: denomIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
route,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
swapExactIn = async (
|
||||||
|
{
|
||||||
|
coinIn,
|
||||||
|
denomOut,
|
||||||
|
slippage,
|
||||||
|
}: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
slippage: Decimal
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
swap_exact_in: {
|
||||||
|
coin_in: coinIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
slippage,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
transferResult = async (
|
||||||
|
{
|
||||||
|
denomIn,
|
||||||
|
denomOut,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
recipient: Addr
|
||||||
|
},
|
||||||
|
fee: number | StdFee | 'auto' = 'auto',
|
||||||
|
memo?: string,
|
||||||
|
_funds?: Coin[],
|
||||||
|
): Promise<ExecuteResult> => {
|
||||||
|
return await this.client.execute(
|
||||||
|
this.sender,
|
||||||
|
this.contractAddress,
|
||||||
|
{
|
||||||
|
transfer_result: {
|
||||||
|
denom_in: denomIn,
|
||||||
|
denom_out: denomOut,
|
||||||
|
recipient,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fee,
|
||||||
|
memo,
|
||||||
|
_funds,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,235 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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,
|
||||||
|
OwnerUpdate,
|
||||||
|
Uint128,
|
||||||
|
Decimal,
|
||||||
|
Addr,
|
||||||
|
Empty,
|
||||||
|
Coin,
|
||||||
|
QueryMsg,
|
||||||
|
EstimateExactInSwapResponse,
|
||||||
|
OwnerResponse,
|
||||||
|
RouteResponseForEmpty,
|
||||||
|
ArrayOfRouteResponseForEmpty,
|
||||||
|
} from './MarsSwapperBase.types'
|
||||||
|
import { MarsSwapperBaseQueryClient, MarsSwapperBaseClient } from './MarsSwapperBase.client'
|
||||||
|
export const marsSwapperBaseQueryKeys = {
|
||||||
|
contract: [
|
||||||
|
{
|
||||||
|
contract: 'marsSwapperBase',
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
address: (contractAddress: string | undefined) =>
|
||||||
|
[{ ...marsSwapperBaseQueryKeys.contract[0], address: contractAddress }] as const,
|
||||||
|
owner: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const,
|
||||||
|
route: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'route', args }] as const,
|
||||||
|
routes: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[{ ...marsSwapperBaseQueryKeys.address(contractAddress)[0], method: 'routes', args }] as const,
|
||||||
|
estimateExactInSwap: (contractAddress: string | undefined, args?: Record<string, unknown>) =>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...marsSwapperBaseQueryKeys.address(contractAddress)[0],
|
||||||
|
method: 'estimate_exact_in_swap',
|
||||||
|
args,
|
||||||
|
},
|
||||||
|
] as const,
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseReactQuery<TResponse, TData = TResponse> {
|
||||||
|
client: MarsSwapperBaseQueryClient | undefined
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<TResponse, Error, TData>,
|
||||||
|
"'queryKey' | 'queryFn' | 'initialData'"
|
||||||
|
> & {
|
||||||
|
initialData?: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseEstimateExactInSwapQuery<TData>
|
||||||
|
extends MarsSwapperBaseReactQuery<EstimateExactInSwapResponse, TData> {
|
||||||
|
args: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseEstimateExactInSwapQuery<TData = EstimateExactInSwapResponse>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperBaseEstimateExactInSwapQuery<TData>) {
|
||||||
|
return useQuery<EstimateExactInSwapResponse, Error, TData>(
|
||||||
|
marsSwapperBaseQueryKeys.estimateExactInSwap(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.estimateExactInSwap({
|
||||||
|
coinIn: args.coinIn,
|
||||||
|
denomOut: args.denomOut,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseRoutesQuery<TData>
|
||||||
|
extends MarsSwapperBaseReactQuery<ArrayOfRouteResponseForEmpty, TData> {
|
||||||
|
args: {
|
||||||
|
limit?: number
|
||||||
|
startAfter?: string[][]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseRoutesQuery<TData = ArrayOfRouteResponseForEmpty>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperBaseRoutesQuery<TData>) {
|
||||||
|
return useQuery<ArrayOfRouteResponseForEmpty, Error, TData>(
|
||||||
|
marsSwapperBaseQueryKeys.routes(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.routes({
|
||||||
|
limit: args.limit,
|
||||||
|
startAfter: args.startAfter,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseRouteQuery<TData>
|
||||||
|
extends MarsSwapperBaseReactQuery<RouteResponseForEmpty, TData> {
|
||||||
|
args: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseRouteQuery<TData = RouteResponseForEmpty>({
|
||||||
|
client,
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperBaseRouteQuery<TData>) {
|
||||||
|
return useQuery<RouteResponseForEmpty, Error, TData>(
|
||||||
|
marsSwapperBaseQueryKeys.route(client?.contractAddress, args),
|
||||||
|
() =>
|
||||||
|
client
|
||||||
|
? client.route({
|
||||||
|
denomIn: args.denomIn,
|
||||||
|
denomOut: args.denomOut,
|
||||||
|
})
|
||||||
|
: Promise.reject(new Error('Invalid client')),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseOwnerQuery<TData>
|
||||||
|
extends MarsSwapperBaseReactQuery<OwnerResponse, TData> {}
|
||||||
|
export function useMarsSwapperBaseOwnerQuery<TData = OwnerResponse>({
|
||||||
|
client,
|
||||||
|
options,
|
||||||
|
}: MarsSwapperBaseOwnerQuery<TData>) {
|
||||||
|
return useQuery<OwnerResponse, Error, TData>(
|
||||||
|
marsSwapperBaseQueryKeys.owner(client?.contractAddress),
|
||||||
|
() => (client ? client.owner() : Promise.reject(new Error('Invalid client'))),
|
||||||
|
{ ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseTransferResultMutation {
|
||||||
|
client: MarsSwapperBaseClient
|
||||||
|
msg: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
recipient: Addr
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseTransferResultMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseTransferResultMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) =>
|
||||||
|
client.transferResult(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseSwapExactInMutation {
|
||||||
|
client: MarsSwapperBaseClient
|
||||||
|
msg: {
|
||||||
|
coinIn: Coin
|
||||||
|
denomOut: string
|
||||||
|
slippage: Decimal
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseSwapExactInMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseSwapExactInMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.swapExactIn(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseSetRouteMutation {
|
||||||
|
client: MarsSwapperBaseClient
|
||||||
|
msg: {
|
||||||
|
denomIn: string
|
||||||
|
denomOut: string
|
||||||
|
route: Empty
|
||||||
|
}
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseSetRouteMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseSetRouteMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.setRoute(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export interface MarsSwapperBaseUpdateOwnerMutation {
|
||||||
|
client: MarsSwapperBaseClient
|
||||||
|
msg: OwnerUpdate
|
||||||
|
args?: {
|
||||||
|
fee?: number | StdFee | 'auto'
|
||||||
|
memo?: string
|
||||||
|
funds?: Coin[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function useMarsSwapperBaseUpdateOwnerMutation(
|
||||||
|
options?: Omit<
|
||||||
|
UseMutationOptions<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>,
|
||||||
|
'mutationFn'
|
||||||
|
>,
|
||||||
|
) {
|
||||||
|
return useMutation<ExecuteResult, Error, MarsSwapperBaseUpdateOwnerMutation>(
|
||||||
|
({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds),
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface InstantiateMsg {
|
||||||
|
owner: string
|
||||||
|
}
|
||||||
|
export type ExecuteMsg =
|
||||||
|
| {
|
||||||
|
update_owner: OwnerUpdate
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
set_route: {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
route: Empty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
swap_exact_in: {
|
||||||
|
coin_in: Coin
|
||||||
|
denom_out: string
|
||||||
|
slippage: Decimal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
transfer_result: {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
recipient: Addr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export type OwnerUpdate =
|
||||||
|
| {
|
||||||
|
propose_new_owner: {
|
||||||
|
proposed: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'clear_proposed'
|
||||||
|
| 'accept_proposed'
|
||||||
|
| 'abolish_owner_role'
|
||||||
|
| {
|
||||||
|
set_emergency_owner: {
|
||||||
|
emergency_owner: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| 'clear_emergency_owner'
|
||||||
|
export type Uint128 = string
|
||||||
|
export type Decimal = string
|
||||||
|
export type Addr = string
|
||||||
|
export interface Empty {
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export interface Coin {
|
||||||
|
amount: Uint128
|
||||||
|
denom: string
|
||||||
|
[k: string]: unknown
|
||||||
|
}
|
||||||
|
export type QueryMsg =
|
||||||
|
| {
|
||||||
|
owner: {}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
route: {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
routes: {
|
||||||
|
limit?: number | null
|
||||||
|
start_after?: [string, string] | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
estimate_exact_in_swap: {
|
||||||
|
coin_in: Coin
|
||||||
|
denom_out: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface EstimateExactInSwapResponse {
|
||||||
|
amount: Uint128
|
||||||
|
}
|
||||||
|
export interface OwnerResponse {
|
||||||
|
abolished: boolean
|
||||||
|
emergency_owner?: string | null
|
||||||
|
initialized: boolean
|
||||||
|
owner?: string | null
|
||||||
|
proposed?: string | null
|
||||||
|
}
|
||||||
|
export interface RouteResponseForEmpty {
|
||||||
|
denom_in: string
|
||||||
|
denom_out: string
|
||||||
|
route: Empty
|
||||||
|
}
|
||||||
|
export type ArrayOfRouteResponseForEmpty = RouteResponseForEmpty[]
|
13
src/types/generated/mars-swapper-base/bundle.ts
Normal file
13
src/types/generated/mars-swapper-base/bundle.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
|
* 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 _42 from './MarsSwapperBase.types'
|
||||||
|
import * as _43 from './MarsSwapperBase.client'
|
||||||
|
import * as _44 from './MarsSwapperBase.react-query'
|
||||||
|
export namespace contracts {
|
||||||
|
export const MarsSwapperBase = { ..._42, ..._43, ..._44 }
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
@ -55,7 +55,6 @@ export type Addr = string
|
|||||||
export interface SwapAmountInRoute {
|
export interface SwapAmountInRoute {
|
||||||
pool_id: number
|
pool_id: number
|
||||||
token_out_denom: string
|
token_out_denom: string
|
||||||
[k: string]: unknown
|
|
||||||
}
|
}
|
||||||
export interface Coin {
|
export interface Coin {
|
||||||
amount: Uint128
|
amount: Uint128
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.30.1.
|
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
|
||||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as _21 from './MarsSwapperOsmosis.types'
|
import * as _45 from './MarsSwapperOsmosis.types'
|
||||||
import * as _22 from './MarsSwapperOsmosis.client'
|
import * as _46 from './MarsSwapperOsmosis.client'
|
||||||
import * as _23 from './MarsSwapperOsmosis.react-query'
|
import * as _47 from './MarsSwapperOsmosis.react-query'
|
||||||
export namespace contracts {
|
export namespace contracts {
|
||||||
export const MarsSwapperOsmosis = { ..._21, ..._22, ..._23 }
|
export const MarsSwapperOsmosis = { ..._45, ..._46, ..._47 }
|
||||||
}
|
}
|
||||||
|
1
src/types/interfaces/account.d.ts
vendored
1
src/types/interfaces/account.d.ts
vendored
@ -4,6 +4,7 @@ interface Account extends AccountChange {
|
|||||||
debts: BNCoin[]
|
debts: BNCoin[]
|
||||||
lends: BNCoin[]
|
lends: BNCoin[]
|
||||||
vaults: DepositedVault[]
|
vaults: DepositedVault[]
|
||||||
|
perps: PerpPosition[]
|
||||||
kind: AccountKind
|
kind: AccountKind
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
src/types/interfaces/asset.d.ts
vendored
1
src/types/interfaces/asset.d.ts
vendored
@ -1,6 +1,7 @@
|
|||||||
interface Asset extends AssetMetaData {
|
interface Asset extends AssetMetaData {
|
||||||
denom: string
|
denom: string
|
||||||
poolId?: number
|
poolId?: number
|
||||||
|
isPerpsEnabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AssetMetaData {
|
interface AssetMetaData {
|
||||||
|
13
src/types/interfaces/chain.d.ts
vendored
13
src/types/interfaces/chain.d.ts
vendored
@ -9,7 +9,7 @@ interface ChainConfig {
|
|||||||
params: string
|
params: string
|
||||||
creditManager: string
|
creditManager: string
|
||||||
accountNft: string
|
accountNft: string
|
||||||
perps?: string
|
perps: string
|
||||||
pyth: string
|
pyth: string
|
||||||
}
|
}
|
||||||
defaultCurrency: {
|
defaultCurrency: {
|
||||||
@ -48,3 +48,14 @@ interface ChainConfig {
|
|||||||
perps: boolean
|
perps: boolean
|
||||||
farm: boolean
|
farm: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ContractClients {
|
||||||
|
accountNft: import('types/generated/mars-account-nft/MarsAccountNft.client').MarsAccountNftQueryClient
|
||||||
|
creditManager: import('types/generated/mars-credit-manager/MarsCreditManager.client').MarsCreditManagerQueryClient
|
||||||
|
incentives: import('types/generated/mars-incentives/MarsIncentives.client').MarsIncentivesQueryClient
|
||||||
|
oracle: import('types/generated/mars-oracle-osmosis/MarsOracleOsmosis.client').MarsOracleOsmosisQueryClient
|
||||||
|
params: import('types/generated/mars-params/MarsParams.client').MarsParamsQueryClient
|
||||||
|
perps: import('types/generated/mars-perps/MarsPerps.client').MarsPerpsQueryClient
|
||||||
|
redBank: import('types/generated/mars-red-bank/MarsRedBank.client').MarsRedBankQueryClient
|
||||||
|
swapper: import('types/generated/mars-swapper-osmosis/MarsSwapperOsmosis.client').MarsSwapperOsmosisQueryClient
|
||||||
|
}
|
||||||
|
1
src/types/interfaces/store/broadcast.d.ts
vendored
1
src/types/interfaces/store/broadcast.d.ts
vendored
@ -18,7 +18,6 @@ interface ToastObjectOptions extends HandleResponseProps {
|
|||||||
interface ToastObject {
|
interface ToastObject {
|
||||||
response: Promise<BroadcastResult>
|
response: Promise<BroadcastResult>
|
||||||
options: ToastObjectOptions
|
options: ToastObjectOptions
|
||||||
|
|
||||||
swapOptions?: {
|
swapOptions?: {
|
||||||
coinIn: BNCoin
|
coinIn: BNCoin
|
||||||
denomOut: string
|
denomOut: string
|
||||||
|
1
src/types/interfaces/store/settings.d.ts
vendored
1
src/types/interfaces/store/settings.d.ts
vendored
@ -4,6 +4,7 @@ interface Settings {
|
|||||||
reduceMotion: boolean
|
reduceMotion: boolean
|
||||||
tradingPairSimple: TradingPair
|
tradingPairSimple: TradingPair
|
||||||
tradingPairAdvanced: TradingPair
|
tradingPairAdvanced: TradingPair
|
||||||
|
perpsAsset: string
|
||||||
enableAutoLendGlobal: boolean
|
enableAutoLendGlobal: boolean
|
||||||
slippage: number
|
slippage: number
|
||||||
tutorial: boolean
|
tutorial: boolean
|
||||||
|
@ -185,6 +185,8 @@ export function convertAccountToPositions(account: Account): Positions {
|
|||||||
amount: lend.amount.toString(),
|
amount: lend.amount.toString(),
|
||||||
denom: lend.denom,
|
denom: lend.denom,
|
||||||
})),
|
})),
|
||||||
|
// TODO: 📈 Add correct type mapping
|
||||||
|
perps: account.perps,
|
||||||
vaults: account.vaults.map(
|
vaults: account.vaults.map(
|
||||||
(vault) =>
|
(vault) =>
|
||||||
({
|
({
|
||||||
@ -242,6 +244,8 @@ export function cloneAccount(account: Account): Account {
|
|||||||
unlocked: vault.values.unlocked,
|
unlocked: vault.values.unlocked,
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
|
// TODO: 📈Add correct type mapping
|
||||||
|
perps: account.perps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user