@gearbox-protocol/sdk 16.0.0-next.26 → 16.0.0-next.28

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.
Files changed (71) hide show
  1. package/dist/cjs/model/index.js +1 -0
  2. package/dist/cjs/model/previews.js +23 -0
  3. package/dist/cjs/onchain/accounts/index.js +2 -0
  4. package/dist/cjs/onchain/accounts/intents/index.js +2 -0
  5. package/dist/cjs/onchain/accounts/intents/open-strategy.js +4 -18
  6. package/dist/cjs/onchain/accounts/intents/realize.js +77 -50
  7. package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
  8. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +13 -5
  9. package/dist/cjs/onchain/index.js +2 -0
  10. package/dist/cjs/onchain/positions/PositionsService.js +79 -0
  11. package/dist/cjs/preview/index.js +6 -6
  12. package/dist/cjs/preview/preview/{buildDelayedPreview.js → buildDelayedStrategyVerify.js} +6 -25
  13. package/dist/cjs/preview/preview/index.js +6 -6
  14. package/dist/cjs/preview/preview/{previewAdjustCreditAccount.js → previewAdjustStrategyVerify.js} +6 -24
  15. package/dist/cjs/preview/preview/{previewCloseOrRepayCreditAccount.js → previewExitOrRepayStrategyVerify.js} +3 -3
  16. package/dist/cjs/preview/preview/{previewPoolOperation.js → previewLpVerify.js} +3 -3
  17. package/dist/cjs/preview/preview/{previewOpenCreditAccount.js → previewOpenStrategyVerify.js} +6 -26
  18. package/dist/cjs/preview/preview/previewOperation.js +10 -10
  19. package/dist/cjs/preview/validate/checkOperation.js +13 -9
  20. package/dist/cjs/rewards/rewards/api.js +15 -7
  21. package/dist/cjs/sdk/prepare/PrepareApi.js +7 -0
  22. package/dist/cjs/sdk/prepare/withdrawable-collaterals.js +23 -0
  23. package/dist/esm/model/index.js +2 -2
  24. package/dist/esm/model/previews.js +23 -1
  25. package/dist/esm/onchain/accounts/index.js +2 -1
  26. package/dist/esm/onchain/accounts/intents/index.js +2 -1
  27. package/dist/esm/onchain/accounts/intents/open-strategy.js +4 -18
  28. package/dist/esm/onchain/accounts/intents/realize.js +77 -50
  29. package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
  30. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +13 -5
  31. package/dist/esm/onchain/index.js +2 -1
  32. package/dist/esm/onchain/positions/PositionsService.js +79 -0
  33. package/dist/esm/preview/index.js +4 -4
  34. package/dist/esm/preview/preview/{buildDelayedPreview.js → buildDelayedStrategyVerify.js} +7 -26
  35. package/dist/esm/preview/preview/index.js +4 -4
  36. package/dist/esm/preview/preview/{previewAdjustCreditAccount.js → previewAdjustStrategyVerify.js} +7 -25
  37. package/dist/esm/preview/preview/{previewCloseOrRepayCreditAccount.js → previewExitOrRepayStrategyVerify.js} +3 -3
  38. package/dist/esm/preview/preview/{previewPoolOperation.js → previewLpVerify.js} +3 -3
  39. package/dist/esm/preview/preview/{previewOpenCreditAccount.js → previewOpenStrategyVerify.js} +7 -27
  40. package/dist/esm/preview/preview/previewOperation.js +10 -10
  41. package/dist/esm/preview/validate/checkOperation.js +13 -9
  42. package/dist/esm/rewards/rewards/api.js +16 -8
  43. package/dist/esm/sdk/prepare/PrepareApi.js +7 -0
  44. package/dist/esm/sdk/prepare/withdrawable-collaterals.js +22 -0
  45. package/dist/types/model/index.d.ts +2 -2
  46. package/dist/types/model/previews.d.ts +202 -76
  47. package/dist/types/onchain/accounts/index.d.ts +2 -1
  48. package/dist/types/onchain/accounts/intents/index.d.ts +2 -1
  49. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +1 -7
  50. package/dist/types/onchain/accounts/intents/testing/market.d.ts +1 -0
  51. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +7 -0
  52. package/dist/types/onchain/accounts/intents/utils/index.d.ts +1 -1
  53. package/dist/types/onchain/index.d.ts +2 -1
  54. package/dist/types/onchain/positions/PositionsService.d.ts +30 -0
  55. package/dist/types/preview/index.d.ts +5 -5
  56. package/dist/types/preview/preview/{buildDelayedPreview.d.ts → buildDelayedStrategyVerify.d.ts} +4 -4
  57. package/dist/types/preview/preview/index.d.ts +4 -4
  58. package/dist/types/preview/preview/{previewAdjustCreditAccount.d.ts → previewAdjustStrategyVerify.d.ts} +4 -4
  59. package/dist/types/preview/preview/{previewCloseOrRepayCreditAccount.d.ts → previewExitOrRepayStrategyVerify.d.ts} +4 -4
  60. package/dist/types/preview/preview/previewLpVerify.d.ts +11 -0
  61. package/dist/types/preview/preview/previewOpenStrategyVerify.d.ts +12 -0
  62. package/dist/types/preview/validate/checkOperation.d.ts +12 -4
  63. package/dist/types/preview/validate/index.d.ts +2 -2
  64. package/dist/types/rewards/rewards/api.d.ts +12 -6
  65. package/dist/types/rewards/rewards/merkl-api.d.ts +6 -0
  66. package/dist/types/sdk/prepare/PrepareApi.d.ts +5 -0
  67. package/dist/types/sdk/prepare/types.d.ts +18 -1
  68. package/dist/types/sdk/prepare/withdrawable-collaterals.d.ts +11 -0
  69. package/package.json +1 -1
  70. package/dist/types/preview/preview/previewOpenCreditAccount.d.ts +0 -12
  71. package/dist/types/preview/preview/previewPoolOperation.d.ts +0 -11
