@gearbox-protocol/sdk 15.1.0-next.1 → 15.1.0-next.10
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/abi/iExpirable.js +15 -0
- package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +8 -5
- package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/cjs/dev/AccountOpener.js +0 -1
- package/dist/cjs/dev/compareOpportunities.js +218 -0
- package/dist/cjs/model/charts.js +147 -0
- package/dist/cjs/model/charts.schema.js +240 -0
- package/dist/cjs/model/index.js +35 -22
- package/dist/cjs/model/liquidations.schema.js +1 -1
- package/dist/cjs/model/notices.schema.js +25 -0
- package/dist/cjs/model/opportunities.schema.js +1 -1
- package/dist/cjs/model/positions.schema.js +48 -2
- package/dist/cjs/new-sdk/AbstractNamespace.js +34 -4
- package/dist/cjs/new-sdk/GearboxSDK.js +72 -3
- package/dist/cjs/new-sdk/execute/ExecuteApi.js +95 -0
- package/dist/cjs/new-sdk/execute/index.js +3 -0
- package/dist/cjs/new-sdk/index.js +7 -0
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +29 -6
- package/dist/cjs/new-sdk/positions/PositionsNamespace.js +3 -6
- package/dist/cjs/new-sdk/simulate/SimulateApi.js +361 -0
- package/dist/cjs/new-sdk/simulate/index.js +4 -0
- package/dist/cjs/new-sdk/utils/index.js +0 -1
- package/dist/cjs/offchain/AbstractOffchainNamespace.js +10 -7
- package/dist/cjs/offchain/GearboxAPI.js +7 -0
- package/dist/cjs/offchain/index.js +3 -0
- package/dist/cjs/offchain/notices/OffchainNotices.js +27 -0
- package/dist/cjs/offchain/notices/index.js +3 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +4 -8
- package/dist/cjs/offchain/positions/OffchainPositions.js +12 -12
- package/dist/cjs/preview/preview/CreditAccountState.js +14 -1
- package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/cjs/preview/preview/previewOperation.js +1 -1
- package/dist/cjs/sdk/MultichainSDK.js +3 -4
- package/dist/cjs/sdk/OnchainSDK.js +42 -13
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +2 -8
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/cjs/sdk/accounts/index.js +5 -2
- package/dist/cjs/sdk/accounts/intents/guards.js +114 -0
- package/dist/cjs/sdk/accounts/intents/index.js +216 -358
- package/dist/cjs/sdk/accounts/intents/math.js +56 -0
- package/dist/cjs/sdk/accounts/intents/open-strategy.js +133 -0
- package/dist/cjs/sdk/accounts/intents/operations.js +165 -0
- package/dist/cjs/sdk/accounts/intents/plan.js +373 -0
- package/dist/cjs/sdk/accounts/intents/realize.js +301 -0
- package/dist/cjs/sdk/accounts/intents/testing/delayed.js +50 -0
- package/dist/cjs/sdk/accounts/intents/testing/market.js +166 -0
- package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +194 -35
- package/dist/cjs/sdk/accounts/intents/tests/add-collateral.fixtures.js +123 -0
- package/dist/cjs/sdk/accounts/intents/tests/adjust-leverage.fixtures.js +254 -0
- package/dist/cjs/sdk/accounts/intents/tests/deposit.fixtures.js +324 -0
- package/dist/cjs/sdk/accounts/intents/tests/finish-decrease-leverage.fixtures.js +242 -0
- package/dist/cjs/sdk/accounts/intents/tests/finish-withdraw.fixtures.js +383 -0
- package/dist/cjs/sdk/accounts/intents/tests/open-strategy.fixtures.js +133 -0
- package/dist/cjs/sdk/accounts/intents/tests/withdraw-asset.fixtures.js +131 -0
- package/dist/cjs/sdk/accounts/intents/tests/withdraw.fixtures.js +426 -0
- package/dist/cjs/sdk/accounts/intents/types.js +16 -0
- package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
- package/dist/cjs/sdk/accounts/intents/utils/credit-account-slice.js +45 -0
- package/dist/cjs/sdk/accounts/intents/utils/index.js +17 -8
- package/dist/cjs/sdk/accounts/intents/utils/ledger.js +94 -0
- package/dist/cjs/sdk/accounts/intents/utils/pick-token.js +72 -0
- package/dist/cjs/sdk/accounts/intents/utils/quotas-for-update.js +27 -0
- package/dist/cjs/sdk/accounts/intents/utils/router-path.js +86 -0
- package/dist/cjs/sdk/accounts/intents/view.js +38 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +29 -18
- package/dist/cjs/sdk/base/BaseContract.js +1 -1
- package/dist/cjs/sdk/base/TokensMeta.js +78 -27
- package/dist/cjs/sdk/index.js +30 -7
- package/dist/cjs/sdk/market/MarketRegister.js +16 -7
- package/dist/cjs/sdk/market/ZapperRegister.js +56 -25
- package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +1 -12
- package/dist/cjs/sdk/market/credit/CreditSuite.js +28 -9
- package/dist/cjs/sdk/market/credit/index.js +3 -0
- package/dist/cjs/sdk/market/credit/isStrategyCollateral.js +50 -0
- package/dist/cjs/sdk/market/index.js +17 -0
- package/dist/cjs/sdk/market/math.js +57 -44
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +15 -1
- package/dist/cjs/sdk/market/rwa/RWARegistry.js +22 -0
- package/dist/cjs/sdk/opportunities/index.js +0 -13
- package/dist/cjs/sdk/options.js +1 -5
- package/dist/cjs/sdk/pools/PoolService.js +132 -3
- package/dist/cjs/sdk/pools/index.js +2 -0
- package/dist/cjs/sdk/positions/PositionsService.js +213 -1
- package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
- package/dist/cjs/sdk/positions/calcHealthFactor.js +52 -0
- package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
- package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
- package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +19 -0
- package/dist/cjs/sdk/positions/index.js +12 -1
- package/dist/cjs/sdk/positions/types.js +31 -0
- package/dist/cjs/sdk/utils/abi-decode.js +2 -2
- package/dist/cjs/sdk/utils/viem/executeMulticallBatches.js +32 -0
- package/dist/cjs/sdk/utils/viem/index.js +2 -0
- package/dist/esm/abi/iExpirable.js +14 -0
- package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +8 -5
- package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/esm/dev/AccountOpener.js +1 -2
- package/dist/esm/dev/compareOpportunities.js +216 -0
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/charts.js +140 -0
- package/dist/esm/model/charts.schema.js +226 -0
- package/dist/esm/model/index.js +9 -7
- package/dist/esm/model/liquidations.schema.js +1 -1
- package/dist/esm/model/notices.schema.js +23 -0
- package/dist/esm/model/opportunities.schema.js +1 -1
- package/dist/esm/model/positions.schema.js +46 -4
- package/dist/esm/new-sdk/AbstractNamespace.js +34 -4
- package/dist/esm/new-sdk/GearboxSDK.js +72 -4
- package/dist/esm/new-sdk/execute/ExecuteApi.js +94 -0
- package/dist/esm/new-sdk/execute/index.js +2 -0
- package/dist/esm/new-sdk/index.js +6 -2
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +29 -6
- package/dist/esm/new-sdk/positions/PositionsNamespace.js +3 -6
- package/dist/esm/new-sdk/simulate/SimulateApi.js +360 -0
- package/dist/esm/new-sdk/simulate/index.js +3 -0
- package/dist/esm/new-sdk/utils/index.js +0 -1
- package/dist/esm/offchain/AbstractOffchainNamespace.js +10 -7
- package/dist/esm/offchain/GearboxAPI.js +7 -0
- package/dist/esm/offchain/index.js +3 -1
- package/dist/esm/offchain/notices/OffchainNotices.js +26 -0
- package/dist/esm/offchain/notices/index.js +2 -0
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +4 -8
- package/dist/esm/offchain/positions/OffchainPositions.js +12 -12
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/preview/preview/CreditAccountState.js +14 -1
- package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/esm/preview/preview/previewOperation.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/MultichainSDK.js +3 -4
- package/dist/esm/sdk/OnchainSDK.js +42 -13
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +4 -10
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/esm/sdk/accounts/index.js +3 -2
- package/dist/esm/sdk/accounts/intents/guards.js +108 -0
- package/dist/esm/sdk/accounts/intents/index.js +214 -358
- package/dist/esm/sdk/accounts/intents/math.js +51 -0
- package/dist/esm/sdk/accounts/intents/open-strategy.js +132 -0
- package/dist/esm/sdk/accounts/intents/operations.js +153 -0
- package/dist/esm/sdk/accounts/intents/plan.js +361 -0
- package/dist/esm/sdk/accounts/intents/realize.js +300 -0
- package/dist/esm/sdk/accounts/intents/testing/delayed.js +38 -0
- package/dist/esm/sdk/accounts/intents/testing/market.js +148 -0
- package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +194 -35
- package/dist/esm/sdk/accounts/intents/tests/add-collateral.fixtures.js +110 -0
- package/dist/esm/sdk/accounts/intents/tests/adjust-leverage.fixtures.js +234 -0
- package/dist/esm/sdk/accounts/intents/tests/deposit.fixtures.js +302 -0
- package/dist/esm/sdk/accounts/intents/tests/finish-decrease-leverage.fixtures.js +220 -0
- package/dist/esm/sdk/accounts/intents/tests/finish-withdraw.fixtures.js +355 -0
- package/dist/esm/sdk/accounts/intents/tests/open-strategy.fixtures.js +119 -0
- package/dist/esm/sdk/accounts/intents/tests/withdraw-asset.fixtures.js +117 -0
- package/dist/esm/sdk/accounts/intents/tests/withdraw.fixtures.js +402 -0
- package/dist/esm/sdk/accounts/intents/types.js +16 -1
- package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
- package/dist/esm/sdk/accounts/intents/utils/credit-account-slice.js +43 -0
- package/dist/esm/sdk/accounts/intents/utils/index.js +9 -7
- package/dist/esm/sdk/accounts/intents/utils/ledger.js +93 -0
- package/dist/esm/sdk/accounts/intents/utils/pick-token.js +68 -0
- package/dist/esm/sdk/accounts/intents/utils/quotas-for-update.js +27 -1
- package/dist/esm/sdk/accounts/intents/utils/router-path.js +85 -0
- package/dist/esm/sdk/accounts/intents/view.js +37 -0
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +29 -18
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/BaseContract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +80 -29
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +13 -4
- package/dist/esm/sdk/market/MarketRegister.js +16 -7
- package/dist/esm/sdk/market/ZapperRegister.js +56 -25
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +2 -13
- package/dist/esm/sdk/market/credit/CreditSuite.js +29 -10
- package/dist/esm/sdk/market/credit/index.js +2 -1
- package/dist/esm/sdk/market/credit/isStrategyCollateral.js +48 -0
- package/dist/esm/sdk/market/index.js +3 -1
- package/dist/esm/sdk/market/math.js +52 -40
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +17 -3
- package/dist/esm/sdk/market/rwa/RWARegistry.js +22 -0
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/opportunities/index.js +1 -2
- package/dist/esm/sdk/options.js +1 -5
- package/dist/esm/sdk/pools/PoolService.js +133 -6
- package/dist/esm/sdk/pools/index.js +2 -2
- package/dist/esm/sdk/positions/PositionsService.js +213 -1
- package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
- package/dist/esm/sdk/positions/calcHealthFactor.js +51 -0
- package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
- package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
- package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +18 -0
- package/dist/esm/sdk/positions/index.js +7 -2
- package/dist/esm/sdk/positions/types.js +31 -1
- package/dist/esm/sdk/utils/abi-decode.js +2 -2
- package/dist/esm/sdk/utils/viem/executeMulticallBatches.js +31 -0
- package/dist/esm/sdk/utils/viem/index.js +2 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/abi/iExpirable.d.ts +14 -0
- package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +6 -1
- package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
- package/dist/types/dev/compareOpportunities.d.ts +153 -0
- package/dist/types/model/charts.d.ts +349 -0
- package/dist/types/model/charts.schema.d.ts +364 -0
- package/dist/types/model/index.d.ts +8 -6
- package/dist/types/model/notices.d.ts +29 -0
- package/dist/types/model/notices.schema.d.ts +23 -0
- package/dist/types/model/opportunities.d.ts +9 -9
- package/dist/types/model/positions.d.ts +133 -7
- package/dist/types/model/positions.schema.d.ts +128 -1
- package/dist/types/new-sdk/AbstractNamespace.d.ts +15 -2
- package/dist/types/new-sdk/GearboxSDK.d.ts +14 -2
- package/dist/types/new-sdk/execute/ExecuteApi.d.ts +108 -0
- package/dist/types/new-sdk/execute/index.d.ts +2 -0
- package/dist/types/new-sdk/index.d.ts +8 -4
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +19 -7
- package/dist/types/new-sdk/opportunities/types.d.ts +30 -9
- package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +4 -5
- package/dist/types/new-sdk/positions/types.d.ts +9 -9
- package/dist/types/new-sdk/simulate/SimulateApi.d.ts +90 -0
- package/dist/types/new-sdk/simulate/index.d.ts +3 -0
- package/dist/types/new-sdk/simulate/types.d.ts +508 -0
- package/dist/types/new-sdk/types.d.ts +35 -1
- package/dist/types/new-sdk/utils/index.d.ts +1 -2
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +5 -21
- package/dist/types/offchain/GearboxAPI.d.ts +6 -0
- package/dist/types/offchain/index.d.ts +4 -2
- package/dist/types/offchain/notices/OffchainNotices.d.ts +19 -0
- package/dist/types/offchain/notices/index.d.ts +2 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +8 -4
- package/dist/types/offchain/positions/OffchainPositions.d.ts +8 -6
- package/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
- package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
- package/dist/types/preview/preview/types.d.ts +4 -2
- package/dist/types/sdk/MultichainSDK.d.ts +0 -5
- package/dist/types/sdk/OnchainSDK.d.ts +1 -5
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
- package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
- package/dist/types/sdk/accounts/index.d.ts +7 -5
- package/dist/types/sdk/accounts/intents/guards.d.ts +72 -0
- package/dist/types/sdk/accounts/intents/index.d.ts +130 -15
- package/dist/types/sdk/accounts/intents/math.d.ts +46 -0
- package/dist/types/sdk/accounts/intents/open-strategy.d.ts +64 -0
- package/dist/types/sdk/accounts/intents/operations.d.ts +215 -0
- package/dist/types/sdk/accounts/intents/plan.d.ts +189 -0
- package/dist/types/sdk/accounts/intents/realize.d.ts +35 -0
- package/dist/types/sdk/accounts/intents/testing/delayed.d.ts +50 -0
- package/dist/types/sdk/accounts/intents/testing/expect.d.ts +17 -21
- package/dist/types/sdk/accounts/intents/testing/market.d.ts +91 -0
- package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +64 -16
- package/dist/types/sdk/accounts/intents/tests/add-collateral.fixtures.d.ts +45 -0
- package/dist/types/sdk/accounts/intents/tests/adjust-leverage.fixtures.d.ts +56 -0
- package/dist/types/sdk/accounts/intents/tests/deposit.fixtures.d.ts +64 -0
- package/dist/types/sdk/accounts/intents/tests/finish-decrease-leverage.fixtures.d.ts +107 -0
- package/dist/types/sdk/accounts/intents/tests/finish-withdraw.fixtures.d.ts +136 -0
- package/dist/types/sdk/accounts/intents/tests/open-strategy.fixtures.d.ts +56 -0
- package/dist/types/sdk/accounts/intents/tests/withdraw-asset.fixtures.d.ts +60 -0
- package/dist/types/sdk/accounts/intents/tests/withdraw.fixtures.d.ts +79 -0
- package/dist/types/sdk/accounts/intents/types.d.ts +369 -43
- package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/utils/assemble-operation-calls.d.ts +1 -1
- package/dist/types/sdk/accounts/intents/utils/credit-account-slice.d.ts +29 -0
- package/dist/types/sdk/accounts/intents/utils/index.d.ts +7 -5
- package/dist/types/sdk/accounts/intents/utils/ledger.d.ts +41 -0
- package/dist/types/sdk/accounts/intents/utils/pick-token.d.ts +55 -0
- package/dist/types/sdk/accounts/intents/utils/quotas-for-update.d.ts +15 -4
- package/dist/types/sdk/accounts/intents/utils/router-path.d.ts +70 -0
- package/dist/types/sdk/accounts/intents/view.d.ts +15 -0
- package/dist/types/sdk/accounts/types.d.ts +17 -14
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +6 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +18 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +44 -1
- package/dist/types/sdk/base/index.d.ts +2 -2
- package/dist/types/sdk/base/token-types.d.ts +12 -1
- package/dist/types/sdk/index.d.ts +28 -19
- package/dist/types/sdk/market/MarketRegister.d.ts +7 -3
- package/dist/types/sdk/market/ZapperRegister.d.ts +20 -2
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +0 -4
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +6 -3
- package/dist/types/sdk/market/credit/index.d.ts +2 -1
- package/dist/types/sdk/market/credit/isStrategyCollateral.d.ts +74 -0
- package/dist/types/sdk/market/credit/types.d.ts +2 -9
- package/dist/types/sdk/market/index.d.ts +4 -2
- package/dist/types/sdk/market/math.d.ts +44 -34
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +6 -2
- package/dist/types/sdk/market/oracle/types.d.ts +10 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +5 -0
- package/dist/types/sdk/market/pool/types.d.ts +5 -0
- package/dist/types/sdk/market/rwa/RWARegistry.d.ts +13 -0
- package/dist/types/sdk/market/types.d.ts +5 -1
- package/dist/types/sdk/opportunities/index.d.ts +1 -2
- package/dist/types/sdk/options.d.ts +0 -1
- package/dist/types/sdk/pools/PoolService.d.ts +32 -2
- package/dist/types/sdk/pools/index.d.ts +3 -3
- package/dist/types/sdk/pools/types.d.ts +109 -4
- package/dist/types/sdk/positions/PositionsService.d.ts +33 -2
- package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
- package/dist/types/sdk/positions/calcHealthFactor.d.ts +55 -0
- package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
- package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
- package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +16 -0
- package/dist/types/sdk/positions/index.d.ts +7 -2
- package/dist/types/sdk/positions/types.d.ts +58 -1
- package/dist/types/sdk/types/state.d.ts +6 -0
- package/dist/types/sdk/utils/viem/executeMulticallBatches.d.ts +39 -0
- package/dist/types/sdk/utils/viem/index.d.ts +3 -2
- package/package.json +2 -1
- package/dist/cjs/model/history.js +0 -53
- package/dist/cjs/model/history.schema.js +0 -128
- package/dist/cjs/sdk/accounts/intents/intents/index.js +0 -14
- package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +0 -121
- package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.js +0 -15
- package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.fixtures.js +0 -108
- package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.js +0 -51
- package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +0 -130
- package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.js +0 -83
- package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +0 -117
- package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.js +0 -15
- package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +0 -95
- package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.js +0 -15
- package/dist/cjs/sdk/accounts/intents/intents/resume/index.js +0 -13
- package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +0 -138
- package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.js +0 -161
- package/dist/cjs/sdk/accounts/intents/operations/add-collateral/index.js +0 -17
- package/dist/cjs/sdk/accounts/intents/operations/claim-delayed/index.js +0 -54
- package/dist/cjs/sdk/accounts/intents/operations/close-credit-account/index.js +0 -26
- package/dist/cjs/sdk/accounts/intents/operations/decrease-debt/index.js +0 -12
- package/dist/cjs/sdk/accounts/intents/operations/increase-debt/index.js +0 -12
- package/dist/cjs/sdk/accounts/intents/operations/index.js +0 -27
- package/dist/cjs/sdk/accounts/intents/operations/quota-update/index.js +0 -22
- package/dist/cjs/sdk/accounts/intents/operations/repay-credit-account/index.js +0 -22
- package/dist/cjs/sdk/accounts/intents/operations/start-delayed-withdrawal/index.js +0 -18
- package/dist/cjs/sdk/accounts/intents/operations/swap/index.js +0 -18
- package/dist/cjs/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +0 -27
- package/dist/cjs/sdk/accounts/intents/operations/withdraw-collateral/index.js +0 -43
- package/dist/cjs/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +0 -27
- package/dist/cjs/sdk/accounts/intents/quoters/close.js +0 -58
- package/dist/cjs/sdk/accounts/intents/quoters/index.js +0 -7
- package/dist/cjs/sdk/accounts/intents/quoters/swap.js +0 -79
- package/dist/cjs/sdk/accounts/intents/testing/expect.js +0 -167
- package/dist/cjs/sdk/accounts/intents/testing/resume.js +0 -172
- package/dist/cjs/sdk/accounts/intents/utils/simulate-adjust-state.js +0 -39
- package/dist/cjs/sdk/accounts/intents/utils/simulate-assets.js +0 -69
- package/dist/cjs/sdk/accounts/intents/utils/with-quota-update.js +0 -13
- package/dist/esm/model/history.js +0 -49
- package/dist/esm/model/history.schema.js +0 -116
- package/dist/esm/sdk/accounts/intents/intents/index.js +0 -8
- package/dist/esm/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +0 -107
- package/dist/esm/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.js +0 -14
- package/dist/esm/sdk/accounts/intents/intents/resume/close/close.fixtures.js +0 -94
- package/dist/esm/sdk/accounts/intents/intents/resume/close/close.js +0 -50
- package/dist/esm/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +0 -114
- package/dist/esm/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.js +0 -82
- package/dist/esm/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +0 -110
- package/dist/esm/sdk/accounts/intents/intents/resume/deposit/deposit.js +0 -14
- package/dist/esm/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +0 -88
- package/dist/esm/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.js +0 -14
- package/dist/esm/sdk/accounts/intents/intents/resume/index.js +0 -7
- package/dist/esm/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +0 -121
- package/dist/esm/sdk/accounts/intents/intents/resume/withdraw/withdraw.js +0 -160
- package/dist/esm/sdk/accounts/intents/operations/add-collateral/index.js +0 -16
- package/dist/esm/sdk/accounts/intents/operations/claim-delayed/index.js +0 -52
- package/dist/esm/sdk/accounts/intents/operations/close-credit-account/index.js +0 -25
- package/dist/esm/sdk/accounts/intents/operations/decrease-debt/index.js +0 -11
- package/dist/esm/sdk/accounts/intents/operations/increase-debt/index.js +0 -11
- package/dist/esm/sdk/accounts/intents/operations/index.js +0 -14
- package/dist/esm/sdk/accounts/intents/operations/quota-update/index.js +0 -21
- package/dist/esm/sdk/accounts/intents/operations/repay-credit-account/index.js +0 -21
- package/dist/esm/sdk/accounts/intents/operations/start-delayed-withdrawal/index.js +0 -17
- package/dist/esm/sdk/accounts/intents/operations/swap/index.js +0 -17
- package/dist/esm/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +0 -26
- package/dist/esm/sdk/accounts/intents/operations/withdraw-collateral/index.js +0 -42
- package/dist/esm/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +0 -26
- package/dist/esm/sdk/accounts/intents/quoters/close.js +0 -56
- package/dist/esm/sdk/accounts/intents/quoters/index.js +0 -3
- package/dist/esm/sdk/accounts/intents/quoters/swap.js +0 -77
- package/dist/esm/sdk/accounts/intents/testing/expect.js +0 -162
- package/dist/esm/sdk/accounts/intents/testing/resume.js +0 -157
- package/dist/esm/sdk/accounts/intents/utils/simulate-adjust-state.js +0 -38
- package/dist/esm/sdk/accounts/intents/utils/simulate-assets.js +0 -68
- package/dist/esm/sdk/accounts/intents/utils/with-quota-update.js +0 -12
- package/dist/types/model/history.d.ts +0 -153
- package/dist/types/model/history.schema.d.ts +0 -95
- package/dist/types/new-sdk/utils/history.d.ts +0 -18
- package/dist/types/sdk/accounts/intents/intents/index.d.ts +0 -8
- package/dist/types/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.d.ts +0 -13
- package/dist/types/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.d.ts +0 -38
- package/dist/types/sdk/accounts/intents/intents/resume/close/close.d.ts +0 -26
- package/dist/types/sdk/accounts/intents/intents/resume/close/close.fixtures.d.ts +0 -63
- package/dist/types/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.d.ts +0 -26
- package/dist/types/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.d.ts +0 -86
- package/dist/types/sdk/accounts/intents/intents/resume/deposit/deposit.d.ts +0 -13
- package/dist/types/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.d.ts +0 -48
- package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.d.ts +0 -13
- package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.d.ts +0 -46
- package/dist/types/sdk/accounts/intents/intents/resume/index.d.ts +0 -7
- package/dist/types/sdk/accounts/intents/intents/resume/withdraw/withdraw.d.ts +0 -33
- package/dist/types/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.d.ts +0 -68
- package/dist/types/sdk/accounts/intents/operations/add-collateral/index.d.ts +0 -23
- package/dist/types/sdk/accounts/intents/operations/claim-delayed/index.d.ts +0 -55
- package/dist/types/sdk/accounts/intents/operations/close-credit-account/index.d.ts +0 -22
- package/dist/types/sdk/accounts/intents/operations/decrease-debt/index.d.ts +0 -18
- package/dist/types/sdk/accounts/intents/operations/increase-debt/index.d.ts +0 -18
- package/dist/types/sdk/accounts/intents/operations/index.d.ts +0 -14
- package/dist/types/sdk/accounts/intents/operations/quota-update/index.d.ts +0 -24
- package/dist/types/sdk/accounts/intents/operations/repay-credit-account/index.d.ts +0 -31
- package/dist/types/sdk/accounts/intents/operations/start-delayed-withdrawal/index.d.ts +0 -23
- package/dist/types/sdk/accounts/intents/operations/swap/index.d.ts +0 -28
- package/dist/types/sdk/accounts/intents/operations/types.d.ts +0 -21
- package/dist/types/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.d.ts +0 -30
- package/dist/types/sdk/accounts/intents/operations/withdraw-collateral/index.d.ts +0 -36
- package/dist/types/sdk/accounts/intents/operations/wrap-rwa-collateral/index.d.ts +0 -30
- package/dist/types/sdk/accounts/intents/quoters/close.d.ts +0 -43
- package/dist/types/sdk/accounts/intents/quoters/index.d.ts +0 -3
- package/dist/types/sdk/accounts/intents/quoters/swap.d.ts +0 -43
- package/dist/types/sdk/accounts/intents/testing/resume.d.ts +0 -84
- package/dist/types/sdk/accounts/intents/utils/simulate-adjust-state.d.ts +0 -19
- package/dist/types/sdk/accounts/intents/utils/simulate-assets.d.ts +0 -21
- package/dist/types/sdk/accounts/intents/utils/with-quota-update.d.ts +0 -16
- /package/dist/cjs/{new-sdk/utils/history.js → model/notices.js} +0 -0
- /package/dist/cjs/{sdk/accounts/intents/operations → new-sdk/simulate}/types.js +0 -0
- /package/dist/esm/{new-sdk/utils/history.js → model/notices.js} +0 -0
- /package/dist/esm/{sdk/accounts/intents/operations → new-sdk/simulate}/types.js +0 -0
|
@@ -255,6 +255,15 @@ declare const poolPositionSchema: z.ZodObject<{
|
|
|
255
255
|
}, z.core.$strip>], "kind">>;
|
|
256
256
|
}, z.core.$strip>>;
|
|
257
257
|
}, z.core.$strip>;
|
|
258
|
+
/**
|
|
259
|
+
* {@link BorrowRateBreakdown}
|
|
260
|
+
**/
|
|
261
|
+
declare const borrowRateBreakdownSchema: z.ZodObject<{
|
|
262
|
+
total: z.ZodNumber;
|
|
263
|
+
totalOnDebt: z.ZodNumber;
|
|
264
|
+
base: z.ZodNumber;
|
|
265
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
266
|
+
}, z.core.$strip>;
|
|
258
267
|
/**
|
|
259
268
|
* {@link StrategyPosition}
|
|
260
269
|
**/
|
|
@@ -323,6 +332,14 @@ declare const strategyPositionSchema: z.ZodObject<{
|
|
|
323
332
|
}, z.core.$strip>;
|
|
324
333
|
}, z.core.$strip>;
|
|
325
334
|
healthFactor: z.ZodNumber;
|
|
335
|
+
borrowRate: z.ZodOptional<z.ZodObject<{
|
|
336
|
+
total: z.ZodNumber;
|
|
337
|
+
totalOnDebt: z.ZodNumber;
|
|
338
|
+
base: z.ZodNumber;
|
|
339
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
340
|
+
}, z.core.$strip>>;
|
|
341
|
+
timeToLiquidation: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
342
|
+
liquidationPrice: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
326
343
|
pnl: z.ZodOptional<z.ZodObject<{
|
|
327
344
|
organic: z.ZodObject<{
|
|
328
345
|
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
@@ -568,6 +585,14 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
568
585
|
}, z.core.$strip>;
|
|
569
586
|
}, z.core.$strip>;
|
|
570
587
|
healthFactor: z.ZodNumber;
|
|
588
|
+
borrowRate: z.ZodOptional<z.ZodObject<{
|
|
589
|
+
total: z.ZodNumber;
|
|
590
|
+
totalOnDebt: z.ZodNumber;
|
|
591
|
+
base: z.ZodNumber;
|
|
592
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
593
|
+
}, z.core.$strip>>;
|
|
594
|
+
timeToLiquidation: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
595
|
+
liquidationPrice: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
571
596
|
pnl: z.ZodOptional<z.ZodObject<{
|
|
572
597
|
organic: z.ZodObject<{
|
|
573
598
|
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
@@ -755,5 +780,107 @@ declare const positionKeySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
755
780
|
creditAccount: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
756
781
|
kind: z.ZodLiteral<"strategy">;
|
|
757
782
|
}, z.core.$strip>], "kind">;
|
|
783
|
+
/**
|
|
784
|
+
* {@link PositionsTotals}
|
|
785
|
+
**/
|
|
786
|
+
declare const positionsTotalsSchema: z.ZodObject<{
|
|
787
|
+
currentYield: z.ZodNullable<z.ZodObject<{
|
|
788
|
+
totalApy: z.ZodOptional<z.ZodNumber>;
|
|
789
|
+
organicApy: z.ZodNumber;
|
|
790
|
+
rewards: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
791
|
+
kind: z.ZodLiteral<"token">;
|
|
792
|
+
token: z.ZodObject<{
|
|
793
|
+
chainId: z.ZodNumber;
|
|
794
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
795
|
+
symbol: z.ZodString;
|
|
796
|
+
name: z.ZodString;
|
|
797
|
+
decimals: z.ZodNumber;
|
|
798
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
799
|
+
}, z.core.$strip>;
|
|
800
|
+
supplyApr: z.ZodOptional<z.ZodNumber>;
|
|
801
|
+
borrowApr: z.ZodOptional<z.ZodNumber>;
|
|
802
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
803
|
+
kind: z.ZodLiteral<"point">;
|
|
804
|
+
points: z.ZodArray<z.ZodObject<{
|
|
805
|
+
id: z.ZodString;
|
|
806
|
+
name: z.ZodString;
|
|
807
|
+
multiplier: z.ZodNullable<z.ZodNumber>;
|
|
808
|
+
}, z.core.$strip>>;
|
|
809
|
+
}, z.core.$strip>], "kind">>>;
|
|
810
|
+
}, z.core.$strip>>;
|
|
811
|
+
pnl: z.ZodNullable<z.ZodObject<{
|
|
812
|
+
organic: z.ZodObject<{
|
|
813
|
+
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
814
|
+
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
815
|
+
token: z.ZodObject<{
|
|
816
|
+
chainId: z.ZodNumber;
|
|
817
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
818
|
+
symbol: z.ZodString;
|
|
819
|
+
name: z.ZodString;
|
|
820
|
+
decimals: z.ZodNumber;
|
|
821
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
822
|
+
}, z.core.$strip>;
|
|
823
|
+
}, z.core.$strip>;
|
|
824
|
+
total: z.ZodObject<{
|
|
825
|
+
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
826
|
+
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
827
|
+
token: z.ZodObject<{
|
|
828
|
+
chainId: z.ZodNumber;
|
|
829
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
830
|
+
symbol: z.ZodString;
|
|
831
|
+
name: z.ZodString;
|
|
832
|
+
decimals: z.ZodNumber;
|
|
833
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
834
|
+
}, z.core.$strip>;
|
|
835
|
+
}, z.core.$strip>;
|
|
836
|
+
rewards: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
837
|
+
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
838
|
+
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
839
|
+
token: z.ZodObject<{
|
|
840
|
+
chainId: z.ZodNumber;
|
|
841
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
842
|
+
symbol: z.ZodString;
|
|
843
|
+
name: z.ZodString;
|
|
844
|
+
decimals: z.ZodNumber;
|
|
845
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
846
|
+
}, z.core.$strip>;
|
|
847
|
+
kind: z.ZodLiteral<"token">;
|
|
848
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
849
|
+
kind: z.ZodLiteral<"point">;
|
|
850
|
+
points: z.ZodArray<z.ZodObject<{
|
|
851
|
+
id: z.ZodString;
|
|
852
|
+
name: z.ZodString;
|
|
853
|
+
multiplier: z.ZodNullable<z.ZodNumber>;
|
|
854
|
+
value: z.ZodNumber;
|
|
855
|
+
}, z.core.$strip>>;
|
|
856
|
+
}, z.core.$strip>], "kind">>;
|
|
857
|
+
}, z.core.$strip>>;
|
|
858
|
+
netValueUsd: z.ZodNullable<z.ZodNumber>;
|
|
859
|
+
claimableUsd: z.ZodNullable<z.ZodNumber>;
|
|
860
|
+
}, z.core.$strip>;
|
|
861
|
+
/**
|
|
862
|
+
* {@link PositionTransactionKind}
|
|
863
|
+
**/
|
|
864
|
+
declare const positionTransactionKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"open">, z.ZodLiteral<"deposit">, z.ZodLiteral<"withdraw">, z.ZodLiteral<"adjustLeverage">, z.ZodLiteral<"addCollateral">, z.ZodLiteral<"withdrawCollateral">, z.ZodLiteral<"liquidation">]>;
|
|
865
|
+
/**
|
|
866
|
+
* {@link PositionTransaction}
|
|
867
|
+
**/
|
|
868
|
+
declare const positionTransactionSchema: z.ZodObject<{
|
|
869
|
+
txHash: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
870
|
+
timestamp: z.ZodNumber;
|
|
871
|
+
kind: z.ZodUnion<readonly [z.ZodLiteral<"open">, z.ZodLiteral<"deposit">, z.ZodLiteral<"withdraw">, z.ZodLiteral<"adjustLeverage">, z.ZodLiteral<"addCollateral">, z.ZodLiteral<"withdrawCollateral">, z.ZodLiteral<"liquidation">]>;
|
|
872
|
+
assets: z.ZodArray<z.ZodObject<{
|
|
873
|
+
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
874
|
+
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
875
|
+
token: z.ZodObject<{
|
|
876
|
+
chainId: z.ZodNumber;
|
|
877
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
878
|
+
symbol: z.ZodString;
|
|
879
|
+
name: z.ZodString;
|
|
880
|
+
decimals: z.ZodNumber;
|
|
881
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
882
|
+
}, z.core.$strip>;
|
|
883
|
+
}, z.core.$strip>>;
|
|
884
|
+
}, z.core.$strip>;
|
|
758
885
|
//#endregion
|
|
759
|
-
export { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema };
|
|
886
|
+
export { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ILogger } from "../sdk/types/logger.js";
|
|
2
|
+
import { ChainId } from "../model/primitives.js";
|
|
2
3
|
import { DataResponse } from "../model/response.js";
|
|
3
4
|
import "../model/index.js";
|
|
4
|
-
import { NamespaceOptions } from "./types.js";
|
|
5
|
+
import { EnsureFreshChains, NamespaceOptions } from "./types.js";
|
|
5
6
|
import { EntityMerger, ListMerger } from "./utils/types.js";
|
|
6
7
|
import "./utils/index.js";
|
|
7
8
|
//#region src/new-sdk/AbstractNamespace.d.ts
|
|
@@ -17,6 +18,11 @@ interface MergedQuery<Onchain, Offchain, T> {
|
|
|
17
18
|
fromChain: (source: Onchain) => Promise<DataResponse<T>>;
|
|
18
19
|
fromBackend: (source: Offchain) => Promise<DataResponse<T>>;
|
|
19
20
|
merge: ListMerger<T> | EntityMerger<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Chains the on-chain leg touches, so only they are revalidated before it;
|
|
23
|
+
* omitted when the read fans out to every chain.
|
|
24
|
+
**/
|
|
25
|
+
chainIds?: readonly ChainId[];
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Base class of every {@link GearboxSDK} namespace: holds the two source
|
|
@@ -33,9 +39,16 @@ declare abstract class AbstractNamespace<Onchain, Offchain> {
|
|
|
33
39
|
**/
|
|
34
40
|
protected readonly maxOffchainLagSeconds: number;
|
|
35
41
|
protected readonly logger?: ILogger;
|
|
42
|
+
/**
|
|
43
|
+
* The SDK's loading policy, awaited before every on-chain leg: attached, and
|
|
44
|
+
* the touched chains no older than the SDK allows.
|
|
45
|
+
**/
|
|
46
|
+
protected readonly ensureFresh?: EnsureFreshChains;
|
|
36
47
|
protected constructor(name: string, onchain: Onchain | undefined, offchain: Offchain | undefined, options: NamespaceOptions);
|
|
37
48
|
/**
|
|
38
|
-
* The on-chain source namespace on its own
|
|
49
|
+
* The on-chain source namespace on its own — every read of it attaches and
|
|
50
|
+
* revalidates like a merged read does, so a consumer showing the two sources
|
|
51
|
+
* separately still gets the SDK's loading policy. Throws
|
|
39
52
|
* {@link SourceUnavailableError} in `offchain` mode.
|
|
40
53
|
**/
|
|
41
54
|
get onchain(): Onchain;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { NetworkType } from "../sdk/chain/chains.js";
|
|
2
2
|
import "../sdk/index.js";
|
|
3
|
-
import { GearboxSDKOptions, Mode, OffchainByMode, OnchainByMode } from "./types.js";
|
|
3
|
+
import { GearboxSDKOptions, Mode, NoticesByMode, OffchainByMode, OnchainByMode } from "./types.js";
|
|
4
4
|
import { Opportunities } from "./opportunities/types.js";
|
|
5
5
|
import "./opportunities/index.js";
|
|
6
6
|
import { Positions } from "./positions/types.js";
|
|
7
7
|
import "./positions/index.js";
|
|
8
8
|
//#region src/new-sdk/GearboxSDK.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Default {@link GearboxSDKOptions.maxStateAgeSeconds}: the fastest poll an
|
|
11
|
+
* app runs, so a 30 s tick sees state no older than itself.
|
|
12
|
+
**/
|
|
13
|
+
declare const DEFAULT_MAX_STATE_AGE = 30;
|
|
9
14
|
/**
|
|
10
15
|
* Entry point over both sources of Gearbox data: the chain and the Gearbox
|
|
11
16
|
* backend. The {@link Mode} is fixed at construction and decides which methods
|
|
@@ -43,6 +48,13 @@ declare class GearboxSDK<const M extends Mode = Mode> {
|
|
|
43
48
|
* Namespace for the positions a wallet holds.
|
|
44
49
|
**/
|
|
45
50
|
readonly positions: Positions<M>;
|
|
51
|
+
/**
|
|
52
|
+
* The banners the backend attaches to a pool opportunity or a strategy
|
|
53
|
+
* position, see {@link Notice}. Top-level because the subject is either
|
|
54
|
+
* kind of entity, so neither namespace owns it. Backend-only, hence gated
|
|
55
|
+
* by mode like every other backend read: absent in `onchain` mode.
|
|
56
|
+
**/
|
|
57
|
+
readonly notices: NoticesByMode[M];
|
|
46
58
|
constructor(options: GearboxSDKOptions<M>);
|
|
47
59
|
/**
|
|
48
60
|
* Attaches the on-chain SDK when this instance owns one; a no-op in `offchain`
|
|
@@ -66,4 +78,4 @@ declare class GearboxSDK<const M extends Mode = Mode> {
|
|
|
66
78
|
get offchain(): OffchainByMode[M];
|
|
67
79
|
}
|
|
68
80
|
//#endregion
|
|
69
|
-
export { GearboxSDK };
|
|
81
|
+
export { DEFAULT_MAX_STATE_AGE, GearboxSDK };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ChainId } from "../../model/primitives.js";
|
|
2
|
+
import { Asset } from "../../sdk/base/types.js";
|
|
3
|
+
import "../../model/index.js";
|
|
4
|
+
import { SecuritizeRegisterMessage } from "../../sdk/market/rwa/securitize/types.js";
|
|
5
|
+
import { RawTx } from "../../sdk/types/transactions.js";
|
|
6
|
+
import "../../sdk/index.js";
|
|
7
|
+
import { LpSimulate, OpenStrategySimulate, StrategySimulate } from "../simulate/types.js";
|
|
8
|
+
import { ChainOf } from "../simulate/SimulateApi.js";
|
|
9
|
+
import "../simulate/index.js";
|
|
10
|
+
import { Address } from "viem";
|
|
11
|
+
//#region src/new-sdk/execute/ExecuteApi.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* A pool deposit, withdrawal or redemption, as
|
|
14
|
+
* {@link OpportunitiesSimulate.deposit} / {@link OpportunitiesSimulate.withdraw}
|
|
15
|
+
* / {@link OpportunitiesSimulate.redeem} priced it. The simulation carries the
|
|
16
|
+
* tokens on both sides and the zapper, so nothing else is needed to encode
|
|
17
|
+
* the call.
|
|
18
|
+
**/
|
|
19
|
+
interface PoolPrepareRequest {
|
|
20
|
+
kind: "pool";
|
|
21
|
+
chainId: ChainId;
|
|
22
|
+
pool: Address;
|
|
23
|
+
wallet: Address;
|
|
24
|
+
op: "deposit" | "withdraw" | "redeem";
|
|
25
|
+
sim: Extract<LpSimulate, {
|
|
26
|
+
ok: true;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Opening a new position, from a viable
|
|
31
|
+
* {@link OpportunitiesSimulate.openNewStrategy} result. The preview values
|
|
32
|
+
* collateral in underlying only, so the wallet's actual collateral assets and
|
|
33
|
+
* the native value to attach come from the caller.
|
|
34
|
+
**/
|
|
35
|
+
interface OpenPrepareRequest {
|
|
36
|
+
kind: "open";
|
|
37
|
+
chainId: ChainId;
|
|
38
|
+
creditManager: Address;
|
|
39
|
+
wallet: Address;
|
|
40
|
+
sim: Extract<OpenStrategySimulate, {
|
|
41
|
+
ok: true;
|
|
42
|
+
}>;
|
|
43
|
+
/** What leaves the wallet, token by token. */
|
|
44
|
+
collateral: Asset[];
|
|
45
|
+
/** Native value to attach when paying a wrapped-native market in the coin. */
|
|
46
|
+
ethAmount: bigint;
|
|
47
|
+
/**
|
|
48
|
+
* Token the position ends up in. RWA markets resolve their open
|
|
49
|
+
* requirements against it; omitting it skips the RWA check entirely.
|
|
50
|
+
**/
|
|
51
|
+
targetToken?: Address;
|
|
52
|
+
/**
|
|
53
|
+
* EIP-712 registration signatures the wallet already signed this session,
|
|
54
|
+
* attached as `signaturesToCache` when the market is RWA-gated.
|
|
55
|
+
**/
|
|
56
|
+
signaturesToCache?: SecuritizeRegisterMessage[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Any of the five operations on an existing account, from a viable
|
|
60
|
+
* {@link StrategySimulate}: the facade multicall is the simulation's `calls`.
|
|
61
|
+
**/
|
|
62
|
+
interface AccountPrepareRequest {
|
|
63
|
+
kind: "account";
|
|
64
|
+
chainId: ChainId;
|
|
65
|
+
creditAccount: Address;
|
|
66
|
+
wallet: Address;
|
|
67
|
+
sim: Extract<StrategySimulate, {
|
|
68
|
+
ok: true;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* What {@link OpportunitiesExecute.buildTx} turns into a transaction: a
|
|
73
|
+
* simulate result plus the few facts about the wallet the simulation does not
|
|
74
|
+
* carry.
|
|
75
|
+
**/
|
|
76
|
+
type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | AccountPrepareRequest;
|
|
77
|
+
/**
|
|
78
|
+
* The write side of the opportunities namespace: turns what `simulate`
|
|
79
|
+
* answered into the transaction to sign. Sending, and whatever the wallet has
|
|
80
|
+
* to do first (allowances, permits, RWA signatures), stays with the caller —
|
|
81
|
+
* `checkPrerequisites` reports the former on the built transaction.
|
|
82
|
+
**/
|
|
83
|
+
interface OpportunitiesExecute {
|
|
84
|
+
/**
|
|
85
|
+
* The transaction to sign, from a simulate result. No second round of math:
|
|
86
|
+
* `account` requests submit the simulation's own multicall, `open` requests
|
|
87
|
+
* hand the preview's router path and quotas to `openCA`, `pool` requests
|
|
88
|
+
* encode the deposit / redeem the simulation priced.
|
|
89
|
+
*
|
|
90
|
+
* @throws on a simulation that is not `ok`; when a `pool` request names a
|
|
91
|
+
* route the pool has no metadata for, or one the pool does not accept a
|
|
92
|
+
* transaction for (RWA on-demand deposits)
|
|
93
|
+
**/
|
|
94
|
+
buildTx(request: PrepareRequest): Promise<RawTx>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* {@inheritDoc OpportunitiesExecute}
|
|
98
|
+
**/
|
|
99
|
+
declare class ExecuteApi implements OpportunitiesExecute {
|
|
100
|
+
#private;
|
|
101
|
+
constructor(chainOf: ChainOf);
|
|
102
|
+
/**
|
|
103
|
+
* {@inheritDoc OpportunitiesExecute.buildTx}
|
|
104
|
+
**/
|
|
105
|
+
buildTx(request: PrepareRequest): Promise<RawTx>;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { AccountPrepareRequest, ExecuteApi, OpenPrepareRequest, OpportunitiesExecute, PoolPrepareRequest, PrepareRequest };
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { GearboxSDKOptions, Mode, NamespaceOptions, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, PlainMultichainSDKOptions } from "./types.js";
|
|
1
|
+
import { EnsureFreshChains, GearboxSDKOptions, Mode, NamespaceOptions, NoticesByMode, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, PlainMultichainSDKOptions } from "./types.js";
|
|
2
2
|
import { EntityMerger, FilterResult, ListMerger, MergeListResult } from "./utils/types.js";
|
|
3
3
|
import { filterResponse } from "./utils/filterResponse.js";
|
|
4
|
-
import { HistoryReader } from "./utils/history.js";
|
|
5
4
|
import { DEFAULT_MAX_OFFCHAIN_LAG, mergeChainList, mergeChainOne } from "./utils/mergeChains.js";
|
|
6
5
|
import "./utils/index.js";
|
|
7
6
|
import { AbstractNamespace, MergedQuery } from "./AbstractNamespace.js";
|
|
7
|
+
import { AddCollateralParams, AdjustLeverageParams, DelayedSimulate, DelayedStrategySimulate, DepositStrategyParams, FinishDelayedParams, LpParams, LpRedeemParams, LpSimulate, OpenStrategyParams, OpenStrategySimulate, OpportunitiesSimulate, PoolInput, PositionInput, RepayStrategyParams, SimulateOptions, StrategyInput, StrategyRoutesSimulate, StrategySimulate, WithdrawCollateralParams, WithdrawStrategyParams } from "./simulate/types.js";
|
|
8
|
+
import { ChainOf, SimulateApi } from "./simulate/SimulateApi.js";
|
|
9
|
+
import "./simulate/index.js";
|
|
10
|
+
import { AccountPrepareRequest, ExecuteApi, OpenPrepareRequest, OpportunitiesExecute, PoolPrepareRequest, PrepareRequest } from "./execute/ExecuteApi.js";
|
|
11
|
+
import "./execute/index.js";
|
|
8
12
|
import { Opportunities, OpportunitiesBase, OpportunitiesByMode, OpportunitiesMerged, OpportunitiesOffchainBranch, OpportunitiesOffchainOnly, OpportunitiesOnchainBranch, OpportunitiesOnchainOnly, OpportunityMergers } from "./opportunities/types.js";
|
|
9
13
|
import { OpportunitiesNamespace } from "./opportunities/OpportunitiesNamespace.js";
|
|
10
14
|
import "./opportunities/index.js";
|
|
11
15
|
import { PositionMergers, Positions, PositionsBase, PositionsByMode, PositionsMerged, PositionsOffchainBranch, PositionsOffchainOnly, PositionsOnchainBranch, PositionsOnchainOnly } from "./positions/types.js";
|
|
12
16
|
import { PositionsNamespace } from "./positions/PositionsNamespace.js";
|
|
13
17
|
import "./positions/index.js";
|
|
14
|
-
import { GearboxSDK } from "./GearboxSDK.js";
|
|
18
|
+
import { DEFAULT_MAX_STATE_AGE, GearboxSDK } from "./GearboxSDK.js";
|
|
15
19
|
import { AllSourcesFailedError } from "./errors/AllSourcesFailedError.js";
|
|
16
20
|
import { MissingSourceError } from "./errors/MissingSourceError.js";
|
|
17
21
|
import { NoSourceServedError } from "./errors/NoSourceServedError.js";
|
|
@@ -20,4 +24,4 @@ import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
|
|
|
20
24
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
21
25
|
import { everyChainFailed } from "./errors/everyChainFailed.js";
|
|
22
26
|
import "./errors/index.js";
|
|
23
|
-
export { AbstractNamespace, AllSourcesFailedError, ChainRef, DEFAULT_MAX_OFFCHAIN_LAG, type EntityMerger, type FilterResult, GearboxSDK, GearboxSDKOptions,
|
|
27
|
+
export { AbstractNamespace, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, ChainOf, ChainRef, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedSimulate, DelayedStrategySimulate, DepositStrategyParams, EnsureFreshChains, type EntityMerger, ExecuteApi, type FilterResult, FinishDelayedParams, GearboxSDK, GearboxSDKOptions, type ListMerger, LpParams, LpRedeemParams, LpSimulate, type MergeListResult, MergedQuery, MissingSourceError, Mode, NamespaceOptions, NoSourceServedError, NoticesByMode, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenPrepareRequest, OpenStrategyParams, OpenStrategySimulate, Opportunities, OpportunitiesBase, OpportunitiesByMode, OpportunitiesExecute, OpportunitiesMerged, OpportunitiesNamespace, OpportunitiesOffchainBranch, OpportunitiesOffchainOnly, OpportunitiesOnchainBranch, OpportunitiesOnchainOnly, OpportunitiesSimulate, OpportunityMergers, PlainMultichainSDKOptions, PoolInput, PoolPrepareRequest, PositionInput, PositionMergers, Positions, PositionsBase, PositionsByMode, PositionsMerged, PositionsNamespace, PositionsOffchainBranch, PositionsOffchainOnly, PositionsOnchainBranch, PositionsOnchainOnly, PrepareRequest, RepayStrategyParams, SimulateApi, SimulateOptions, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyRoutesSimulate, StrategySimulate, WithdrawCollateralParams, WithdrawStrategyParams, assertSameChains, everyChainFailed, filterResponse, mergeChainList, mergeChainOne };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
2
|
-
import { PoolHistoryMetric, StrategyHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainSDK } from "../../sdk/MultichainSDK.js";
|
|
@@ -8,21 +8,33 @@ import { GearboxAPI } from "../../offchain/GearboxAPI.js";
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { NamespaceOptions } from "../types.js";
|
|
10
10
|
import { FilterResult } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
import { AbstractNamespace } from "../AbstractNamespace.js";
|
|
14
|
-
import {
|
|
13
|
+
import { OpportunitiesSimulate } from "../simulate/types.js";
|
|
14
|
+
import "../simulate/index.js";
|
|
15
|
+
import { OpportunitiesExecute } from "../execute/ExecuteApi.js";
|
|
16
|
+
import "../execute/index.js";
|
|
17
|
+
import { OpportunitiesBase, OpportunitiesOffchainOnly, OpportunitiesOnchainOnly, OpportunityMergers } from "./types.js";
|
|
15
18
|
//#region src/new-sdk/opportunities/OpportunitiesNamespace.d.ts
|
|
16
19
|
/**
|
|
17
20
|
* The `opportunities` namespace of a {@link GearboxSDK}, see
|
|
18
21
|
* {@link OpportunitiesByMode} for what each mode offers.
|
|
19
22
|
**/
|
|
20
|
-
declare class OpportunitiesNamespace extends AbstractNamespace<MultichainSDK["opportunities"], GearboxAPI["opportunities"]> implements OpportunitiesBase, OpportunitiesOffchainOnly {
|
|
23
|
+
declare class OpportunitiesNamespace extends AbstractNamespace<MultichainSDK["opportunities"], GearboxAPI["opportunities"]> implements OpportunitiesBase, OpportunitiesOffchainOnly, OpportunitiesOnchainOnly {
|
|
24
|
+
#private;
|
|
21
25
|
/**
|
|
22
26
|
* {@inheritDoc OpportunitiesBase.merge}
|
|
23
27
|
**/
|
|
24
28
|
readonly merge: OpportunityMergers;
|
|
25
29
|
constructor(onchain: MultichainSDK | undefined, offchain: GearboxAPI | undefined, options: NamespaceOptions);
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc OpportunitiesOnchainOnly.simulate}
|
|
32
|
+
**/
|
|
33
|
+
get simulate(): OpportunitiesSimulate;
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc OpportunitiesOnchainOnly.execute}
|
|
36
|
+
**/
|
|
37
|
+
get execute(): OpportunitiesExecute;
|
|
26
38
|
/**
|
|
27
39
|
* {@inheritDoc OpportunitiesBase.list}
|
|
28
40
|
**/
|
|
@@ -40,10 +52,10 @@ declare class OpportunitiesNamespace extends AbstractNamespace<MultichainSDK["op
|
|
|
40
52
|
**/
|
|
41
53
|
filter<R extends DataResponse<Opportunity[]> | undefined>(response: R, filter?: OpportunityFilter): FilterResult<R, Opportunity>;
|
|
42
54
|
/**
|
|
43
|
-
* {@inheritDoc OpportunitiesOffchainOnly.
|
|
55
|
+
* {@inheritDoc OpportunitiesOffchainOnly.charts}
|
|
44
56
|
**/
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
charts<const Metrics extends readonly PoolOpportunityChartMetric[]>(key: PoolOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
58
|
+
charts<const Metrics extends readonly StrategyOpportunityChartMetric[]>(key: StrategyOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
47
59
|
}
|
|
48
60
|
//#endregion
|
|
49
61
|
export { OpportunitiesNamespace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
2
|
-
import { PoolHistoryMetric, StrategyHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainOpportunitiesService } from "../../sdk/opportunities/MultichainOpportunitiesService.js";
|
|
@@ -8,8 +8,11 @@ import { OffchainOpportunities } from "../../offchain/opportunities/OffchainOppo
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { Mode } from "../types.js";
|
|
10
10
|
import { EntityMerger, FilterResult, ListMerger } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
12
|
+
import { OpportunitiesSimulate } from "../simulate/types.js";
|
|
13
|
+
import "../simulate/index.js";
|
|
14
|
+
import { OpportunitiesExecute } from "../execute/ExecuteApi.js";
|
|
15
|
+
import "../execute/index.js";
|
|
13
16
|
//#region src/new-sdk/opportunities/types.d.ts
|
|
14
17
|
/**
|
|
15
18
|
* What the `opportunities` namespace offers in every mode.
|
|
@@ -56,17 +59,35 @@ interface OpportunitiesBase {
|
|
|
56
59
|
**/
|
|
57
60
|
interface OpportunitiesOffchainOnly {
|
|
58
61
|
/**
|
|
59
|
-
* Historical charts of one opportunity, one
|
|
60
|
-
* `
|
|
61
|
-
*
|
|
62
|
+
* Historical charts of one opportunity, one series per metric on a shared
|
|
63
|
+
* axis: `charts(key, ["depositApy", "borrowApy"], "1m")`.
|
|
64
|
+
*
|
|
65
|
+
* The key's kind decides which metrics exist, so asking a pool for a strategy
|
|
66
|
+
* chart does not compile, and the bundle is keyed by exactly the metrics
|
|
67
|
+
* named — one of them is a bundle of one, not a different call.
|
|
62
68
|
**/
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
charts<const Metrics extends readonly PoolOpportunityChartMetric[]>(key: PoolOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
70
|
+
charts<const Metrics extends readonly StrategyOpportunityChartMetric[]>(key: StrategyOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
65
71
|
}
|
|
66
72
|
/**
|
|
67
|
-
* Reads only the chain can answer.
|
|
73
|
+
* Reads only the chain can answer.
|
|
68
74
|
**/
|
|
69
|
-
interface OpportunitiesOnchainOnly {
|
|
75
|
+
interface OpportunitiesOnchainOnly {
|
|
76
|
+
/**
|
|
77
|
+
* Simulations of what a deposit, withdrawal or leverage change would do.
|
|
78
|
+
*
|
|
79
|
+
* Absent in `offchain` mode: every one of them reads live account and pool
|
|
80
|
+
* state, and the strategy flows additionally need the pathfinder for real swap
|
|
81
|
+
* paths, so there is nothing the backend could answer with.
|
|
82
|
+
**/
|
|
83
|
+
readonly simulate: OpportunitiesSimulate;
|
|
84
|
+
/**
|
|
85
|
+
* The transaction a simulate result stands for, see
|
|
86
|
+
* {@link OpportunitiesExecute.buildTx}. Absent in `offchain` mode for the
|
|
87
|
+
* same reason as {@link simulate}: it encodes against live chain state.
|
|
88
|
+
**/
|
|
89
|
+
execute: OpportunitiesExecute;
|
|
90
|
+
}
|
|
70
91
|
/**
|
|
71
92
|
* Which reads the `opportunities` namespace has in each mode. A widened mode
|
|
72
93
|
* offers what every mode has, i.e. {@link OpportunitiesBase} alone.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
-
import { PoolPositionHistoryMetric, StrategyPositionHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainSDK } from "../../sdk/MultichainSDK.js";
|
|
@@ -8,7 +8,6 @@ import { GearboxAPI } from "../../offchain/GearboxAPI.js";
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { NamespaceOptions } from "../types.js";
|
|
10
10
|
import { FilterResult } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
import { AbstractNamespace } from "../AbstractNamespace.js";
|
|
14
13
|
import { PositionMergers, PositionsBase, PositionsOffchainOnly } from "./types.js";
|
|
@@ -33,10 +32,10 @@ declare class PositionsNamespace extends AbstractNamespace<MultichainSDK["positi
|
|
|
33
32
|
**/
|
|
34
33
|
filter<R extends DataResponse<Position[]> | undefined>(response: R, filter?: PositionFilter): FilterResult<R, Position>;
|
|
35
34
|
/**
|
|
36
|
-
* {@inheritDoc PositionsOffchainOnly.
|
|
35
|
+
* {@inheritDoc PositionsOffchainOnly.charts}
|
|
37
36
|
**/
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
charts<const Metrics extends readonly PoolPositionChartMetric[]>(key: PoolPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
38
|
+
charts<const Metrics extends readonly StrategyPositionChartMetric[]>(key: StrategyPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
40
39
|
}
|
|
41
40
|
//#endregion
|
|
42
41
|
export { PositionsNamespace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
-
import { PoolPositionHistoryMetric, StrategyPositionHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainPositionsService } from "../../sdk/positions/MultichainPositionsService.js";
|
|
@@ -8,7 +8,6 @@ import { OffchainPositions } from "../../offchain/positions/OffchainPositions.js
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { Mode } from "../types.js";
|
|
10
10
|
import { FilterResult, ListMerger } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
import { Address } from "viem";
|
|
14
13
|
//#region src/new-sdk/positions/types.d.ts
|
|
@@ -50,14 +49,15 @@ interface PositionsBase {
|
|
|
50
49
|
**/
|
|
51
50
|
interface PositionsOffchainOnly {
|
|
52
51
|
/**
|
|
53
|
-
* Historical charts of one position, one
|
|
54
|
-
* `
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
52
|
+
* Historical charts of one position, one series per metric on a shared axis:
|
|
53
|
+
* `charts(key, ["value", "apy"], "1m")`.
|
|
54
|
+
*
|
|
55
|
+
* The key's kind decides which metrics exist, so asking a pool position for a
|
|
56
|
+
* strategy chart does not compile. Liquidation positions have no charts: a
|
|
57
|
+
* delayed withdrawal is a single event rather than a series.
|
|
58
58
|
**/
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
charts<const Metrics extends readonly PoolPositionChartMetric[]>(key: PoolPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
60
|
+
charts<const Metrics extends readonly StrategyPositionChartMetric[]>(key: StrategyPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Reads only the chain can answer. Empty for now.
|