@gearbox-protocol/sdk 16.0.0-next.21 → 16.0.0-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/onchain/accounts/index.js +5 -0
- package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +2 -2
- package/dist/cjs/onchain/accounts/intents/open-strategy.js +7 -4
- package/dist/cjs/onchain/accounts/intents/realize.js +10 -6
- package/dist/cjs/onchain/accounts/intents/tail.js +3 -2
- package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -1
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +18 -1
- package/dist/cjs/onchain/accounts/intents/tests/add-collateral.fixtures.js +4 -4
- package/dist/cjs/onchain/accounts/intents/tests/adjust-leverage.fixtures.js +15 -15
- package/dist/cjs/onchain/accounts/intents/tests/deposit.fixtures.js +13 -13
- package/dist/cjs/onchain/accounts/intents/tests/finish-decrease-leverage.fixtures.js +2 -2
- package/dist/cjs/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +2 -2
- package/dist/cjs/onchain/accounts/intents/tests/withdraw-asset.fixtures.js +4 -4
- package/dist/cjs/onchain/accounts/intents/tests/withdraw.fixtures.js +7 -7
- package/dist/cjs/onchain/accounts/intents/utils/adjust-state-to-snapshot.js +8 -5
- package/dist/cjs/onchain/accounts/intents/utils/common.js +2 -2
- package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +4 -4
- package/dist/cjs/onchain/accounts/intents/utils/quotas-for-update.js +2 -2
- package/dist/cjs/onchain/accounts/intents/view.js +2 -2
- package/dist/cjs/{common-utils/utils/creditAccount → onchain/accounts}/quota-utils.js +3 -3
- package/dist/cjs/onchain/index.js +12 -0
- package/dist/cjs/onchain/market/MarketSuite.js +15 -0
- package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +2 -2
- package/dist/cjs/onchain/market/math.js +6 -2
- package/dist/cjs/onchain/pools/PoolService.js +25 -29
- package/dist/cjs/onchain/utils/index.js +7 -0
- package/dist/cjs/{common-utils → onchain}/utils/trace.js +1 -1
- package/dist/cjs/preview/index.js +3 -1
- package/dist/cjs/preview/preview/buildDelayedPreview.js +4 -5
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +3 -3
- package/dist/cjs/preview/preview/previewCloseOrRepayCreditAccount.js +1 -1
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +7 -7
- package/dist/cjs/preview/trace/extractAdapterCallTraces.js +2 -2
- package/dist/cjs/preview/trace/findFacadeCalls.js +2 -2
- package/dist/cjs/preview/validate/checkOperation.js +47 -37
- package/dist/cjs/preview/validate/checkSimulation.js +3 -16
- package/dist/cjs/preview/validate/index.js +3 -1
- package/dist/cjs/rewards/rewards/api.js +0 -1
- package/dist/cjs/rewards/rewards/extra-apy.js +0 -1
- package/dist/cjs/sdk/execute/ExecuteApi.js +9 -6
- package/dist/cjs/sdk/prepare/PrepareApi.js +4 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/index.js +2 -1
- package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +2 -2
- package/dist/esm/onchain/accounts/intents/open-strategy.js +7 -4
- package/dist/esm/onchain/accounts/intents/realize.js +10 -6
- package/dist/esm/onchain/accounts/intents/tail.js +3 -2
- package/dist/esm/onchain/accounts/intents/testing/market.js +1 -1
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +18 -1
- package/dist/esm/onchain/accounts/intents/tests/add-collateral.fixtures.js +4 -4
- package/dist/esm/onchain/accounts/intents/tests/adjust-leverage.fixtures.js +15 -15
- package/dist/esm/onchain/accounts/intents/tests/deposit.fixtures.js +13 -13
- package/dist/esm/onchain/accounts/intents/tests/finish-decrease-leverage.fixtures.js +2 -2
- package/dist/esm/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +2 -2
- package/dist/esm/onchain/accounts/intents/tests/withdraw-asset.fixtures.js +4 -4
- package/dist/esm/onchain/accounts/intents/tests/withdraw.fixtures.js +7 -7
- package/dist/esm/onchain/accounts/intents/utils/adjust-state-to-snapshot.js +8 -5
- package/dist/esm/onchain/accounts/intents/utils/common.js +2 -2
- package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +4 -4
- package/dist/esm/onchain/accounts/intents/utils/quotas-for-update.js +1 -1
- package/dist/esm/onchain/accounts/intents/view.js +2 -2
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/{common-utils/utils/creditAccount → onchain/accounts}/quota-utils.js +3 -3
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/chain/detectNetwork.js +1 -1
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/index.js +3 -1
- package/dist/esm/onchain/market/MarketSuite.js +15 -0
- package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/math.js +6 -2
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/pools/PoolService.js +26 -30
- package/dist/esm/onchain/utils/index.js +2 -1
- package/dist/esm/{common-utils → onchain}/utils/trace.js +1 -1
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/preview/index.js +2 -2
- package/dist/esm/preview/preview/buildDelayedPreview.js +4 -5
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +3 -3
- package/dist/esm/preview/preview/previewCloseOrRepayCreditAccount.js +1 -1
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +7 -7
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractAdapterCallTraces.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/preview/trace/findFacadeCalls.js +1 -1
- package/dist/esm/preview/validate/checkOperation.js +45 -37
- package/dist/esm/preview/validate/checkSimulation.js +5 -18
- package/dist/esm/preview/validate/index.js +2 -2
- package/dist/esm/rewards/rewards/api.js +0 -1
- package/dist/esm/rewards/rewards/extra-apy.js +0 -1
- package/dist/esm/sdk/execute/ExecuteApi.js +9 -6
- package/dist/esm/sdk/prepare/PrepareApi.js +4 -1
- package/dist/types/history/classifyMulticallOperations.d.ts +1 -1
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/model/previews.d.ts +59 -109
- package/dist/types/onchain/accounts/index.d.ts +2 -1
- package/dist/types/onchain/accounts/intents/open-strategy.d.ts +15 -29
- package/dist/types/onchain/accounts/intents/operations.d.ts +1 -1
- package/dist/types/onchain/accounts/intents/testing/expect.d.ts +6 -2
- package/dist/types/onchain/accounts/intents/testing/market.d.ts +1 -1
- package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +1 -1
- package/dist/types/onchain/accounts/intents/tests/add-collateral.fixtures.d.ts +1 -1
- package/dist/types/onchain/accounts/intents/tests/adjust-leverage.fixtures.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/tests/deposit.fixtures.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/tests/withdraw-asset.fixtures.d.ts +1 -1
- package/dist/types/onchain/accounts/intents/tests/withdraw.fixtures.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/types.d.ts +8 -59
- package/dist/types/onchain/accounts/intents/utils/adjust-state-to-snapshot.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +3 -3
- package/dist/types/{common-utils/utils/creditAccount → onchain/accounts}/quota-utils.d.ts +3 -4
- package/dist/types/onchain/base/index.d.ts +2 -2
- package/dist/types/onchain/base/types.d.ts +5 -1
- package/dist/types/onchain/index.d.ts +5 -3
- package/dist/types/onchain/market/MarketSuite.d.ts +13 -1
- package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +1 -1
- package/dist/types/onchain/market/adapters/contracts/AccountMigratorAdapterContract.d.ts +1 -1
- package/dist/types/onchain/market/credit/index.d.ts +2 -2
- package/dist/types/onchain/market/credit/types.d.ts +10 -1
- package/dist/types/onchain/market/index.d.ts +2 -2
- package/dist/types/onchain/market/math.d.ts +5 -1
- package/dist/types/onchain/pools/types.d.ts +6 -4
- package/dist/types/onchain/utils/index.d.ts +2 -1
- package/dist/types/{common-utils → onchain}/utils/trace.d.ts +1 -1
- package/dist/types/preview/index.d.ts +2 -2
- package/dist/types/preview/preview/buildDelayedPreview.d.ts +1 -1
- package/dist/types/preview/trace/extractAdapterCallTraces.d.ts +1 -1
- package/dist/types/preview/trace/findFacadeCalls.d.ts +1 -1
- package/dist/types/preview/trace/types.d.ts +1 -1
- package/dist/types/preview/validate/checkOperation.d.ts +24 -7
- package/dist/types/preview/validate/index.d.ts +2 -2
- package/dist/types/rewards/rewards/extra-apy.d.ts +1 -1
- package/package.json +1 -6
- package/dist/cjs/common-utils/axios-cache/AxiosCache.js +0 -98
- package/dist/cjs/common-utils/axios-cache/index.js +0 -3
- package/dist/cjs/common-utils/charts/credit-manager-payload.js +0 -1
- package/dist/cjs/common-utils/charts/credit-manager.js +0 -100
- package/dist/cjs/common-utils/charts/credit-session.js +0 -211
- package/dist/cjs/common-utils/charts/credit-sessions-payload.js +0 -1
- package/dist/cjs/common-utils/charts/graph-payload.js +0 -1
- package/dist/cjs/common-utils/charts/index.js +0 -18
- package/dist/cjs/common-utils/charts/pool-payload.js +0 -1
- package/dist/cjs/common-utils/charts/pool.js +0 -177
- package/dist/cjs/common-utils/charts/token-data.js +0 -68
- package/dist/cjs/common-utils/index.js +0 -191
- package/dist/cjs/common-utils/package.json +0 -1
- package/dist/cjs/common-utils/static/index.js +0 -5
- package/dist/cjs/common-utils/static/migration-config.js +0 -1
- package/dist/cjs/common-utils/static/pool-config.js +0 -1
- package/dist/cjs/common-utils/static/strategy.js +0 -1
- package/dist/cjs/common-utils/static/trading-pair.js +0 -1
- package/dist/cjs/common-utils/test-utils/index.js +0 -105
- package/dist/cjs/common-utils/utils/apy/bonus-apy-from-points.js +0 -5
- package/dist/cjs/common-utils/utils/apy/calculate-borrow-rate-from-utilization.js +0 -22
- package/dist/cjs/common-utils/utils/apy/calculate-borrow-rate-from-utilization.spec.js +0 -34
- package/dist/cjs/common-utils/utils/apy/calculate-earnings.js +0 -23
- package/dist/cjs/common-utils/utils/apy/calculate-earnings.spec.js +0 -68
- package/dist/cjs/common-utils/utils/apy/calculate-effective-borrow-rate.js +0 -8
- package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +0 -20
- package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.spec.js +0 -39
- package/dist/cjs/common-utils/utils/apy/get-complex-apy-list.js +0 -18
- package/dist/cjs/common-utils/utils/apy/get-rate-with-fee.js +0 -16
- package/dist/cjs/common-utils/utils/apy/get-safe-base-borrow-rate.js +0 -14
- package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +0 -16
- package/dist/cjs/common-utils/utils/apy/index.js +0 -21
- package/dist/cjs/common-utils/utils/apy/max-apy-formula.js +0 -14
- package/dist/cjs/common-utils/utils/assets-math.js +0 -185
- package/dist/cjs/common-utils/utils/constants.js +0 -9
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +0 -41
- package/dist/cjs/common-utils/utils/creditAccount/calc-overall-apy.js +0 -46
- package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +0 -22
- package/dist/cjs/common-utils/utils/creditAccount/calc-relative-base-borrow-rate.js +0 -16
- package/dist/cjs/common-utils/utils/creditAccount/debt.js +0 -46
- package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +0 -24
- package/dist/cjs/common-utils/utils/creditAccount/index.js +0 -27
- package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +0 -39
- package/dist/cjs/common-utils/utils/creditAccount/sort.js +0 -95
- package/dist/cjs/common-utils/utils/creditAccount/types.js +0 -1
- package/dist/cjs/common-utils/utils/index.js +0 -175
- package/dist/cjs/common-utils/utils/price-math.js +0 -51
- package/dist/cjs/common-utils/utils/strategies/assets/assets.js +0 -7
- package/dist/cjs/common-utils/utils/strategies/assets/index.js +0 -3
- package/dist/cjs/common-utils/utils/strategies/availability/check-boolean.js +0 -10
- package/dist/cjs/common-utils/utils/strategies/availability/check-degen-nft.js +0 -13
- package/dist/cjs/common-utils/utils/strategies/availability/index.js +0 -5
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.js +0 -23
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.spec.js +0 -109
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list-core.js +0 -31
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js +0 -15
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js +0 -23
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.js +0 -29
- package/dist/cjs/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.spec.js +0 -95
- package/dist/cjs/common-utils/utils/strategies/credit-managers/index.js +0 -13
- package/dist/cjs/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.js +0 -9
- package/dist/cjs/common-utils/utils/strategies/eligibility/index.js +0 -5
- package/dist/cjs/common-utils/utils/strategies/eligibility/is-strategy-eligible.js +0 -20
- package/dist/cjs/common-utils/utils/strategies/eligibility/is-strategy-released.js +0 -8
- package/dist/cjs/common-utils/utils/strategies/index.js +0 -121
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-loss-coefficient.js +0 -10
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +0 -16
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +0 -21
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.spec.js +0 -304
- package/dist/cjs/common-utils/utils/strategies/leverage/get-collateral-by-debt.js +0 -10
- package/dist/cjs/common-utils/utils/strategies/leverage/get-collateral-by-debt.spec.js +0 -30
- package/dist/cjs/common-utils/utils/strategies/leverage/get-factor-from-leverage.js +0 -9
- package/dist/cjs/common-utils/utils/strategies/leverage/get-leverage-from-factor.js +0 -9
- package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-debt.js +0 -47
- package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-debt.spec.js +0 -222
- package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.js +0 -7
- package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.spec.js +0 -19
- package/dist/cjs/common-utils/utils/strategies/leverage/index.js +0 -21
- package/dist/cjs/common-utils/utils/strategies/leverage/max-leverage-threshold.js +0 -17
- package/dist/cjs/common-utils/utils/strategies/leverage/max-leverage.js +0 -17
- package/dist/cjs/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.js +0 -16
- package/dist/cjs/common-utils/utils/strategies/lists/get-available-strategies.js +0 -32
- package/dist/cjs/common-utils/utils/strategies/lists/get-disabled-strategies.js +0 -33
- package/dist/cjs/common-utils/utils/strategies/lists/get-released-strategies-list-core.js +0 -24
- package/dist/cjs/common-utils/utils/strategies/lists/get-released-strategies-list.js +0 -16
- package/dist/cjs/common-utils/utils/strategies/lists/index.js +0 -7
- package/dist/cjs/common-utils/utils/strategies/points/get-complex-points-list.js +0 -15
- package/dist/cjs/common-utils/utils/strategies/points/get-points-info.js +0 -12
- package/dist/cjs/common-utils/utils/strategies/points/get-points-rates.js +0 -8
- package/dist/cjs/common-utils/utils/strategies/points/get-strategy-points.js +0 -41
- package/dist/cjs/common-utils/utils/strategies/points/index.js +0 -9
- package/dist/cjs/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.js +0 -3
- package/dist/cjs/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.js +0 -18
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-apy.js +0 -63
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-apy.spec.js +0 -184
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +0 -38
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.spec.js +0 -126
- package/dist/cjs/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +0 -43
- package/dist/cjs/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +0 -135
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +0 -297
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-info-core.js +0 -70
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-info.js +0 -33
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.js +0 -66
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-you-can-earn.js +0 -58
- package/dist/cjs/common-utils/utils/strategies/strategy-info/index.js +0 -23
- package/dist/cjs/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.js +0 -9
- package/dist/cjs/common-utils/utils/strategies/strategy-info/types.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/strategy-state/index.js +0 -3
- package/dist/cjs/common-utils/utils/strategies/strategy-state/is-strategy-disabled.js +0 -14
- package/dist/cjs/common-utils/utils/strategies/tokens/add-amount-in-target.js +0 -18
- package/dist/cjs/common-utils/utils/strategies/tokens/add-amount-in-target.spec.js +0 -29
- package/dist/cjs/common-utils/utils/strategies/tokens/get-chain-phantom-tokens.js +0 -10
- package/dist/cjs/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.js +0 -12
- package/dist/cjs/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.spec.js +0 -37
- package/dist/cjs/common-utils/utils/strategies/tokens/get-native-token-address.js +0 -8
- package/dist/cjs/common-utils/utils/strategies/tokens/index.js +0 -26
- package/dist/cjs/common-utils/utils/strategies/tokens/is-activated-token.js +0 -9
- package/dist/cjs/common-utils/utils/strategies/tokens/is-apy-with-points-exception.js +0 -10
- package/dist/cjs/common-utils/utils/strategies/tokens/is-collateral-token.js +0 -28
- package/dist/cjs/common-utils/utils/strategies/tokens/is-collateral-token.spec.js +0 -143
- package/dist/cjs/common-utils/utils/strategies/tokens/is-forbidden-token.js +0 -7
- package/dist/cjs/common-utils/utils/strategies/tokens/is-obtainable-token.js +0 -13
- package/dist/cjs/common-utils/utils/strategies/tokens/is-obtainable-token.spec.js +0 -148
- package/dist/cjs/common-utils/utils/strategies/tokens/is-usable-token.js +0 -15
- package/dist/cjs/common-utils/utils/strategies/tokens/is-valid-extra-collateral-token.js +0 -22
- package/dist/cjs/common-utils/utils/strategies/tokens/wrap-token-address.js +0 -8
- package/dist/cjs/common-utils/utils/strategies/tokens/wrap-token-address.spec.js +0 -15
- package/dist/cjs/common-utils/utils/strategies/types/chains.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/credit-manager-data-legacy.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/curator-filter.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/index.js +0 -14
- package/dist/cjs/common-utils/utils/strategies/types/legacy-strategy-data-source.js +0 -30
- package/dist/cjs/common-utils/utils/strategies/types/points-slices.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/sdk-state.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/strategies-cm-list.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/strategy-data-source.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/strategy-data.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/strategy-earnings.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/strategy.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types/targetable.js +0 -1
- package/dist/cjs/common-utils/utils/strategies/types.js +0 -4
- package/dist/cjs/plugins/apy/ApyPlugin.js +0 -248
- package/dist/cjs/plugins/apy/apy-parser.js +0 -129
- package/dist/cjs/plugins/apy/constants.js +0 -7
- package/dist/cjs/plugins/apy/index.js +0 -18
- package/dist/cjs/plugins/apy/package.json +0 -1
- package/dist/cjs/plugins/apy/pool-apy-types.js +0 -1
- package/dist/cjs/plugins/apy/pool-apy-utils.js +0 -121
- package/dist/cjs/plugins/apy/strategy-data-source.js +0 -163
- package/dist/cjs/plugins/apy/types.js +0 -1
- package/dist/cjs/plugins/remote-configs/CustomConfigSource.js +0 -18
- package/dist/cjs/plugins/remote-configs/RemoteConfigSource.js +0 -26
- package/dist/cjs/plugins/remote-configs/RemoteConfigsPlugin.js +0 -127
- package/dist/cjs/plugins/remote-configs/index.js +0 -8
- package/dist/cjs/plugins/remote-configs/package.json +0 -1
- package/dist/cjs/plugins/remote-configs/types.js +0 -1
- package/dist/esm/common-utils/axios-cache/AxiosCache.js +0 -95
- package/dist/esm/common-utils/axios-cache/index.js +0 -2
- package/dist/esm/common-utils/charts/credit-manager-payload.js +0 -1
- package/dist/esm/common-utils/charts/credit-manager.js +0 -99
- package/dist/esm/common-utils/charts/credit-session.js +0 -206
- package/dist/esm/common-utils/charts/credit-sessions-payload.js +0 -1
- package/dist/esm/common-utils/charts/graph-payload.js +0 -1
- package/dist/esm/common-utils/charts/index.js +0 -9
- package/dist/esm/common-utils/charts/pool-payload.js +0 -1
- package/dist/esm/common-utils/charts/pool.js +0 -175
- package/dist/esm/common-utils/charts/token-data.js +0 -67
- package/dist/esm/common-utils/index.js +0 -87
- package/dist/esm/common-utils/package.json +0 -1
- package/dist/esm/common-utils/static/index.js +0 -5
- package/dist/esm/common-utils/static/migration-config.js +0 -1
- package/dist/esm/common-utils/static/pool-config.js +0 -1
- package/dist/esm/common-utils/static/strategy.js +0 -1
- package/dist/esm/common-utils/static/trading-pair.js +0 -1
- package/dist/esm/common-utils/test-utils/index.js +0 -93
- package/dist/esm/common-utils/utils/apy/bonus-apy-from-points.js +0 -4
- package/dist/esm/common-utils/utils/apy/calculate-borrow-rate-from-utilization.js +0 -21
- package/dist/esm/common-utils/utils/apy/calculate-borrow-rate-from-utilization.spec.js +0 -34
- package/dist/esm/common-utils/utils/apy/calculate-earnings.js +0 -22
- package/dist/esm/common-utils/utils/apy/calculate-earnings.spec.js +0 -68
- package/dist/esm/common-utils/utils/apy/calculate-effective-borrow-rate.js +0 -7
- package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +0 -19
- package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.spec.js +0 -39
- package/dist/esm/common-utils/utils/apy/get-complex-apy-list.js +0 -17
- package/dist/esm/common-utils/utils/apy/get-rate-with-fee.js +0 -15
- package/dist/esm/common-utils/utils/apy/get-safe-base-borrow-rate.js +0 -13
- package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +0 -15
- package/dist/esm/common-utils/utils/apy/index.js +0 -11
- package/dist/esm/common-utils/utils/apy/max-apy-formula.js +0 -13
- package/dist/esm/common-utils/utils/assets-math.js +0 -184
- package/dist/esm/common-utils/utils/constants.js +0 -6
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +0 -40
- package/dist/esm/common-utils/utils/creditAccount/calc-overall-apy.js +0 -45
- package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +0 -21
- package/dist/esm/common-utils/utils/creditAccount/calc-relative-base-borrow-rate.js +0 -15
- package/dist/esm/common-utils/utils/creditAccount/debt.js +0 -44
- package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +0 -23
- package/dist/esm/common-utils/utils/creditAccount/index.js +0 -10
- package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +0 -38
- package/dist/esm/common-utils/utils/creditAccount/sort.js +0 -90
- package/dist/esm/common-utils/utils/creditAccount/types.js +0 -1
- package/dist/esm/common-utils/utils/index.js +0 -81
- package/dist/esm/common-utils/utils/price-math.js +0 -50
- package/dist/esm/common-utils/utils/strategies/assets/assets.js +0 -6
- package/dist/esm/common-utils/utils/strategies/assets/index.js +0 -2
- package/dist/esm/common-utils/utils/strategies/availability/check-boolean.js +0 -9
- package/dist/esm/common-utils/utils/strategies/availability/check-degen-nft.js +0 -12
- package/dist/esm/common-utils/utils/strategies/availability/index.js +0 -3
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.js +0 -22
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.spec.js +0 -109
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list-core.js +0 -30
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js +0 -14
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js +0 -22
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.js +0 -28
- package/dist/esm/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.spec.js +0 -95
- package/dist/esm/common-utils/utils/strategies/credit-managers/index.js +0 -7
- package/dist/esm/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.js +0 -8
- package/dist/esm/common-utils/utils/strategies/eligibility/index.js +0 -3
- package/dist/esm/common-utils/utils/strategies/eligibility/is-strategy-eligible.js +0 -19
- package/dist/esm/common-utils/utils/strategies/eligibility/is-strategy-released.js +0 -7
- package/dist/esm/common-utils/utils/strategies/index.js +0 -66
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-loss-coefficient.js +0 -9
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +0 -15
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +0 -20
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.spec.js +0 -304
- package/dist/esm/common-utils/utils/strategies/leverage/get-collateral-by-debt.js +0 -9
- package/dist/esm/common-utils/utils/strategies/leverage/get-collateral-by-debt.spec.js +0 -30
- package/dist/esm/common-utils/utils/strategies/leverage/get-factor-from-leverage.js +0 -8
- package/dist/esm/common-utils/utils/strategies/leverage/get-leverage-from-factor.js +0 -8
- package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-debt.js +0 -46
- package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-debt.spec.js +0 -222
- package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.js +0 -6
- package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.spec.js +0 -19
- package/dist/esm/common-utils/utils/strategies/leverage/index.js +0 -11
- package/dist/esm/common-utils/utils/strategies/leverage/max-leverage-threshold.js +0 -16
- package/dist/esm/common-utils/utils/strategies/leverage/max-leverage.js +0 -16
- package/dist/esm/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.js +0 -15
- package/dist/esm/common-utils/utils/strategies/lists/get-available-strategies.js +0 -31
- package/dist/esm/common-utils/utils/strategies/lists/get-disabled-strategies.js +0 -32
- package/dist/esm/common-utils/utils/strategies/lists/get-released-strategies-list-core.js +0 -23
- package/dist/esm/common-utils/utils/strategies/lists/get-released-strategies-list.js +0 -15
- package/dist/esm/common-utils/utils/strategies/lists/index.js +0 -4
- package/dist/esm/common-utils/utils/strategies/points/get-complex-points-list.js +0 -14
- package/dist/esm/common-utils/utils/strategies/points/get-points-info.js +0 -11
- package/dist/esm/common-utils/utils/strategies/points/get-points-rates.js +0 -7
- package/dist/esm/common-utils/utils/strategies/points/get-strategy-points.js +0 -40
- package/dist/esm/common-utils/utils/strategies/points/index.js +0 -5
- package/dist/esm/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.js +0 -2
- package/dist/esm/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.js +0 -17
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-apy.js +0 -62
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-apy.spec.js +0 -184
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +0 -37
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.spec.js +0 -124
- package/dist/esm/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +0 -42
- package/dist/esm/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +0 -133
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +0 -296
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-info-core.js +0 -69
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-info.js +0 -32
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.js +0 -65
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-you-can-earn.js +0 -57
- package/dist/esm/common-utils/utils/strategies/strategy-info/index.js +0 -12
- package/dist/esm/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.js +0 -8
- package/dist/esm/common-utils/utils/strategies/strategy-info/types.js +0 -1
- package/dist/esm/common-utils/utils/strategies/strategy-state/index.js +0 -2
- package/dist/esm/common-utils/utils/strategies/strategy-state/is-strategy-disabled.js +0 -13
- package/dist/esm/common-utils/utils/strategies/tokens/add-amount-in-target.js +0 -17
- package/dist/esm/common-utils/utils/strategies/tokens/add-amount-in-target.spec.js +0 -29
- package/dist/esm/common-utils/utils/strategies/tokens/get-chain-phantom-tokens.js +0 -9
- package/dist/esm/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.js +0 -11
- package/dist/esm/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.spec.js +0 -37
- package/dist/esm/common-utils/utils/strategies/tokens/get-native-token-address.js +0 -7
- package/dist/esm/common-utils/utils/strategies/tokens/index.js +0 -13
- package/dist/esm/common-utils/utils/strategies/tokens/is-activated-token.js +0 -8
- package/dist/esm/common-utils/utils/strategies/tokens/is-apy-with-points-exception.js +0 -8
- package/dist/esm/common-utils/utils/strategies/tokens/is-collateral-token.js +0 -27
- package/dist/esm/common-utils/utils/strategies/tokens/is-collateral-token.spec.js +0 -143
- package/dist/esm/common-utils/utils/strategies/tokens/is-forbidden-token.js +0 -6
- package/dist/esm/common-utils/utils/strategies/tokens/is-obtainable-token.js +0 -12
- package/dist/esm/common-utils/utils/strategies/tokens/is-obtainable-token.spec.js +0 -148
- package/dist/esm/common-utils/utils/strategies/tokens/is-usable-token.js +0 -14
- package/dist/esm/common-utils/utils/strategies/tokens/is-valid-extra-collateral-token.js +0 -21
- package/dist/esm/common-utils/utils/strategies/tokens/wrap-token-address.js +0 -7
- package/dist/esm/common-utils/utils/strategies/tokens/wrap-token-address.spec.js +0 -15
- package/dist/esm/common-utils/utils/strategies/types/chains.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/credit-manager-data-legacy.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/curator-filter.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/index.js +0 -13
- package/dist/esm/common-utils/utils/strategies/types/legacy-strategy-data-source.js +0 -29
- package/dist/esm/common-utils/utils/strategies/types/points-slices.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/sdk-state.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/strategies-cm-list.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/strategy-data-source.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/strategy-data.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/strategy-earnings.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/strategy.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types/targetable.js +0 -1
- package/dist/esm/common-utils/utils/strategies/types.js +0 -3
- package/dist/esm/plugins/apy/ApyPlugin.js +0 -247
- package/dist/esm/plugins/apy/apy-parser.js +0 -126
- package/dist/esm/plugins/apy/constants.js +0 -5
- package/dist/esm/plugins/apy/index.js +0 -7
- package/dist/esm/plugins/apy/package.json +0 -1
- package/dist/esm/plugins/apy/pool-apy-types.js +0 -1
- package/dist/esm/plugins/apy/pool-apy-utils.js +0 -116
- package/dist/esm/plugins/apy/strategy-data-source.js +0 -162
- package/dist/esm/plugins/apy/types.js +0 -1
- package/dist/esm/plugins/remote-configs/CustomConfigSource.js +0 -17
- package/dist/esm/plugins/remote-configs/RemoteConfigSource.js +0 -25
- package/dist/esm/plugins/remote-configs/RemoteConfigsPlugin.js +0 -126
- package/dist/esm/plugins/remote-configs/index.js +0 -5
- package/dist/esm/plugins/remote-configs/package.json +0 -1
- package/dist/esm/plugins/remote-configs/types.js +0 -1
- package/dist/types/common-utils/axios-cache/AxiosCache.d.ts +0 -31
- package/dist/types/common-utils/axios-cache/index.d.ts +0 -2
- package/dist/types/common-utils/charts/credit-manager-payload.d.ts +0 -53
- package/dist/types/common-utils/charts/credit-manager.d.ts +0 -51
- package/dist/types/common-utils/charts/credit-session.d.ts +0 -113
- package/dist/types/common-utils/charts/credit-sessions-payload.d.ts +0 -113
- package/dist/types/common-utils/charts/graph-payload.d.ts +0 -12
- package/dist/types/common-utils/charts/index.d.ts +0 -9
- package/dist/types/common-utils/charts/pool-payload.d.ts +0 -114
- package/dist/types/common-utils/charts/pool.d.ts +0 -94
- package/dist/types/common-utils/charts/token-data.d.ts +0 -47
- package/dist/types/common-utils/index.d.ts +0 -107
- package/dist/types/common-utils/static/index.d.ts +0 -5
- package/dist/types/common-utils/static/migration-config.d.ts +0 -13
- package/dist/types/common-utils/static/pool-config.d.ts +0 -14
- package/dist/types/common-utils/static/strategy.d.ts +0 -86
- package/dist/types/common-utils/static/trading-pair.d.ts +0 -18
- package/dist/types/common-utils/test-utils/index.d.ts +0 -19
- package/dist/types/common-utils/utils/apy/bonus-apy-from-points.d.ts +0 -7
- package/dist/types/common-utils/utils/apy/calculate-borrow-rate-from-utilization.d.ts +0 -5
- package/dist/types/common-utils/utils/apy/calculate-borrow-rate-from-utilization.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/apy/calculate-earnings.d.ts +0 -19
- package/dist/types/common-utils/utils/apy/calculate-earnings.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/apy/calculate-effective-borrow-rate.d.ts +0 -9
- package/dist/types/common-utils/utils/apy/calculate-safe-borrow-rate.d.ts +0 -14
- package/dist/types/common-utils/utils/apy/calculate-safe-borrow-rate.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/apy/get-complex-apy-list.d.ts +0 -8
- package/dist/types/common-utils/utils/apy/get-rate-with-fee.d.ts +0 -10
- package/dist/types/common-utils/utils/apy/get-safe-base-borrow-rate.d.ts +0 -7
- package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +0 -14
- package/dist/types/common-utils/utils/apy/index.d.ts +0 -11
- package/dist/types/common-utils/utils/apy/max-apy-formula.d.ts +0 -9
- package/dist/types/common-utils/utils/assets-math.d.ts +0 -117
- package/dist/types/common-utils/utils/constants.d.ts +0 -7
- package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +0 -32
- package/dist/types/common-utils/utils/creditAccount/calc-overall-apy.d.ts +0 -41
- package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +0 -24
- package/dist/types/common-utils/utils/creditAccount/calc-relative-base-borrow-rate.d.ts +0 -18
- package/dist/types/common-utils/utils/creditAccount/debt.d.ts +0 -39
- package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +0 -24
- package/dist/types/common-utils/utils/creditAccount/index.d.ts +0 -10
- package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +0 -31
- package/dist/types/common-utils/utils/creditAccount/sort.d.ts +0 -59
- package/dist/types/common-utils/utils/creditAccount/types.d.ts +0 -22
- package/dist/types/common-utils/utils/index.d.ts +0 -93
- package/dist/types/common-utils/utils/price-math.d.ts +0 -49
- package/dist/types/common-utils/utils/strategies/assets/assets.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/assets/index.d.ts +0 -2
- package/dist/types/common-utils/utils/strategies/availability/check-boolean.d.ts +0 -4
- package/dist/types/common-utils/utils/strategies/availability/check-degen-nft.d.ts +0 -8
- package/dist/types/common-utils/utils/strategies/availability/index.d.ts +0 -3
- package/dist/types/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.d.ts +0 -21
- package/dist/types/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list-core.d.ts +0 -14
- package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.d.ts +0 -10
- package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.d.ts +0 -12
- package/dist/types/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.d.ts +0 -17
- package/dist/types/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/credit-managers/index.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.d.ts +0 -6
- package/dist/types/common-utils/utils/strategies/eligibility/index.d.ts +0 -3
- package/dist/types/common-utils/utils/strategies/eligibility/is-strategy-eligible.d.ts +0 -16
- package/dist/types/common-utils/utils/strategies/eligibility/is-strategy-released.d.ts +0 -4
- package/dist/types/common-utils/utils/strategies/index.d.ts +0 -78
- package/dist/types/common-utils/utils/strategies/leverage/calculate-loss-coefficient.d.ts +0 -4
- package/dist/types/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.d.ts +0 -15
- package/dist/types/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.d.ts +0 -14
- package/dist/types/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/leverage/get-collateral-by-debt.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/leverage/get-collateral-by-debt.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/leverage/get-factor-from-leverage.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/leverage/get-leverage-from-factor.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/leverage/get-recommended-debt.d.ts +0 -24
- package/dist/types/common-utils/utils/strategies/leverage/get-recommended-debt.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/leverage/index.d.ts +0 -11
- package/dist/types/common-utils/utils/strategies/leverage/max-leverage-threshold.d.ts +0 -8
- package/dist/types/common-utils/utils/strategies/leverage/max-leverage.d.ts +0 -12
- package/dist/types/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.d.ts +0 -14
- package/dist/types/common-utils/utils/strategies/lists/get-available-strategies.d.ts +0 -11
- package/dist/types/common-utils/utils/strategies/lists/get-disabled-strategies.d.ts +0 -12
- package/dist/types/common-utils/utils/strategies/lists/get-released-strategies-list-core.d.ts +0 -16
- package/dist/types/common-utils/utils/strategies/lists/get-released-strategies-list.d.ts +0 -10
- package/dist/types/common-utils/utils/strategies/lists/index.d.ts +0 -4
- package/dist/types/common-utils/utils/strategies/points/get-complex-points-list.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/points/get-points-info.d.ts +0 -12
- package/dist/types/common-utils/utils/strategies/points/get-points-rates.d.ts +0 -6
- package/dist/types/common-utils/utils/strategies/points/get-strategy-points.d.ts +0 -27
- package/dist/types/common-utils/utils/strategies/points/index.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.d.ts +0 -2
- package/dist/types/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.d.ts +0 -31
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-apy.d.ts +0 -31
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-apy.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-points.d.ts +0 -26
- package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-points.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/strategy-info/cm-availability-condition.d.ts +0 -6
- package/dist/types/common-utils/utils/strategies/strategy-info/credit-manager-issues.d.ts +0 -34
- package/dist/types/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.d.ts +0 -22
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-info-core.d.ts +0 -21
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-info.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.d.ts +0 -17
- package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-you-can-earn.d.ts +0 -31
- package/dist/types/common-utils/utils/strategies/strategy-info/index.d.ts +0 -12
- package/dist/types/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/strategy-info/types.d.ts +0 -113
- package/dist/types/common-utils/utils/strategies/strategy-state/index.d.ts +0 -2
- package/dist/types/common-utils/utils/strategies/strategy-state/is-strategy-disabled.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/tokens/add-amount-in-target.d.ts +0 -10
- package/dist/types/common-utils/utils/strategies/tokens/add-amount-in-target.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/tokens/get-chain-phantom-tokens.d.ts +0 -8
- package/dist/types/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.d.ts +0 -16
- package/dist/types/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/tokens/get-native-token-address.d.ts +0 -4
- package/dist/types/common-utils/utils/strategies/tokens/index.d.ts +0 -13
- package/dist/types/common-utils/utils/strategies/tokens/is-activated-token.d.ts +0 -10
- package/dist/types/common-utils/utils/strategies/tokens/is-apy-with-points-exception.d.ts +0 -6
- package/dist/types/common-utils/utils/strategies/tokens/is-collateral-token.d.ts +0 -17
- package/dist/types/common-utils/utils/strategies/tokens/is-collateral-token.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/tokens/is-forbidden-token.d.ts +0 -9
- package/dist/types/common-utils/utils/strategies/tokens/is-obtainable-token.d.ts +0 -11
- package/dist/types/common-utils/utils/strategies/tokens/is-obtainable-token.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/tokens/is-usable-token.d.ts +0 -6
- package/dist/types/common-utils/utils/strategies/tokens/is-valid-extra-collateral-token.d.ts +0 -20
- package/dist/types/common-utils/utils/strategies/tokens/wrap-token-address.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/tokens/wrap-token-address.spec.d.ts +0 -1
- package/dist/types/common-utils/utils/strategies/types/chains.d.ts +0 -6
- package/dist/types/common-utils/utils/strategies/types/credit-manager-data-legacy.d.ts +0 -34
- package/dist/types/common-utils/utils/strategies/types/curator-filter.d.ts +0 -5
- package/dist/types/common-utils/utils/strategies/types/index.d.ts +0 -13
- package/dist/types/common-utils/utils/strategies/types/legacy-strategy-data-source.d.ts +0 -7
- package/dist/types/common-utils/utils/strategies/types/points-slices.d.ts +0 -24
- package/dist/types/common-utils/utils/strategies/types/sdk-state.d.ts +0 -17
- package/dist/types/common-utils/utils/strategies/types/strategies-cm-list.d.ts +0 -9
- package/dist/types/common-utils/utils/strategies/types/strategy-data-source.d.ts +0 -22
- package/dist/types/common-utils/utils/strategies/types/strategy-data.d.ts +0 -19
- package/dist/types/common-utils/utils/strategies/types/strategy-earnings.d.ts +0 -47
- package/dist/types/common-utils/utils/strategies/types/strategy.d.ts +0 -20
- package/dist/types/common-utils/utils/strategies/types/targetable.d.ts +0 -9
- package/dist/types/common-utils/utils/strategies/types.d.ts +0 -14
- package/dist/types/plugins/apy/ApyPlugin.d.ts +0 -59
- package/dist/types/plugins/apy/apy-parser.d.ts +0 -10
- package/dist/types/plugins/apy/constants.d.ts +0 -5
- package/dist/types/plugins/apy/index.d.ts +0 -7
- package/dist/types/plugins/apy/pool-apy-types.d.ts +0 -45
- package/dist/types/plugins/apy/pool-apy-utils.d.ts +0 -77
- package/dist/types/plugins/apy/strategy-data-source.d.ts +0 -21
- package/dist/types/plugins/apy/types.d.ts +0 -64
- package/dist/types/plugins/remote-configs/CustomConfigSource.d.ts +0 -16
- package/dist/types/plugins/remote-configs/RemoteConfigSource.d.ts +0 -35
- package/dist/types/plugins/remote-configs/RemoteConfigsPlugin.d.ts +0 -29
- package/dist/types/plugins/remote-configs/index.d.ts +0 -8
- package/dist/types/plugins/remote-configs/types.d.ts +0 -26
|
@@ -30,7 +30,7 @@ function checkOperation(input, options = {}) {
|
|
|
30
30
|
case "RWAOpenCreditAccount":
|
|
31
31
|
case "AdjustCreditAccount": return creditIssues(sdk, preview, options);
|
|
32
32
|
case "CloseCreditAccount":
|
|
33
|
-
case "RepayCreditAccount": return marketIssues(sdk
|
|
33
|
+
case "RepayCreditAccount": return marketIssues(sdk.marketRegister.findCreditManager(preview.creditManager));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function poolIssues(sdk, preview, options, isDeposit) {
|
|
@@ -49,8 +49,8 @@ function poolIssues(sdk, preview, options, isDeposit) {
|
|
|
49
49
|
})) || fundingIssue(options, [preview.tokenIn]);
|
|
50
50
|
}
|
|
51
51
|
/** What the market itself refuses, whatever the operation does. */
|
|
52
|
-
function marketIssues(
|
|
53
|
-
const
|
|
52
|
+
function marketIssues(suite) {
|
|
53
|
+
const creditManager = suite.creditManager.address;
|
|
54
54
|
return checkCreditManagerPaused({
|
|
55
55
|
isPaused: suite.isPaused,
|
|
56
56
|
creditManager
|
|
@@ -65,29 +65,42 @@ function creditIssues(sdk, preview, options) {
|
|
|
65
65
|
const market = suite.market;
|
|
66
66
|
const underlying = toToken(sdk, market.pool.underlying);
|
|
67
67
|
const isOpening = preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount";
|
|
68
|
-
return marketIssues(
|
|
69
|
-
debt: preview.
|
|
68
|
+
return marketIssues(suite) || checkDebtInBand({
|
|
69
|
+
debt: preview.totalDebt.value,
|
|
70
70
|
minDebt: suite.creditFacade.minDebt,
|
|
71
71
|
maxDebt: suite.creditFacade.maxDebt,
|
|
72
72
|
underlying,
|
|
73
73
|
allowZero: !isOpening
|
|
74
|
-
}) || borrowIssue(suite, preview, underlying) || forbiddenIssue(suite, preview) ||
|
|
75
|
-
|
|
74
|
+
}) || borrowIssue(suite, preview, underlying) || forbiddenIssue(suite, preview) || quotaCountIssue(suite, preview) || quotaIssue(market, preview, underlying) || collateralIssue(preview, options) || fundingIssue(options, preview.collateralAdded);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A bar that reads nothing but the projected account, so a parsed transaction
|
|
78
|
+
* and a simulated one are held to it by the same code.
|
|
79
|
+
*
|
|
80
|
+
* These stay separate functions rather than one block because the order the
|
|
81
|
+
* checks run in is the answer: `checkOperation` interleaves the checks that
|
|
82
|
+
* need an operation's *delta* between them, and the caller acts on the first
|
|
83
|
+
* issue reported.
|
|
84
|
+
*/
|
|
85
|
+
function quotaCountIssue(suite, projection) {
|
|
86
|
+
return checkQuotaCount({
|
|
87
|
+
count: projection.quotas.filter((q) => q.value > 0n).length,
|
|
76
88
|
max: suite.creditManager.maxEnabledTokens
|
|
77
|
-
})
|
|
89
|
+
});
|
|
78
90
|
}
|
|
79
91
|
/**
|
|
80
92
|
* What the transaction draws, against what the market can lend right now.
|
|
81
93
|
*
|
|
82
94
|
* Only a draw is weighed: repaying, or leaving the debt alone, can never exceed
|
|
83
|
-
* a ceiling. Opening borrows the whole debt; adjusting borrows
|
|
95
|
+
* a ceiling. Opening borrows the whole debt; adjusting borrows
|
|
96
|
+
* `totalDebtChange`.
|
|
84
97
|
*
|
|
85
98
|
* The engine holds every simulation to this already (`assertCanBorrow`), so
|
|
86
99
|
* this is here for the transactions it never saw — a pasted calldata reaches
|
|
87
100
|
* the confirm screen with nothing else standing between it and a revert.
|
|
88
101
|
*/
|
|
89
102
|
function borrowIssue(suite, preview, underlying) {
|
|
90
|
-
const drawn = preview.operation === "AdjustCreditAccount" ? preview.
|
|
103
|
+
const drawn = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
|
|
91
104
|
if (drawn <= 0n) return null;
|
|
92
105
|
const { limit, binding } = borrowable(suite);
|
|
93
106
|
return checkBorrowLimit({
|
|
@@ -97,12 +110,27 @@ function borrowIssue(suite, preview, underlying) {
|
|
|
97
110
|
underlying
|
|
98
111
|
});
|
|
99
112
|
}
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
/**
|
|
114
|
+
* The account against whichever bars the caller holds it to.
|
|
115
|
+
*
|
|
116
|
+
* A loan-free account is nothing to weigh: the health factor reports its
|
|
117
|
+
* zero-debt sentinel and no bar applies.
|
|
118
|
+
*
|
|
119
|
+
* {@inheritDoc quotaCountIssue}
|
|
120
|
+
*/
|
|
121
|
+
function collateralIssue(projection, options) {
|
|
122
|
+
const { minHealthFactor, minSafeHealthFactor, currentHealthFactor } = options;
|
|
123
|
+
if (projection.totalDebt.value === 0n) return null;
|
|
124
|
+
return (minHealthFactor === void 0 ? null : checkCollateralised({
|
|
125
|
+
healthFactor: projection.healthFactor,
|
|
126
|
+
required: minHealthFactor,
|
|
127
|
+
safePrices: false,
|
|
128
|
+
improvesFrom: currentHealthFactor
|
|
129
|
+
})) || (minSafeHealthFactor === void 0 || projection.safeHealthFactor === void 0 ? null : checkCollateralised({
|
|
130
|
+
healthFactor: projection.safeHealthFactor,
|
|
131
|
+
required: minSafeHealthFactor,
|
|
132
|
+
safePrices: true
|
|
133
|
+
}));
|
|
106
134
|
}
|
|
107
135
|
/** The wallet's side of the operation, against the balances it was given. */
|
|
108
136
|
function fundingIssue(options, puts) {
|
|
@@ -118,12 +146,6 @@ function fundingIssue(options, puts) {
|
|
|
118
146
|
}
|
|
119
147
|
return null;
|
|
120
148
|
}
|
|
121
|
-
/** What the wallet puts in, which is what its balances have to cover. */
|
|
122
|
-
function collateralOf(preview) {
|
|
123
|
-
if ("collateral" in preview) return preview.collateral;
|
|
124
|
-
if ("collateralAdded" in preview) return preview.collateralAdded;
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
149
|
function forbiddenIssue(suite, preview) {
|
|
128
150
|
const obtained = preview.operation === "AdjustCreditAccount" ? preview.assetsChange : preview.assets;
|
|
129
151
|
const forbidden = suite.forbiddenTokens;
|
|
@@ -153,19 +175,5 @@ function quotaIssue(market, preview, underlying) {
|
|
|
153
175
|
}
|
|
154
176
|
return null;
|
|
155
177
|
}
|
|
156
|
-
/** The two collateral bars, shared by the preview and the simulation paths. */
|
|
157
|
-
function collateralIssuesOf(factors, options) {
|
|
158
|
-
const { minHealthFactor, minSafeHealthFactor, currentHealthFactor } = options;
|
|
159
|
-
return (minHealthFactor === void 0 ? null : checkCollateralised({
|
|
160
|
-
healthFactor: factors.healthFactor,
|
|
161
|
-
required: minHealthFactor,
|
|
162
|
-
safePrices: false,
|
|
163
|
-
improvesFrom: currentHealthFactor
|
|
164
|
-
})) || (minSafeHealthFactor === void 0 || factors.safeHealthFactor === void 0 ? null : checkCollateralised({
|
|
165
|
-
healthFactor: factors.safeHealthFactor,
|
|
166
|
-
required: minSafeHealthFactor,
|
|
167
|
-
safePrices: true
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
178
|
//#endregion
|
|
171
|
-
export { checkOperation,
|
|
179
|
+
export { checkOperation, collateralIssue, marketIssues, quotaCountIssue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkDebtInBand } from "../../onchain/validation/checks.js";
|
|
2
2
|
import { toToken } from "../../onchain/validation/token.js";
|
|
3
3
|
import "../../onchain/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { collateralIssue, marketIssues, quotaCountIssue } from "./checkOperation.js";
|
|
5
5
|
//#region src/preview/validate/checkSimulation.ts
|
|
6
6
|
/**
|
|
7
7
|
* Whether a simulated operation clears the caller's own bars.
|
|
@@ -26,26 +26,13 @@ import { collateralIssuesOf } from "./checkOperation.js";
|
|
|
26
26
|
function checkSimulation(input, options = {}) {
|
|
27
27
|
const { sdk, state, creditManager } = input;
|
|
28
28
|
const suite = sdk.marketRegister.findCreditManager(creditManager);
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
creditManager
|
|
32
|
-
}) || checkMarketExpired({
|
|
33
|
-
isExpired: suite.isExpired,
|
|
34
|
-
creditManager,
|
|
35
|
-
expirationDate: suite.creditFacade.expirationDate
|
|
36
|
-
}) || checkDebtInBand({
|
|
37
|
-
debt: state.accountDebt,
|
|
29
|
+
return marketIssues(suite) || checkDebtInBand({
|
|
30
|
+
debt: state.totalDebt.value,
|
|
38
31
|
minDebt: suite.creditFacade.minDebt,
|
|
39
32
|
maxDebt: suite.creditFacade.maxDebt,
|
|
40
33
|
underlying: toToken(sdk, suite.market.pool.underlying),
|
|
41
34
|
allowZero: true
|
|
42
|
-
}) ||
|
|
43
|
-
count: Object.values(state.quotas).filter((q) => q.balance > 0n).length,
|
|
44
|
-
max: suite.creditManager.maxEnabledTokens
|
|
45
|
-
}) || (state.accountDebt === 0n ? null : collateralIssuesOf({
|
|
46
|
-
healthFactor: state.healthFactor,
|
|
47
|
-
safeHealthFactor: state.safeHealthFactor
|
|
48
|
-
}, options));
|
|
35
|
+
}) || quotaCountIssue(suite, state) || collateralIssue(state, options);
|
|
49
36
|
}
|
|
50
37
|
//#endregion
|
|
51
38
|
export { checkSimulation };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { checkOperation,
|
|
1
|
+
import { checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./checkOperation.js";
|
|
2
2
|
import { checkSimulation } from "./checkSimulation.js";
|
|
3
|
-
export { checkOperation, checkSimulation,
|
|
3
|
+
export { checkOperation, checkSimulation, collateralIssue, marketIssues, quotaCountIssue };
|
|
@@ -2,7 +2,6 @@ import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
|
2
2
|
import { BigIntMath } from "../../onchain/utils/bigint-math.js";
|
|
3
3
|
import { toBigInt } from "../../onchain/utils/formatter.js";
|
|
4
4
|
import "../../onchain/index.js";
|
|
5
|
-
import "../../common-utils/index.js";
|
|
6
5
|
import { MerkleXYZApi } from "./merkl-api.js";
|
|
7
6
|
import { getAddress, isAddress } from "viem";
|
|
8
7
|
//#region src/rewards/rewards/api.ts
|
|
@@ -3,7 +3,6 @@ import { chains } from "../../onchain/chain/chains.js";
|
|
|
3
3
|
import { PERCENTAGE_FACTOR } from "../../onchain/constants/math.js";
|
|
4
4
|
import { toBN } from "../../onchain/utils/formatter.js";
|
|
5
5
|
import "../../onchain/index.js";
|
|
6
|
-
import "../../common-utils/index.js";
|
|
7
6
|
import axios from "axios";
|
|
8
7
|
//#region src/rewards/rewards/extra-apy.ts
|
|
9
8
|
function getKeyForPoolPointsInfo(i) {
|
|
@@ -24,21 +24,24 @@ function poolTx(sdk, request) {
|
|
|
24
24
|
const { pool, wallet, sim } = request;
|
|
25
25
|
const { tokenIn, tokenOut } = sim.preview;
|
|
26
26
|
if (request.op === "deposit") {
|
|
27
|
-
const meta = sdk.pools.getDepositMetadata(pool, tokenIn.token, tokenOut.token);
|
|
27
|
+
const meta = sdk.pools.getDepositMetadata(pool, tokenIn.token.address, tokenOut.token.address);
|
|
28
28
|
const result = sdk.pools.addLiquidity({
|
|
29
29
|
pool,
|
|
30
30
|
wallet,
|
|
31
|
-
collateral:
|
|
31
|
+
collateral: {
|
|
32
|
+
token: tokenIn.token.address,
|
|
33
|
+
balance: tokenIn.value
|
|
34
|
+
},
|
|
32
35
|
meta
|
|
33
36
|
});
|
|
34
|
-
if (!result) throw new Error(`pool ${pool} takes no deposit transaction for ${tokenIn.token} (${meta.type})`);
|
|
37
|
+
if (!result) throw new Error(`pool ${pool} takes no deposit transaction for ${tokenIn.token.address} (${meta.type})`);
|
|
35
38
|
return result.tx;
|
|
36
39
|
}
|
|
37
|
-
const meta = sdk.pools.getWithdrawalMetadata(pool, tokenIn.token, tokenOut.token);
|
|
40
|
+
const meta = sdk.pools.getWithdrawalMetadata(pool, tokenIn.token.address, tokenOut.token.address);
|
|
38
41
|
return sdk.pools.removeLiquidity({
|
|
39
42
|
pool,
|
|
40
43
|
wallet,
|
|
41
|
-
amount: request.op === "withdraw" ? tokenOut.
|
|
44
|
+
amount: request.op === "withdraw" ? tokenOut.value : tokenIn.value,
|
|
42
45
|
permit: void 0,
|
|
43
46
|
meta,
|
|
44
47
|
mode: request.op === "withdraw" ? "withdraw" : "redeem"
|
|
@@ -52,7 +55,7 @@ async function openTx(sdk, request) {
|
|
|
52
55
|
to: wallet,
|
|
53
56
|
collateral,
|
|
54
57
|
ethAmount,
|
|
55
|
-
debt: preview.
|
|
58
|
+
debt: preview.totalDebt.value,
|
|
56
59
|
calls: preview.calls,
|
|
57
60
|
averageQuota: preview.averageQuota,
|
|
58
61
|
minQuota: preview.minQuota,
|
|
@@ -65,7 +65,10 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
65
65
|
tokenOut
|
|
66
66
|
});
|
|
67
67
|
const call = pools.addLiquidity({
|
|
68
|
-
collateral:
|
|
68
|
+
collateral: {
|
|
69
|
+
token: preview.tokenIn.token.address,
|
|
70
|
+
balance: preview.tokenIn.value
|
|
71
|
+
},
|
|
69
72
|
pool: pool.pool,
|
|
70
73
|
wallet: params.wallet,
|
|
71
74
|
meta: pools.getDepositMetadata(pool.pool, tokenIn, tokenOut)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AddressMap } from "../onchain/utils/AddressMap.js";
|
|
2
2
|
import { ParsedCallV2 } from "../onchain/base/types.js";
|
|
3
|
-
import { CallTrace } from "../
|
|
3
|
+
import { CallTrace } from "../onchain/utils/trace.js";
|
|
4
4
|
import { ChainContractsRegister } from "../onchain/base/ChainContractsRegister.js";
|
|
5
5
|
import "../onchain/index.js";
|
|
6
6
|
import { TokenTransfer } from "../preview/parse/types-adapters.js";
|
|
@@ -15,8 +15,8 @@ import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
|
|
|
15
15
|
import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
|
|
16
16
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
17
17
|
import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
18
|
-
import { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
|
|
18
|
+
import { AccountProjection, AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
|
|
19
19
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
|
|
20
20
|
import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
|
|
21
21
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
22
|
-
export { AdjustCreditAccountPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
|
|
22
|
+
export { AccountProjection, AdjustCreditAccountPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
|
|
@@ -137,8 +137,16 @@ interface PoolOperationPreview {
|
|
|
137
137
|
*/
|
|
138
138
|
error?: OperationPreviewError;
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
/**
|
|
141
|
+
* A credit account as an operation leaves it, answered by both halves of the
|
|
142
|
+
* SDK: `prepare`, which walks a request forward into the calls that realise it,
|
|
143
|
+
* and `preview`, which decodes calls that already exist and replays them back.
|
|
144
|
+
*
|
|
145
|
+
* `totalDebt`, `totalValue`, `leverage` and `healthFactor` mean here exactly
|
|
146
|
+
* what they mean on a {@link StrategyPosition}, down to the token an amount
|
|
147
|
+
* names — an RWA market reports USDC, not the dcUSDC wrapper the pool holds.
|
|
148
|
+
**/
|
|
149
|
+
interface AccountProjection {
|
|
142
150
|
/**
|
|
143
151
|
* Health factor in basis points: below `10000` the account is liquidatable.
|
|
144
152
|
*
|
|
@@ -150,12 +158,14 @@ interface OpenCreditAccountPreview {
|
|
|
150
158
|
* token's main and reserve oracle feeds, which is what the credit manager
|
|
151
159
|
* switches to for a call that hands funds over.
|
|
152
160
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
161
|
+
* Absent only where the walk had no reason to weigh it: the intents engine
|
|
162
|
+
* computes it for an operation that hands funds over, which is the one the
|
|
163
|
+
* credit manager holds to safe prices on-chain. Both preview builders and
|
|
164
|
+
* `openNewStrategy` always report it.
|
|
155
165
|
*
|
|
156
166
|
* @example `11800` where `healthFactor` is `12500`
|
|
157
167
|
**/
|
|
158
|
-
safeHealthFactor
|
|
168
|
+
safeHealthFactor?: Bps;
|
|
159
169
|
/**
|
|
160
170
|
* Cost of the debt, broken down by source.
|
|
161
171
|
**/
|
|
@@ -177,6 +187,29 @@ interface OpenCreditAccountPreview {
|
|
|
177
187
|
* unleveraged; `0` if underwater.
|
|
178
188
|
**/
|
|
179
189
|
leverage: Leverage;
|
|
190
|
+
/**
|
|
191
|
+
* Everything the account holds, denominated in the market's underlying.
|
|
192
|
+
**/
|
|
193
|
+
totalValue: TokenAmount;
|
|
194
|
+
/**
|
|
195
|
+
* What it would take to settle the loan: principal plus accrued interest and
|
|
196
|
+
* fees, in the market's underlying.
|
|
197
|
+
**/
|
|
198
|
+
totalDebt: TokenAmount;
|
|
199
|
+
/**
|
|
200
|
+
* What the account holds, token by token.
|
|
201
|
+
**/
|
|
202
|
+
assets: TokenAmount[];
|
|
203
|
+
/**
|
|
204
|
+
* Quota bought for each collateral, denominated in the market's underlying
|
|
205
|
+
* rather than in the collateral token — the same convention as
|
|
206
|
+
* {@link PositionCollateral.quota}. A token the account leaves unquoted is
|
|
207
|
+
* absent rather than present at zero.
|
|
208
|
+
**/
|
|
209
|
+
quotas: TokenAmount[];
|
|
210
|
+
}
|
|
211
|
+
interface OpenCreditAccountPreview extends AccountProjection {
|
|
212
|
+
operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
|
|
180
213
|
/**
|
|
181
214
|
* Credit manager the account is opened in
|
|
182
215
|
*/
|
|
@@ -186,10 +219,10 @@ interface OpenCreditAccountPreview {
|
|
|
186
219
|
*/
|
|
187
220
|
name: string;
|
|
188
221
|
/**
|
|
189
|
-
*
|
|
190
|
-
* from `assets`. Undefined when nothing is quoted.
|
|
222
|
+
* Collateral token this position is a strategy in: the first quoted token,
|
|
223
|
+
* with its balance taken from `assets`. Undefined when nothing is quoted.
|
|
191
224
|
*/
|
|
192
|
-
|
|
225
|
+
targetCollateral?: TokenAmount;
|
|
193
226
|
/**
|
|
194
227
|
* Tokens that were added as collateral during account opening.
|
|
195
228
|
*
|
|
@@ -197,81 +230,21 @@ interface OpenCreditAccountPreview {
|
|
|
197
230
|
* `NATIVE_ADDRESS` entry, with the wrapped native token amount reduced
|
|
198
231
|
* accordingly (omitted entirely when it reaches zero).
|
|
199
232
|
*/
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Sum of collateral tokens in underlying
|
|
203
|
-
*/
|
|
204
|
-
collateralValue: bigint;
|
|
205
|
-
/**
|
|
206
|
-
* Total account value after opening: collateral plus borrowed amount, in
|
|
207
|
-
* underlying.
|
|
208
|
-
*/
|
|
209
|
-
totalValue: bigint;
|
|
210
|
-
/**
|
|
211
|
-
* Borrowed amount in underlying
|
|
212
|
-
*/
|
|
213
|
-
debt: bigint;
|
|
214
|
-
/**
|
|
215
|
-
* WARNING: unlike every other `TokenAmount` in this model, `value` is
|
|
216
|
-
* denominated in the market underlying, NOT in `token`. `token` only
|
|
217
|
-
* identifies which collateral the quota applies to; `valueUsd` prices the
|
|
218
|
-
* underlying amount.
|
|
219
|
-
*
|
|
220
|
-
* Desired quotas
|
|
221
|
-
*/
|
|
222
|
-
quotas: TokenAmount[];
|
|
233
|
+
collateralAdded: TokenAmount[];
|
|
223
234
|
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
235
|
+
* Own funds in the position: what the wallet put in, valued in underlying.
|
|
236
|
+
* `totalValue` is this plus the borrowed amount.
|
|
226
237
|
*/
|
|
227
|
-
|
|
238
|
+
netValue: TokenAmount;
|
|
228
239
|
/**
|
|
229
240
|
* Set when preview encountered non-fatal errors, all fields are
|
|
230
|
-
* still computed best-effort, but derived fields (`assets`,
|
|
231
|
-
* `
|
|
241
|
+
* still computed best-effort, but derived fields (`assets`,
|
|
242
|
+
* `targetCollateral`, `netValue`) may be unreliable in that case.
|
|
232
243
|
*/
|
|
233
244
|
error?: OperationPreviewError;
|
|
234
245
|
}
|
|
235
|
-
interface AdjustCreditAccountPreview {
|
|
246
|
+
interface AdjustCreditAccountPreview extends AccountProjection {
|
|
236
247
|
operation: "AdjustCreditAccount";
|
|
237
|
-
/**
|
|
238
|
-
* Health factor in basis points: below `10000` the account is liquidatable.
|
|
239
|
-
*
|
|
240
|
-
* @example `12500` for a health factor of 1.25
|
|
241
|
-
**/
|
|
242
|
-
healthFactor: Bps;
|
|
243
|
-
/**
|
|
244
|
-
* The same factor with collateral valued at safe prices — the lower of each
|
|
245
|
-
* token's main and reserve oracle feeds, which is what the credit manager
|
|
246
|
-
* switches to for a call that hands funds over.
|
|
247
|
-
*
|
|
248
|
-
* Always reported, so a caller that needs the stricter reading does not have
|
|
249
|
-
* to recompute it; whether to hold the account to it is the caller's call.
|
|
250
|
-
*
|
|
251
|
-
* @example `11800` where `healthFactor` is `12500`
|
|
252
|
-
**/
|
|
253
|
-
safeHealthFactor: Bps;
|
|
254
|
-
/**
|
|
255
|
-
* Cost of the debt, broken down by source.
|
|
256
|
-
**/
|
|
257
|
-
borrowRate: BorrowRateBreakdown;
|
|
258
|
-
/**
|
|
259
|
-
* Estimated milliseconds until the health factor decays to `10000` under
|
|
260
|
-
* the current borrow rate, or `null` when the debt carries no rate (or the
|
|
261
|
-
* account is already liquidatable).
|
|
262
|
-
**/
|
|
263
|
-
timeToLiquidation: bigint | null;
|
|
264
|
-
/**
|
|
265
|
-
* Price of the single non-underlying collateral at which the account
|
|
266
|
-
* becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
|
|
267
|
-
* when the account holds zero or several non-underlying assets.
|
|
268
|
-
**/
|
|
269
|
-
liquidationPrice: bigint | null;
|
|
270
|
-
/**
|
|
271
|
-
* Total-value leverage: `totalValue / (totalValue − totalDebt)`. `1` =
|
|
272
|
-
* unleveraged; `0` if underwater.
|
|
273
|
-
**/
|
|
274
|
-
leverage: Leverage;
|
|
275
248
|
/**
|
|
276
249
|
* Credit manager the account is opened in
|
|
277
250
|
*/
|
|
@@ -296,45 +269,18 @@ interface AdjustCreditAccountPreview {
|
|
|
296
269
|
* Tokens that were withdrawn as collateral during account adjustment.
|
|
297
270
|
*/
|
|
298
271
|
collateralWithdrawn: TokenAmount[];
|
|
299
|
-
/**
|
|
300
|
-
* Sum of collateral tokens in underlying
|
|
301
|
-
*/
|
|
302
|
-
totalValue: bigint;
|
|
303
|
-
/**
|
|
304
|
-
* What the account owes in underlying once the operation lands: principal
|
|
305
|
-
* plus accrued interest and fees, which is the amount it would take to
|
|
306
|
-
* settle the loan — the same quantity `prepare` projects as `accountDebt`.
|
|
307
|
-
*/
|
|
308
|
-
debt: bigint;
|
|
309
272
|
/**
|
|
310
273
|
* Debt after minus debt before. A repayment settles interest and fees
|
|
311
274
|
* before principal, so this is the payment itself rather than the part of
|
|
312
275
|
* it the principal happened to absorb.
|
|
313
276
|
*/
|
|
314
|
-
|
|
277
|
+
totalDebtChange: TokenAmount;
|
|
315
278
|
/**
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
* underlying amount.
|
|
320
|
-
*
|
|
321
|
-
* Desired quotas
|
|
322
|
-
*/
|
|
323
|
-
quotas: TokenAmount[];
|
|
324
|
-
/**
|
|
325
|
-
* WARNING: unlike every other `TokenAmount` in this model, `value` is
|
|
326
|
-
* denominated in the market underlying, NOT in `token`. `token` only
|
|
327
|
-
* identifies which collateral the quota applies to; `valueUsd` prices the
|
|
328
|
-
* underlying amount.
|
|
329
|
-
*
|
|
330
|
-
* Quotas after minus quotas before
|
|
279
|
+
* Quotas after minus quotas before. Denominated in the market's underlying
|
|
280
|
+
* like {@link AccountProjection.quotas}, so `token` names the collateral the
|
|
281
|
+
* quota applies to rather than the amount's own unit.
|
|
331
282
|
*/
|
|
332
283
|
quotasChange: TokenAmount[];
|
|
333
|
-
/**
|
|
334
|
-
* Minimum amount of assets on credit account after the operation,
|
|
335
|
-
* as estimated by router
|
|
336
|
-
*/
|
|
337
|
-
assets: TokenAmount[];
|
|
338
284
|
/**
|
|
339
285
|
* Assets after minus assets before
|
|
340
286
|
*/
|
|
@@ -425,9 +371,13 @@ interface RepayCreditAccountPreview {
|
|
|
425
371
|
*/
|
|
426
372
|
collateralWithdrawn: TokenAmount[];
|
|
427
373
|
/**
|
|
428
|
-
* Total debt repaid: principal + accrued interest + fees, in underlying
|
|
374
|
+
* Total debt repaid: principal + accrued interest + fees, in underlying.
|
|
375
|
+
*
|
|
376
|
+
* The same quantity an {@link AdjustCreditAccountPreview} reports as
|
|
377
|
+
* `totalDebtChange`, with the sign a repayment screen reads: positive for
|
|
378
|
+
* what the wallet parted with.
|
|
429
379
|
*/
|
|
430
|
-
debtRepaid:
|
|
380
|
+
debtRepaid: TokenAmount;
|
|
431
381
|
/**
|
|
432
382
|
* Intent of the delayed withdrawal this transaction claims; set when the
|
|
433
383
|
* multicall claims a delayed withdrawal
|
|
@@ -490,4 +440,4 @@ interface DelayedCreditAccountOperationPreview {
|
|
|
490
440
|
*/
|
|
491
441
|
type OperationPreview = PoolOperationPreview | OpenCreditAccountPreview | AdjustCreditAccountPreview | CloseCreditAccountPreview | RepayCreditAccountPreview | DelayedCreditAccountOperationPreview;
|
|
492
442
|
//#endregion
|
|
493
|
-
export { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview };
|
|
443
|
+
export { AccountProjection, AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview };
|
|
@@ -22,6 +22,7 @@ import "./bots/index.js";
|
|
|
22
22
|
import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
|
|
23
23
|
import { borrowable } from "./intents/guards.js";
|
|
24
24
|
import { LeverageBand } from "./intents/leverage-band.js";
|
|
25
|
+
import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, roundUpQuota } from "./quota-utils.js";
|
|
25
26
|
import { AccountCalculatorOperation } from "./intents/operations.js";
|
|
26
27
|
import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./intents/types.js";
|
|
27
28
|
import { OpenStrategyPreview, OpenStrategyProps } from "./intents/open-strategy.js";
|
|
@@ -32,4 +33,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
|
|
|
32
33
|
import { LiquidationsService } from "./liquidations/LiquidationsService.js";
|
|
33
34
|
import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
|
|
34
35
|
import "./liquidations/index.js";
|
|
35
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, borrowable, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
36
|
+
export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, borrowable, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bps, TokenAmount } from "../../../model/primitives.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AccountProjection } from "../../../model/previews.js";
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { Asset } from "../../base/types.js";
|
|
5
5
|
import { MultiCall } from "../../types/transactions.js";
|
|
@@ -32,42 +32,28 @@ interface OpenStrategyProps {
|
|
|
32
32
|
* hands back expected and floor balances from a single call, and `openCA` wants
|
|
33
33
|
* both `minQuota` and `averageQuota`, so there is nothing to gain by dropping one.
|
|
34
34
|
*/
|
|
35
|
-
interface OpenStrategyPreview {
|
|
35
|
+
interface OpenStrategyPreview extends Omit<AccountProjection, "assets" | "quotas"> {
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
**/
|
|
41
|
-
healthFactor: Bps;
|
|
42
|
-
/**
|
|
43
|
-
* Cost of the debt, broken down by source.
|
|
44
|
-
**/
|
|
45
|
-
borrowRate: BorrowRateBreakdown;
|
|
46
|
-
/**
|
|
47
|
-
* Estimated milliseconds until the health factor decays to `10000` under
|
|
48
|
-
* the current borrow rate, or `null` when the debt carries no rate (or the
|
|
49
|
-
* account is already liquidatable).
|
|
37
|
+
* The same factor with collateral valued at safe prices, which is what the
|
|
38
|
+
* credit manager weighs an opening at on-chain. Always reported here: an
|
|
39
|
+
* opening always hands the pool's funds over.
|
|
50
40
|
**/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
* becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
|
|
55
|
-
* when the account holds zero or several non-underlying assets.
|
|
56
|
-
**/
|
|
57
|
-
liquidationPrice: bigint | null;
|
|
58
|
-
/** Debt drawn, in underlying. */
|
|
59
|
-
debt: bigint;
|
|
60
|
-
/** Collateral supplied, valued in underlying. */
|
|
61
|
-
collateral: bigint;
|
|
62
|
-
/** Position size — collateral plus debt, in underlying. */
|
|
63
|
-
totalValue: bigint;
|
|
41
|
+
safeHealthFactor: Bps;
|
|
42
|
+
/** Own funds put in, valued in underlying. */
|
|
43
|
+
netValue: TokenAmount;
|
|
64
44
|
/** What the routed leg lost to market depth; `undefined` if not measured. */
|
|
65
45
|
priceImpact: PathLossRate | undefined;
|
|
66
46
|
/** Expected post-open balances. */
|
|
67
47
|
averageAssets: TokenAmount[];
|
|
68
48
|
/** Floor post-open balances after slippage. */
|
|
69
49
|
minAssets: TokenAmount[];
|
|
70
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Quotas to buy against `averageAssets`; feeds `openCA.averageQuota`.
|
|
52
|
+
*
|
|
53
|
+
* Bare pairs rather than priced amounts, like `calls` below: these three are
|
|
54
|
+
* transport for the transaction, handed to `openCA` untouched, and are the
|
|
55
|
+
* only fields here a caller is not meant to display.
|
|
56
|
+
**/
|
|
71
57
|
averageQuota: Asset[];
|
|
72
58
|
/** Quotas to buy against `minAssets`; feeds `openCA.minQuota`. */
|
|
73
59
|
minQuota: Asset[];
|
|
@@ -3,7 +3,7 @@ import { Asset } from "../../base/types.js";
|
|
|
3
3
|
import { MultiCall } from "../../types/transactions.js";
|
|
4
4
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
5
5
|
import { EncodableCreditAccountOperation } from "../types.js";
|
|
6
|
-
import { calcQuotaUpdate } from "
|
|
6
|
+
import { calcQuotaUpdate } from "../quota-utils.js";
|
|
7
7
|
import { CreditAccountSlice } from "./types.js";
|
|
8
8
|
import "../../index.js";
|
|
9
9
|
import { Address } from "viem";
|