@@ -1,14 +1,12 @@
1
1
  import { AP_WETH_TOKEN } from "../../onchain/constants/address-provider.js";
2
- import { DUST_THRESHOLD } from "../../onchain/constants/math.js";
3
- import { calcPositionLeverage } from "../../onchain/market/math.js";
4
- import { ERROR_UNPRICEABLE_TOKEN } from "../../model/previews.js";
2
+ import { ERROR_UNPRICEABLE_TOKEN, asEstimated } from "../../model/previews.js";
5
3
  import "../../model/index.js";
6
4
  import "../../onchain/index.js";
7
5
  import { CreditAccountState } from "./CreditAccountState.js";
8
6
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
9
7
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
10
- //#region src/preview/preview/previewOpenCreditAccount.ts
11
- async function previewOpenCreditAccount(input, operation) {
8
+ //#region src/preview/preview/previewOpenStrategyVerify.ts
9
+ async function previewOpenStrategyVerify(input, operation) {
12
10
  const { sdk, value = 0n } = input;
13
11
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
14
12
  const oracle = market.priceOracle;
@@ -29,32 +27,14 @@ async function previewOpenCreditAccount(input, operation) {
29
27
  });
30
28
  const { assets: collateral, error: unwrapError } = unwrapNativeCollateral(state.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
31
29
  error ??= unwrapError ?? priceError;
32
- const assets = account.balances.toAssets(DUST_THRESHOLD);
33
- const quotas = account.quotas.toAssets(0n);
34
- const totalValue = netValue + account.totalDebt;
35
- const snap = account.toSnapshot(totalValue);
30
+ const snap = account.toSnapshot(netValue + account.totalDebt);
36
31
  const targetAsset = inferTargetAsset(operation.multicall, account.balances);
37
32
  return {
38
33
  operation: operation.operation,
39
- creditManager: operation.creditManager,
40
- name: sdk.marketRegister.findCreditManager(operation.creditManager).name,
34
+ ...asEstimated(sdk.positions.projection(snap, { availableLiquidityChange: -account.totalDebt })),
41
35
  targetCollateral: targetAsset ? oracle.toTokenAmount(targetAsset.token, targetAsset.balance) : void 0,
42
36
  collateralAdded: collateral.map((a) => oracle.toTokenAmount(a.token, a.balance)),
43
- netValue: market.toUnderlyingAmount(netValue),
44
- totalValue: market.toUnderlyingAmount(totalValue),
45
- totalDebt: market.toUnderlyingAmount(account.totalDebt),
46
- quotas: quotas.map((q) => ({
47
- token: sdk.tokensMeta.mustGetToken(q.token),
48
- ...oracle.toAmount(market.underlying, q.balance)
49
- })),
50
- assets: assets.map((a) => oracle.toTokenAmount(a.token, a.balance)),
51
- error,
52
- healthFactor: sdk.positions.healthFactor(snap),
53
- safeHealthFactor: sdk.positions.healthFactor(snap, { safePrices: true }),
54
- borrowRate: sdk.positions.borrowRate(snap, { availableLiquidityChange: -account.totalDebt }),
55
- timeToLiquidation: sdk.positions.timeToLiquidation(snap, { availableLiquidityChange: -account.totalDebt }),
56
- liquidationPrice: sdk.positions.liquidationPrice(snap),
57
- leverage: calcPositionLeverage(totalValue, account.totalDebt)
37
+ error
58
38
  };
59
39
  }
60
40
  /**
@@ -72,4 +52,4 @@ function inferTargetAsset(multicall, balances) {
72
52
  }
73
53
  }
74
54
  //#endregion
75
- export { previewOpenCreditAccount };
55
+ export { previewOpenStrategyVerify };
@@ -1,16 +1,16 @@
1
1
  import { parseOperationCalldata } from "../parse/parseOperationCalldata.js";
2
2
  import { isPoolOperation } from "../parse/types.js";
3
3
  import "../parse/index.js";
4
- import { buildDelayedPreview } from "./buildDelayedPreview.js";
4
+ import { buildDelayedStrategyVerify } from "./buildDelayedStrategyVerify.js";
5
5
  import { isCloseOrRepay } from "./detectCloseOrRepay.js";
6
6
  import { resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
7
7
  import { detectDelayedOperation } from "./detectDelayedOperation.js";
8
8
  import { UnsupportedOperationError } from "./errors.js";
9
9
  import { replayMulticall } from "./replayMulticall.js";
10
- import { previewAdjustCreditAccount } from "./previewAdjustCreditAccount.js";
11
- import { previewCloseOrRepayCreditAccount } from "./previewCloseOrRepayCreditAccount.js";
12
- import { previewOpenCreditAccount } from "./previewOpenCreditAccount.js";
13
- import { previewPoolOperation } from "./previewPoolOperation.js";
10
+ import { previewAdjustStrategyVerify } from "./previewAdjustStrategyVerify.js";
11
+ import { previewExitOrRepayStrategyVerify } from "./previewExitOrRepayStrategyVerify.js";
12
+ import { previewLpVerify } from "./previewLpVerify.js";
13
+ import { previewOpenStrategyVerify } from "./previewOpenStrategyVerify.js";
14
14
  //#region src/preview/preview/previewOperation.ts
15
15
  /**
16
16
  * Previews a raw operation calldata: decodes it into a typed operation and
@@ -18,11 +18,11 @@ import { previewPoolOperation } from "./previewPoolOperation.js";
18
18
  */
19
19
  async function previewOperation(input, options) {
20
20
  const operation = parseOperationCalldata(input);
21
- if (isPoolOperation(operation)) return previewPoolOperation(input, operation, options);
22
- if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") return previewOpenCreditAccount(input, operation);
21
+ if (isPoolOperation(operation)) return previewLpVerify(input, operation, options);
22
+ if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") return previewOpenStrategyVerify(input, operation);
23
23
  if (operation.operation === "CloseCreditAccount") {
24
24
  const resolved = await resolveCreditAccount(input, operation, options);
25
- const preview = await previewCloseOrRepayCreditAccount(input, operation, true, resolved);
25
+ const preview = await previewExitOrRepayStrategyVerify(input, operation, true, resolved);
26
26
  preview.intent = await resolveDelayedClaimIntent(input.sdk, operation.multicall, options?.blockNumber);
27
27
  return preview;
28
28
  }
@@ -52,7 +52,7 @@ async function resolveCreditAccount(input, operation, options) {
52
52
  */
53
53
  async function previewMulticallOperation(input, operation, options) {
54
54
  const { sdk } = input;
55
- const instantPreview = isCloseOrRepay(operation.multicall) ? await previewCloseOrRepayCreditAccount(input, operation, false, options) : await previewAdjustCreditAccount(input, operation, options);
55
+ const instantPreview = isCloseOrRepay(operation.multicall) ? await previewExitOrRepayStrategyVerify(input, operation, false, options) : await previewAdjustStrategyVerify(input, operation, options);
56
56
  const delayed = detectDelayedOperation(sdk, operation.multicall);
57
57
  if (!delayed) {
58
58
  instantPreview.intent = await resolveDelayedClaimIntent(sdk, operation.multicall, options?.blockNumber);
@@ -70,7 +70,7 @@ async function previewMulticallOperation(input, operation, options) {
70
70
  name: sdk.marketRegister.findCreditManager(operation.creditManager).name,
71
71
  intent: delayed.intent,
72
72
  instantPreview,
73
- delayedPreview: buildDelayedPreview(after.account, before, delayed, convert, receivedToken, sdk)
73
+ delayedPreview: buildDelayedStrategyVerify(after.account, before, delayed, convert, receivedToken, sdk)
74
74
  };
75
75
  }
76
76
  //#endregion
@@ -71,7 +71,11 @@ function creditIssues(sdk, preview, options) {
71
71
  maxDebt: suite.creditFacade.maxDebt,
72
72
  underlying,
73
73
  allowZero: !isOpening
74
- }) || borrowIssue(suite, preview, underlying) || forbiddenIssue(suite, preview) || quotaCountIssue(suite, preview) || quotaIssue(market, preview, underlying) || collateralIssue(preview, options) || fundingIssue(options, preview.collateralAdded);
74
+ }) || borrowIssue(suite, preview, underlying) || forbiddenIssue(suite, preview) || quotaCountIssue(suite, preview) || quotaIssue(market, preview, underlying) || collateralIssue({
75
+ totalDebt: preview.totalDebt,
76
+ healthFactor: preview.estHealthFactor,
77
+ safeHealthFactor: preview.estSafeHealthFactor
78
+ }, options) || fundingIssue(options, preview.collateralAdded);
75
79
  }
