@gearbox-protocol/sdk 14.12.0-next.65 → 14.12.0-next.67
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/common-utils/index.js +2 -2
- package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +3 -3
- package/dist/cjs/common-utils/utils/assets-math.js +7 -7
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +2 -2
- package/dist/cjs/common-utils/utils/creditAccount/debt.js +2 -2
- package/dist/cjs/common-utils/utils/creditAccount/quota-utils.js +5 -5
- package/dist/cjs/common-utils/utils/index.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +5 -5
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +2 -2
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +4 -4
- package/dist/cjs/dev/index.js +2 -1
- package/dist/cjs/dev/kycUtils.js +1 -1
- package/dist/cjs/dev/midasUtils.js +104 -0
- package/dist/cjs/model/history.js +28 -0
- package/dist/cjs/model/history.schema.js +84 -0
- package/dist/cjs/model/index.js +64 -0
- package/dist/cjs/model/liquidations.js +23 -0
- package/dist/cjs/model/liquidations.schema.js +91 -0
- package/dist/cjs/model/opportunities.js +55 -0
- package/dist/cjs/model/opportunities.schema.js +220 -0
- package/dist/cjs/model/package.json +1 -0
- package/dist/cjs/model/positions.js +1 -0
- package/dist/cjs/model/primitives.js +1 -0
- package/dist/cjs/model/primitives.schema.js +85 -0
- package/dist/cjs/new-sdk/AbstractNamespace.js +158 -0
- package/dist/cjs/new-sdk/GearboxSDK.js +122 -0
- package/dist/cjs/new-sdk/index.js +11 -0
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +122 -0
- package/dist/cjs/new-sdk/opportunities/index.js +4 -0
- package/dist/cjs/new-sdk/opportunities/types.js +1 -0
- package/dist/cjs/new-sdk/package.json +1 -0
- package/dist/cjs/new-sdk/types.js +22 -0
- package/dist/cjs/new-sdk/utils/history.js +1 -0
- package/dist/cjs/new-sdk/utils/index.js +2 -0
- package/dist/cjs/offchain/GearboxAPI.js +33 -0
- package/dist/cjs/offchain/index.js +8 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +97 -0
- package/dist/cjs/offchain/opportunities/index.js +4 -0
- package/dist/cjs/offchain/package.json +1 -0
- package/dist/cjs/offchain/types.js +1 -0
- package/dist/cjs/preview/preview/buildDelayedPreview.js +5 -5
- package/dist/cjs/rewards/rewards/api.js +2 -2
- package/dist/cjs/rewards/rewards/extra-apy.js +2 -2
- package/dist/cjs/sdk/MultichainSDK.js +18 -2
- package/dist/cjs/sdk/OnchainSDK.js +8 -1
- package/dist/cjs/sdk/accounts/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +150 -106
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
- package/dist/cjs/sdk/accounts/liquidations/constants.js +13 -0
- package/dist/cjs/sdk/accounts/liquidations/index.js +2 -0
- package/dist/cjs/sdk/base/MultichainConstruct.js +80 -0
- package/dist/cjs/sdk/base/TokensMeta.js +51 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- package/dist/cjs/sdk/chain/chains.js +76 -0
- package/dist/cjs/sdk/chain/index.js +4 -0
- package/dist/cjs/sdk/core/errors.js +13 -0
- package/dist/cjs/sdk/core/index.js +2 -1
- package/dist/cjs/sdk/index.js +25 -1
- package/dist/cjs/sdk/market/MarketConfiguratorContract.js +14 -0
- package/dist/cjs/sdk/market/MarketSuite.js +163 -0
- package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +26 -0
- package/dist/cjs/sdk/market/credit/CreditSuite.js +102 -0
- package/dist/cjs/sdk/market/math.js +104 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
- package/dist/cjs/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
- package/dist/cjs/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
- package/dist/cjs/sdk/market/pool/PoolSuite.js +28 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +27 -0
- package/dist/cjs/sdk/market/pool/math.js +44 -0
- package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
- package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +60 -0
- package/dist/cjs/sdk/opportunities/OpportunitiesService.js +103 -0
- package/dist/cjs/sdk/opportunities/index.js +12 -0
- package/dist/cjs/sdk/types/multichain.js +1 -0
- package/dist/cjs/{common-utils → sdk}/utils/bigint-math.js +11 -11
- package/dist/cjs/sdk/utils/index.js +3 -0
- package/dist/cjs/sdk/utils/zod.js +12 -0
- package/dist/esm/common-utils/index.js +1 -1
- package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +1 -1
- package/dist/esm/common-utils/utils/assets-math.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/debt.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/quota-utils.js +1 -1
- package/dist/esm/common-utils/utils/index.js +1 -1
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +1 -1
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/index.js +3 -3
- package/dist/esm/dev/kycUtils.js +1 -1
- package/dist/esm/dev/midasUtils.js +105 -2
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/history.js +26 -0
- package/dist/esm/model/history.schema.js +76 -0
- package/dist/esm/model/index.js +9 -0
- package/dist/esm/model/liquidations.js +22 -0
- package/dist/esm/model/liquidations.schema.js +83 -0
- package/dist/esm/model/opportunities.js +51 -0
- package/dist/esm/model/opportunities.schema.js +198 -0
- package/dist/esm/model/package.json +1 -0
- package/dist/esm/model/positions.js +1 -0
- package/dist/esm/model/primitives.js +1 -0
- package/dist/esm/model/primitives.schema.js +75 -0
- package/dist/esm/new-sdk/AbstractNamespace.js +157 -0
- package/dist/esm/new-sdk/GearboxSDK.js +121 -0
- package/dist/esm/new-sdk/index.js +7 -0
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +121 -0
- package/dist/esm/new-sdk/opportunities/index.js +3 -0
- package/dist/esm/new-sdk/opportunities/types.js +1 -0
- package/dist/esm/new-sdk/package.json +1 -0
- package/dist/esm/new-sdk/types.js +21 -0
- package/dist/esm/new-sdk/utils/history.js +1 -0
- package/dist/esm/new-sdk/utils/index.js +2 -0
- package/dist/esm/offchain/GearboxAPI.js +32 -0
- package/dist/esm/offchain/index.js +5 -0
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +95 -0
- package/dist/esm/offchain/opportunities/index.js +2 -0
- package/dist/esm/offchain/package.json +1 -0
- package/dist/esm/offchain/types.js +1 -0
- package/dist/esm/preview/preview/buildDelayedPreview.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/rewards/rewards/api.js +1 -1
- package/dist/esm/rewards/rewards/extra-apy.js +1 -1
- package/dist/esm/sdk/MultichainSDK.js +18 -2
- package/dist/esm/sdk/OnchainSDK.js +8 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/index.js +2 -2
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +153 -109
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
- package/dist/esm/sdk/accounts/liquidations/constants.js +12 -1
- package/dist/esm/sdk/accounts/liquidations/index.js +2 -2
- 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/MultichainConstruct.js +79 -0
- package/dist/esm/sdk/base/TokensMeta.js +53 -2
- package/dist/esm/sdk/base/index.js +2 -1
- package/dist/esm/sdk/chain/chains.js +74 -2
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/chain/index.js +2 -2
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/core/errors.js +13 -1
- package/dist/esm/sdk/core/index.js +2 -2
- package/dist/esm/sdk/index.js +11 -5
- package/dist/esm/sdk/market/MarketConfiguratorContract.js +14 -0
- package/dist/esm/sdk/market/MarketSuite.js +163 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +26 -0
- package/dist/esm/sdk/market/credit/CreditSuite.js +102 -0
- package/dist/esm/sdk/market/math.js +98 -0
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
- package/dist/esm/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
- package/dist/esm/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +28 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +28 -1
- package/dist/esm/sdk/market/pool/math.js +41 -0
- package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -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/MultichainOpportunitiesService.js +59 -0
- package/dist/esm/sdk/opportunities/OpportunitiesService.js +102 -0
- package/dist/esm/sdk/opportunities/index.js +4 -0
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/types/multichain.js +1 -0
- package/dist/esm/{common-utils → sdk}/utils/bigint-math.js +11 -11
- package/dist/esm/sdk/utils/index.js +3 -2
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/sdk/utils/zod.js +13 -2
- package/dist/types/common-utils/index.d.ts +1 -1
- package/dist/types/common-utils/utils/index.d.ts +1 -1
- package/dist/types/dev/index.d.ts +2 -2
- package/dist/types/dev/midasUtils.d.ts +31 -2
- package/dist/types/model/history.d.ts +105 -0
- package/dist/types/model/history.schema.d.ts +66 -0
- package/dist/types/model/index.d.ts +9 -0
- package/dist/types/model/liquidations.d.ts +230 -0
- package/dist/types/model/liquidations.schema.d.ts +292 -0
- package/dist/types/model/opportunities.d.ts +543 -0
- package/dist/types/model/opportunities.schema.d.ts +1066 -0
- package/dist/types/model/positions.d.ts +11 -0
- package/dist/types/model/primitives.d.ts +193 -0
- package/dist/types/model/primitives.schema.d.ts +81 -0
- package/dist/types/new-sdk/AbstractNamespace.d.ts +119 -0
- package/dist/types/new-sdk/GearboxSDK.d.ts +78 -0
- package/dist/types/new-sdk/index.d.ts +9 -0
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +69 -0
- package/dist/types/new-sdk/opportunities/index.d.ts +3 -0
- package/dist/types/new-sdk/opportunities/types.d.ts +66 -0
- package/dist/types/new-sdk/types.d.ts +149 -0
- package/dist/types/new-sdk/utils/history.d.ts +44 -0
- package/dist/types/new-sdk/utils/index.d.ts +2 -0
- package/dist/types/offchain/GearboxAPI.d.ts +31 -0
- package/dist/types/offchain/index.d.ts +5 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +69 -0
- package/dist/types/offchain/opportunities/index.d.ts +2 -0
- package/dist/types/offchain/types.d.ts +50 -0
- package/dist/types/sdk/MultichainSDK.d.ts +15 -2
- package/dist/types/sdk/OnchainSDK.d.ts +9 -3
- package/dist/types/sdk/accounts/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +24 -16
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +26 -20
- package/dist/types/sdk/accounts/liquidations/constants.d.ts +12 -1
- package/dist/types/sdk/accounts/liquidations/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/types.d.ts +34 -309
- package/dist/types/sdk/base/MultichainConstruct.d.ts +57 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +26 -0
- package/dist/types/sdk/base/index.d.ts +2 -1
- package/dist/types/sdk/chain/chains.d.ts +68 -1
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/core/errors.d.ts +10 -1
- package/dist/types/sdk/core/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +15 -8
- package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +9 -0
- package/dist/types/sdk/market/MarketSuite.d.ts +109 -1
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +14 -0
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +47 -0
- package/dist/types/sdk/market/credit/types.d.ts +22 -0
- package/dist/types/sdk/market/index.d.ts +2 -2
- package/dist/types/sdk/market/math.d.ts +74 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +23 -0
- package/dist/types/sdk/market/oracle/types.d.ts +46 -0
- package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +12 -0
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +22 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +23 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +18 -0
- package/dist/types/sdk/market/pool/math.d.ts +57 -0
- package/dist/types/sdk/market/pool/types.d.ts +23 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +6 -0
- package/dist/types/sdk/market/pricefeeds/types.d.ts +10 -0
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +40 -0
- package/dist/types/sdk/opportunities/OpportunitiesService.d.ts +47 -0
- package/dist/types/sdk/opportunities/index.d.ts +4 -0
- package/dist/types/sdk/types/index.d.ts +2 -1
- package/dist/types/sdk/types/multichain.d.ts +65 -0
- package/dist/types/sdk/types/state.d.ts +1 -1
- package/dist/types/sdk/types/transactions.d.ts +3 -0
- package/dist/types/{common-utils → sdk}/utils/bigint-math.d.ts +7 -11
- package/dist/types/sdk/utils/index.d.ts +3 -2
- package/dist/types/sdk/utils/zod.d.ts +6 -2
- package/package.json +16 -1
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +0 -201
- package/dist/esm/sdk/accounts/liquidations/helpers.js +0 -192
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +0 -140
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_history = require("./history.js");
|
|
3
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
|
+
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
5
|
+
const require_model_history_schema = require("./history.schema.js");
|
|
6
|
+
const require_model_liquidations = require("./liquidations.js");
|
|
7
|
+
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
8
|
+
const require_model_opportunities = require("./opportunities.js");
|
|
9
|
+
require("./primitives.js");
|
|
10
|
+
exports.POOL_HISTORY_METRICS = require_model_history.POOL_HISTORY_METRICS;
|
|
11
|
+
exports.STRATEGY_HISTORY_METRICS = require_model_history.STRATEGY_HISTORY_METRICS;
|
|
12
|
+
exports.amountSchema = require_model_primitives_schema.amountSchema;
|
|
13
|
+
exports.apyBreakdownSchema = require_model_opportunities_schema.apyBreakdownSchema;
|
|
14
|
+
exports.assetTypeSchema = require_model_primitives_schema.assetTypeSchema;
|
|
15
|
+
exports.bpsSchema = require_model_primitives_schema.bpsSchema;
|
|
16
|
+
exports.chainIdSchema = require_model_primitives_schema.chainIdSchema;
|
|
17
|
+
exports.curatorSchema = require_model_primitives_schema.curatorSchema;
|
|
18
|
+
exports.delayedReceivedAssetSchema = require_model_liquidations_schema.delayedReceivedAssetSchema;
|
|
19
|
+
exports.historyChartMetadataSchema = require_model_history_schema.historyChartMetadataSchema;
|
|
20
|
+
exports.historyMetricSchema = require_model_history_schema.historyMetricSchema;
|
|
21
|
+
exports.historyPointSchema = require_model_history_schema.historyPointSchema;
|
|
22
|
+
exports.historyRangeSchema = require_model_history_schema.historyRangeSchema;
|
|
23
|
+
exports.historySeriesSchema = require_model_history_schema.historySeriesSchema;
|
|
24
|
+
exports.instantReceivedAssetSchema = require_model_liquidations_schema.instantReceivedAssetSchema;
|
|
25
|
+
exports.leverageSchema = require_model_primitives_schema.leverageSchema;
|
|
26
|
+
exports.liquidatableAccountFilterSchema = require_model_liquidations_schema.liquidatableAccountFilterSchema;
|
|
27
|
+
exports.liquidatableAccountSchema = require_model_liquidations_schema.liquidatableAccountSchema;
|
|
28
|
+
exports.liquidationApprovalSchema = require_model_liquidations_schema.liquidationApprovalSchema;
|
|
29
|
+
exports.liquidationDetailsSchema = require_model_liquidations_schema.liquidationDetailsSchema;
|
|
30
|
+
exports.liquidationPositionSchema = require_model_liquidations_schema.liquidationPositionSchema;
|
|
31
|
+
exports.matchesLiquidatableAccountFilter = require_model_liquidations.matchesLiquidatableAccountFilter;
|
|
32
|
+
exports.matchesOpportunityFilter = require_model_opportunities.matchesOpportunityFilter;
|
|
33
|
+
exports.opportunityBaseSchema = require_model_opportunities_schema.opportunityBaseSchema;
|
|
34
|
+
exports.opportunityDetailSchema = require_model_opportunities_schema.opportunityDetailSchema;
|
|
35
|
+
exports.opportunityFilterSchema = require_model_opportunities_schema.opportunityFilterSchema;
|
|
36
|
+
exports.opportunityHistoryQuerySchema = require_model_history_schema.opportunityHistoryQuerySchema;
|
|
37
|
+
exports.opportunityId = require_model_opportunities.opportunityId;
|
|
38
|
+
exports.opportunityKeySchema = require_model_opportunities_schema.opportunityKeySchema;
|
|
39
|
+
exports.opportunityKindSchema = require_model_opportunities_schema.opportunityKindSchema;
|
|
40
|
+
exports.opportunitySchema = require_model_opportunities_schema.opportunitySchema;
|
|
41
|
+
exports.pointRewardsSchema = require_model_opportunities_schema.pointRewardsSchema;
|
|
42
|
+
exports.pointsProgramSchema = require_model_opportunities_schema.pointsProgramSchema;
|
|
43
|
+
exports.poolHistoryMetricSchema = require_model_history_schema.poolHistoryMetricSchema;
|
|
44
|
+
exports.poolOpportunityDetailSchema = require_model_opportunities_schema.poolOpportunityDetailSchema;
|
|
45
|
+
exports.poolOpportunityId = require_model_opportunities.poolOpportunityId;
|
|
46
|
+
exports.poolOpportunityKeySchema = require_model_opportunities_schema.poolOpportunityKeySchema;
|
|
47
|
+
exports.poolOpportunitySchema = require_model_opportunities_schema.poolOpportunitySchema;
|
|
48
|
+
exports.priceFeedDataSchema = require_model_opportunities_schema.priceFeedDataSchema;
|
|
49
|
+
exports.priceFeedSummarySchema = require_model_opportunities_schema.priceFeedSummarySchema;
|
|
50
|
+
exports.quotaAssetSchema = require_model_opportunities_schema.quotaAssetSchema;
|
|
51
|
+
exports.rateCurvePointSchema = require_model_opportunities_schema.rateCurvePointSchema;
|
|
52
|
+
exports.rateCurveSchema = require_model_opportunities_schema.rateCurveSchema;
|
|
53
|
+
exports.receivedAssetSchema = require_model_liquidations_schema.receivedAssetSchema;
|
|
54
|
+
exports.rewardsSchema = require_model_opportunities_schema.rewardsSchema;
|
|
55
|
+
exports.strategyHistoryMetricSchema = require_model_history_schema.strategyHistoryMetricSchema;
|
|
56
|
+
exports.strategyOpportunityDetailSchema = require_model_opportunities_schema.strategyOpportunityDetailSchema;
|
|
57
|
+
exports.strategyOpportunityId = require_model_opportunities.strategyOpportunityId;
|
|
58
|
+
exports.strategyOpportunityKeySchema = require_model_opportunities_schema.strategyOpportunityKeySchema;
|
|
59
|
+
exports.strategyOpportunitySchema = require_model_opportunities_schema.strategyOpportunitySchema;
|
|
60
|
+
exports.timestampSchema = require_model_primitives_schema.timestampSchema;
|
|
61
|
+
exports.tokenAmountSchema = require_model_primitives_schema.tokenAmountSchema;
|
|
62
|
+
exports.tokenRewardsSchema = require_model_opportunities_schema.tokenRewardsSchema;
|
|
63
|
+
exports.tokenSchema = require_model_primitives_schema.tokenSchema;
|
|
64
|
+
exports.txCallSchema = require_model_primitives_schema.txCallSchema;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/model/liquidations.ts
|
|
3
|
+
/**
|
|
4
|
+
* Whether a liquidatable account satisfies every criterion of a filter.
|
|
5
|
+
*
|
|
6
|
+
* This is the single definition of what each criterion means: every source
|
|
7
|
+
* builds its rows first and runs them through here, so the chain and the
|
|
8
|
+
* backend cannot disagree on what a filter selects.
|
|
9
|
+
*
|
|
10
|
+
* @param account - Row to test.
|
|
11
|
+
* @param filter - Criteria to test against. An absent filter matches anything.
|
|
12
|
+
**/
|
|
13
|
+
function matchesLiquidatableAccountFilter(account, filter) {
|
|
14
|
+
if (!filter) return true;
|
|
15
|
+
if (filter.chainIds && !filter.chainIds.includes(account.chainId)) return false;
|
|
16
|
+
if (filter.underlyingType && account.totalValue.token.assetType !== filter.underlyingType) return false;
|
|
17
|
+
if (filter.paused !== void 0 && account.paused !== filter.paused) return false;
|
|
18
|
+
if (filter.rwa !== void 0 && account.rwa !== filter.rwa) return false;
|
|
19
|
+
if (filter.delayed !== void 0 && account.isDelayed !== filter.delayed) return false;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.matchesLiquidatableAccountFilter = matchesLiquidatableAccountFilter;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
|
+
let zod_v4 = require("zod/v4");
|
|
5
|
+
//#region src/model/liquidations.schema.ts
|
|
6
|
+
/**
|
|
7
|
+
* Runtime schemas for {@link ./liquidations.js}, see the note in
|
|
8
|
+
* `primitives.schema.ts` on why they are written by hand.
|
|
9
|
+
**/
|
|
10
|
+
/**
|
|
11
|
+
* {@link LiquidatableAccountFilter}
|
|
12
|
+
**/
|
|
13
|
+
const liquidatableAccountFilterSchema = zod_v4.z.object({
|
|
14
|
+
chainIds: zod_v4.z.array(require_model_primitives_schema.chainIdSchema).optional(),
|
|
15
|
+
underlyingType: require_model_primitives_schema.assetTypeSchema.optional(),
|
|
16
|
+
paused: zod_v4.z.boolean().optional(),
|
|
17
|
+
rwa: zod_v4.z.boolean().optional(),
|
|
18
|
+
delayed: zod_v4.z.boolean().optional()
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* {@link LiquidatableAccount}
|
|
22
|
+
**/
|
|
23
|
+
const liquidatableAccountSchema = zod_v4.z.object({
|
|
24
|
+
chainId: require_model_primitives_schema.chainIdSchema,
|
|
25
|
+
creditAccount: require_sdk_utils_zod.ZodAddress(),
|
|
26
|
+
creditManager: require_sdk_utils_zod.ZodAddress(),
|
|
27
|
+
asset: require_model_primitives_schema.tokenSchema,
|
|
28
|
+
totalValue: require_model_primitives_schema.tokenAmountSchema,
|
|
29
|
+
repaymentAmount: require_model_primitives_schema.tokenAmountSchema,
|
|
30
|
+
estimatedProfit: require_model_primitives_schema.tokenAmountSchema,
|
|
31
|
+
isDelayed: zod_v4.z.boolean(),
|
|
32
|
+
paused: zod_v4.z.boolean(),
|
|
33
|
+
rwa: zod_v4.z.boolean()
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* {@link InstantReceivedAsset}
|
|
37
|
+
**/
|
|
38
|
+
const instantReceivedAssetSchema = zod_v4.z.object({
|
|
39
|
+
...require_model_primitives_schema.tokenAmountSchema.shape,
|
|
40
|
+
isDelayed: zod_v4.z.literal(false)
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* {@link DelayedReceivedAsset}
|
|
44
|
+
**/
|
|
45
|
+
const delayedReceivedAssetSchema = zod_v4.z.object({
|
|
46
|
+
...require_model_primitives_schema.tokenAmountSchema.shape,
|
|
47
|
+
isDelayed: zod_v4.z.literal(true),
|
|
48
|
+
redeemerAddress: require_sdk_utils_zod.ZodAddress().optional(),
|
|
49
|
+
claimableAt: require_model_primitives_schema.timestampSchema.optional()
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* {@link ReceivedAsset}
|
|
53
|
+
**/
|
|
54
|
+
const receivedAssetSchema = zod_v4.z.discriminatedUnion("isDelayed", [instantReceivedAssetSchema, delayedReceivedAssetSchema]);
|
|
55
|
+
/**
|
|
56
|
+
* {@link LiquidationApproval}
|
|
57
|
+
**/
|
|
58
|
+
const liquidationApprovalSchema = require_model_primitives_schema.tokenAmountSchema.extend({ spender: require_sdk_utils_zod.ZodAddress() });
|
|
59
|
+
/**
|
|
60
|
+
* {@link LiquidationPosition}
|
|
61
|
+
**/
|
|
62
|
+
const liquidationPositionSchema = zod_v4.z.object({
|
|
63
|
+
chainId: require_model_primitives_schema.chainIdSchema,
|
|
64
|
+
sourceToken: require_model_primitives_schema.tokenSchema,
|
|
65
|
+
output: require_model_primitives_schema.tokenAmountSchema,
|
|
66
|
+
claimableAt: require_model_primitives_schema.timestampSchema.optional(),
|
|
67
|
+
claimTx: require_model_primitives_schema.txCallSchema.optional(),
|
|
68
|
+
redeemer: require_sdk_utils_zod.ZodAddress().optional()
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* {@link LiquidationDetails}
|
|
72
|
+
**/
|
|
73
|
+
const liquidationDetailsSchema = zod_v4.z.object({
|
|
74
|
+
...liquidatableAccountSchema.shape,
|
|
75
|
+
repaymentAmount: require_model_primitives_schema.tokenAmountSchema,
|
|
76
|
+
receivedAssets: zod_v4.z.array(receivedAssetSchema),
|
|
77
|
+
isLiquidatorEligible: zod_v4.z.boolean(),
|
|
78
|
+
isCreditAccountFrozen: zod_v4.z.boolean(),
|
|
79
|
+
kycProtocol: zod_v4.z.string().optional(),
|
|
80
|
+
kycToken: require_model_primitives_schema.tokenSchema.optional(),
|
|
81
|
+
approve: liquidationApprovalSchema.optional()
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
exports.delayedReceivedAssetSchema = delayedReceivedAssetSchema;
|
|
85
|
+
exports.instantReceivedAssetSchema = instantReceivedAssetSchema;
|
|
86
|
+
exports.liquidatableAccountFilterSchema = liquidatableAccountFilterSchema;
|
|
87
|
+
exports.liquidatableAccountSchema = liquidatableAccountSchema;
|
|
88
|
+
exports.liquidationApprovalSchema = liquidationApprovalSchema;
|
|
89
|
+
exports.liquidationDetailsSchema = liquidationDetailsSchema;
|
|
90
|
+
exports.liquidationPositionSchema = liquidationPositionSchema;
|
|
91
|
+
exports.receivedAssetSchema = receivedAssetSchema;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/model/opportunities.ts
|
|
3
|
+
/**
|
|
4
|
+
* Builds the canonical id of a pool opportunity.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* poolOpportunityId(1, "0xda00...") // "1:0xda00..."
|
|
9
|
+
* ```
|
|
10
|
+
**/
|
|
11
|
+
function poolOpportunityId(chainId, pool) {
|
|
12
|
+
return `${chainId}:${pool.toLowerCase()}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the canonical id of a strategy opportunity.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* strategyOpportunityId(1, "0x3eb9...", "0x7f39...") // "1:0x3eb9...:0x7f39..."
|
|
20
|
+
* ```
|
|
21
|
+
**/
|
|
22
|
+
function strategyOpportunityId(chainId, creditManager, targetCollateral) {
|
|
23
|
+
return `${chainId}:${creditManager.toLowerCase()}:${targetCollateral.toLowerCase()}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Canonical id of any opportunity, dispatching on {@link Opportunity.kind}.
|
|
27
|
+
**/
|
|
28
|
+
function opportunityId(opportunity) {
|
|
29
|
+
return opportunity.kind === "pool" ? poolOpportunityId(opportunity.chainId, opportunity.pool) : strategyOpportunityId(opportunity.chainId, opportunity.creditManager, opportunity.targetCollateral.address);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether an opportunity satisfies every criterion of a filter.
|
|
33
|
+
*
|
|
34
|
+
* This is the single definition of what each criterion means: every source
|
|
35
|
+
* builds its rows first and runs them through here, so the chain and the
|
|
36
|
+
* backend cannot disagree on what a filter selects.
|
|
37
|
+
*
|
|
38
|
+
* @param opportunity - Row to test.
|
|
39
|
+
* @param filter - Criteria to test against. An absent filter matches anything.
|
|
40
|
+
**/
|
|
41
|
+
function matchesOpportunityFilter(opportunity, filter) {
|
|
42
|
+
if (!filter) return true;
|
|
43
|
+
if (filter.kind && opportunity.kind !== filter.kind) return false;
|
|
44
|
+
if (filter.chainIds && !filter.chainIds.includes(opportunity.chainId)) return false;
|
|
45
|
+
if (filter.underlyingType && opportunity.underlyingToken.assetType !== filter.underlyingType) return false;
|
|
46
|
+
if (filter.paused !== void 0 && opportunity.paused !== filter.paused) return false;
|
|
47
|
+
if (filter.sunset !== void 0 && opportunity.sunset !== filter.sunset) return false;
|
|
48
|
+
if (filter.rwa !== void 0 && opportunity.rwa !== filter.rwa) return false;
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
exports.matchesOpportunityFilter = matchesOpportunityFilter;
|
|
53
|
+
exports.opportunityId = opportunityId;
|
|
54
|
+
exports.poolOpportunityId = poolOpportunityId;
|
|
55
|
+
exports.strategyOpportunityId = strategyOpportunityId;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
|
+
let zod_v4 = require("zod/v4");
|
|
5
|
+
//#region src/model/opportunities.schema.ts
|
|
6
|
+
/**
|
|
7
|
+
* Runtime schemas for {@link ./opportunities.js}, see the note in
|
|
8
|
+
* `primitives.schema.ts` on why they are written by hand.
|
|
9
|
+
**/
|
|
10
|
+
/**
|
|
11
|
+
* {@link OpportunityKind}
|
|
12
|
+
**/
|
|
13
|
+
const opportunityKindSchema = zod_v4.z.union([zod_v4.z.literal("pool"), zod_v4.z.literal("strategy")]);
|
|
14
|
+
/**
|
|
15
|
+
* {@link PointsProgram}
|
|
16
|
+
**/
|
|
17
|
+
const pointsProgramSchema = zod_v4.z.object({
|
|
18
|
+
id: zod_v4.z.string(),
|
|
19
|
+
name: zod_v4.z.string(),
|
|
20
|
+
multiplier: zod_v4.z.number().nullable()
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* {@link TokenRewards}
|
|
24
|
+
**/
|
|
25
|
+
const tokenRewardsSchema = zod_v4.z.object({
|
|
26
|
+
kind: zod_v4.z.literal("token"),
|
|
27
|
+
token: require_model_primitives_schema.tokenSchema,
|
|
28
|
+
supplyApr: require_model_primitives_schema.bpsSchema.optional(),
|
|
29
|
+
borrowApr: require_model_primitives_schema.bpsSchema.optional()
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* {@link PointRewards}
|
|
33
|
+
**/
|
|
34
|
+
const pointRewardsSchema = zod_v4.z.object({
|
|
35
|
+
kind: zod_v4.z.literal("point"),
|
|
36
|
+
points: zod_v4.z.array(pointsProgramSchema)
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* {@link Rewards}
|
|
40
|
+
**/
|
|
41
|
+
const rewardsSchema = zod_v4.z.discriminatedUnion("kind", [tokenRewardsSchema, pointRewardsSchema]);
|
|
42
|
+
/**
|
|
43
|
+
* {@link ApyBreakdown}
|
|
44
|
+
**/
|
|
45
|
+
const apyBreakdownSchema = zod_v4.z.object({
|
|
46
|
+
totalApy: require_model_primitives_schema.bpsSchema,
|
|
47
|
+
organicApy: require_model_primitives_schema.bpsSchema,
|
|
48
|
+
rewards: zod_v4.z.array(rewardsSchema)
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* {@link OpportunityBase}
|
|
52
|
+
**/
|
|
53
|
+
const opportunityBaseSchema = zod_v4.z.object({
|
|
54
|
+
chainId: require_model_primitives_schema.chainIdSchema,
|
|
55
|
+
title: zod_v4.z.string(),
|
|
56
|
+
curator: require_model_primitives_schema.curatorSchema,
|
|
57
|
+
underlyingToken: require_model_primitives_schema.tokenSchema,
|
|
58
|
+
totalSupply: require_model_primitives_schema.amountSchema,
|
|
59
|
+
totalBorrow: require_model_primitives_schema.amountSchema,
|
|
60
|
+
utilization: require_model_primitives_schema.bpsSchema,
|
|
61
|
+
supplyApy: apyBreakdownSchema.optional(),
|
|
62
|
+
collateralTokens: zod_v4.z.array(require_model_primitives_schema.tokenSchema),
|
|
63
|
+
paused: zod_v4.z.boolean(),
|
|
64
|
+
rwa: zod_v4.z.boolean(),
|
|
65
|
+
sunset: zod_v4.z.boolean()
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* {@link PoolOpportunity}
|
|
69
|
+
**/
|
|
70
|
+
const poolOpportunitySchema = zod_v4.z.object({
|
|
71
|
+
...opportunityBaseSchema.shape,
|
|
72
|
+
kind: zod_v4.z.literal("pool"),
|
|
73
|
+
pool: require_sdk_utils_zod.ZodAddress()
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* {@link StrategyOpportunity}
|
|
77
|
+
**/
|
|
78
|
+
const strategyOpportunitySchema = zod_v4.z.object({
|
|
79
|
+
...opportunityBaseSchema.shape,
|
|
80
|
+
kind: zod_v4.z.literal("strategy"),
|
|
81
|
+
creditManager: require_sdk_utils_zod.ZodAddress(),
|
|
82
|
+
targetCollateral: require_model_primitives_schema.tokenSchema,
|
|
83
|
+
liquidationThreshold: require_model_primitives_schema.bpsSchema,
|
|
84
|
+
liquidationPremium: require_model_primitives_schema.bpsSchema,
|
|
85
|
+
liquidationFee: require_model_primitives_schema.bpsSchema,
|
|
86
|
+
expirationDate: require_model_primitives_schema.timestampSchema.nullable(),
|
|
87
|
+
collateralApy: apyBreakdownSchema.optional(),
|
|
88
|
+
borrowApy: require_model_primitives_schema.bpsSchema.optional(),
|
|
89
|
+
additionalBorrowApy: require_model_primitives_schema.bpsSchema.optional(),
|
|
90
|
+
maxBorrowAmount: require_model_primitives_schema.amountSchema,
|
|
91
|
+
maxLeverage: require_model_primitives_schema.leverageSchema
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* {@link Opportunity}
|
|
95
|
+
**/
|
|
96
|
+
const opportunitySchema = zod_v4.z.discriminatedUnion("kind", [poolOpportunitySchema, strategyOpportunitySchema]);
|
|
97
|
+
/**
|
|
98
|
+
* {@link OpportunityFilter}
|
|
99
|
+
**/
|
|
100
|
+
const opportunityFilterSchema = zod_v4.z.object({
|
|
101
|
+
kind: opportunityKindSchema.optional(),
|
|
102
|
+
chainIds: zod_v4.z.array(require_model_primitives_schema.chainIdSchema).optional(),
|
|
103
|
+
underlyingType: require_model_primitives_schema.assetTypeSchema.optional(),
|
|
104
|
+
paused: zod_v4.z.boolean().optional(),
|
|
105
|
+
sunset: zod_v4.z.boolean().optional(),
|
|
106
|
+
rwa: zod_v4.z.boolean().optional()
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* {@link RateCurvePoint}
|
|
110
|
+
**/
|
|
111
|
+
const rateCurvePointSchema = zod_v4.z.object({
|
|
112
|
+
utilization: require_model_primitives_schema.bpsSchema,
|
|
113
|
+
supplyApy: require_model_primitives_schema.bpsSchema,
|
|
114
|
+
borrowApy: require_model_primitives_schema.bpsSchema
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* {@link RateCurve}
|
|
118
|
+
**/
|
|
119
|
+
const rateCurveSchema = zod_v4.z.object({
|
|
120
|
+
points: zod_v4.z.array(rateCurvePointSchema),
|
|
121
|
+
borrowingLimitUtilization: require_model_primitives_schema.bpsSchema.nullable()
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* {@link QuotaAsset}
|
|
125
|
+
**/
|
|
126
|
+
const quotaAssetSchema = zod_v4.z.object({
|
|
127
|
+
token: require_model_primitives_schema.tokenSchema,
|
|
128
|
+
quotaRate: require_model_primitives_schema.bpsSchema,
|
|
129
|
+
limit: require_model_primitives_schema.amountSchema,
|
|
130
|
+
used: require_model_primitives_schema.amountSchema
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* {@link PriceFeedData}. Recursive: a composite feed lists the feeds it reads.
|
|
134
|
+
**/
|
|
135
|
+
const priceFeedDataSchema = zod_v4.z.object({
|
|
136
|
+
name: zod_v4.z.string(),
|
|
137
|
+
type: zod_v4.z.string(),
|
|
138
|
+
feedAddress: require_sdk_utils_zod.ZodAddress(),
|
|
139
|
+
get dependencies() {
|
|
140
|
+
return zod_v4.z.array(priceFeedDataSchema);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* {@link PriceFeedSummary}
|
|
145
|
+
**/
|
|
146
|
+
const priceFeedSummarySchema = zod_v4.z.object({
|
|
147
|
+
underlyingPriceInUsd: zod_v4.z.number(),
|
|
148
|
+
collateralPriceInUsd: zod_v4.z.number(),
|
|
149
|
+
collateralPriceInUnderlying: zod_v4.z.number(),
|
|
150
|
+
underlyingFeed: priceFeedDataSchema,
|
|
151
|
+
collateralFeed: priceFeedDataSchema
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* {@link PoolOpportunityDetail}
|
|
155
|
+
**/
|
|
156
|
+
const poolOpportunityDetailSchema = zod_v4.z.object({
|
|
157
|
+
...poolOpportunitySchema.shape,
|
|
158
|
+
rateCurve: rateCurveSchema,
|
|
159
|
+
quotaAssets: zod_v4.z.array(quotaAssetSchema)
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* {@link StrategyOpportunityDetail}
|
|
163
|
+
**/
|
|
164
|
+
const strategyOpportunityDetailSchema = zod_v4.z.object({
|
|
165
|
+
...strategyOpportunitySchema.shape,
|
|
166
|
+
rateCurve: rateCurveSchema,
|
|
167
|
+
priceFeeds: priceFeedSummarySchema
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* {@link OpportunityDetail}
|
|
171
|
+
**/
|
|
172
|
+
const opportunityDetailSchema = zod_v4.z.discriminatedUnion("kind", [poolOpportunityDetailSchema, strategyOpportunityDetailSchema]);
|
|
173
|
+
/**
|
|
174
|
+
* {@link PoolOpportunityKey}
|
|
175
|
+
**/
|
|
176
|
+
const poolOpportunityKeySchema = zod_v4.z.object({
|
|
177
|
+
chainId: require_model_primitives_schema.chainIdSchema,
|
|
178
|
+
pool: require_sdk_utils_zod.ZodAddress()
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
* {@link StrategyOpportunityKey}
|
|
182
|
+
**/
|
|
183
|
+
const strategyOpportunityKeySchema = zod_v4.z.object({
|
|
184
|
+
chainId: require_model_primitives_schema.chainIdSchema,
|
|
185
|
+
creditManager: require_sdk_utils_zod.ZodAddress(),
|
|
186
|
+
targetCollateral: require_sdk_utils_zod.ZodAddress()
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* {@link OpportunityKey}
|
|
190
|
+
**/
|
|
191
|
+
const opportunityKeySchema = zod_v4.z.discriminatedUnion("kind", [zod_v4.z.object({
|
|
192
|
+
kind: zod_v4.z.literal("pool"),
|
|
193
|
+
...poolOpportunityKeySchema.shape
|
|
194
|
+
}), zod_v4.z.object({
|
|
195
|
+
kind: zod_v4.z.literal("strategy"),
|
|
196
|
+
...strategyOpportunityKeySchema.shape
|
|
197
|
+
})]);
|
|
198
|
+
//#endregion
|
|
199
|
+
exports.apyBreakdownSchema = apyBreakdownSchema;
|
|
200
|
+
exports.opportunityBaseSchema = opportunityBaseSchema;
|
|
201
|
+
exports.opportunityDetailSchema = opportunityDetailSchema;
|
|
202
|
+
exports.opportunityFilterSchema = opportunityFilterSchema;
|
|
203
|
+
exports.opportunityKeySchema = opportunityKeySchema;
|
|
204
|
+
exports.opportunityKindSchema = opportunityKindSchema;
|
|
205
|
+
exports.opportunitySchema = opportunitySchema;
|
|
206
|
+
exports.pointRewardsSchema = pointRewardsSchema;
|
|
207
|
+
exports.pointsProgramSchema = pointsProgramSchema;
|
|
208
|
+
exports.poolOpportunityDetailSchema = poolOpportunityDetailSchema;
|
|
209
|
+
exports.poolOpportunityKeySchema = poolOpportunityKeySchema;
|
|
210
|
+
exports.poolOpportunitySchema = poolOpportunitySchema;
|
|
211
|
+
exports.priceFeedDataSchema = priceFeedDataSchema;
|
|
212
|
+
exports.priceFeedSummarySchema = priceFeedSummarySchema;
|
|
213
|
+
exports.quotaAssetSchema = quotaAssetSchema;
|
|
214
|
+
exports.rateCurvePointSchema = rateCurvePointSchema;
|
|
215
|
+
exports.rateCurveSchema = rateCurveSchema;
|
|
216
|
+
exports.rewardsSchema = rewardsSchema;
|
|
217
|
+
exports.strategyOpportunityDetailSchema = strategyOpportunityDetailSchema;
|
|
218
|
+
exports.strategyOpportunityKeySchema = strategyOpportunityKeySchema;
|
|
219
|
+
exports.strategyOpportunitySchema = strategyOpportunitySchema;
|
|
220
|
+
exports.tokenRewardsSchema = tokenRewardsSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
let zod_v4 = require("zod/v4");
|
|
4
|
+
//#region src/model/primitives.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runtime schemas for {@link ./primitives.js}.
|
|
7
|
+
*
|
|
8
|
+
* The hand-written types are the contract; these schemas exist so the offchain
|
|
9
|
+
* client can reject a backend response that no longer matches it. The two are
|
|
10
|
+
* kept in sync by the type-level tests in `model.test-d.ts`, not by inferring
|
|
11
|
+
* one from the other.
|
|
12
|
+
**/
|
|
13
|
+
/**
|
|
14
|
+
* {@link ChainId}
|
|
15
|
+
**/
|
|
16
|
+
const chainIdSchema = zod_v4.z.number().int().positive();
|
|
17
|
+
/**
|
|
18
|
+
* {@link Timestamp}
|
|
19
|
+
**/
|
|
20
|
+
const timestampSchema = zod_v4.z.number().int().nonnegative();
|
|
21
|
+
/**
|
|
22
|
+
* {@link Bps}. Integer, not bounded to `0..10000`: rates may exceed 100%.
|
|
23
|
+
**/
|
|
24
|
+
const bpsSchema = zod_v4.z.number().int();
|
|
25
|
+
/**
|
|
26
|
+
* {@link AssetType}
|
|
27
|
+
**/
|
|
28
|
+
const assetTypeSchema = zod_v4.z.union([
|
|
29
|
+
zod_v4.z.literal("Stable"),
|
|
30
|
+
zod_v4.z.literal("ETH"),
|
|
31
|
+
zod_v4.z.literal("BTC")
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* {@link Leverage}
|
|
35
|
+
**/
|
|
36
|
+
const leverageSchema = zod_v4.z.number().positive();
|
|
37
|
+
/**
|
|
38
|
+
* {@link Amount}
|
|
39
|
+
**/
|
|
40
|
+
const amountSchema = zod_v4.z.object({
|
|
41
|
+
value: zod_v4.z.bigint(),
|
|
42
|
+
valueUsd: zod_v4.z.number().nullable()
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* {@link Token}
|
|
46
|
+
**/
|
|
47
|
+
const tokenSchema = zod_v4.z.object({
|
|
48
|
+
chainId: chainIdSchema,
|
|
49
|
+
address: require_sdk_utils_zod.ZodAddress(),
|
|
50
|
+
symbol: zod_v4.z.string(),
|
|
51
|
+
name: zod_v4.z.string(),
|
|
52
|
+
decimals: zod_v4.z.number().int().nonnegative(),
|
|
53
|
+
assetType: assetTypeSchema.optional()
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* {@link TokenAmount}
|
|
57
|
+
**/
|
|
58
|
+
const tokenAmountSchema = amountSchema.extend({ token: tokenSchema });
|
|
59
|
+
/**
|
|
60
|
+
* {@link TxCall}
|
|
61
|
+
**/
|
|
62
|
+
const txCallSchema = zod_v4.z.object({
|
|
63
|
+
to: require_sdk_utils_zod.ZodAddress(),
|
|
64
|
+
callData: require_sdk_utils_zod.ZodHex(),
|
|
65
|
+
value: zod_v4.z.bigint().optional()
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* {@link Curator}
|
|
69
|
+
**/
|
|
70
|
+
const curatorSchema = zod_v4.z.object({
|
|
71
|
+
address: require_sdk_utils_zod.ZodAddress(),
|
|
72
|
+
name: zod_v4.z.string(),
|
|
73
|
+
url: zod_v4.z.string().nullable()
|
|
74
|
+
});
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.amountSchema = amountSchema;
|
|
77
|
+
exports.assetTypeSchema = assetTypeSchema;
|
|
78
|
+
exports.bpsSchema = bpsSchema;
|
|
79
|
+
exports.chainIdSchema = chainIdSchema;
|
|
80
|
+
exports.curatorSchema = curatorSchema;
|
|
81
|
+
exports.leverageSchema = leverageSchema;
|
|
82
|
+
exports.timestampSchema = timestampSchema;
|
|
83
|
+
exports.tokenAmountSchema = tokenAmountSchema;
|
|
84
|
+
exports.tokenSchema = tokenSchema;
|
|
85
|
+
exports.txCallSchema = txCallSchema;
|