diff --git a/.env.example b/.env.example index 84b55c2..01e7fed 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,7 @@ # OSMOSIS-1 # NEXT_PUBLIC_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com NEXT_PUBLIC_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com -NEXT_PUBLIC_OSMOSIS_GQL=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql - -# OSMO-TEST-5 # -NEXT_PUBLIC_OSMOSIS_TEST_RPC=https://rpc.osmotest5.osmosis.zone -NEXT_PUBLIC_OSMOSIS_TEST_REST=https://lcd.osmotest5.osmosis.zone -NEXT_PUBLIC_OSMOSIS_TEST_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql +NEXT_PUBLIC_OSMOSIS_GQL=https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql # PION-1 # NEXT_PUBLIC_NEUTRON_TEST_RPC=https://rpc-palvus.pion-1.ntrn.tech/ diff --git a/.env.production b/.env.production index f549088..b553e93 100644 --- a/.env.production +++ b/.env.production @@ -6,11 +6,6 @@ NEXT_PUBLIC_OSMOSIS_RPC=APP_NEXT_OSMOSIS_RPC NEXT_PUBLIC_OSMOSIS_REST=APP_NEXT_OSMOSIS_REST NEXT_PUBLIC_OSMOSIS_GQL=APP_NEXT_OSMOSIS_GQL -# OSMO-TEST-5 # -NEXT_PUBLIC_OSMOSIS_TEST_RPC=APP_NEXT_OSMOSIS_TEST_RPC -NEXT_PUBLIC_OSMOSIS_TEST_REST=APP_NEXT_OSMOSIS_TEST_REST -NEXT_PUBLIC_OSMOSIS_TEST_GQL=APP_NEXT_OSMOSIS_TEST_GQL - # PION-1 # NEXT_PUBLIC_NEUTRON_TEST_RPC=APP_NEXT_NEUTRON_TEST_RPC NEXT_PUBLIC_NEUTRON_TEST_REST=APP_NEXT_NEUTRON_TEST_REST diff --git a/README.md b/README.md index 6a6a4eb..2d1625f 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,9 @@ We allow the use of environment variables to be passed to the Docker container t | Variable | Description | Default | | --------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------- | -| URL_OSMOSIS_GQL | The Osmosis Hive GraphQL endpoint to use | https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql | +| URL_OSMOSIS_GQL | The Osmosis Hive GraphQL endpoint to use | https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql | | URL_OSMOSIS_REST | The Osmosis node REST endpoint to use | https://lcd-osmosis.blockapsis.com | | URL_OSMOSIS_RPC | The Osmosis node RPC endpoint to use | https://rpc-osmosis.blockapsis.com | -| URL_OSMOSIS_TEST_GQL | The Osmosis Testnet Hive GraphQL endpoint to use | https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql | -| URL_OSMOSIS_TEST_REST | The Osmosis Testnet node REST endpoint to use | https://lcd.osmotest5.osmosis.zone | -| URL_OSMOSIS_TEST_RPC | The Osmosis Testnet node RPC endpoint to use | https://rpc.osmotest5.osmosis.zone | | URL_NEUTRON_GQL | The Neutron Hive GraphQL endpoint to use | https://neutron.rpc.p2p.world/qgrnU6PsQZA8F9S5Fb8Fn3tV3kXmMBl2M9bcc9jWLjQy8p/hive/graphql | | URL_NEUTRON_REST | The Neutron node REST endpoint to use | https://rest-kralum.neutron-1.neutron.org | | URL_NEUTRON_RPC | The Neutron node RPC endpoint to use | https://rpc-kralum.neutron-1.neutron.org | @@ -52,9 +49,6 @@ docker run -it -p 3000:3000 \ -e URL_OSMOSIS_GQL=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql \ -e URL_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com \ -e URL_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com \ - -e URL_OSMOSIS_TEST_GQL=https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql \ - -e URL_OSMOSIS_TEST_REST=https://lcd.osmotest5.osmosis.zone \ - -e URL_OSMOSIS_TEST_RPC=https://rpc.osmotest5.osmosis.zone \ -e URL_NEUTRON_GQL=https://neutron.rpc.p2p.world/qgrnU6PsQZA8F9S5Fb8Fn3tV3kXmMBl2M9bcc9jWLjQy8p/hive/graphql \ -e URL_NEUTRON_REST=https://rest-kralum.neutron-1.neutron.org \ -e URL_NEUTRON_RPC=https://rpc-kralum.neutron-1.neutron.org \ diff --git a/entrypoint.sh b/entrypoint.sh index 926d7f9..25ac31b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,9 +7,6 @@ envFilename='override.conf' echo "APP_NEXT_OSMOSIS_RPC=$URL_OSMOSIS_RPC" >> $envFilename echo "APP_NEXT_OSMOSIS_REST=$URL_OSMOSIS_REST" >> $envFilename echo "APP_NEXT_OSMOSIS_GQL=$URL_OSMOSIS_GQL" >> $envFilename -echo "APP_NEXT_OSMOSIS_TEST_RPC=$URL_OSMOSIS_TEST_RPC" >> $envFilename -echo "APP_NEXT_OSMOSIS_TEST_REST=$URL_OSMOSIS_TEST_REST" >> $envFilename -echo "APP_NEXT_OSMOSIS_TEST_GQL=$URL_OSMOSIS_TEST_GQL" >> $envFilename echo "APP_NEXT_NEUTRON_RPC=$URL_NEUTRON_RPC" >> $envFilename echo "APP_NEXT_NEUTRON_REST=$URL_NEUTRON_REST" >> $envFilename echo "APP_NEXT_NEUTRON_GQL=$URL_NEUTRON_GQL" >> $envFilename diff --git a/package.json b/package.json index 1bb6529..77b67eb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mars", "homepage": "./", - "version": "1.6.5", + "version": "1.7.0", "private": false, "license": "SEE LICENSE IN LICENSE FILE", "scripts": { @@ -22,7 +22,7 @@ "@cosmjs/launchpad": "^0.27.1", "@cosmjs/proto-signing": "^0.31.1", "@cosmjs/stargate": "^0.31.1", - "@marsprotocol/wallet-connector": "^2.1.2", + "@marsprotocol/wallet-connector": "^2.1.3", "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@ramonak/react-progress-bar": "^5.0.3", diff --git a/src/components/common/Containers/CommonContainer.tsx b/src/components/common/Containers/CommonContainer.tsx index 1306e2b..4ce555b 100644 --- a/src/components/common/Containers/CommonContainer.tsx +++ b/src/components/common/Containers/CommonContainer.tsx @@ -17,12 +17,14 @@ import { useUserDebt, useUserIcns, } from 'hooks/queries' +import { useAssetParams } from 'hooks/queries/useAssetParams' import { useMarsPrice } from 'hooks/queries/useMarsPrice' import { usePythVaa } from 'hooks/queries/usePythVaa' import { useUserCollaterals } from 'hooks/queries/useUserCollaterals' import { ReactNode, useEffect, useState } from 'react' import useStore from 'store' import { State } from 'types/enums' +import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client' import { MigrationInProgress } from '../MigrationInProgress/MigrationInProgress' @@ -31,6 +33,8 @@ interface CommonContainerProps { } export const CommonContainer = ({ children }: CommonContainerProps) => { + useAssetParams() + // ------------------ // EXTERNAL HOOKS // --------------- @@ -52,6 +56,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => { const marketDeposits = useStore((s) => s.marketDeposits) const marketInfo = useStore((s) => s.marketInfo) const migrationInProgress = useStore((s) => s.migrationInProgress) + const paramsAddress = useStore((s) => s.networkConfig.contracts.params) const redBankState = useStore((s) => s.redBankState) const rpc = useStore((s) => s.networkConfig.rpcUrl) const userBalances = useStore((s) => s.userBalances) @@ -76,6 +81,7 @@ export const CommonContainer = ({ children }: CommonContainerProps) => { client: undefined, creditManagerClient: undefined, accountNftClient: undefined, + paramsClient: undefined, userWalletAddress: '', }) } @@ -133,6 +139,11 @@ export const CommonContainer = ({ children }: CommonContainerProps) => { }) }, [simulate, sign, connectedWallet, cosmWasmClient, broadcast, networkConfig, chainId]) + useEffect(() => { + if (!paramsAddress || !cosmWasmClient) return + useStore.setState({ paramsClient: new MarsParamsQueryClient(cosmWasmClient, paramsAddress) }) + }, [cosmWasmClient, paramsAddress]) + useEffect(() => { setRedBankAssets() }, [ diff --git a/src/components/common/Containers/FieldsContainer.tsx b/src/components/common/Containers/FieldsContainer.tsx index 8cad06e..35d38ee 100644 --- a/src/components/common/Containers/FieldsContainer.tsx +++ b/src/components/common/Containers/FieldsContainer.tsx @@ -1,3 +1,4 @@ +import { useVaultParams } from 'hooks/queries/useVaultParams' import { ReactNode, useEffect } from 'react' import useStore from 'store' import { AccountNftClient, CreditManagerClient } from 'types/classes' @@ -7,6 +8,7 @@ interface FieldsContainerProps { } export const FieldsContainer = ({ children }: FieldsContainerProps) => { + const { data: vaultParams } = useVaultParams() const client = useStore((s) => s.client) const currentNetwork = useStore((s) => s.currentNetwork) const networkConfig = useStore((s) => s.networkConfig) @@ -20,6 +22,7 @@ export const FieldsContainer = ({ children }: FieldsContainerProps) => { useEffect(() => { if (!networkConfig.isFieldsEnabled || !creditManagerAddress || !accountNftContractAddress) return + if (!client || client.connectedWallet.network.chainId !== currentNetwork) return useStore.setState({ creditManagerClient: new CreditManagerClient(creditManagerAddress, client), @@ -35,6 +38,7 @@ export const FieldsContainer = ({ children }: FieldsContainerProps) => { creditManagerAddress, currentNetwork, getVaults, + vaultParams, ]) useEffect(() => { diff --git a/src/components/common/Notification/Notification.module.scss b/src/components/common/Notification/Notification.module.scss index bf6253a..3e4c079 100644 --- a/src/components/common/Notification/Notification.module.scss +++ b/src/components/common/Notification/Notification.module.scss @@ -4,7 +4,6 @@ width: 100%; min-height: rem-calc(48); display: flex; - align-items: center; @include layoutPopover; margin-bottom: space(8) !important; @include padding(2, 3); @@ -22,7 +21,10 @@ } .icon { - @include margin(0, 4); + height: 100%; + display: flex; + align-items: flex-start; + @include margin(2.5); } &.info { @@ -59,7 +61,7 @@ position: absolute; right: 0; top: 0; - @include margin(4, 4, 0, 0); + @include margin(3, 3, 0, 0); border: none; background: transparent; @include padding(0); @@ -75,3 +77,18 @@ } } } + +@media only screen and (min-width: $bpMediumHigh) { + .notification { + align-items: center; + + .icon { + align-items: center; + @include margin(0, 4); + } + + .closeNotification { + @include margin(4, 4, 0, 0); + } + } +} diff --git a/src/components/common/Tooltip/Apy.tsx b/src/components/common/Tooltip/Apy.tsx index 719eada..7017db9 100644 --- a/src/components/common/Tooltip/Apy.tsx +++ b/src/components/common/Tooltip/Apy.tsx @@ -13,13 +13,11 @@ interface Props { export const Apy = ({ apyData, leverage, borrowRate }: Props) => { const { t } = useTranslation() - const totalApy = useMemo( () => (apyData.total ?? 0) * leverage - borrowRate ?? 0, [apyData, leverage, borrowRate], ) const leveragedApy = useMemo(() => (apyData.total ?? 0) * leverage, [apyData, leverage]) - const performanceFee = apyData.fees && apyData.fees[0].value > 0 ? apyData.fees[0] : null return (
@@ -31,16 +29,6 @@ export const Apy = ({ apyData, leverage, borrowRate }: Props) => { {formatValue(apyData.total ?? 0, 2, 2, true, false, '%', true)}
- {leverage > 1 && ( <> @@ -55,21 +43,13 @@ export const Apy = ({ apyData, leverage, borrowRate }: Props) => { {borrowRate > 0 && ( -
+
{t('fields.borrowRateApy')} {formatValue(borrowRate, 2, 2, true, '-', '%', true)}
)} - {performanceFee && ( -
- {performanceFee.type} - - {formatValue(performanceFee.value, 2, 2, true, '-', '%', true)} - -
- )} )}
diff --git a/src/components/fields/ActiveVaultsTable/useActiveVaultsColumns.tsx b/src/components/fields/ActiveVaultsTable/useActiveVaultsColumns.tsx index e01bf1b..ba6e7e9 100644 --- a/src/components/fields/ActiveVaultsTable/useActiveVaultsColumns.tsx +++ b/src/components/fields/ActiveVaultsTable/useActiveVaultsColumns.tsx @@ -256,9 +256,11 @@ export const useActiveVaultsColumns = () => { ) case 'active': - if (row.original.position.apy?.net !== null) { + if ( + row.original.position.apy?.net !== null && + row.original.position.apy?.borrow !== 0 + ) { const apy = new BigNumber(row.original.position.apy.net).toNumber() - return ( <> { content={unlockedContent()} showNotification hideCloseBtn - > + /> ) } diff --git a/src/configs/devnet.ts b/src/configs/devnet.ts new file mode 100644 index 0000000..8c94ac1 --- /dev/null +++ b/src/configs/devnet.ts @@ -0,0 +1,282 @@ +import { ChainInfoID } from '@marsprotocol/wallet-connector' +import atom from 'images/atom.svg' +import axl from 'images/axl.svg' +import axlusdc from 'images/axlusdc.svg' +import axlwbtc from 'images/axlwbtc.svg' +import axlweth from 'images/axlweth.svg' +import mars from 'images/mars.svg' +import osmo from 'images/osmo.svg' +import statom from 'images/statom.svg' +import colors from 'styles/_assets.module.scss' + +const ASSETS: NetworkAssets = { + osmo: { + symbol: 'OSMO', + name: 'Osmosis', + id: 'OSMO', + denom: 'uosmo', + color: colors.osmo, + logo: osmo, + decimals: 6, + priceFeedId: '5867f5683c757393a0670ef0f701490950fe93fdb006d181c8265a831ac0c5c6', + }, + axlusdc: { + symbol: 'USDC.axl', + name: 'Axelar USDC', + id: 'axlUSDC', + denom: 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858', + color: colors.usdc, + decimals: 6, + logo: axlusdc, + priceFeedId: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a', + }, + axlwbtc: { + symbol: 'WBTC.axl', + id: 'axlWBTC', + name: 'Axelar Wrapped Bitcoin', + denom: 'ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F', + color: colors.wbtc, + logo: axlwbtc, + decimals: 8, + priceFeedId: 'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43', + }, + axlweth: { + symbol: 'WETH.axl', + id: 'axlWETH', + name: 'Axelar Wrapped Ethereum', + denom: 'ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5', + color: colors.weth, + logo: axlweth, + decimals: 18, + priceFeedId: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace', + }, + atom: { + symbol: 'ATOM', + name: 'Atom', + id: 'ATOM', + denom: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2', + color: colors.atom, + logo: atom, + decimals: 6, + priceFeedId: 'b00b60f88b03a6a625a8d1c048c3f66653edf217439983d037e7222c4e612819', + }, + axl: { + symbol: 'AXL', + name: 'Axelar', + id: 'AXL', + denom: 'ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E', + color: colors.axl, + logo: axl, + decimals: 6, + priceFeedId: '60144b1d5c9e9851732ad1d9760e3485ef80be39b984f6bf60f82b28a2b7f126', + }, + statom: { + symbol: 'stATOM', + name: 'Stride Atom', + id: 'stATOM', + denom: 'ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901', + color: colors.statom, + logo: statom, + decimals: 6, + }, +} + +const OTHER_ASSETS: { [denom: string]: OtherAsset } = { + mars: { + symbol: 'MARS', + name: 'Mars', + id: 'MARS', + denom: 'ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580', + color: colors.mars, + logo: mars, + decimals: 6, + }, + usd: { + symbol: '', + prefix: '$', + name: 'US Dollar', + denom: 'usd', + color: '', + logo: '', + decimals: 2, + }, +} + +export const NETWORK_CONFIG: NetworkConfig = { + name: ChainInfoID.OsmosisDevnet, + displayName: 'Osmosis Testnet', + hiveUrl: 'https://devnet-osmosis-gql.marsprotocol.io/graphql', + rpcUrl: 'https://rpc.devnet.osmosis.zone/', + restUrl: 'https://lcd.devnet.osmosis.zone/', + vaultAprUrl: 'https://api.marsprotocol.io/v1/vaults/osmosis', + usdPriceUrl: 'https://xc-mainnet.pyth.network/api/', + chainIcon: osmo, + contracts: { + redBank: 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg', + incentives: 'osmo1nkahswfr8shg8rlxqwup0vgahp0dk4x8w6tkv3rra8rratnut36sk22vrm', + oracle: 'osmo1mhznfr60vjdp2gejhyv2gax9nvyyzhd3z0qcwseyetkfustjauzqycsy2g', + creditManager: 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf', + params: 'osmo1aye5qcer5n52crrkaf35jprsad2807q6kg3eeeu7k79h4slxfausfqhc9y', + accountNft: 'osmo1450hrg6dv2l58c0rvdwx8ec2a0r6dd50hn4frk370tpvqjhy8khqw7sw09', + }, + assets: { + base: ASSETS.osmo, + whitelist: [ + ASSETS.osmo, + ASSETS.atom, + ASSETS.axl, + ASSETS.axlusdc, + ASSETS.axlwbtc, + ASSETS.axlweth, + ASSETS.statom, + ], + other: [OTHER_ASSETS.usd, OTHER_ASSETS.mars], + currencies: [ + OTHER_ASSETS.usd, + ASSETS.osmo, + ASSETS.atom, + ASSETS.axl, + ASSETS.axlweth, + ASSETS.axlwbtc, + ASSETS.statom, + OTHER_ASSETS.mars, + ], + }, + displayCurrency: OTHER_ASSETS.usd, + appUrl: 'https://app.osmosis.zone', + isFieldsEnabled: true, + hasMultiAssetIncentives: true, +} + +export const VAULT_CONFIGS: Vault[] = [ + { + address: 'osmo1g3kmqpp8608szfp0pdag3r6z85npph7wmccat8lgl3mp407kv73qlj7qwp', + name: { name: 'OSMO-ATOM LP', unlockDuration: 14, unlockTimeframe: 'days' }, + denoms: { + primary: 'uosmo', + secondary: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2', + lpToken: 'gamm/pool/1', + }, + symbols: { + primary: 'OSMO', + secondary: 'ATOM', + }, + color: '#6f7390', + lockup: 86400 * 14, + provider: 'Apollo vault', + description: { maxLeverage: 3.7, lpName: 'OSMO-ATOM' }, + ltv: { + max: 0.725, + contract: 0.73, + liq: 0.75, + }, + apy: { + total: null, + vaultAddress: '', + }, + }, + { + address: 'osmo1jfmwayj8jqp9tfy4v4eks5c2jpnqdumn8x8xvfllng0wfes770qqp7jl4j', + name: { name: 'OSMO-USDC.axl LP', unlockDuration: 14, unlockTimeframe: 'days' }, + denoms: { + primary: 'uosmo', + secondary: 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858', + lpToken: 'gamm/pool/678', + }, + symbols: { + primary: 'OSMO', + secondary: 'USDC.axl', + }, + color: '#478edc', + lockup: 86400 * 14, + provider: 'Apollo vault', + description: { maxLeverage: 4, lpName: 'OSMO-USDC.axl' }, + ltv: { + max: 0.745, + contract: 0.75, + liq: 0.77, + }, + apy: { + total: null, + vaultAddress: '', + }, + }, + { + address: 'osmo1a6tcf60pyz8qq2n532dzcs7s7sj8klcmra04tvaqympzcvxqg9esn7xz7l', + name: { name: 'stATOM-ATOM', unlockDuration: 14, unlockTimeframe: 'days' }, + denoms: { + primary: 'ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901', + secondary: 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2', + lpToken: 'gamm/pool/803', + }, + symbols: { + primary: 'stATOM', + secondary: 'ATOM', + }, + color: '#a446db', + lockup: 86400 * 14, + provider: 'Apollo vault', + description: { maxLeverage: 2.78, lpName: 'stATOM-ATOM' }, + ltv: { + max: 0.635, + contract: 0.64, + liq: 0.65, + }, + apy: { + total: null, + vaultAddress: '', + }, + }, + { + address: 'osmo185gqewrlde8vrqw7j8lpad67v8jfrx9u7770k9q87tqqecctp5tq50wt2c', + name: { name: 'OSMO-WBTC.axl', unlockDuration: 14, unlockTimeframe: 'days' }, + denoms: { + primary: 'uosmo', + secondary: 'ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F', + lpToken: 'gamm/pool/712', + }, + symbols: { + primary: 'OSMO', + secondary: 'WBTC.axl', + }, + color: colors.wbtc, + lockup: 86400 * 14, + provider: 'Apollo vault', + description: { maxLeverage: 4, lpName: 'OSMO-WBTC.axl' }, + ltv: { + max: 0.745, + contract: 0.75, + liq: 0.77, + }, + apy: { + total: null, + vaultAddress: '', + }, + }, + { + address: 'osmo1r235f4tdkwrsnj3mdm9hf647l754y6g6xsmz0nas5r4vr5tda3qsgtftef', + name: { name: 'OSMO-WETH.axl', unlockDuration: 14, unlockTimeframe: 'days' }, + denoms: { + primary: 'uosmo', + secondary: 'ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5', + lpToken: 'gamm/pool/704', + }, + symbols: { + primary: 'OSMO', + secondary: 'WETH.axl', + }, + color: colors.weth, + lockup: 86400 * 14, + provider: 'Apollo vault', + description: { maxLeverage: 4, lpName: 'OSMO-WETH.axl' }, + ltv: { + max: 0.745, + contract: 0.75, + liq: 0.77, + }, + apy: { + total: null, + vaultAddress: '', + }, + }, +] diff --git a/src/configs/osmo-test-5.ts b/src/configs/osmo-test-5.ts deleted file mode 100644 index e21803d..0000000 --- a/src/configs/osmo-test-5.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { ChainInfoID } from '@marsprotocol/wallet-connector' -import atom from 'images/atom.svg' -import axl from 'images/axl.svg' -import axlusdc from 'images/axlusdc.svg' -import mars from 'images/mars.svg' -import osmo from 'images/osmo.svg' -import colors from 'styles/_assets.module.scss' - -const ASSETS: NetworkAssets = { - osmo: { - symbol: 'OSMO', - name: 'Osmosis', - id: 'OSMO', - denom: 'uosmo', - color: colors.osmo, - logo: osmo, - decimals: 6, - priceFeedId: '5867f5683c757393a0670ef0f701490950fe93fdb006d181c8265a831ac0c5c6', - }, - atom: { - symbol: 'ATOM', - name: 'Atom', - id: 'ATOM', - denom: 'ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477', - color: colors.atom, - logo: atom, - decimals: 6, - priceFeedId: 'b00b60f88b03a6a625a8d1c048c3f66653edf217439983d037e7222c4e612819', - }, - axl: { - symbol: 'AXL', - name: 'Axelar', - id: 'AXL', - denom: 'ibc/4DAE26570FD24ABA40E2BE4137E39D946C78B00B248D3F78B0919567C4371156', - color: colors.axl, - logo: axl, - decimals: 6, - priceFeedId: '60144b1d5c9e9851732ad1d9760e3485ef80be39b984f6bf60f82b28a2b7f126', - }, - axlusdc: { - symbol: 'USDC.axl', - name: 'Axelar USDC', - id: 'axlUSDC', - denom: 'ibc/6F34E1BD664C36CE49ACC28E60D62559A5F96C4F9A6CCE4FC5A67B2852E24CFE', - color: colors.usdc, - decimals: 6, - logo: axlusdc, - priceFeedId: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a', - }, -} - -const OTHER_ASSETS: { [denom: string]: OtherAsset } = { - mars: { - symbol: 'MARS', - name: 'Mars', - id: 'MARS', - denom: 'ibc/2E7368A14AC9AB7870F32CFEA687551C5064FA861868EDF7437BC877358A81F9', - color: colors.mars, - logo: mars, - decimals: 6, - }, - usd: { - symbol: '', - prefix: '$', - name: 'US Dollar', - denom: 'usd', - color: '', - logo: '', - decimals: 2, - }, -} - -export const NETWORK_CONFIG: NetworkConfig = { - name: ChainInfoID.OsmosisTestnet, - displayName: 'Osmosis Testnet', - hiveUrl: - process.env.NEXT_PUBLIC_OSMOSIS_TEST_GQL ?? - 'https://testnet-osmosis-node.marsprotocol.io/XF32UOOU55CX/osmosis-hive-front/graphql', - rpcUrl: process.env.NEXT_PUBLIC_OSMOSIS_TEST_RPC ?? 'https://rpc.osmotest5.osmosis.zone/', - restUrl: process.env.NEXT_PUBLIC_OSMOSIS_TEST_REST ?? 'https://lcd.osmotest5.osmosis.zone/', - apolloAprUrl: 'https://api.apollo.farm/api/vault_infos/v2/osmo-test-5', - usdPriceUrl: 'https://xc-mainnet.pyth.network/api/', - chainIcon: osmo, - contracts: { - redBank: 'osmo1dl4rylasnd7mtfzlkdqn2gr0ss4gvyykpvr6d7t5ylzf6z535n9s5jjt8u', - incentives: 'osmo1zyz57xf82963mcsgqu3hq5y0h9mrltm4ttq2qe5mjth9ezp3375qe0sm7d', - oracle: 'osmo1khe29uw3t85nmmp3mtr8dls7v2qwsfk3tndu5h4w5g2r5tzlz5qqarq2e2', - creditManager: 'osmo15ywk53ck3wp6tnqgedfd8cnfx7fuhz9dr583hw8scp0xjgw46m0sf3kyyp', - accountNft: 'osmo1ye2rntzz9qmxgv7eg09supww6k6xs0y0sekcr3x5clp087fymn4q3y33s4', - pyth: 'osmo12u2vqdecdte84kg6c3d40nwzjsya59hsj048n687m9q3t6wdmqgsq6zrlx', - }, - assets: { - base: ASSETS.osmo, - whitelist: [ASSETS.osmo, ASSETS.atom, ASSETS.axl, ASSETS.axlusdc], - other: [OTHER_ASSETS.usd, OTHER_ASSETS.mars], - currencies: [ - OTHER_ASSETS.usd, - ASSETS.osmo, - ASSETS.atom, - ASSETS.axl, - ASSETS.axlusdc, - OTHER_ASSETS.mars, - ], - }, - displayCurrency: OTHER_ASSETS.usd, - appUrl: 'https://testnet.osmosis.zone', - isFieldsEnabled: true, -} - -export const VAULT_CONFIGS: Vault[] = [ - { - address: 'osmo1m45ap4rq4m2mfjkcqu9ks9mxmyx2hvx0cdca9sjmrg46q7lghzqqhxxup5', - name: { name: 'OSMO-ATOM LP', unlockDuration: 1, unlockTimeframe: 'day' }, - denoms: { - primary: 'uosmo', - secondary: 'ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477', - lpToken: 'gamm/pool/12', - }, - symbols: { - primary: 'OSMO', - secondary: 'ATOM', - }, - color: colors.usdc, - lockup: 86400 * 1, - provider: 'Apollo vault', - description: { maxLeverage: 1.43, lpName: 'OSMO-ATOM' }, - ltv: { - max: 0.295, - contract: 0.3, - liq: 0.4, - }, - apy: { - apys: null, - fees: null, - total: null, - vaultAddress: '', - }, - }, - { - address: 'osmo14lu7m4ganxs20258dazafrjfaulmfxruq9n0r0th90gs46jk3tuqwfkqwn', - name: { name: 'OSMO-USDC.axl LP', unlockDuration: 7, unlockTimeframe: 'days' }, - denoms: { - primary: 'uosmo', - secondary: 'ibc/6F34E1BD664C36CE49ACC28E60D62559A5F96C4F9A6CCE4FC5A67B2852E24CFE', - lpToken: 'gamm/pool/5', - }, - symbols: { - primary: 'OSMO', - secondary: 'USDC.axl', - }, - color: colors.usdc, - lockup: 86400 * 7, - provider: 'Apollo vault', - description: { maxLeverage: 1.43, lpName: 'OSMO-USDC.axl' }, - ltv: { - max: 0.295, - contract: 0.3, - liq: 0.4, - }, - apy: { - apys: null, - fees: null, - total: null, - vaultAddress: '', - }, - }, -] diff --git a/src/configs/osmosis-1.ts b/src/configs/osmosis-1.ts index c151e5c..ef10899 100644 --- a/src/configs/osmosis-1.ts +++ b/src/configs/osmosis-1.ts @@ -107,10 +107,10 @@ export const NETWORK_CONFIG: NetworkConfig = { displayName: 'Osmosis', hiveUrl: process.env.NEXT_PUBLIC_OSMOSIS_GQL ?? - 'https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql', + 'https://osmosis.rpc.p2p.world/4dqst8e8Cgd2HMb2HDNkimP7NIkcbjuk/hive/graphql', rpcUrl: process.env.NEXT_PUBLIC_OSMOSIS_RPC ?? 'https://rpc-osmosis.blockapsis.com/', restUrl: process.env.NEXT_PUBLIC_OSMOSIS_REST ?? 'https://lcd-osmosis.blockapsis.com/', - apolloAprUrl: 'https://api.apollo.farm/api/vault_infos/v2/osmosis-1', + vaultAprUrl: 'https://api.marsprotocol.io/v1/vaults/osmosis', usdPriceUrl: 'https://xc-mainnet.pyth.network/api/', chainIcon: osmo, contracts: { @@ -120,6 +120,7 @@ export const NETWORK_CONFIG: NetworkConfig = { creditManager: 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf', accountNft: 'osmo1450hrg6dv2l58c0rvdwx8ec2a0r6dd50hn4frk370tpvqjhy8khqw7sw09', pyth: 'osmo13ge29x4e2s63a8ytz2px8gurtyznmue4a69n5275692v3qn3ks8q7cwck7', + params: 'osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent', }, assets: { base: ASSETS.osmo, @@ -147,6 +148,7 @@ export const NETWORK_CONFIG: NetworkConfig = { displayCurrency: OTHER_ASSETS.usd, appUrl: 'https://app.osmosis.zone', isFieldsEnabled: true, + hasMultiAssetIncentives: true, } export const VAULT_CONFIGS: Vault[] = [ @@ -172,8 +174,6 @@ export const VAULT_CONFIGS: Vault[] = [ liq: 0.75, }, apy: { - apys: null, - fees: null, total: null, vaultAddress: '', }, @@ -200,8 +200,6 @@ export const VAULT_CONFIGS: Vault[] = [ liq: 0.77, }, apy: { - apys: null, - fees: null, total: null, vaultAddress: '', }, @@ -228,8 +226,6 @@ export const VAULT_CONFIGS: Vault[] = [ liq: 0.65, }, apy: { - apys: null, - fees: null, total: null, vaultAddress: '', }, @@ -256,8 +252,6 @@ export const VAULT_CONFIGS: Vault[] = [ liq: 0.77, }, apy: { - apys: null, - fees: null, total: null, vaultAddress: '', }, @@ -284,8 +278,6 @@ export const VAULT_CONFIGS: Vault[] = [ liq: 0.77, }, apy: { - apys: null, - fees: null, total: null, vaultAddress: '', }, diff --git a/src/constants/appConstants.ts b/src/constants/appConstants.ts index 382f311..6146bde 100644 --- a/src/constants/appConstants.ts +++ b/src/constants/appConstants.ts @@ -14,6 +14,8 @@ export const SWAP_THRESHOLD = 10 export const VAULT_DEPOSIT_BUFFER = 0.99 export const GAS_ADJUSTMENT = 1.3 +export const ITEM_LIMIT_PER_QUERY = 10 + /* fields query keys */ export const CONFIG = 'config' export const STATE = 'state' @@ -38,6 +40,6 @@ export const TERMS_OF_SERVICE = 'termsOfService' export const SUPPORTED_CHAINS: { chainId: ChainInfoID; type: 'testnet' | 'mainnet' }[] = [ { chainId: ChainInfoID.Osmosis1, type: 'mainnet' }, { chainId: ChainInfoID.Neutron, type: 'mainnet' }, - { chainId: ChainInfoID.OsmosisTestnet, type: 'testnet' }, + { chainId: ChainInfoID.OsmosisDevnet, type: 'testnet' }, { chainId: ChainInfoID.NeutronTestnet, type: 'testnet' }, ] diff --git a/src/constants/defaults.ts b/src/constants/defaults.ts index e98a95e..7ff42f9 100644 --- a/src/constants/defaults.ts +++ b/src/constants/defaults.ts @@ -22,8 +22,6 @@ export const DEFAULT_POSITION: Position = { net: 0, }, apy: { - apys: null, - fees: null, total: 19, borrow: 5.2, net: 13.8, diff --git a/src/functions/fields/getClosePositionActions.ts b/src/functions/fields/getClosePositionActions.ts index c3ba68f..567ff21 100644 --- a/src/functions/fields/getClosePositionActions.ts +++ b/src/functions/fields/getClosePositionActions.ts @@ -7,6 +7,7 @@ export const getClosePositionActions = ( primaryToSecondaryRate: number, slippage: number, whitelistedAssets: Asset[], + isV2: boolean, ): Action[] => { const swapMessage: Action[] = [] @@ -56,6 +57,40 @@ export const getClosePositionActions = ( }) } + const withdrawLiquidity = isV2 + ? { + withdraw_liquidity: { + slippage: slippage.toString(), + lp_token: { + amount: 'account_balance' as ActionAmount, + denom: vault.denoms.lpToken, + }, + }, + } + : { + withdraw_liquidity: { + lp_token: { + amount: 'account_balance' as ActionAmount, + denom: vault.denoms.lpToken, + }, + }, + } + + const repay = isV2 + ? { + repay: { + coin: { + denom: vault.position.borrowDenom || vault.denoms.secondary, + amount: 'account_balance' as ActionAmount, + }, + }, + } + : { + repay: { + denom: vault.position.borrowDenom || vault.denoms.secondary, + amount: 'account_balance' as ActionAmount, + }, + } return [ { exit_vault_unlocked: { @@ -65,24 +100,10 @@ export const getClosePositionActions = ( }, }, }, - { - withdraw_liquidity: { - lp_token: { - amount: 'account_balance', - denom: vault.denoms.lpToken, - }, - }, - }, + withdrawLiquidity, ...swapMessage, ...(Math.max(vault.position.amounts.borrowedPrimary, vault.position.amounts.borrowedSecondary) - ? [ - { - repay: { - denom: vault.position.borrowDenom || vault.denoms.secondary, - amount: 'account_balance' as ActionAmount, - }, - }, - ] + ? [repay] : []), { refund_all_coin_balances: {} }, ] diff --git a/src/functions/fields/getRepayActionsAndFunds.ts b/src/functions/fields/getRepayActionsAndFunds.ts index 9b3e780..da6256d 100644 --- a/src/functions/fields/getRepayActionsAndFunds.ts +++ b/src/functions/fields/getRepayActionsAndFunds.ts @@ -2,18 +2,29 @@ import { Action, Coin } from 'types/generated/mars-credit-manager/MarsCreditMana import { orderCoinsByDenom } from './orderCoinsByDenom' -export const getRepayActionsAndFunds = (coin: Coin): [Action[], Coin[]] => { +export const getRepayActionsAndFunds = (coin: Coin, isV2: boolean): [Action[], Coin[]] => { + const repay = isV2 + ? { + repay: { + coin: { + denom: coin.denom, + amount: { exact: coin.amount }, + }, + }, + } + : { + repay: { + denom: coin.denom, + amount: { exact: coin.amount }, + }, + } + return [ [ { deposit: coin, }, - { - repay: { - denom: coin.denom, - amount: { exact: coin.amount }, - }, - }, + repay, ], orderCoinsByDenom([coin]), ] diff --git a/src/functions/getSwapUrl.ts b/src/functions/getSwapUrl.ts index d77df30..744ad4e 100644 --- a/src/functions/getSwapUrl.ts +++ b/src/functions/getSwapUrl.ts @@ -14,7 +14,7 @@ export const getSwapUrl = (options: Options) => { if (!chain) return '#' - if (chain === ChainInfoID.Osmosis1 || chain === ChainInfoID.OsmosisTestnet) { + if (chain === ChainInfoID.Osmosis1 || chain === ChainInfoID.OsmosisDevnet) { fromName = from.id toName = to.id diff --git a/src/functions/index.ts b/src/functions/index.ts index 6c6ac2b..a797c14 100644 --- a/src/functions/index.ts +++ b/src/functions/index.ts @@ -4,6 +4,7 @@ export { findByDenom } from './findByDenom' export { formatToValueSymbol } from './formatToValueSymbol' export { getFeeFromResponse } from './getFeeFromResponse' export { getSwapUrl } from './getSwapUrl' +export { iterateContractQuery } from './iterateContractQuery' export { updateAssetPrices } from './updateAssetPrices' export { updateExchangeRate } from './updateExchangeRate' // @endindex diff --git a/src/functions/iterateContractQuery.ts b/src/functions/iterateContractQuery.ts new file mode 100644 index 0000000..2a4a884 --- /dev/null +++ b/src/functions/iterateContractQuery.ts @@ -0,0 +1,36 @@ +import { ITEM_LIMIT_PER_QUERY } from 'constants/appConstants' + +interface KeyProperties { + denom?: string + addr?: string +} + +type Query = ({ + limit, + startAfter, +}: { + limit?: number | undefined + startAfter?: string | undefined +}) => Promise + +export async function iterateContractQuery( + query: Query, + keyProperty: keyof KeyProperties = 'denom', + previousResults?: T[], +): Promise { + const lastItem = previousResults && previousResults.at(-1) + const lastItemKey = lastItem && lastItem[keyProperty] + const params = { + limit: ITEM_LIMIT_PER_QUERY, + startAfter: lastItemKey, + } + + const results = await query(params) + const accumulated = (previousResults ?? []).concat(results) + + if (results.length < ITEM_LIMIT_PER_QUERY) { + return accumulated + } + + return await iterateContractQuery(query, keyProperty, accumulated) +} diff --git a/src/hooks/queries/index.ts b/src/hooks/queries/index.ts index 27111a9..9acf11d 100644 --- a/src/hooks/queries/index.ts +++ b/src/hooks/queries/index.ts @@ -1,4 +1,5 @@ // @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { useAssetParams } from './useAssetParams' export { useBlockHeight } from './useBlockHeight' export { useClosePosition } from './useClosePosition' export { useDepositAndDebt } from './useDepositAndDebt' @@ -18,4 +19,5 @@ export { useUserBalance } from './useUserBalance' export { useUserCollaterals } from './useUserCollaterals' export { useUserDebt } from './useUserDebt' export { useUserIcns } from './useUserIcns' +export { useVaultParams } from './useVaultParams' // @endindex diff --git a/src/hooks/queries/useAssetParams.tsx b/src/hooks/queries/useAssetParams.tsx new file mode 100644 index 0000000..6b7f625 --- /dev/null +++ b/src/hooks/queries/useAssetParams.tsx @@ -0,0 +1,23 @@ +import { useQuery } from '@tanstack/react-query' +import { iterateContractQuery } from 'functions' +import useStore from 'store' +import { QUERY_KEYS } from 'types/enums/queryKeys' + +export const useAssetParams = () => { + const paramsContract = useStore((s) => s.networkConfig.contracts.params) + const paramsClient = useStore((s) => s.paramsClient) + + return useQuery( + [QUERY_KEYS.ASSET_PARAMS], + async () => { + if (!paramsClient) return [] + + const params = await iterateContractQuery(paramsClient.allAssetParams) + useStore.setState({ assetParams: params }) + return params + }, + { + enabled: (!!paramsContract && !!paramsClient) || !paramsContract, + }, + ) +} diff --git a/src/hooks/queries/useClosePosition.tsx b/src/hooks/queries/useClosePosition.tsx index 9b74618..a49e8f5 100644 --- a/src/hooks/queries/useClosePosition.tsx +++ b/src/hooks/queries/useClosePosition.tsx @@ -13,6 +13,8 @@ export const useClosePosition = (props: Props) => { const getExchangeRate = useStore((s) => s.getExchangeRate) const slippage = useStore((s) => s.slippage) const whitelistedAssets = useStore((s) => s.whitelistedAssets) + const networkConfig = useStore((s) => s.networkConfig) + const isV2 = !!networkConfig.contracts?.params const actions = useMemo(() => { if (!props.activeVault) return [] @@ -25,8 +27,9 @@ export const useClosePosition = (props: Props) => { primaryToSecondaryRate, slippage, whitelistedAssets, + isV2, ) - }, [props.activeVault, getExchangeRate, slippage]) + }, [isV2, props.activeVault, getExchangeRate, slippage, whitelistedAssets]) const { data: fee } = useEstimateFarmFee({ accountId: props.activeVault?.position.accountId, diff --git a/src/hooks/queries/useEditPosition.tsx b/src/hooks/queries/useEditPosition.tsx index f2c2783..ccea271 100644 --- a/src/hooks/queries/useEditPosition.tsx +++ b/src/hooks/queries/useEditPosition.tsx @@ -1,12 +1,12 @@ import BigNumber from 'bignumber.js' import { SWAP_THRESHOLD } from 'constants/appConstants' import { coinsToActionCoins, orderCoinsByDenom } from 'functions/fields' -import { useProvideLiquidity } from 'hooks/queries' import { useMemo } from 'react' import useStore from 'store' import { Action, Coin } from 'types/generated/mars-credit-manager/MarsCreditManager.types' import { useEstimateFarmFee } from './useEstimateFarmFee' +import { useProvideLiquidity } from './useProvideLiquidity' interface Props { accountId?: null | string @@ -18,6 +18,8 @@ interface Props { } export const useEditPosition = (props: Props) => { + const networkConfig = useStore((s) => s.networkConfig) + const isV2 = !!networkConfig.contracts?.params const convertToBaseCurrency = useStore((s) => s.convertToBaseCurrency) const convertValueToAmount = useStore((s) => s.convertValueToAmount) const slippage = useStore((s) => s.slippage) @@ -122,7 +124,7 @@ export const useEditPosition = (props: Props) => { }) const { actions, funds } = useMemo<{ actions: Action[]; funds: Coin[] }>(() => { - if (!minLpToReceive || props.isReducingPosition) return { actions: [], funds: [] } + if ((!isV2 && !minLpToReceive) || props.isReducingPosition) return { actions: [], funds: [] } const coins: { supply: Coin[]; borrow?: Coin } = { supply: [], borrow: undefined } @@ -194,11 +196,27 @@ export const useEditPosition = (props: Props) => { } BigNumber.config({ EXPONENTIAL_AT: [-7, 30] }) - const minimumReceive = new BigNumber(minLpToReceive) + const minimumReceive = new BigNumber(isV2 || !minLpToReceive ? 0 : minLpToReceive) .times(1 - slippage) .integerValue(BigNumber.ROUND_CEIL) .toString() + const provideLiquidity = isV2 + ? { + provide_liquidity: { + coins_in: coinsToActionCoins(coinsAfterSwap), + lp_token_out: props.vault?.denoms.lpToken || '', + slippage: slippage.toString(), + }, + } + : { + provide_liquidity: { + coins_in: coinsToActionCoins(coinsAfterSwap), + lp_token_out: props.vault?.denoms.lpToken || '', + minimum_receive: minimumReceive, + }, + } + const actions: Action[] = [ ...(coins.supply[0] ? [ @@ -210,13 +228,7 @@ export const useEditPosition = (props: Props) => { ...(coins.supply[1] ? [{ deposit: coins.supply[1] }] : []), ...(coins.borrow ? [{ borrow: coins.borrow }] : []), ...swapMessage, - { - provide_liquidity: { - coins_in: coinsToActionCoins(coinsAfterSwap), - lp_token_out: props.vault?.denoms.lpToken || '', - minimum_receive: minimumReceive, - }, - }, + provideLiquidity, { enter_vault: { coin: { @@ -236,11 +248,12 @@ export const useEditPosition = (props: Props) => { } }, [ editPosition, - minLpToReceive, props.vault, coinsAfterSwap, convertToBaseCurrency, convertValueToAmount, + minLpToReceive, + isV2, slippage, props.isReducingPosition, ]) diff --git a/src/hooks/queries/useRedBank.tsx b/src/hooks/queries/useRedBank.tsx index d31241a..6a03df4 100644 --- a/src/hooks/queries/useRedBank.tsx +++ b/src/hooks/queries/useRedBank.tsx @@ -1,6 +1,7 @@ import { useQuery } from '@tanstack/react-query' import { getRedbankQuery } from 'functions/queries' import { gql, request } from 'graphql-request' +import { useAssetParams } from 'hooks/queries' import useStore from 'store' import { State } from 'types/enums' import { QUERY_KEYS } from 'types/enums/queryKeys' @@ -11,7 +12,7 @@ export const useRedBank = () => { const whitelistedAssets = useStore((s) => s.whitelistedAssets) const processRedBankQuery = useStore((s) => s.processRedBankQuery) const setRedBankState = useStore((s) => s.setRedBankState) - + const { data: assetParams, isLoading } = useAssetParams() const hiveUrl = networkConfig.hiveUrl const redbankAddress = networkConfig.contracts.redBank const incentivesAddress = networkConfig.contracts.incentives @@ -19,8 +20,8 @@ export const useRedBank = () => { useQuery( [QUERY_KEYS.REDBANK], - async () => - await request( + async () => { + return await request( hiveUrl!, gql` ${getRedbankQuery( @@ -31,14 +32,15 @@ export const useRedBank = () => { whitelistedAssets, )} `, - ), + ) + }, { - enabled: !!userWalletAddress && !!whitelistedAssets?.length, + enabled: !!userWalletAddress && !!whitelistedAssets?.length && !!assetParams && !isLoading, staleTime: 30000, refetchInterval: 30000, onError: () => setRedBankState(State.ERROR), onSuccess: (data) => { - processRedBankQuery(data, whitelistedAssets!) + processRedBankQuery(data, whitelistedAssets!, assetParams || []) }, }, ) diff --git a/src/hooks/queries/useRepayPosition.tsx b/src/hooks/queries/useRepayPosition.tsx index 72f4567..89e269f 100644 --- a/src/hooks/queries/useRepayPosition.tsx +++ b/src/hooks/queries/useRepayPosition.tsx @@ -1,5 +1,6 @@ import { getRepayActionsAndFunds, orderCoinsByDenom } from 'functions/fields' import { useEffect, useMemo, useState } from 'react' +import useStore from 'store' import { useEstimateFarmFee } from './useEstimateFarmFee' @@ -12,6 +13,8 @@ interface Props { export const useRepayPosition = (props: Props) => { const [amount, setAmount] = useState(0) + const networkConfig = useStore((s) => s.networkConfig) + const isV2 = !!networkConfig.contracts?.params useEffect(() => { const borrowKey = @@ -32,11 +35,14 @@ export const useRepayPosition = (props: Props) => { const [actions, funds] = useMemo(() => { if (!amount) return [[], []] - return getRepayActionsAndFunds({ - denom: props.activeVault.position.borrowDenom || props.activeVault.denoms.secondary, - amount: amount.toString(), - }) - }, [amount, props.activeVault.denoms.secondary, props.activeVault.position.borrowDenom]) + return getRepayActionsAndFunds( + { + denom: props.activeVault.position.borrowDenom || props.activeVault.denoms.secondary, + amount: amount.toString(), + }, + isV2, + ) + }, [isV2, amount, props.activeVault.denoms.secondary, props.activeVault.position.borrowDenom]) const { data: fee } = useEstimateFarmFee({ accountId: props.prevPosition.accountId, diff --git a/src/hooks/queries/useVaultParams.tsx b/src/hooks/queries/useVaultParams.tsx new file mode 100644 index 0000000..d9b6486 --- /dev/null +++ b/src/hooks/queries/useVaultParams.tsx @@ -0,0 +1,20 @@ +import { useQuery } from '@tanstack/react-query' +import { iterateContractQuery } from 'functions' +import useStore from 'store' +import { QUERY_KEYS } from 'types/enums/queryKeys' + +export const useVaultParams = () => { + const paramsClient = useStore((s) => s.paramsClient) + + return useQuery( + [QUERY_KEYS.VAULT_PARAMS], + async () => { + if (!paramsClient) return [] + return await iterateContractQuery(paramsClient.allVaultConfigs) + }, + { + enabled: !!paramsClient, + initialData: [], + }, + ) +} diff --git a/src/libs/chainId.ts b/src/libs/chainId.ts index 89fd9cd..ad08782 100644 --- a/src/libs/chainId.ts +++ b/src/libs/chainId.ts @@ -17,7 +17,7 @@ export const getCurrentChainId = () => { break case 'testnet-osmosis': - chainId = ChainInfoID.OsmosisTestnet + chainId = ChainInfoID.OsmosisDevnet break case 'testnet-neutron': diff --git a/src/libs/networkConfig.ts b/src/libs/networkConfig.ts index c36089e..8aefc38 100644 --- a/src/libs/networkConfig.ts +++ b/src/libs/networkConfig.ts @@ -1,11 +1,11 @@ +import { + NETWORK_CONFIG as osmosisDevnetConfig, + VAULT_CONFIGS as osmosisDevnetVaultConfig, +} from '../configs/devnet' import { NETWORK_CONFIG as neutronMainnetConfig, VAULT_CONFIGS as neutronMainnetVaultConfig, } from '../configs/neutron-1' -import { - NETWORK_CONFIG as osmosisTestnetConfig, - VAULT_CONFIGS as osmosisTestnetVaultConfig, -} from '../configs/osmo-test-5' import { NETWORK_CONFIG as osmosisMainnetConfig, VAULT_CONFIGS as osmosisMainnetVaultConfig, @@ -23,8 +23,8 @@ export const getNetworkConfig = (network: string): NetworkConfig => { networkConfig = neutronMainnetConfig break - case 'osmo-test-5': - networkConfig = osmosisTestnetConfig + case 'devnet': + networkConfig = osmosisDevnetConfig break case 'pion-1': @@ -46,8 +46,8 @@ export const getNetworkVaultConfig = (network: string): Vault[] => { vaultConfig = neutronMainnetVaultConfig break - case 'osmo-test-5': - vaultConfig = osmosisTestnetVaultConfig + case 'devnet': + vaultConfig = osmosisDevnetVaultConfig break case 'pion-1': diff --git a/src/mocks/position.ts b/src/mocks/position.ts index cc80e85..258d267 100644 --- a/src/mocks/position.ts +++ b/src/mocks/position.ts @@ -22,8 +22,6 @@ export const position: Position = { net: 0, }, apy: { - apys: null, - fees: null, total: 19, borrow: 5.2, net: 13.8, diff --git a/src/mocks/vault.ts b/src/mocks/vault.ts index 164e3f2..c26f371 100644 --- a/src/mocks/vault.ts +++ b/src/mocks/vault.ts @@ -1,8 +1,6 @@ export const vault: Vault = { address: 'test', apy: { - apys: null, - fees: null, total: null, vaultAddress: '', }, diff --git a/src/store/interfaces/common.interface.ts b/src/store/interfaces/common.interface.ts index 5ca2068..6459cd0 100644 --- a/src/store/interfaces/common.interface.ts +++ b/src/store/interfaces/common.interface.ts @@ -10,6 +10,8 @@ import { BlockHeightData } from 'hooks/queries/useBlockHeight' import { DepositAndDebtData } from 'hooks/queries/useDepositAndDebt' import { UserBalanceData } from 'hooks/queries/useUserBalance' import { UserIcnsData } from 'hooks/queries/useUserIcns' +import { MarsParamsQueryClient } from 'types/generated/mars-params/MarsParams.client' +import { AssetParamsBaseForAddr } from 'types/generated/mars-params/MarsParams.types' import { ContractMsg } from 'types/types' export interface CommonSlice { @@ -17,6 +19,7 @@ export interface CommonSlice { // VARIABLES // ------------------ addressProviderConfig?: AddressProviderConfig + assetParams: AssetParamsBaseForAddr[] baseAsset?: Asset basecampConfig?: BasecampConfig baseCurrency: { @@ -41,6 +44,7 @@ export interface CommonSlice { marketDeposits: Coin[] networkConfig: NetworkConfig otherAssets: OtherAsset[] + paramsClient?: MarsParamsQueryClient queryErrors: string[] acceptedTermsOfService: boolean slippage: number @@ -64,7 +68,6 @@ export interface CommonSlice { fee: StdFee sender?: string }) => Promise - getAdditionalDecimals(denom: string): number loadNetworkConfig: () => void queryContract: ( contractAddress: string, @@ -73,9 +76,9 @@ export interface CommonSlice { ignoreFailures?: boolean, ) => Promise // ------------------ - // SETTERS - // ------------------ setChainInfo: (chainInfo: SimplifiedChainInfo) => void + // ------------------ + // SETTERS setCurrentNetwork: (network: ChainInfoID) => void setTutorialStep: (type: 'fields' | 'redbank', step?: number) => void setLcdClient: (rpc: string, chainId: string) => void @@ -83,13 +86,15 @@ export interface CommonSlice { setQueryError: (name: string, isError: boolean) => void setServerError: (isError: boolean) => void // ------------------ - // QUERY RELATED - // ------------------ previousBlockHeightQueryData?: BlockHeightData + // ------------------ + // QUERY RELATED previousUserBalanceQueryData?: UserBalanceData previousUserIcnsQueryData?: UserIcnsData previousUserUnclaimedBalanceQueryData?: number processDepositAndDebtQuery: (data: DepositAndDebtData) => void processUserBalanceQuery: (data: UserBalanceData) => void processBlockHeightQuery: (data: BlockHeightData) => void + + getAdditionalDecimals(denom: string): number } diff --git a/src/store/interfaces/redBank.interface.ts b/src/store/interfaces/redBank.interface.ts index a5c1be5..0b983ef 100644 --- a/src/store/interfaces/redBank.interface.ts +++ b/src/store/interfaces/redBank.interface.ts @@ -1,5 +1,6 @@ import { Coin } from '@cosmjs/stargate' import { State } from 'types/enums' +import { AssetParamsBaseForAddr } from 'types/generated/mars-params/MarsParams.types' export interface RedBankSlice { // ------------------ @@ -35,5 +36,9 @@ export interface RedBankSlice { // QUERY RELATED // ------------------ previousRedBankQueryData?: RedBankData - processRedBankQuery: (data: RedBankData, whitelistedAssets: Asset[]) => void + processRedBankQuery: ( + data: RedBankData, + whitelistedAssets: Asset[], + assetParams: AssetParamsBaseForAddr[], + ) => void } diff --git a/src/store/slices/common.ts b/src/store/slices/common.ts index 23196cd..1a0faea 100644 --- a/src/store/slices/common.ts +++ b/src/store/slices/common.ts @@ -28,6 +28,7 @@ const commonSlice = ( // ------------------ // VARIABLES // ------------------ + assetParams: [], baseCurrency: { denom: 'uosmo', symbol: 'OSMO', @@ -198,8 +199,7 @@ const commonSlice = ( const lcdClient = get().lcdClient if (!lcdClient) return try { - const res = await lcdClient.get(contractAddress, queryMsg) - return res + return await lcdClient.get(contractAddress, queryMsg) } catch (exception: any) { } finally { attempts += 1 diff --git a/src/store/slices/redBank.ts b/src/store/slices/redBank.ts index a7e1ce2..48d3590 100644 --- a/src/store/slices/redBank.ts +++ b/src/store/slices/redBank.ts @@ -9,6 +9,7 @@ import { RedBankSlice } from 'store/interfaces/redBank.interface' import { Store } from 'store/interfaces/store.interface' import colors from 'styles/_assets.module.scss' import { State } from 'types/enums' +import { AssetParamsBaseForAddr } from 'types/generated/mars-params/MarsParams.types' import { GetState } from 'zustand' import { NamedSet } from 'zustand/middleware' @@ -30,7 +31,7 @@ const redBankSlice = (set: NamedSet, get: GetState): RedBankSlice const convertToBaseCurrency = get().convertToBaseCurrency if (!incentives?.length || !marketTotalLiquidity || !assets || !convertToBaseCurrency) return - const incentiveAssetsInfo = incentives.map((incentive: MarketIncentive) => { + return incentives.map((incentive: MarketIncentive) => { const incentiveAsset = findAssetByDenom(incentive.denom, assets) if (!incentiveAsset) return { @@ -61,8 +62,6 @@ const redBankSlice = (set: NamedSet, get: GetState): RedBankSlice apy: incentiveApr * 100, } }) - - return incentiveAssetsInfo }, computeMarketLiquidity: (denom: string) => { return Number(get().marketAssetLiquidity.find((asset) => asset.denom === denom)?.amount) || 0 @@ -128,8 +127,8 @@ const redBankSlice = (set: NamedSet, get: GetState): RedBankSlice incentiveInfo, isCollateral: true, depositCap: depositCap, - borrowEnabled: marketInfo?.borrow_enabled ?? false, - depositEnabled: marketInfo?.deposit_enabled ?? false, + borrowEnabled: !!marketInfo?.borrow_enabled, + depositEnabled: !!marketInfo?.deposit_enabled, } redBankAsset.subRows = [{ ...redBankAsset }] redBankAssets.push(redBankAsset) @@ -147,7 +146,11 @@ const redBankSlice = (set: NamedSet, get: GetState): RedBankSlice // ------------------ // QUERY RELATED // ------------------ - processRedBankQuery: (data: RedBankData, whitelistedAssets: Asset[]) => { + processRedBankQuery: ( + data: RedBankData, + whitelistedAssets: Asset[], + assetParams: AssetParamsBaseForAddr[], + ) => { if (isEqual(data, get().previousRedBankQueryData) && get().marketInfo.length) return const marketInfo: Market[] = [] @@ -158,16 +161,26 @@ const redBankSlice = (set: NamedSet, get: GetState): RedBankSlice const denom = asset.denom const id = asset.id const queryResult = data.rbwasmkey + const marketData: Market = { ...queryResult[`${id}Market`], denom: denom, incentives: [], } + const assetParam = assetParams.find((param) => param.denom === denom) + + if (assetParam) { + marketData.borrow_enabled = assetParam.red_bank.borrow_enabled + marketData.deposit_enabled = assetParam.red_bank.deposit_enabled + marketData.max_loan_to_value = assetParam.max_loan_to_value + marketData.liquidation_threshold = assetParam.liquidation_threshold + marketData.deposit_cap = assetParam.deposit_cap + } + if (hasMultiAssetIncentives) { - const marketIncentiveData = queryResult[ - `${id}MarketIncentive` - ] as MultiAssetMarketIncentive[] + const marketIncentiveData = + (queryResult[`${id}MarketIncentive`] as MultiAssetMarketIncentive[]) ?? [] marketIncentiveData.forEach((incentive) => { marketData.incentives.push({ denom: incentive.denom, diff --git a/src/store/slices/vaults.ts b/src/store/slices/vaults.ts index ff846c3..7f1980f 100644 --- a/src/store/slices/vaults.ts +++ b/src/store/slices/vaults.ts @@ -1,5 +1,5 @@ import BigNumber from 'bignumber.js' -import { findByDenom } from 'functions' +import { findByDenom, iterateContractQuery } from 'functions' import { getAmountsFromActiveVault, getLeverageFromValues } from 'functions/fields' import { convertAprToApy, demagnify, leverageToLtv, magnify } from 'libs/parse' import moment from 'moment' @@ -7,11 +7,12 @@ import { Store } from 'store/interfaces/store.interface' import { Options, VaultsSlice } from 'store/interfaces/vaults.interface.' import { VaultClient } from 'types/classes' import { - ArrayOfVaultInfoResponse, LockingVaultAmount, Positions, + VaultBaseForString, + VaultUtilizationResponse, } from 'types/generated/mars-credit-manager/MarsCreditManager.types' -import { VaultBaseForString } from 'types/generated/mars-mock-credit-manager/MarsMockCreditManager.types' +import { ArrayOfVaultInfoResponse } from 'types/generated/mars-mock-credit-manager/MarsMockCreditManager.types' import { GetState } from 'zustand' import { NamedSet } from 'zustand/middleware' @@ -163,39 +164,25 @@ export const vaultsSlice = (set: NamedSet, get: GetState): VaultsS const vaultAddresses = get().vaultConfigs.map((vault) => vault.address) const networkConfig = get().networkConfig - if (!networkConfig.apolloAprUrl) return null + if (!networkConfig.vaultAprUrl) return null try { - const response = await fetch(networkConfig.apolloAprUrl) + const response = await fetch(networkConfig.vaultAprUrl) if (response.ok) { - const data: ApolloAprResponse[] = await response.json() + const data: AprResponse = await response.json() - const filteredData = data.filter((aprData) => - vaultAddresses.includes(aprData.contract_address), + const filteredData = data.vaults.filter((aprData) => + vaultAddresses.includes(aprData.address), ) const newApys: ApyBreakdown[] = filteredData.map((aprData) => { - const aprTotal = aprData.apr.aprs.reduce((prev, curr) => Number(curr.value) + prev, 0) - const feeTotal = aprData.apr.fees.reduce((prev, curr) => Number(curr.value) + prev, 0) - const finalApr = (aprTotal - feeTotal) * 100 - const finalApy = convertAprToApy(finalApr, 365) - - const apys = aprData.apr.aprs.map((apr) => ({ - type: apr.type, - value: new BigNumber(apr.value).dividedBy(aprTotal).multipliedBy(finalApy).toNumber(), - })) - - const fees = aprData.apr.fees.map((fee) => ({ - type: fee.type, - value: new BigNumber(fee.value).dividedBy(feeTotal).multipliedBy(finalApy).toNumber(), - })) + const aprTotal = aprData.apr.projected_apr * 100 + const finalApy = convertAprToApy(aprTotal, 365) return { - vaultAddress: aprData.contract_address, + vaultAddress: aprData.address, total: finalApy, - apys, - fees, } }) @@ -213,42 +200,74 @@ export const vaultsSlice = (set: NamedSet, get: GetState): VaultsS getCaps: async (options?: Options) => { const caps = get().caps if (caps && !options?.refetch) return caps - + const networkConfig = get().networkConfig const creditManagerClient = get().creditManagerClient + const paramsClient = get().paramsClient if (!creditManagerClient) return [] - let data: VaultCapData[] = [] + if (networkConfig.contracts?.params) { + if (!paramsClient) return [] - const getBatch = async (startAfter?: VaultBaseForString): Promise => { - const batch: ArrayOfVaultInfoResponse = await creditManagerClient.query({ - vaults_info: { limit: 5, start_after: startAfter }, - }) - - const batchProcessed = batch?.map( - (vaultInfo) => - ({ - address: vaultInfo.vault.address, - vaultCap: { - denom: vaultInfo.config.deposit_cap.denom, - used: Number(vaultInfo.utilization.amount), - max: Number(vaultInfo.config.deposit_cap.amount), - }, - } as VaultCapData), + const utilizationPromises = Promise.all( + get().vaultConfigs.map>((vaultConfig) => + creditManagerClient.query({ + vault_utilization: { vault: { address: vaultConfig.address } }, + }), + ), ) - data = [...data, ...batchProcessed] + const depositCapPromises = iterateContractQuery(paramsClient.allVaultConfigs) - if (batch.length === 5) { - await getBatch({ - address: batchProcessed[batchProcessed.length - 1].address, - } as VaultBaseForString) + return Promise.all([utilizationPromises, depositCapPromises]).then( + ([vaultUtilizations, depositCaps]) => { + return vaultUtilizations.map((utilization) => { + const depositCap = depositCaps.find( + (depositCap) => depositCap.addr === utilization.vault.address, + ) + return { + address: utilization.vault.address, + vaultCap: { + denom: utilization.utilization.denom, + used: Number(utilization.utilization.amount), + max: Number(depositCap?.deposit_cap.amount || 0), + }, + } + }) + }, + ) + } else { + let data: VaultCapData[] = [] + const getBatch = async (startAfter?: VaultBaseForString): Promise => { + const batch: ArrayOfVaultInfoResponse = await creditManagerClient.query({ + vaults_info: { limit: 5, start_after: startAfter }, + }) + + const batchProcessed = batch?.map( + (vaultInfo) => + ({ + address: vaultInfo.vault.address, + vaultCap: { + denom: vaultInfo.config.deposit_cap.denom, + used: Number(vaultInfo.utilization.amount), + max: Number(vaultInfo.config.deposit_cap.amount), + }, + } as VaultCapData), + ) + + data = [...data, ...batchProcessed] + + if (batch.length === 5) { + await getBatch({ + address: batchProcessed[batchProcessed.length - 1].address, + } as VaultBaseForString) + } } + + await getBatch() + + return data } - - await getBatch() - - return data }, getLpTokens: async (options?: Options) => { const lpTokens = get().lpTokens @@ -289,6 +308,7 @@ export const vaultsSlice = (set: NamedSet, get: GetState): VaultsS if (get().isLoading) return set({ isLoading: true }) + const vaultAssets = get().getVaultAssets(options) const unlockTimes = get().getUnlockTimes(options) const caps = get().getCaps(options) @@ -305,8 +325,6 @@ export const vaultsSlice = (set: NamedSet, get: GetState): VaultsS ) vaultConfig.apy = { - apys: null, - fees: null, total: null, vaultAddress: vaultConfig.address, } @@ -509,8 +527,6 @@ export const vaultsSlice = (set: NamedSet, get: GetState): VaultsS borrow: trueBorrowRate, total: null, net: null, - apys: null, - fees: null, }, currentLeverage: leverage, ltv: leverageToLtv(leverage), diff --git a/src/types/enums/queryKeys.ts b/src/types/enums/queryKeys.ts index 37d7bf5..9c16998 100644 --- a/src/types/enums/queryKeys.ts +++ b/src/types/enums/queryKeys.ts @@ -18,4 +18,6 @@ export enum QUERY_KEYS { USD_PRICE = 'usdPrice', USER_COLLATERAL = 'userCollateral', PYTH_VAA = 'pythVaa', + ASSET_PARAMS = 'assetParams', + VAULT_PARAMS = 'vaultParams', } diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts index 0c7015d..de0aaed 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts @@ -1,6 +1,6 @@ // @ts-nocheck /** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -9,29 +9,40 @@ import { StdFee } from '@cosmjs/amino' import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' import { + AccountKind, Action, + ArrayOfAccount, ArrayOfCoin, ArrayOfCoinBalanceResponseItem, ArrayOfDebtShares, - ArrayOfLentShares, ArrayOfSharesResponseItem, - ArrayOfString, - ArrayOfVaultInfoResponse, ArrayOfVaultPositionResponseItem, - ArrayOfVaultWithBalance, + CallbackMsg, Coin, ConfigResponse, ConfigUpdates, DebtShares, - HealthResponse, - LentShares, NftConfigUpdates, + OwnerUpdate, Positions, Uint128, VaultBaseForString, + VaultPosition, + VaultPositionValue, + VaultUtilizationResponse, } from './MarsCreditManager.types' export interface MarsCreditManagerReadOnlyInterface { contractAddress: string + accountKind: ({ accountId }: { accountId: string }) => Promise + accounts: ({ + limit, + owner, + startAfter, + }: { + limit?: number + owner: string + startAfter?: string + }) => Promise config: () => Promise vaultsInfo: ({ limit, @@ -40,15 +51,8 @@ export interface MarsCreditManagerReadOnlyInterface { limit?: number startAfter?: VaultBaseForString }) => Promise - allowedCoins: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }) => Promise + vaultUtilization: ({ vault }: { vault: VaultBaseForString }) => Promise positions: ({ accountId }: { accountId: string }) => Promise - health: ({ accountId }: { accountId: string }) => Promise allCoinBalances: ({ limit, startAfter, @@ -71,21 +75,6 @@ export interface MarsCreditManagerReadOnlyInterface { limit?: number startAfter?: string }) => Promise - allLentShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }) => Promise - totalLentShares: () => Promise - allTotalLentShares: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }) => Promise allVaultPositions: ({ limit, startAfter, @@ -93,14 +82,6 @@ export interface MarsCreditManagerReadOnlyInterface { limit?: number startAfter?: string[][] }) => Promise - totalVaultCoinBalance: ({ vault }: { vault: VaultBaseForString }) => Promise - allTotalVaultCoinBalances: ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: VaultBaseForString - }) => Promise estimateProvideLiquidity: ({ coinsIn, lpTokenOut, @@ -109,6 +90,11 @@ export interface MarsCreditManagerReadOnlyInterface { lpTokenOut: string }) => Promise estimateWithdrawLiquidity: ({ lpToken }: { lpToken: Coin }) => Promise + vaultPositionValue: ({ + vaultPosition, + }: { + vaultPosition: VaultPosition + }) => Promise } export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyInterface { client: CosmWasmClient @@ -117,28 +103,44 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn constructor(client: CosmWasmClient, contractAddress: string) { this.client = client this.contractAddress = contractAddress + this.accountKind = this.accountKind.bind(this) + this.accounts = this.accounts.bind(this) this.config = this.config.bind(this) this.vaultsInfo = this.vaultsInfo.bind(this) - this.allowedCoins = this.allowedCoins.bind(this) + this.vaultUtilization = this.vaultUtilization.bind(this) this.positions = this.positions.bind(this) - this.health = this.health.bind(this) this.allCoinBalances = this.allCoinBalances.bind(this) this.allDebtShares = this.allDebtShares.bind(this) this.totalDebtShares = this.totalDebtShares.bind(this) this.allTotalDebtShares = this.allTotalDebtShares.bind(this) - this.allLentShares = this.allLentShares.bind(this) - this.totalLentShares = this.totalLentShares.bind(this) - this.allTotalLentShares = this.allTotalLentShares.bind(this) this.allVaultPositions = this.allVaultPositions.bind(this) - this.totalVaultCoinBalance = this.totalVaultCoinBalance.bind(this) - this.allTotalVaultCoinBalances = this.allTotalVaultCoinBalances.bind(this) this.estimateProvideLiquidity = this.estimateProvideLiquidity.bind(this) this.estimateWithdrawLiquidity = this.estimateWithdrawLiquidity.bind(this) + this.vaultPositionValue = this.vaultPositionValue.bind(this) } - config = async (): Promise => { + accountKind = async ({ accountId }: { accountId: string }): Promise => { return this.client.queryContractSmart(this.contractAddress, { - config: {}, + account_kind: { + account_id: accountId, + }, + }) + } + accounts = async ({ + limit, + owner, + startAfter, + }: { + limit?: number + owner: string + startAfter?: string + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + accounts: { + limit, + owner, + start_after: startAfter, + }, }) } vaultsInfo = async ({ @@ -146,6 +148,7 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn startAfter, }: { limit?: number + owner: string startAfter?: VaultBaseForString }): Promise => { return this.client.queryContractSmart(this.contractAddress, { @@ -155,17 +158,19 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn }, }) } - allowedCoins = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }): Promise => { + config = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { - allowed_coins: { - limit, - start_after: startAfter, + config: {}, + }) + } + vaultUtilization = async ({ + vault, + }: { + vault: VaultBaseForString + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + vault_utilization: { + vault, }, }) } @@ -176,13 +181,6 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn }, }) } - health = async ({ accountId }: { accountId: string }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - health: { - account_id: accountId, - }, - }) - } allCoinBalances = async ({ limit, startAfter, @@ -230,39 +228,6 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn }, }) } - allLentShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string[][] - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_lent_shares: { - limit, - start_after: startAfter, - }, - }) - } - totalLentShares = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - total_lent_shares: {}, - }) - } - allTotalLentShares = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: string - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_total_lent_shares: { - limit, - start_after: startAfter, - }, - }) - } allVaultPositions = async ({ limit, startAfter, @@ -277,27 +242,6 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn }, }) } - totalVaultCoinBalance = async ({ vault }: { vault: VaultBaseForString }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - total_vault_coin_balance: { - vault, - }, - }) - } - allTotalVaultCoinBalances = async ({ - limit, - startAfter, - }: { - limit?: number - startAfter?: VaultBaseForString - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - all_total_vault_coin_balances: { - limit, - start_after: startAfter, - }, - }) - } estimateProvideLiquidity = async ({ coinsIn, lpTokenOut, @@ -319,6 +263,17 @@ export class MarsCreditManagerQueryClient implements MarsCreditManagerReadOnlyIn }, }) } + vaultPositionValue = async ({ + vaultPosition, + }: { + vaultPosition: VaultPosition + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + vault_position_value: { + vault_position: vaultPosition, + }, + }) + } } export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInterface { contractAddress: string @@ -326,7 +281,7 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt createCreditAccount: ( fee?: number | StdFee | 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ) => Promise updateCreditAccount: ( { @@ -338,7 +293,17 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt }, fee?: number | StdFee | 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], + ) => Promise + repayFromWallet: ( + { + accountId, + }: { + accountId: string + }, + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[], ) => Promise updateConfig: ( { @@ -348,27 +313,31 @@ export interface MarsCreditManagerInterface extends MarsCreditManagerReadOnlyInt }, fee?: number | StdFee | 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ) => Promise updateOwner: ( + ownerUpdate: OwnerUpdate, fee?: number | StdFee | 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ) => Promise updateNftConfig: ( { - updates, + config, + ownership, }: { - updates: NftConfigUpdates + config?: NftConfigUpdates + ownership?: Action }, fee?: number | StdFee | 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ) => Promise callback: ( + callbackMsg: CallbackMsg, fee?: number | StdFee | 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ) => Promise } export class MarsCreditManagerClient @@ -386,6 +355,7 @@ export class MarsCreditManagerClient this.contractAddress = contractAddress this.createCreditAccount = this.createCreditAccount.bind(this) this.updateCreditAccount = this.updateCreditAccount.bind(this) + this.repayFromWallet = this.repayFromWallet.bind(this) this.updateConfig = this.updateConfig.bind(this) this.updateOwner = this.updateOwner.bind(this) this.updateNftConfig = this.updateNftConfig.bind(this) @@ -395,7 +365,7 @@ export class MarsCreditManagerClient createCreditAccount = async ( fee: number | StdFee | 'auto' = 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ): Promise => { return await this.client.execute( this.sender, @@ -405,7 +375,7 @@ export class MarsCreditManagerClient }, fee, memo, - funds, + _funds, ) } updateCreditAccount = async ( @@ -418,7 +388,7 @@ export class MarsCreditManagerClient }, fee: number | StdFee | 'auto' = 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ): Promise => { return await this.client.execute( this.sender, @@ -431,7 +401,30 @@ export class MarsCreditManagerClient }, fee, memo, - funds, + _funds, + ) + } + repayFromWallet = async ( + { + accountId, + }: { + accountId: string + }, + fee: number | StdFee | 'auto' = 'auto', + memo?: string, + _funds?: Coin[], + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + repay_from_wallet: { + account_id: accountId, + }, + }, + fee, + memo, + _funds, ) } updateConfig = async ( @@ -442,7 +435,7 @@ export class MarsCreditManagerClient }, fee: number | StdFee | 'auto' = 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ): Promise => { return await this.client.execute( this.sender, @@ -454,62 +447,67 @@ export class MarsCreditManagerClient }, fee, memo, - funds, + _funds, ) } updateOwner = async ( + ownerUpdate: OwnerUpdate, fee: number | StdFee | 'auto' = 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ): Promise => { return await this.client.execute( this.sender, this.contractAddress, { - update_owner: {}, + update_owner: ownerUpdate, }, fee, memo, - funds, + _funds, ) } updateNftConfig = async ( { - updates, + config, + ownership, }: { - updates: NftConfigUpdates + config?: NftConfigUpdates + ownership?: Action }, fee: number | StdFee | 'auto' = 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ): Promise => { return await this.client.execute( this.sender, this.contractAddress, { update_nft_config: { - updates, + config, + ownership, }, }, fee, memo, - funds, + _funds, ) } callback = async ( + callbackMsg: CallbackMsg, fee: number | StdFee | 'auto' = 'auto', memo?: string, - funds?: Coin[], + _funds?: Coin[], ): Promise => { return await this.client.execute( this.sender, this.contractAddress, { - callback: {}, + callback: callbackMsg, }, fee, memo, - funds, + _funds, ) } } diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts index 9e3df1d..c022254 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts @@ -1,19 +1,26 @@ // @ts-nocheck /** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ +import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate' import { toUtf8 } from '@cosmjs/encoding' import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx' -import { MsgExecuteContractEncodeObject } from 'cosmwasm' -import { Action, Coin, ConfigUpdates, NftConfigUpdates } from './MarsCreditManager.types' +import { + Action, + CallbackMsg, + Coin, + ConfigUpdates, + NftConfigUpdates, + OwnerUpdate, +} from './MarsCreditManager.types' export interface MarsCreditManagerMessage { contractAddress: string sender: string - createCreditAccount: (funds?: Coin[]) => MsgExecuteContractEncodeObject + createCreditAccount: (_funds?: Coin[]) => MsgExecuteContractEncodeObject updateCreditAccount: ( { accountId, @@ -22,7 +29,15 @@ export interface MarsCreditManagerMessage { accountId: string actions: Action[] }, - funds?: Coin[], + _funds?: Coin[], + ) => MsgExecuteContractEncodeObject + repayFromWallet: ( + { + accountId, + }: { + accountId: string + }, + _funds?: Coin[], ) => MsgExecuteContractEncodeObject updateConfig: ( { @@ -30,18 +45,20 @@ export interface MarsCreditManagerMessage { }: { updates: ConfigUpdates }, - funds?: Coin[], + _funds?: Coin[], ) => MsgExecuteContractEncodeObject - updateOwner: (funds?: Coin[]) => MsgExecuteContractEncodeObject + updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject updateNftConfig: ( { - updates, + config, + ownership, }: { - updates: NftConfigUpdates + config?: NftConfigUpdates + ownership?: Action }, - funds?: Coin[], + _funds?: Coin[], ) => MsgExecuteContractEncodeObject - callback: (funds?: Coin[]) => MsgExecuteContractEncodeObject + callback: (callbackMsg: CallbackMsg, _funds?: Coin[]) => MsgExecuteContractEncodeObject } export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessage { sender: string @@ -52,13 +69,14 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag this.contractAddress = contractAddress this.createCreditAccount = this.createCreditAccount.bind(this) this.updateCreditAccount = this.updateCreditAccount.bind(this) + this.repayFromWallet = this.repayFromWallet.bind(this) this.updateConfig = this.updateConfig.bind(this) this.updateOwner = this.updateOwner.bind(this) this.updateNftConfig = this.updateNftConfig.bind(this) this.callback = this.callback.bind(this) } - createCreditAccount = (funds?: Coin[]): MsgExecuteContractEncodeObject => { + createCreditAccount = (_funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', value: MsgExecuteContract.fromPartial({ @@ -69,7 +87,7 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag create_credit_account: {}, }), ), - funds, + funds: _funds, }), } } @@ -81,7 +99,7 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag accountId: string actions: Action[] }, - funds?: Coin[], + _funds?: Coin[], ): MsgExecuteContractEncodeObject => { return { typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', @@ -96,7 +114,31 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag }, }), ), - funds, + funds: _funds, + }), + } + } + repayFromWallet = ( + { + accountId, + }: { + accountId: string + }, + _funds?: Coin[], + ): MsgExecuteContractEncodeObject => { + return { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8( + JSON.stringify({ + repay_from_wallet: { + account_id: accountId, + }, + }), + ), + funds: _funds, }), } } @@ -106,7 +148,7 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag }: { updates: ConfigUpdates }, - funds?: Coin[], + _funds?: Coin[], ): MsgExecuteContractEncodeObject => { return { typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', @@ -120,11 +162,11 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag }, }), ), - funds, + funds: _funds, }), } } - updateOwner = (funds?: Coin[]): MsgExecuteContractEncodeObject => { + updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', value: MsgExecuteContract.fromPartial({ @@ -132,20 +174,22 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag contract: this.contractAddress, msg: toUtf8( JSON.stringify({ - update_owner: {}, + update_owner: ownerUpdate, }), ), - funds, + funds: _funds, }), } } updateNftConfig = ( { - updates, + config, + ownership, }: { - updates: NftConfigUpdates + config?: NftConfigUpdates + ownership?: Action }, - funds?: Coin[], + _funds?: Coin[], ): MsgExecuteContractEncodeObject => { return { typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', @@ -155,15 +199,16 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag msg: toUtf8( JSON.stringify({ update_nft_config: { - updates, + config, + ownership, }, }), ), - funds, + funds: _funds, }), } } - callback = (funds?: Coin[]): MsgExecuteContractEncodeObject => { + callback = (callbackMsg: CallbackMsg, _funds?: Coin[]): MsgExecuteContractEncodeObject => { return { typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', value: MsgExecuteContract.fromPartial({ @@ -171,10 +216,10 @@ export class MarsCreditManagerMessageComposer implements MarsCreditManagerMessag contract: this.contractAddress, msg: toUtf8( JSON.stringify({ - callback: {}, + callback: callbackMsg, }), ), - funds, + funds: _funds, }), } } diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts index a6df4f8..ce0c223 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts @@ -1,6 +1,6 @@ // @ts-nocheck /** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -11,26 +11,27 @@ import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tan import { MarsCreditManagerClient, MarsCreditManagerQueryClient } from './MarsCreditManager.client' import { + AccountKind, Action, + ArrayOfAccount, ArrayOfCoin, ArrayOfCoinBalanceResponseItem, ArrayOfDebtShares, - ArrayOfLentShares, ArrayOfSharesResponseItem, - ArrayOfString, - ArrayOfVaultInfoResponse, ArrayOfVaultPositionResponseItem, - ArrayOfVaultWithBalance, + CallbackMsg, Coin, ConfigResponse, ConfigUpdates, DebtShares, - HealthResponse, - LentShares, NftConfigUpdates, + OwnerUpdate, Positions, Uint128, VaultBaseForString, + VaultPosition, + VaultPositionValue, + VaultUtilizationResponse, } from './MarsCreditManager.types' export const marsCreditManagerQueryKeys = { contract: [ @@ -40,26 +41,30 @@ export const marsCreditManagerQueryKeys = { ] as const, address: (contractAddress: string | undefined) => [{ ...marsCreditManagerQueryKeys.contract[0], address: contractAddress }] as const, + accountKind: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'account_kind', args }, + ] as const, + accounts: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'accounts', args }, + ] as const, config: (contractAddress: string | undefined, args?: Record) => [ { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'config', args }, ] as const, - vaultsInfo: (contractAddress: string | undefined, args?: Record) => + vaultUtilization: (contractAddress: string | undefined, args?: Record) => [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'vaults_info', args }, - ] as const, - allowedCoins: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'allowed_coins', args }, + { + ...marsCreditManagerQueryKeys.address(contractAddress)[0], + method: 'vault_utilization', + args, + }, ] as const, positions: (contractAddress: string | undefined, args?: Record) => [ { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'positions', args }, ] as const, - health: (contractAddress: string | undefined, args?: Record) => - [ - { ...marsCreditManagerQueryKeys.address(contractAddress)[0], method: 'health', args }, - ] as const, allCoinBalances: (contractAddress: string | undefined, args?: Record) => [ { @@ -92,30 +97,6 @@ export const marsCreditManagerQueryKeys = { args, }, ] as const, - allLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_lent_shares', - args, - }, - ] as const, - totalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_lent_shares', - args, - }, - ] as const, - allTotalLentShares: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_lent_shares', - args, - }, - ] as const, allVaultPositions: (contractAddress: string | undefined, args?: Record) => [ { @@ -124,25 +105,6 @@ export const marsCreditManagerQueryKeys = { args, }, ] as const, - totalVaultCoinBalance: (contractAddress: string | undefined, args?: Record) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'total_vault_coin_balance', - args, - }, - ] as const, - allTotalVaultCoinBalances: ( - contractAddress: string | undefined, - args?: Record, - ) => - [ - { - ...marsCreditManagerQueryKeys.address(contractAddress)[0], - method: 'all_total_vault_coin_balances', - args, - }, - ] as const, estimateProvideLiquidity: (contractAddress: string | undefined, args?: Record) => [ { @@ -162,6 +124,14 @@ export const marsCreditManagerQueryKeys = { args, }, ] as const, + vaultPositionValue: (contractAddress: string | undefined, args?: Record) => + [ + { + ...marsCreditManagerQueryKeys.address(contractAddress)[0], + method: 'vault_position_value', + args, + }, + ] as const, } export interface MarsCreditManagerReactQuery { client: MarsCreditManagerQueryClient | undefined @@ -172,6 +142,28 @@ export interface MarsCreditManagerReactQuery { initialData?: undefined } } +export interface MarsCreditManagerVaultPositionValueQuery + extends MarsCreditManagerReactQuery { + args: { + vaultPosition: VaultPosition + } +} +export function useMarsCreditManagerVaultPositionValueQuery({ + client, + args, + options, +}: MarsCreditManagerVaultPositionValueQuery) { + return useQuery( + marsCreditManagerQueryKeys.vaultPositionValue(client?.contractAddress, args), + () => + client + ? client.vaultPositionValue({ + vaultPosition: args.vaultPosition, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} export interface MarsCreditManagerEstimateWithdrawLiquidityQuery extends MarsCreditManagerReactQuery { args: { @@ -218,50 +210,6 @@ export function useMarsCreditManagerEstimateProvideLiquidityQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: VaultBaseForString - } -} -export function useMarsCreditManagerAllTotalVaultCoinBalancesQuery< - TData = ArrayOfVaultWithBalance, ->({ client, args, options }: MarsCreditManagerAllTotalVaultCoinBalancesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allTotalVaultCoinBalances(client?.contractAddress, args), - () => - client - ? client.allTotalVaultCoinBalances({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerTotalVaultCoinBalanceQuery - extends MarsCreditManagerReactQuery { - args: { - vault: VaultBaseForString - } -} -export function useMarsCreditManagerTotalVaultCoinBalanceQuery({ - client, - args, - options, -}: MarsCreditManagerTotalVaultCoinBalanceQuery) { - return useQuery( - marsCreditManagerQueryKeys.totalVaultCoinBalance(client?.contractAddress, args), - () => - client - ? client.totalVaultCoinBalance({ - vault: args.vault, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} export interface MarsCreditManagerAllVaultPositionsQuery extends MarsCreditManagerReactQuery { args: { @@ -284,66 +232,6 @@ export function useMarsCreditManagerAllVaultPositionsQuery< { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsCreditManagerAllTotalLentSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string - } -} -export function useMarsCreditManagerAllTotalLentSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllTotalLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allTotalLentShares(client?.contractAddress, args), - () => - client - ? client.allTotalLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerTotalLentSharesQuery - extends MarsCreditManagerReactQuery {} -export function useMarsCreditManagerTotalLentSharesQuery({ - client, - options, -}: MarsCreditManagerTotalLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.totalLentShares(client?.contractAddress), - () => (client ? client.totalLentShares() : Promise.reject(new Error('Invalid client'))), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerAllLentSharesQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: string[][] - } -} -export function useMarsCreditManagerAllLentSharesQuery({ - client, - args, - options, -}: MarsCreditManagerAllLentSharesQuery) { - return useQuery( - marsCreditManagerQueryKeys.allLentShares(client?.contractAddress, args), - () => - client - ? client.allLentShares({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} export interface MarsCreditManagerAllTotalDebtSharesQuery extends MarsCreditManagerReactQuery { args: { @@ -428,28 +316,6 @@ export function useMarsCreditManagerAllCoinBalancesQuery - extends MarsCreditManagerReactQuery { - args: { - accountId: string - } -} -export function useMarsCreditManagerHealthQuery({ - client, - args, - options, -}: MarsCreditManagerHealthQuery) { - return useQuery( - marsCreditManagerQueryKeys.health(client?.contractAddress, args), - () => - client - ? client.health({ - accountId: args.accountId, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} export interface MarsCreditManagerPositionsQuery extends MarsCreditManagerReactQuery { args: { @@ -472,49 +338,23 @@ export function useMarsCreditManagerPositionsQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } -export interface MarsCreditManagerAllowedCoinsQuery - extends MarsCreditManagerReactQuery { +export interface MarsCreditManagerVaultUtilizationQuery + extends MarsCreditManagerReactQuery { args: { - limit?: number - startAfter?: string + vault: VaultBaseForString } } -export function useMarsCreditManagerAllowedCoinsQuery({ +export function useMarsCreditManagerVaultUtilizationQuery({ client, args, options, -}: MarsCreditManagerAllowedCoinsQuery) { - return useQuery( - marsCreditManagerQueryKeys.allowedCoins(client?.contractAddress, args), +}: MarsCreditManagerVaultUtilizationQuery) { + return useQuery( + marsCreditManagerQueryKeys.vaultUtilization(client?.contractAddress, args), () => client - ? client.allowedCoins({ - limit: args.limit, - startAfter: args.startAfter, - }) - : Promise.reject(new Error('Invalid client')), - { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, - ) -} -export interface MarsCreditManagerVaultsInfoQuery - extends MarsCreditManagerReactQuery { - args: { - limit?: number - startAfter?: VaultBaseForString - } -} -export function useMarsCreditManagerVaultsInfoQuery({ - client, - args, - options, -}: MarsCreditManagerVaultsInfoQuery) { - return useQuery( - marsCreditManagerQueryKeys.vaultsInfo(client?.contractAddress, args), - () => - client - ? client.vaultsInfo({ - limit: args.limit, - startAfter: args.startAfter, + ? client.vaultUtilization({ + vault: args.vault, }) : Promise.reject(new Error('Invalid client')), { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, @@ -532,8 +372,57 @@ export function useMarsCreditManagerConfigQuery({ { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, ) } +export interface MarsCreditManagerAccountsQuery + extends MarsCreditManagerReactQuery { + args: { + limit?: number + owner: string + startAfter?: string + } +} +export function useMarsCreditManagerAccountsQuery({ + client, + args, + options, +}: MarsCreditManagerAccountsQuery) { + return useQuery( + marsCreditManagerQueryKeys.accounts(client?.contractAddress, args), + () => + client + ? client.accounts({ + limit: args.limit, + owner: args.owner, + startAfter: args.startAfter, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsCreditManagerAccountKindQuery + extends MarsCreditManagerReactQuery { + args: { + accountId: string + } +} +export function useMarsCreditManagerAccountKindQuery({ + client, + args, + options, +}: MarsCreditManagerAccountKindQuery) { + return useQuery( + marsCreditManagerQueryKeys.accountKind(client?.contractAddress, args), + () => + client + ? client.accountKind({ + accountId: args.accountId, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} export interface MarsCreditManagerCallbackMutation { client: MarsCreditManagerClient + msg: CallbackMsg args?: { fee?: number | StdFee | 'auto' memo?: string @@ -554,7 +443,8 @@ export function useMarsCreditManagerCallbackMutation( export interface MarsCreditManagerUpdateNftConfigMutation { client: MarsCreditManagerClient msg: { - updates: NftConfigUpdates + config?: NftConfigUpdates + ownership?: Action } args?: { fee?: number | StdFee | 'auto' @@ -576,6 +466,7 @@ export function useMarsCreditManagerUpdateNftConfigMutation( } export interface MarsCreditManagerUpdateOwnerMutation { client: MarsCreditManagerClient + msg: OwnerUpdate args?: { fee?: number | StdFee | 'auto' memo?: string @@ -616,6 +507,29 @@ export function useMarsCreditManagerUpdateConfigMutation( options, ) } +export interface MarsCreditManagerRepayFromWalletMutation { + client: MarsCreditManagerClient + msg: { + accountId: string + } + args?: { + fee?: number | StdFee | 'auto' + memo?: string + funds?: Coin[] + } +} +export function useMarsCreditManagerRepayFromWalletMutation( + options?: Omit< + UseMutationOptions, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.repayFromWallet(msg, fee, memo, funds), + options, + ) +} export interface MarsCreditManagerUpdateCreditAccountMutation { client: MarsCreditManagerClient msg: { @@ -655,7 +569,8 @@ export function useMarsCreditManagerCreateCreditAccountMutation( >, ) { return useMutation( - ({ client, args: { fee, memo, funds } = {} }) => client.createCreditAccount(fee, memo, funds), + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.createCreditAccount(msg, fee, memo, funds), options, ) } diff --git a/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts index 209580c..f9d981a 100644 --- a/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts +++ b/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts @@ -1,48 +1,35 @@ // @ts-nocheck /** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ +export type HealthContractBaseForString = string +export type IncentivesUnchecked = string export type Decimal = string export type Uint128 = string export type OracleBaseForString = string -export type RedBankBaseForString = string +export type ParamsBaseForString = string +export type RedBankUnchecked = string export type SwapperBaseForString = string export type ZapperBaseForString = string export interface InstantiateMsg { - allowed_coins: string[] - max_close_factor: Decimal + health_contract: HealthContractBaseForString + incentives: IncentivesUnchecked + max_slippage: Decimal max_unlocking_positions: Uint128 oracle: OracleBaseForString owner: string - red_bank: RedBankBaseForString + params: ParamsBaseForString + red_bank: RedBankUnchecked swapper: SwapperBaseForString vault_configs: VaultInstantiateConfig[] zapper: ZapperBaseForString } -export interface VaultInstantiateConfig { - config: VaultConfig - vault: VaultBaseForString -} -export interface VaultConfig { - deposit_cap: Coin - liquidation_threshold: Decimal - max_ltv: Decimal - whitelisted: boolean -} -export interface Coin { - amount: Uint128 - denom: string - [k: string]: unknown -} -export interface VaultBaseForString { - address: string -} export type ExecuteMsg = | { - create_credit_account: {} + create_credit_account: AccountKind } | { update_credit_account: { @@ -50,6 +37,11 @@ export type ExecuteMsg = actions: Action[] } } + | { + repay_from_wallet: { + account_id: string + } + } | { update_config: { updates: ConfigUpdates @@ -60,27 +52,40 @@ export type ExecuteMsg = } | { update_nft_config: { - updates: NftConfigUpdates + config?: NftConfigUpdates | null + ownership?: Action | null } } | { callback: CallbackMsg } +export type AccountKind = 'default' | 'high_levered_strategy' export type Action = | { deposit: Coin } | { - withdraw: Coin + withdraw: ActionCoin } | { borrow: Coin } | { - lend: Coin + lend: ActionCoin } | { - repay: ActionCoin + reclaim: ActionCoin + } + | { + claim_rewards: {} + } + | { + repay: { + coin?: ActionCoin + amount?: ActionAmount + denom?: string + recipient_account_id?: string | null + } } | { enter_vault: { @@ -107,18 +112,10 @@ export type Action = } } | { - liquidate_coin: { + liquidate: { debt_coin: Coin liquidatee_account_id: string - request_coin_denom: string - } - } - | { - liquidate_vault: { - debt_coin: Coin - liquidatee_account_id: string - position_type: VaultPositionType - request_vault: VaultBaseForString + request: LiquidateRequestForVaultBaseForString } } | { @@ -132,12 +129,14 @@ export type Action = provide_liquidity: { coins_in: ActionCoin[] lp_token_out: string - minimum_receive: Uint128 + slippage?: Decimal + minimum_receive?: Uint128 } } | { withdraw_liquidity: { lp_token: ActionCoin + slippage?: Decimal } } | { @@ -148,7 +147,21 @@ export type ActionAmount = | { exact: Uint128 } +export type LiquidateRequestForVaultBaseForString = + | { + deposit: string + } + | { + lend: string + } + | { + vault: { + position_type: VaultPositionType + request_vault: VaultBaseForString + } + } export type VaultPositionType = 'u_n_l_o_c_k_e_d' | 'l_o_c_k_e_d' | 'u_n_l_o_c_k_i_n_g' +export type AccountNftBaseForString = string export type OwnerUpdate = | { propose_new_owner: { @@ -158,11 +171,17 @@ export type OwnerUpdate = | 'clear_proposed' | 'accept_proposed' | 'abolish_owner_role' + | { + set_emergency_owner: { + emergency_owner: string + } + } + | 'clear_emergency_owner' export type CallbackMsg = | { withdraw: { account_id: string - coin: Coin + coin: ActionCoin recipient: Addr } } @@ -175,19 +194,44 @@ export type CallbackMsg = | { repay: { account_id: string + coin?: ActionCoin + denom?: string + amount?: ActionAmount + } + } + | { + repay_for_recipient: { + benefactor_account_id: string coin: ActionCoin + recipient_account_id: string } } | { lend: { account_id: string - coin: Coin + coin: ActionCoin + } + } + | { + reclaim: { + account_id: string + coin: ActionCoin + } + } + | { + claim_rewards: { + account_id: string } } | { assert_max_ltv: { account_id: string - prev_health: Health + prev_health_state: HealthState + } + } + | { + assert_deposit_caps: { + denoms: string[] } } | { @@ -226,20 +270,11 @@ export type CallbackMsg = } } | { - liquidate_coin: { + liquidate: { debt_coin: Coin liquidatee_account_id: string liquidator_account_id: string - request_coin_denom: string - } - } - | { - liquidate_vault: { - debt_coin: Coin - liquidatee_account_id: string - liquidator_account_id: string - position_type: VaultPositionType - request_vault: VaultBaseForAddr + request: LiquidateRequestForVaultBaseForAddr } } | { @@ -253,15 +288,31 @@ export type CallbackMsg = | { update_coin_balance: { account_id: string + change: ChangeExpected previous_balance: Coin } } + | { + update_coin_balance_after_vault_liquidation: { + account_id: string + previous_balance: Coin + protocol_fee: Decimal + } + } | { provide_liquidity: { account_id: string coins_in: ActionCoin[] lp_token_out: string - minimum_receive: Uint128 + slippage?: Decimal + minimum_receive?: Uint128 + } + } + | { + withdraw_liquidity: { + account_id: string + lp_token: ActionCoin + slippage: Decimal } } | { @@ -275,39 +326,74 @@ export type CallbackMsg = account_id: string } } + | { + assert_hls_rules: { + account_id: string + } + } + | { + remove_reentrancy_guard: {} + } export type Addr = string +export type HealthState = + | 'healthy' + | { + unhealthy: { + max_ltv_health_factor: Decimal + } + } +export type LiquidateRequestForVaultBaseForAddr = + | { + deposit: string + } + | { + lend: string + } + | { + vault: { + position_type: VaultPositionType + request_vault: VaultBaseForAddr + } + } +export type ChangeExpected = 'increase' | 'decrease' +export interface Coin { + amount: Uint128 + denom: string + [k: string]: unknown +} export interface ActionCoin { amount: ActionAmount denom: string } +export interface VaultBaseForString { + address: string +} export interface ConfigUpdates { - account_nft?: string | null - allowed_coins?: string[] | null - max_close_factor?: Decimal | null + account_nft?: AccountNftBaseForString | null + health_contract?: HealthContractBaseForString | null + incentives?: IncentivesUnchecked | null + max_slippage?: Decimal | null max_unlocking_positions?: Uint128 | null oracle?: OracleBaseForString | null + red_bank?: RedBankUnchecked | null + rewards_collector?: string | null swapper?: SwapperBaseForString | null vault_configs?: VaultInstantiateConfig[] | null zapper?: ZapperBaseForString | null } export interface NftConfigUpdates { + credit_manager_contract_addr?: string | null + health_contract_addr?: string | null max_value_for_burn?: Uint128 | null - proposed_new_minter?: string | null -} -export interface Health { - liquidation_health_factor?: Decimal | null - liquidation_threshold_adjusted_collateral: Uint128 - max_ltv_adjusted_collateral: Uint128 - max_ltv_health_factor?: Decimal | null - total_collateral_value: Uint128 - total_debt_value: Uint128 } export interface VaultBaseForAddr { address: Addr } export type QueryMsg = | { - config: {} + account_kind: { + account_id: string + } } | { vaults_info: { @@ -316,18 +402,22 @@ export type QueryMsg = } } | { - allowed_coins: { + accounts: { limit?: number | null + owner: string start_after?: string | null } } | { - positions: { - account_id: string + config: {} + } + | { + vault_utilization: { + vault: VaultBaseForString } } | { - health: { + positions: { account_id: string } } @@ -352,38 +442,12 @@ export type QueryMsg = start_after?: string | null } } - | { - all_lent_shares: { - limit?: number | null - start_after?: [string, string] | null - } - } - | { - total_lent_shares: string - } - | { - all_total_lent_shares: { - limit?: number | null - start_after?: string | null - } - } | { all_vault_positions: { limit?: number | null start_after?: [string, string] | null } } - | { - total_vault_coin_balance: { - vault: VaultBaseForString - } - } - | { - all_total_vault_coin_balances: { - limit?: number | null - start_after?: VaultBaseForString | null - } - } | { estimate_provide_liquidity: { coins_in: Coin[] @@ -395,6 +459,38 @@ export type QueryMsg = lp_token: Coin } } + | { + vault_position_value: { + vault_position: VaultPosition + } + } +export type VaultPositionAmount = + | { + unlocked: VaultAmount + } + | { + locking: LockingVaultAmount + } +export type VaultAmount = string +export type VaultAmount1 = string +export type UnlockingPositions = VaultUnlockingPosition[] +export interface VaultPosition { + amount: VaultPositionAmount + vault: VaultBaseForAddr +} +export interface LockingVaultAmount { + locked: VaultAmount1 + unlocking: UnlockingPositions +} +export interface VaultUnlockingPosition { + coin: Coin + id: number +} +export type ArrayOfAccount = Account[] +export interface Account { + id: string + kind: AccountKind +} export type ArrayOfCoinBalanceResponseItem = CoinBalanceResponseItem[] export interface CoinBalanceResponseItem { account_id: string @@ -412,71 +508,42 @@ export interface DebtShares { denom: string shares: Uint128 } -export type ArrayOfLentShares = LentShares[] -export interface LentShares { - denom: string - shares: Uint128 -} -export type ArrayOfVaultWithBalance = VaultWithBalance[] -export interface VaultWithBalance { - balance: Uint128 - vault: VaultBaseForAddr -} -export type VaultPositionAmount = - | { - unlocked: VaultAmount - } - | { - locking: LockingVaultAmount - } -export type VaultAmount = string -export type VaultAmount1 = string -export type UnlockingPositions = VaultUnlockingPosition[] export type ArrayOfVaultPositionResponseItem = VaultPositionResponseItem[] export interface VaultPositionResponseItem { account_id: string position: VaultPosition } -export interface VaultPosition { - amount: VaultPositionAmount - vault: VaultBaseForAddr -} -export interface LockingVaultAmount { - locked: VaultAmount1 - unlocking: UnlockingPositions -} -export interface VaultUnlockingPosition { - coin: Coin - id: number -} -export type ArrayOfString = string[] export interface ConfigResponse { account_nft?: string | null - max_close_factor: Decimal + health_contract: string + incentives: string + max_slippage: Decimal max_unlocking_positions: Uint128 oracle: string - owner?: string | null - proposed_new_owner?: string | null + ownership: OwnerResponse + params: string red_bank: string + rewards_collector?: RewardsCollector | null swapper: string zapper: string } -export type ArrayOfCoin = Coin[] -export interface HealthResponse { - above_max_ltv: boolean - liquidatable: boolean - liquidation_health_factor?: Decimal | null - liquidation_threshold_adjusted_collateral: Uint128 - max_ltv_adjusted_collateral: Uint128 - max_ltv_health_factor?: Decimal | null - total_collateral_value: Uint128 - total_debt_value: Uint128 +export interface OwnerResponse { + abolished: boolean + emergency_owner?: string | null + initialized: boolean + owner?: string | null + proposed?: string | null } +export interface RewardsCollector { + account_id: string + address: string +} +export type ArrayOfCoin = Coin[] export interface Positions { account_id: string debts: DebtAmount[] deposits: Coin[] - lends: LentAmount[] + lends: Coin[] vaults: VaultPosition[] } export interface DebtAmount { @@ -484,14 +551,16 @@ export interface DebtAmount { denom: string shares: Uint128 } -export interface LentAmount { +export interface VaultPositionValue { + base_coin: CoinValue + vault_coin: CoinValue +} +export interface CoinValue { amount: Uint128 denom: string - shares: Uint128 + value: Uint128 } -export type ArrayOfVaultInfoResponse = VaultInfoResponse[] -export interface VaultInfoResponse { - config: VaultConfig +export interface VaultUtilizationResponse { utilization: Coin vault: VaultBaseForString } diff --git a/src/types/generated/mars-credit-manager/bundle.ts b/src/types/generated/mars-credit-manager/bundle.ts index e2c9935..3ebba13 100644 --- a/src/types/generated/mars-credit-manager/bundle.ts +++ b/src/types/generated/mars-credit-manager/bundle.ts @@ -1,6 +1,6 @@ // @ts-nocheck /** - * This file was automatically generated by @cosmwasm/ts-codegen@0.24.0. + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/src/types/generated/mars-params/MarsParams.client.ts b/src/types/generated/mars-params/MarsParams.client.ts new file mode 100644 index 0000000..f95b303 --- /dev/null +++ b/src/types/generated/mars-params/MarsParams.client.ts @@ -0,0 +1,257 @@ +// @ts-nocheck +/** + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run the @cosmwasm/ts-codegen generate command to regenerate this file. + */ + +import { StdFee } from '@cosmjs/amino' +import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' + +import { + ArrayOfAssetParamsBaseForAddr, + ArrayOfVaultConfigBaseForAddr, + AssetParamsBaseForAddr, + AssetParamsUpdate, + Coin, + Decimal, + EmergencyUpdate, + OwnerResponse, + OwnerUpdate, + TotalDepositResponse, + VaultConfigBaseForAddr, + VaultConfigUpdate, +} from './MarsParams.types' +export interface MarsParamsReadOnlyInterface { + contractAddress: string + owner: () => Promise + assetParams: ({ denom }: { denom: string }) => Promise + allAssetParams: ({ + limit, + startAfter, + }: { + limit?: number + startAfter?: string + }) => Promise + vaultConfig: ({ address }: { address: string }) => Promise + allVaultConfigs: ({ + limit, + startAfter, + }: { + limit?: number + startAfter?: string + }) => Promise + targetHealthFactor: () => Promise + totalDeposit: ({ denom }: { denom: string }) => Promise +} +export class MarsParamsQueryClient implements MarsParamsReadOnlyInterface { + client: CosmWasmClient + contractAddress: string + + constructor(client: CosmWasmClient, contractAddress: string) { + this.client = client + this.contractAddress = contractAddress + this.owner = this.owner.bind(this) + this.assetParams = this.assetParams.bind(this) + this.allAssetParams = this.allAssetParams.bind(this) + this.vaultConfig = this.vaultConfig.bind(this) + this.allVaultConfigs = this.allVaultConfigs.bind(this) + this.targetHealthFactor = this.targetHealthFactor.bind(this) + this.totalDeposit = this.totalDeposit.bind(this) + } + + owner = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + owner: {}, + }) + } + assetParams = async ({ denom }: { denom: string }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + asset_params: { + denom, + }, + }) + } + allAssetParams = async ({ + limit, + startAfter, + }: { + limit?: number + startAfter?: string + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + all_asset_params: { + limit, + start_after: startAfter, + }, + }) + } + vaultConfig = async ({ address }: { address: string }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + vault_config: { + address, + }, + }) + } + allVaultConfigs = async ({ + limit, + startAfter, + }: { + limit?: number + startAfter?: string + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + all_vault_configs: { + limit, + start_after: startAfter, + }, + }) + } + targetHealthFactor = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + target_health_factor: {}, + }) + } + totalDeposit = async ({ denom }: { denom: string }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + total_deposit: { + denom, + }, + }) + } +} +export interface MarsParamsInterface extends MarsParamsReadOnlyInterface { + contractAddress: string + sender: string + updateOwner: ( + ownerUpdate: OwnerUpdate, + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[], + ) => Promise + updateTargetHealthFactor: ( + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[], + ) => Promise + updateAssetParams: ( + assetParamsUpdate: AssetParamsUpdate, + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[], + ) => Promise + updateVaultConfig: ( + vaultConfigUpdate: VaultConfigUpdate, + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[], + ) => Promise + emergencyUpdate: ( + emergencyUpdate: EmergencyUpdate, + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[], + ) => Promise +} +export class MarsParamsClient extends MarsParamsQueryClient implements MarsParamsInterface { + client: SigningCosmWasmClient + sender: string + contractAddress: string + + constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress) + this.client = client + this.sender = sender + this.contractAddress = contractAddress + this.updateOwner = this.updateOwner.bind(this) + this.updateTargetHealthFactor = this.updateTargetHealthFactor.bind(this) + this.updateAssetParams = this.updateAssetParams.bind(this) + this.updateVaultConfig = this.updateVaultConfig.bind(this) + this.emergencyUpdate = this.emergencyUpdate.bind(this) + } + + updateOwner = async ( + ownerUpdate: OwnerUpdate, + fee: number | StdFee | 'auto' = 'auto', + memo?: string, + _funds?: Coin[], + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + update_owner: ownerUpdate, + }, + fee, + memo, + _funds, + ) + } + updateTargetHealthFactor = async ( + fee: number | StdFee | 'auto' = 'auto', + memo?: string, + _funds?: Coin[], + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + update_target_health_factor: {}, + }, + fee, + memo, + _funds, + ) + } + updateAssetParams = async ( + assetParamsUpdate: AssetParamsUpdate, + fee: number | StdFee | 'auto' = 'auto', + memo?: string, + _funds?: Coin[], + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + update_asset_params: assetParamsUpdate, + }, + fee, + memo, + _funds, + ) + } + updateVaultConfig = async ( + vaultConfigUpdate: VaultConfigUpdate, + fee: number | StdFee | 'auto' = 'auto', + memo?: string, + _funds?: Coin[], + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + update_vault_config: vaultConfigUpdate, + }, + fee, + memo, + _funds, + ) + } + emergencyUpdate = async ( + emergencyUpdate: EmergencyUpdate, + fee: number | StdFee | 'auto' = 'auto', + memo?: string, + _funds?: Coin[], + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + emergency_update: emergencyUpdate, + }, + fee, + memo, + _funds, + ) + } +} diff --git a/src/types/generated/mars-params/MarsParams.message-composer.ts b/src/types/generated/mars-params/MarsParams.message-composer.ts new file mode 100644 index 0000000..f5050d4 --- /dev/null +++ b/src/types/generated/mars-params/MarsParams.message-composer.ts @@ -0,0 +1,135 @@ +// @ts-nocheck +/** + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run the @cosmwasm/ts-codegen generate command to regenerate this file. + */ + +import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate' +import { toUtf8 } from '@cosmjs/encoding' +import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx' + +import { + AssetParamsUpdate, + Coin, + EmergencyUpdate, + OwnerUpdate, + VaultConfigUpdate, +} from './MarsParams.types' +export interface MarsParamsMessage { + contractAddress: string + sender: string + updateOwner: (ownerUpdate: OwnerUpdate, _funds?: Coin[]) => MsgExecuteContractEncodeObject + updateTargetHealthFactor: (_funds?: Coin[]) => MsgExecuteContractEncodeObject + updateAssetParams: ( + assetParamsUpdate: AssetParamsUpdate, + _funds?: Coin[], + ) => MsgExecuteContractEncodeObject + updateVaultConfig: ( + vaultConfigUpdate: VaultConfigUpdate, + _funds?: Coin[], + ) => MsgExecuteContractEncodeObject + emergencyUpdate: ( + emergencyUpdate: EmergencyUpdate, + _funds?: Coin[], + ) => MsgExecuteContractEncodeObject +} +export class MarsParamsMessageComposer implements MarsParamsMessage { + sender: string + contractAddress: string + + constructor(sender: string, contractAddress: string) { + this.sender = sender + this.contractAddress = contractAddress + this.updateOwner = this.updateOwner.bind(this) + this.updateTargetHealthFactor = this.updateTargetHealthFactor.bind(this) + this.updateAssetParams = this.updateAssetParams.bind(this) + this.updateVaultConfig = this.updateVaultConfig.bind(this) + this.emergencyUpdate = this.emergencyUpdate.bind(this) + } + + updateOwner = (ownerUpdate: OwnerUpdate, _funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8( + JSON.stringify({ + update_owner: ownerUpdate, + }), + ), + funds: _funds, + }), + } + } + updateTargetHealthFactor = (_funds?: Coin[]): MsgExecuteContractEncodeObject => { + return { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8( + JSON.stringify({ + update_target_health_factor: {}, + }), + ), + funds: _funds, + }), + } + } + updateAssetParams = ( + assetParamsUpdate: AssetParamsUpdate, + _funds?: Coin[], + ): MsgExecuteContractEncodeObject => { + return { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8( + JSON.stringify({ + update_asset_params: assetParamsUpdate, + }), + ), + funds: _funds, + }), + } + } + updateVaultConfig = ( + vaultConfigUpdate: VaultConfigUpdate, + _funds?: Coin[], + ): MsgExecuteContractEncodeObject => { + return { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8( + JSON.stringify({ + update_vault_config: vaultConfigUpdate, + }), + ), + funds: _funds, + }), + } + } + emergencyUpdate = ( + emergencyUpdate: EmergencyUpdate, + _funds?: Coin[], + ): MsgExecuteContractEncodeObject => { + return { + typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', + value: MsgExecuteContract.fromPartial({ + sender: this.sender, + contract: this.contractAddress, + msg: toUtf8( + JSON.stringify({ + emergency_update: emergencyUpdate, + }), + ), + funds: _funds, + }), + } + } +} diff --git a/src/types/generated/mars-params/MarsParams.react-query.ts b/src/types/generated/mars-params/MarsParams.react-query.ts new file mode 100644 index 0000000..e620985 --- /dev/null +++ b/src/types/generated/mars-params/MarsParams.react-query.ts @@ -0,0 +1,306 @@ +// @ts-nocheck +/** + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run the @cosmwasm/ts-codegen generate command to regenerate this file. + */ + +import { StdFee } from '@cosmjs/amino' +import { ExecuteResult } from '@cosmjs/cosmwasm-stargate' +import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from '@tanstack/react-query' + +import { MarsParamsClient, MarsParamsQueryClient } from './MarsParams.client' +import { + ArrayOfAssetParamsBaseForAddr, + ArrayOfVaultConfigBaseForAddr, + AssetParamsBaseForAddr, + AssetParamsUpdate, + Coin, + Decimal, + EmergencyUpdate, + OwnerResponse, + OwnerUpdate, + TotalDepositResponse, + VaultConfigBaseForAddr, + VaultConfigUpdate, +} from './MarsParams.types' +export const marsParamsQueryKeys = { + contract: [ + { + contract: 'marsParams', + }, + ] as const, + address: (contractAddress: string | undefined) => + [{ ...marsParamsQueryKeys.contract[0], address: contractAddress }] as const, + owner: (contractAddress: string | undefined, args?: Record) => + [{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'owner', args }] as const, + assetParams: (contractAddress: string | undefined, args?: Record) => + [{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'asset_params', args }] as const, + allAssetParams: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_asset_params', args }, + ] as const, + vaultConfig: (contractAddress: string | undefined, args?: Record) => + [{ ...marsParamsQueryKeys.address(contractAddress)[0], method: 'vault_config', args }] as const, + allVaultConfigs: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsParamsQueryKeys.address(contractAddress)[0], method: 'all_vault_configs', args }, + ] as const, + targetHealthFactor: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsParamsQueryKeys.address(contractAddress)[0], method: 'target_health_factor', args }, + ] as const, + totalDeposit: (contractAddress: string | undefined, args?: Record) => + [ + { ...marsParamsQueryKeys.address(contractAddress)[0], method: 'total_deposit', args }, + ] as const, +} +export interface MarsParamsReactQuery { + client: MarsParamsQueryClient | undefined + options?: Omit< + UseQueryOptions, + "'queryKey' | 'queryFn' | 'initialData'" + > & { + initialData?: undefined + } +} +export interface MarsParamsTotalDepositQuery + extends MarsParamsReactQuery { + args: { + denom: string + } +} +export function useMarsParamsTotalDepositQuery({ + client, + args, + options, +}: MarsParamsTotalDepositQuery) { + return useQuery( + marsParamsQueryKeys.totalDeposit(client?.contractAddress, args), + () => + client + ? client.totalDeposit({ + denom: args.denom, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsTargetHealthFactorQuery + extends MarsParamsReactQuery {} +export function useMarsParamsTargetHealthFactorQuery({ + client, + options, +}: MarsParamsTargetHealthFactorQuery) { + return useQuery( + marsParamsQueryKeys.targetHealthFactor(client?.contractAddress), + () => (client ? client.targetHealthFactor() : Promise.reject(new Error('Invalid client'))), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsAllVaultConfigsQuery + extends MarsParamsReactQuery { + args: { + limit?: number + startAfter?: string + } +} +export function useMarsParamsAllVaultConfigsQuery({ + client, + args, + options, +}: MarsParamsAllVaultConfigsQuery) { + return useQuery( + marsParamsQueryKeys.allVaultConfigs(client?.contractAddress, args), + () => + client + ? client.allVaultConfigs({ + limit: args.limit, + startAfter: args.startAfter, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsVaultConfigQuery + extends MarsParamsReactQuery { + args: { + address: string + } +} +export function useMarsParamsVaultConfigQuery({ + client, + args, + options, +}: MarsParamsVaultConfigQuery) { + return useQuery( + marsParamsQueryKeys.vaultConfig(client?.contractAddress, args), + () => + client + ? client.vaultConfig({ + address: args.address, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsAllAssetParamsQuery + extends MarsParamsReactQuery { + args: { + limit?: number + startAfter?: string + } +} +export function useMarsParamsAllAssetParamsQuery({ + client, + args, + options, +}: MarsParamsAllAssetParamsQuery) { + return useQuery( + marsParamsQueryKeys.allAssetParams(client?.contractAddress, args), + () => + client + ? client.allAssetParams({ + limit: args.limit, + startAfter: args.startAfter, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsAssetParamsQuery + extends MarsParamsReactQuery { + args: { + denom: string + } +} +export function useMarsParamsAssetParamsQuery({ + client, + args, + options, +}: MarsParamsAssetParamsQuery) { + return useQuery( + marsParamsQueryKeys.assetParams(client?.contractAddress, args), + () => + client + ? client.assetParams({ + denom: args.denom, + }) + : Promise.reject(new Error('Invalid client')), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsOwnerQuery extends MarsParamsReactQuery {} +export function useMarsParamsOwnerQuery({ + client, + options, +}: MarsParamsOwnerQuery) { + return useQuery( + marsParamsQueryKeys.owner(client?.contractAddress), + () => (client ? client.owner() : Promise.reject(new Error('Invalid client'))), + { ...options, enabled: !!client && (options?.enabled != undefined ? options.enabled : true) }, + ) +} +export interface MarsParamsEmergencyUpdateMutation { + client: MarsParamsClient + msg: EmergencyUpdate + args?: { + fee?: number | StdFee | 'auto' + memo?: string + funds?: Coin[] + } +} +export function useMarsParamsEmergencyUpdateMutation( + options?: Omit< + UseMutationOptions, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.emergencyUpdate(msg, fee, memo, funds), + options, + ) +} +export interface MarsParamsUpdateVaultConfigMutation { + client: MarsParamsClient + msg: VaultConfigUpdate + args?: { + fee?: number | StdFee | 'auto' + memo?: string + funds?: Coin[] + } +} +export function useMarsParamsUpdateVaultConfigMutation( + options?: Omit< + UseMutationOptions, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.updateVaultConfig(msg, fee, memo, funds), + options, + ) +} +export interface MarsParamsUpdateAssetParamsMutation { + client: MarsParamsClient + msg: AssetParamsUpdate + args?: { + fee?: number | StdFee | 'auto' + memo?: string + funds?: Coin[] + } +} +export function useMarsParamsUpdateAssetParamsMutation( + options?: Omit< + UseMutationOptions, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.updateAssetParams(msg, fee, memo, funds), + options, + ) +} +export interface MarsParamsUpdateTargetHealthFactorMutation { + client: MarsParamsClient + args?: { + fee?: number | StdFee | 'auto' + memo?: string + funds?: Coin[] + } +} +export function useMarsParamsUpdateTargetHealthFactorMutation( + options?: Omit< + UseMutationOptions, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => + client.updateTargetHealthFactor(msg, fee, memo, funds), + options, + ) +} +export interface MarsParamsUpdateOwnerMutation { + client: MarsParamsClient + msg: OwnerUpdate + args?: { + fee?: number | StdFee | 'auto' + memo?: string + funds?: Coin[] + } +} +export function useMarsParamsUpdateOwnerMutation( + options?: Omit< + UseMutationOptions, + 'mutationFn' + >, +) { + return useMutation( + ({ client, msg, args: { fee, memo, funds } = {} }) => client.updateOwner(msg, fee, memo, funds), + options, + ) +} diff --git a/src/types/generated/mars-params/MarsParams.types.ts b/src/types/generated/mars-params/MarsParams.types.ts new file mode 100644 index 0000000..04005ce --- /dev/null +++ b/src/types/generated/mars-params/MarsParams.types.ts @@ -0,0 +1,215 @@ +// @ts-nocheck +/** + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run the @cosmwasm/ts-codegen generate command to regenerate this file. + */ + +export type Decimal = string +export interface InstantiateMsg { + address_provider: string + owner: string + target_health_factor: Decimal +} +export type ExecuteMsg = + | { + update_owner: OwnerUpdate + } + | { + update_target_health_factor: Decimal + } + | { + update_asset_params: AssetParamsUpdate + } + | { + update_vault_config: VaultConfigUpdate + } + | { + emergency_update: EmergencyUpdate + } +export type OwnerUpdate = + | { + propose_new_owner: { + proposed: string + } + } + | 'clear_proposed' + | 'accept_proposed' + | 'abolish_owner_role' + | { + set_emergency_owner: { + emergency_owner: string + } + } + | 'clear_emergency_owner' +export type AssetParamsUpdate = { + add_or_update: { + params: AssetParamsBaseForString + } +} +export type HlsAssetTypeForString = + | { + coin: { + denom: string + } + } + | { + vault: { + addr: string + } + } +export type Uint128 = string +export type VaultConfigUpdate = { + add_or_update: { + config: VaultConfigBaseForString + } +} +export type EmergencyUpdate = + | { + credit_manager: CmEmergencyUpdate + } + | { + red_bank: RedBankEmergencyUpdate + } +export type CmEmergencyUpdate = + | { + set_zero_max_ltv_on_vault: string + } + | { + set_zero_deposit_cap_on_vault: string + } + | { + disallow_coin: string + } +export type RedBankEmergencyUpdate = { + disable_borrowing: string +} +export interface AssetParamsBaseForString { + credit_manager: CmSettingsForString + denom: string + deposit_cap: Uint128 + liquidation_bonus: LiquidationBonus + liquidation_threshold: Decimal + max_loan_to_value: Decimal + protocol_liquidation_fee: Decimal + red_bank: RedBankSettings +} +export interface CmSettingsForString { + hls?: HlsParamsBaseForString | null + whitelisted: boolean +} +export interface HlsParamsBaseForString { + correlations: HlsAssetTypeForString[] + liquidation_threshold: Decimal + max_loan_to_value: Decimal +} +export interface LiquidationBonus { + max_lb: Decimal + min_lb: Decimal + slope: Decimal + starting_lb: Decimal +} +export interface RedBankSettings { + borrow_enabled: boolean + deposit_enabled: boolean +} +export interface VaultConfigBaseForString { + addr: string + deposit_cap: Coin + hls?: HlsParamsBaseForString | null + liquidation_threshold: Decimal + max_loan_to_value: Decimal + whitelisted: boolean +} +export interface Coin { + amount: Uint128 + denom: string + [k: string]: unknown +} +export type QueryMsg = + | { + owner: {} + } + | { + asset_params: { + denom: string + } + } + | { + all_asset_params: { + limit?: number | null + start_after?: string | null + } + } + | { + vault_config: { + address: string + } + } + | { + all_vault_configs: { + limit?: number | null + start_after?: string | null + } + } + | { + target_health_factor: {} + } + | { + total_deposit: { + denom: string + } + } +export type HlsAssetTypeForAddr = + | { + coin: { + denom: string + } + } + | { + vault: { + addr: Addr + } + } +export type Addr = string +export type ArrayOfAssetParamsBaseForAddr = AssetParamsBaseForAddr[] +export interface AssetParamsBaseForAddr { + credit_manager: CmSettingsForAddr + denom: string + deposit_cap: Uint128 + liquidation_bonus: LiquidationBonus + liquidation_threshold: Decimal + max_loan_to_value: Decimal + protocol_liquidation_fee: Decimal + red_bank: RedBankSettings +} +export interface CmSettingsForAddr { + hls?: HlsParamsBaseForAddr | null + whitelisted: boolean +} +export interface HlsParamsBaseForAddr { + correlations: HlsAssetTypeForAddr[] + liquidation_threshold: Decimal + max_loan_to_value: Decimal +} +export type ArrayOfVaultConfigBaseForAddr = VaultConfigBaseForAddr[] +export interface VaultConfigBaseForAddr { + addr: Addr + deposit_cap: Coin + hls?: HlsParamsBaseForAddr | null + liquidation_threshold: Decimal + max_loan_to_value: Decimal + whitelisted: boolean +} +export interface OwnerResponse { + abolished: boolean + emergency_owner?: string | null + initialized: boolean + owner?: string | null + proposed?: string | null +} +export interface TotalDepositResponse { + amount: Uint128 + cap: Uint128 + denom: string +} diff --git a/src/types/generated/mars-params/bundle.ts b/src/types/generated/mars-params/bundle.ts new file mode 100644 index 0000000..5a951e5 --- /dev/null +++ b/src/types/generated/mars-params/bundle.ts @@ -0,0 +1,14 @@ +// @ts-nocheck +/** + * This file was automatically generated by @cosmwasm/ts-codegen@0.33.0. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run the @cosmwasm/ts-codegen generate command to regenerate this file. + */ + +import * as _25 from './MarsParams.client' +import * as _26 from './MarsParams.message-composer' +import * as _27 from './MarsParams.react-query' +import * as _24 from './MarsParams.types' +export namespace contracts { + export const MarsParams = { ..._24, ..._25, ..._26, ..._27 } +} diff --git a/src/types/interfaces/fields.d.ts b/src/types/interfaces/fields.d.ts index 217354e..4a2ed14 100644 --- a/src/types/interfaces/fields.d.ts +++ b/src/types/interfaces/fields.d.ts @@ -109,21 +109,30 @@ interface PositionApyBreakdown extends ApyBreakdown { net: number | null } -interface ApyBreakdown { - vaultAddress: string - apys: { type: string; value: number }[] | null - fees: { type: string; value: number }[] | null - total: number | null +interface AprResponse { + vaults: AprVault[] } -interface ApolloAprResponse { - contract_address: string +interface AprVault { + chain: string + address: string apr: AprBreakdown } interface AprBreakdown { - aprs: { type: string; value: number }[] - fees: { type: string; value: string | number }[] + start_timestamp: number + end_timestamp: number + period_diff: number + start_vault_token_price: number + end_vault_token_price: number + period_yield: number + period_daily_return: number + projected_apr: number +} + +interface ApyBreakdown { + vaultAddress: string + total: number | null } interface VaultCapData { diff --git a/src/types/interfaces/networkConfig.d.ts b/src/types/interfaces/networkConfig.d.ts index 4524548..29e37db 100644 --- a/src/types/interfaces/networkConfig.d.ts +++ b/src/types/interfaces/networkConfig.d.ts @@ -4,7 +4,7 @@ interface NetworkConfig { hiveUrl: string rpcUrl: string restUrl: string - apolloAprUrl?: string + vaultAprUrl?: string usdPriceUrl?: string chainIcon: string contracts: { @@ -14,6 +14,7 @@ interface NetworkConfig { accountNft?: string creditManager?: string pyth?: string + params?: string } assets: { base: Asset diff --git a/yarn.lock b/yarn.lock index 46dea4a..3a42ff0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1782,7 +1782,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13": +"@jridgewell/sourcemap-codec@^1.4.10": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -1871,10 +1871,10 @@ resolved "https://registry.yarnpkg.com/@kurkle/color/-/color-0.3.2.tgz#5acd38242e8bde4f9986e7913c8fdf49d3aa199f" integrity sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw== -"@marsprotocol/wallet-connector@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@marsprotocol/wallet-connector/-/wallet-connector-2.1.2.tgz#9d5d56fa379706630d09f3008226527055b997ef" - integrity sha512-aHFjgbMo2x3kg3kA9g6Y24vATd5FWwUPcTeuQbk8dwPE8BcKfGhALp37iTMKFC1vdweC+pMn6TCjDtkJ7QhK3Q== +"@marsprotocol/wallet-connector@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@marsprotocol/wallet-connector/-/wallet-connector-2.1.3.tgz#eb30f9fd80ce54fca975c8de71a0514a40483b15" + integrity sha512-LVLUZsWpVl0zB4xxWlt/oFzPTLXrWsBw1VdiqOrIKXrCShyqckHM0QtBLfIBc5u4UXOnS0FAqWrc7PHjymGgPQ== dependencies: "@cosmjs/cosmwasm-stargate" "^0.31.1" "@delphi-labs/shuttle-react" "^3.9.0" @@ -2229,27 +2229,6 @@ "@react-spring/shared" "~9.7.3" "@react-spring/types" "~9.7.3" -"@rollup/plugin-commonjs@24.0.0": - version "24.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.0.tgz#fb7cf4a6029f07ec42b25daa535c75b05a43f75c" - integrity sha512-0w0wyykzdyRRPHOb0cQt14mIBLujfAv6GgP6g8nvg/iBxEm112t3YPPq+Buqe2+imvElTka+bjNlJ/gB56TD8g== - dependencies: - "@rollup/pluginutils" "^5.0.1" - commondir "^1.0.1" - estree-walker "^2.0.2" - glob "^8.0.3" - is-reference "1.2.1" - magic-string "^0.27.0" - -"@rollup/pluginutils@^5.0.1": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" - integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA== - dependencies: - "@types/estree" "^1.0.0" - estree-walker "^2.0.2" - picomatch "^2.3.1" - "@rushstack/eslint-patch@^1.1.3": version "1.3.2" resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.3.2.tgz#31b9c510d8cada9683549e1dbb4284cca5001faf" @@ -2277,132 +2256,6 @@ "@noble/hashes" "~1.3.0" "@scure/base" "~1.1.0" -"@sentry-internal/tracing@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.57.0.tgz#cb761931b635f8f24c84be0eecfacb8516b20551" - integrity sha512-tpViyDd8AhQGYYhI94xi2aaDopXOPfL2Apwrtb3qirWkomIQ2K86W1mPmkce+B0cFOnW2Dxv/ZTFKz6ghjK75A== - dependencies: - "@sentry/core" "7.57.0" - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/browser@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.57.0.tgz#6e724c9eac680dba99ced0fdf81be8d1e3b3bceb" - integrity sha512-E0HaYYlaqHFiIRZXxcvOO8Odvlt+TR1vFFXzqUWXPOvDRxURglTOCQ3EN/u6bxtAGJ6y/Zc2obgihTtypuel/w== - dependencies: - "@sentry-internal/tracing" "7.57.0" - "@sentry/core" "7.57.0" - "@sentry/replay" "7.57.0" - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/cli@^1.74.6": - version "1.75.2" - resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.75.2.tgz#2c38647b38300e52c9839612d42b7c23f8d6455b" - integrity sha512-CG0CKH4VCKWzEaegouWfCLQt9SFN+AieFESCatJ7zSuJmzF05ywpMusjxqRul6lMwfUhRKjGKOzcRJ1jLsfTBw== - dependencies: - https-proxy-agent "^5.0.0" - mkdirp "^0.5.5" - node-fetch "^2.6.7" - progress "^2.0.3" - proxy-from-env "^1.1.0" - which "^2.0.2" - -"@sentry/core@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.57.0.tgz#65093d739c04f320a54395a21be955fcbe326acb" - integrity sha512-l014NudPH0vQlzybtXajPxYFfs9w762NoarjObC3gu76D1jzBBFzhdRelkGpDbSLNTIsKhEDDRpgAjBWJ9icfw== - dependencies: - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/integrations@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.57.0.tgz#298085b3a2fe862cc70bc7f2143aa0fbc617322c" - integrity sha512-C3WZo5AGI2L0dj+mIjeZpdAwDEG2nDYvZbTzq5J9hVoHFdP3t7fOWBHSPkSFVtTdMaJrv+82aKnUefVCeAjxGg== - dependencies: - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - localforage "^1.8.1" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/nextjs@^7.36.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/nextjs/-/nextjs-7.57.0.tgz#a6fc7cb827eb28124e06baf10d160b619208129d" - integrity sha512-TH7Hhs833j1k2rM5K3AqiQ7+bxrTzANZazBLEK1YVec02PpnqflVuBHSdFxT6dG7ypxOpMkN36BN5INY5HHT0Q== - dependencies: - "@rollup/plugin-commonjs" "24.0.0" - "@sentry/core" "7.57.0" - "@sentry/integrations" "7.57.0" - "@sentry/node" "7.57.0" - "@sentry/react" "7.57.0" - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - "@sentry/webpack-plugin" "1.20.0" - chalk "3.0.0" - rollup "2.78.0" - stacktrace-parser "^0.1.10" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/node@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.57.0.tgz#31052f5988ed4496d7f3ff925240cf9b02d09941" - integrity sha512-63mjyUVM6sfJFVQ5TGVRVGUsoEfESl5ABzIW1W0s9gUiQPaG8SOdaQJglb2VNrkMYxnRHgD8Q9LUh/qcmUyPGw== - dependencies: - "@sentry-internal/tracing" "7.57.0" - "@sentry/core" "7.57.0" - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - cookie "^0.4.1" - https-proxy-agent "^5.0.0" - lru_map "^0.3.3" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/react@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.57.0.tgz#cf91f0115bcd2a8306d6c8a39d8e8b53d4b21814" - integrity sha512-XGNTjIoCG3naSmCU8qObd+y+CqAB6NQkGWOp2yyBwp2inyKF2ehJvDh6bIQloBYq2TmOJDa4NfXdMrkilxaLFQ== - dependencies: - "@sentry/browser" "7.57.0" - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - hoist-non-react-statics "^3.3.2" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/replay@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.57.0.tgz#c8f7eae7b7edc9d32c3d2955b337f3b3c76dff39" - integrity sha512-pN4ryNS3J5EYbkXvR+O/+hseAJha7XDl8mPFtK0OGTHG10JzCi4tQJazblHQdpb5QBaMMPCeZ+isyfoQLDNXnw== - dependencies: - "@sentry/core" "7.57.0" - "@sentry/types" "7.57.0" - "@sentry/utils" "7.57.0" - -"@sentry/types@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.57.0.tgz#4fdb80cbd49ba034dd8d9be0c0005a016d5db3ce" - integrity sha512-D7ifoUfxuVCUyktIr5Gc+jXUbtcUMmfHdTtTbf1XCZHua5mJceK9wtl3YCg3eq/HK2Ppd52BKnTzEcS5ZKQM+w== - -"@sentry/utils@7.57.0": - version "7.57.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.57.0.tgz#8253c6fcf35138b4c424234b8da1596e11b98ad8" - integrity sha512-YXrkMCiNklqkXctn4mKYkrzNCf/dfVcRUQrkXjeBC+PHXbcpPyaJgInNvztR7Skl8lE3JPGPN4v5XhLxK1bUUg== - dependencies: - "@sentry/types" "7.57.0" - tslib "^2.4.1 || ^1.9.3" - -"@sentry/webpack-plugin@1.20.0": - version "1.20.0" - resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.20.0.tgz#e7add76122708fb6b4ee7951294b521019720e58" - integrity sha512-Ssj1mJVFsfU6vMCOM2d+h+KQR7QHSfeIP16t4l20Uq/neqWXZUQ2yvQfe4S3BjdbJXz/X4Rw8Hfy1Sd0ocunYw== - dependencies: - "@sentry/cli" "^1.74.6" - webpack-sources "^2.0.0 || ^3.0.0" - "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -2719,11 +2572,6 @@ dependencies: classnames "*" -"@types/estree@*", "@types/estree@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194" - integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA== - "@types/graceful-fs@^4.1.3": version "4.1.6" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" @@ -3609,13 +3457,6 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -brace-expansion@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" - integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== - dependencies: - balanced-match "^1.0.0" - braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" @@ -3750,14 +3591,6 @@ caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001503: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz#418aefeed9d024cd3129bfae0ccc782d4cb8f12b" integrity sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA== -chalk@3.0.0, chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - chalk@^2.0.0, chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -3767,6 +3600,14 @@ chalk@^2.0.0, chalk@^2.4.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -3899,11 +3740,6 @@ commander@^4.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -3919,11 +3755,6 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" - integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== - copy-to-clipboard@^3.3.1: version "3.3.3" resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" @@ -4710,11 +4541,6 @@ estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== -estree-walker@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" - integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== - esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -5190,17 +5016,6 @@ glob@^7.0.0, glob@^7.0.5, glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.3: - version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -5399,7 +5214,7 @@ http-status-codes@^2.2.0: resolved "https://registry.yarnpkg.com/http-status-codes/-/http-status-codes-2.2.0.tgz#bb2efe63d941dfc2be18e15f703da525169622be" integrity sha512-feERVo9iWxvnejp3SEfm/+oNG517npqL2/PIA8ORjyOZjGC7TwCRQsZylciLS64i6pJ0wRYz3rkXLRwbtFa8Ng== -https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: +https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -5465,11 +5280,6 @@ ignore@^5.1.4, ignore@^5.2.0, ignore@^5.2.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== -immediate@~3.0.5: - version "3.0.6" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" - integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ== - immutable@^4.0.0: version "4.3.1" resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.1.tgz#17988b356097ab0719e2f741d56f3ec6c317f9dc" @@ -5672,13 +5482,6 @@ is-potential-custom-element-name@^1.0.1: resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== -is-reference@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" - integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== - dependencies: - "@types/estree" "*" - is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -6462,13 +6265,6 @@ libsodium@^0.7.11: resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.11.tgz#cd10aae7bcc34a300cc6ad0ac88fcca674cfbc2e" integrity sha512-WPfJ7sS53I2s4iM58QxY3Inb83/6mjlYgcmZs7DJsvDlnmVUwNinBCi5vBT43P6bHRy01O4zsMU2CoVR6xJ40A== -lie@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" - integrity sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw== - dependencies: - immediate "~3.0.5" - lilconfig@^2.0.5: version "2.1.0" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" @@ -6491,13 +6287,6 @@ load-tsconfig@^0.2.3: resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1" integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== -localforage@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.10.0.tgz#5c465dc5f62b2807c3a84c0c6a1b1b3212781dd4" - integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== - dependencies: - lie "3.1.1" - locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -6585,23 +6374,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -lru_map@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" - integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== - lz-string@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ== -magic-string@^0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" - integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== - dependencies: - "@jridgewell/sourcemap-codec" "^1.4.13" - make-dir@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -6697,25 +6474,11 @@ minimatch@^3.0.3, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatc dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1: - version "5.1.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" - integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== - dependencies: - brace-expansion "^2.0.1" - minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -mkdirp@^0.5.5: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" @@ -6843,7 +6606,7 @@ node-addon-api@^5.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== -node-fetch@^2.6.11, node-fetch@^2.6.12, node-fetch@^2.6.7: +node-fetch@^2.6.11, node-fetch@^2.6.12: version "2.6.12" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba" integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g== @@ -7253,11 +7016,6 @@ process-warning@^1.0.0: resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== -progress@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== - prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -7659,13 +7417,6 @@ rlp@^2.2.3, rlp@^2.2.4: dependencies: bn.js "^5.2.0" -rollup@2.78.0: - version "2.78.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.78.0.tgz#00995deae70c0f712ea79ad904d5f6b033209d9e" - integrity sha512-4+YfbQC9QEVvKTanHhIAFVUFSRsezvQF8vFOJwtGfb9Bb+r014S+qryr9PSmw8x6sMnPkmFBGAvIFVQxvJxjtg== - optionalDependencies: - fsevents "~2.3.2" - rollup@^3.2.5: version "3.26.2" resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.26.2.tgz#2e76a37606cb523fc9fef43e6f59c93f86d95e7c" @@ -7942,13 +7693,6 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" -stacktrace-parser@^0.1.10: - version "0.1.10" - resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz#29fb0cae4e0d0b85155879402857a1639eb6051a" - integrity sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg== - dependencies: - type-fest "^0.7.1" - stop-iteration-iterator@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz#6a60be0b4ee757d1ed5254858ec66b10c49285e4" @@ -8332,7 +8076,7 @@ tslib@1.14.1, tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, "tslib@^2.4.1 || ^1.9.3", tslib@^2.5.0, tslib@^2.6.0: +tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== @@ -8396,11 +8140,6 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -type-fest@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48" - integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg== - type-fest@^2.5.2: version "2.19.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" @@ -8570,11 +8309,6 @@ webidl-conversions@^7.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -"webpack-sources@^2.0.0 || ^3.0.0": - version "3.2.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" - integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== - whatwg-encoding@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" @@ -8645,7 +8379,7 @@ which-typed-array@^1.1.9: has-tostringtag "^1.0.0" is-typed-array "^1.1.10" -which@^2.0.1, which@^2.0.2: +which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==