76
80
  /**
77
81
  * A bar that reads nothing but the projected account, so a parsed transaction
@@ -82,9 +86,9 @@ function creditIssues(sdk, preview, options) {
82
86
  * need an operation's *delta* between them, and the caller acts on the first
83
87
  * issue reported.
84
88
  */
85
- function quotaCountIssue(suite, projection) {
89
+ function quotaCountIssue(suite, account) {
86
90
  return checkQuotaCount({
87
- count: projection.quotas.filter((q) => q.value > 0n).length,
91
+ count: account.quotas.filter((q) => q.value > 0n).length,
88
92
  max: suite.creditManager.maxEnabledTokens
89
93
  });
90
94
  }
@@ -118,16 +122,16 @@ function borrowIssue(suite, preview, underlying) {
118
122
  *
119
123
  * {@inheritDoc quotaCountIssue}
120
124
  */
121
- function collateralIssue(projection, options) {
125
+ function collateralIssue(account, options) {
122
126
  const { minHealthFactor, minSafeHealthFactor, currentHealthFactor } = options;
123
- if (projection.totalDebt.value === 0n) return null;
127
+ if (account.totalDebt.value === 0n) return null;
124
128
  return (minHealthFactor === void 0 ? null : checkCollateralised({
125
- healthFactor: projection.healthFactor,
129
+ healthFactor: account.healthFactor,
126
130
  required: minHealthFactor,
127
131
  safePrices: false,
128
132
  improvesFrom: currentHealthFactor
129
- })) || (minSafeHealthFactor === void 0 || projection.safeHealthFactor === void 0 ? null : checkCollateralised({
130
- healthFactor: projection.safeHealthFactor,
133
+ })) || (minSafeHealthFactor === void 0 ? null : checkCollateralised({
134
+ healthFactor: account.safeHealthFactor,
131
135
  required: minSafeHealthFactor,
132
136
  safePrices: true
133
137
  }));
@@ -147,7 +151,7 @@ function fundingIssue(options, puts) {
147
151
  return null;
148
152
  }
149
153
  function forbiddenIssue(suite, preview) {
150
- const obtained = preview.operation === "AdjustCreditAccount" ? preview.assetsChange : preview.assets;
154
+ const obtained = preview.operation === "AdjustCreditAccount" ? preview.assetsChange : preview.estAssets;
151
155
  const forbidden = suite.forbiddenTokens;
152
156
  for (const asset of obtained) {
153
157
  if (asset.value <= 0n) continue;
@@ -3,7 +3,7 @@ import { BigIntMath } from "../../onchain/utils/bigint-math.js";
3
3
  import { toBigInt } from "../../onchain/utils/formatter.js";
4
4
  import "../../onchain/index.js";
5
5
  import { MerkleXYZApi } from "./merkl-api.js";
6
- import { getAddress, isAddress } from "viem";
6
+ import { formatUnits, getAddress, isAddress } from "viem";
7
7
  //#region src/rewards/rewards/api.ts
8
8
  /**
9
9
  * The wallet's claimable Merkl rewards on one chain.
@@ -36,10 +36,7 @@ async function getMerklRewards({ sdk, account, reportError, apiKey }) {
36
36
  const key = `${pool}_${rewardTokenAddress}`;
37
37
  const seen = claimable.get(key);
38
38
  if (seen) {
39
- claimable.set(key, {
40
- ...seen,
41
- amount: seen.amount + amount
42
- });
39
+ seen.value += amount;
43
40
  continue;
44
41
  }
45
42
  const poolToken = sdk.tokensMeta.getToken(pool);
@@ -48,12 +45,23 @@ async function getMerklRewards({ sdk, account, reportError, apiKey }) {
48
45
  chainId: sdk.chainId,
49
46
  pool,
50
47
  poolToken,
51
- rewardToken: toRewardToken(sdk, rewardTokenAddress, reward.token),
52
- amount
48
+ token: toRewardToken(sdk, rewardTokenAddress, reward.token),
49
+ value: amount,
50
+ price: reward.token.price
53
51
  });
54
52
  }
55
53
  }
56
- return [...claimable.values()];
54
+ return [...claimable.values()].map(toReward);
55
+ }
56
+ function toReward({ price, token, value, ...rest }) {
57
+ return {
58
+ ...rest,
59
+ amount: {
60
+ token,
61
+ value,
62
+ valueUsd: price === void 0 ? null : Number(formatUnits(value, token.decimals)) * price
63
+ }
64
+ };
57
65
  }
58
66
  /**
59
67
  * A campaign's incentive token is not protocol collateral, so the registry
@@ -5,6 +5,7 @@ import { toToken } from "../../onchain/validation/token.js";
5
5
  import { fetchCreditAccountSlice } from "../../onchain/accounts/intents/utils/credit-account-slice.js";
6
6
  import { CreditAccountOperationsService } from "../../onchain/accounts/intents/index.js";
7
7
  import "../../onchain/index.js";
8
+ import { withdrawableCollaterals } from "./withdrawable-collaterals.js";
8
9
  //#region src/sdk/prepare/PrepareApi.ts
9
10
  /**
10
11
  * {@inheritDoc IOpportunitiesPrepare}
@@ -268,6 +269,12 @@ var PrepareApi = class extends MultichainConstruct {
268
269
  });
269
270
  }
270
271
  /**
272
+ * {@inheritDoc IOpportunitiesPrepare.withdrawableCollaterals}
273
+ **/
274
+ withdrawableCollaterals(position) {
275
+ return withdrawableCollaterals(this.sdk.chain(position.chainId), position);
276
+ }
277
+ /**
271
278
  * {@inheritDoc IOpportunitiesPrepare.maxWithdrawCollateral}
272
279
  **/
273
280
  async maxWithdrawCollateral(position, token, targetHF) {
@@ -0,0 +1,22 @@
1
+ import { isPhantomToken } from "../../onchain/accounts/intents/utils/pick-token.js";
2
+ import "../../onchain/index.js";
3
+ //#region src/sdk/prepare/withdrawable-collaterals.ts
4
+ /**
5
+ * {@inheritDoc IOpportunitiesPrepare.withdrawableCollaterals}
6
+ **/
7
+ function withdrawableCollaterals(sdk, position) {
8
+ return position.collaterals.filter((c) => !isPhantomToken(sdk, c.collateral.token.address)).sort(byValueThenAddress);
9
+ }
10
+ /**
11
+ * Most valuable first. Address breaks a tie so the order is stable: two
12
+ * collaterals can share a value — a pair of unpriced ones share `null` — and a
13
+ * picker that seeds its default from the first row would otherwise change it
14
+ * between reads.
15
+ */
16
+ function byValueThenAddress(a, b) {
17
+ const byValue = (b.collateral.valueUsd ?? 0) - (a.collateral.valueUsd ?? 0);
18
+ if (byValue !== 0) return byValue;
19
+ return a.collateral.token.address < b.collateral.token.address ? -1 : 1;
20
+ }
21
+ //#endregion
22
+ export { withdrawableCollaterals };
@@ -15,8 +15,8 @@ import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
15
15
  import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
16
16
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
17
17
  import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
18
- import { AccountProjection, AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
18
+ import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, OperationPreview, OperationPreviewError, PoolOperationType, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, RoutedField, asEstimated } from "./previews.js";
19
19
  import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
20
20
  import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
21
21
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
22
- export { AccountProjection, AdjustCreditAccountPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
22
+ export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, RoutedField, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };