@gearbox-protocol/sdk 16.0.0 → 16.1.1

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 (55) hide show
  1. package/dist/cjs/dev/abi.js +99 -16
  2. package/dist/cjs/dev/claimFromFaucet.js +3 -3
  3. package/dist/cjs/dev/index.js +1 -1
  4. package/dist/cjs/model/analytics.schema.js +44 -1
  5. package/dist/cjs/model/charts.js +15 -1
  6. package/dist/cjs/model/charts.schema.js +9 -3
  7. package/dist/cjs/model/index.js +9 -4
  8. package/dist/cjs/model/liquidations.schema.js +1 -1
  9. package/dist/cjs/model/opportunities.schema.js +2 -2
  10. package/dist/cjs/model/positions.schema.js +2 -2
  11. package/dist/cjs/offchain/analytics/OffchainAnalytics.js +25 -2
  12. package/dist/cjs/onchain/base/TokensMeta.js +3 -3
  13. package/dist/cjs/onchain/chain/chains.js +7 -0
  14. package/dist/cjs/onchain/market/strategyName.js +1 -1
  15. package/dist/cjs/sdk/analytics/AnalyticsNamespace.js +6 -0
  16. package/dist/esm/dev/abi.js +99 -16
  17. package/dist/esm/dev/claimFromFaucet.js +4 -4
  18. package/dist/esm/dev/index.js +2 -2
  19. package/dist/esm/model/analytics.schema.js +42 -2
  20. package/dist/esm/model/charts.js +15 -2
  21. package/dist/esm/model/charts.schema.js +9 -4
  22. package/dist/esm/model/index.js +6 -6
  23. package/dist/esm/model/liquidations.schema.js +1 -1
  24. package/dist/esm/model/opportunities.schema.js +2 -2
  25. package/dist/esm/model/positions.schema.js +2 -2
  26. package/dist/esm/offchain/analytics/OffchainAnalytics.js +25 -2
  27. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  28. package/dist/esm/onchain/chain/chains.js +7 -0
  29. package/dist/esm/onchain/market/strategyName.js +1 -1
  30. package/dist/esm/sdk/analytics/AnalyticsNamespace.js +6 -0
  31. package/dist/types/dev/abi.d.ts +91 -15
  32. package/dist/types/dev/index.d.ts +2 -2
  33. package/dist/types/model/analytics.d.ts +22 -1
  34. package/dist/types/model/analytics.schema.d.ts +65 -1
  35. package/dist/types/model/charts.d.ts +20 -2
  36. package/dist/types/model/charts.schema.d.ts +14 -2
  37. package/dist/types/model/index.d.ts +5 -5
  38. package/dist/types/model/primitives.d.ts +1 -1
  39. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
  40. package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +14 -2
  41. package/dist/types/offchain/analytics/types.d.ts +11 -0
  42. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
  43. package/dist/types/offchain/opportunities/types.d.ts +1 -1
  44. package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
  45. package/dist/types/offchain/positions/types.d.ts +1 -1
  46. package/dist/types/onchain/base/TokensMeta.d.ts +3 -3
  47. package/dist/types/onchain/base/token-types.d.ts +1 -1
  48. package/dist/types/onchain/market/strategyName.d.ts +1 -1
  49. package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +6 -0
  50. package/dist/types/sdk/analytics/types.d.ts +16 -0
  51. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  52. package/dist/types/sdk/opportunities/types.d.ts +1 -1
  53. package/dist/types/sdk/positions/PositionsNamespace.d.ts +1 -1
  54. package/dist/types/sdk/positions/types.d.ts +1 -1
  55. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { formatBN } from "../onchain/utils/formatter.js";
2
2
  import "../onchain/index.js";
3
- import { faucetAbi } from "./abi.js";
3
+ import { iFaucetAbi } from "./abi.js";
4
4
  import { readContract } from "viem/actions";
5
5
  //#region src/dev/claimFromFaucet.ts
6
6
  async function claimFromFaucet(opts) {
@@ -22,7 +22,7 @@ async function claimFromFaucet(opts) {
22
22
  } else if (typeof amount === "function") {
23
23
  const minAmountUSD = await readContract(publicClient, {
24
24
  address: faucet,
25
- abi: faucetAbi,
25
+ abi: iFaucetAbi,
26
26
  functionName: "minAmountUSD"
27
27
  });
28
28
  logger?.debug(`faucet min amount USD: ${minAmountUSD}`);
@@ -38,7 +38,7 @@ async function claimFromFaucet(opts) {
38
38
  const gas = await publicClient.estimateContractGas({
39
39
  account: claimer,
40
40
  address: faucet,
41
- abi: faucetAbi,
41
+ abi: iFaucetAbi,
42
42
  functionName: "claim",
43
43
  args
44
44
  });
@@ -46,7 +46,7 @@ async function claimFromFaucet(opts) {
46
46
  const { request } = await publicClient.simulateContract({
47
47
  account: claimer,
48
48
  address: faucet,
49
- abi: faucetAbi,
49
+ abi: iFaucetAbi,
50
50
  functionName: "claim",
51
51
  args,
52
52
  chain: wallet.chain,
@@ -1,4 +1,4 @@
1
- import { faucetAbi, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi } from "./abi.js";
1
+ import { iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi } from "./abi.js";
2
2
  import { claimFromFaucet } from "./claimFromFaucet.js";
3
3
  import { anvilNodeInfo, createAnvilClient, evmMineDetailed, extendAnvilClient, isAnvil } from "./createAnvilClient.js";
4
4
  import { createMinter } from "./mint/factory.js";
@@ -25,4 +25,4 @@ import { claimDSToken, claimDSTokens, enableDSTokenBackDating } from "./securiti
25
25
  import "./types.js";
26
26
  import { ONCHAIN_EXECUTION_ID_ADDRESS, verifyTestnet } from "./verifyTestnet.js";
27
27
  import { makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
28
- export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, faucetAbi, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeAndWait };
28
+ export { AccountOpener, Create2Deployer, DEFAULT_CREATE2_SALT, EthCallSpy, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, RevolverTransport, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeAndWait };
@@ -1,7 +1,8 @@
1
1
  import { ZodAddress } from "../onchain/utils/zod.js";
2
+ import { assetTypeSchema, chainIdSchema } from "./primitives.schema.js";
3
+ import { chartRangeSchema, protocolChartMetricSchema } from "./charts.schema.js";
2
4
  import { isFilterSet } from "./filters.js";
3
5
  import { encodeFlag, filterable } from "./filters.schema.js";
4
- import { assetTypeSchema, chainIdSchema } from "./primitives.schema.js";
5
6
  import { liquidationPositionSchema } from "./liquidations.schema.js";
6
7
  import { poolPositionSchema, positionKindSchema, strategyPositionSchema } from "./positions.schema.js";
7
8
  import { isAddress } from "viem";
@@ -104,5 +105,44 @@ const analyticsPositionPageSchema = z.object({
104
105
  offset: z.number().int().nonnegative(),
105
106
  limit: z.number().int().positive().max(100)
106
107
  });
108
+ /**
109
+ * {@link AnalyticsChartQuery}
110
+ *
111
+ * The metric list is narrowed to {@link ProtocolChartMetric} here rather than
112
+ * on the route, so asking the protocol chart for an opportunity metric is
113
+ * rejected by the one codec both sides share instead of by a check only the
114
+ * backend runs.
115
+ **/
116
+ const analyticsChartQueryOptionsSchema = z.object({
117
+ metrics: z.array(protocolChartMetricSchema).readonly().refine((metrics) => metrics.length > 0, { error: "a chart read needs at least one metric" }).refine((metrics) => new Set(metrics).size === metrics.length, { error: "a chart read needs distinct metrics" }),
118
+ range: chartRangeSchema,
119
+ chainIds: z.array(chainIdSchema).optional()
120
+ });
121
+ /**
122
+ * {@link AnalyticsChartQuery} as URL query parameters: the metrics comma-joined
123
+ * like every other chart read, and the chains comma-joined like every other
124
+ * analytics read.
125
+ **/
126
+ const analyticsChartQueryParamsSchema = z.object({
127
+ metrics: z.string().regex(/^\w+(,\w+)*$/),
128
+ range: chartRangeSchema,
129
+ chainIds: z.string().regex(/^$|^\d+(,\d+)*$/).optional()
130
+ });
131
+ /**
132
+ * Codec for a protocol-wide chart query. It is shared by the SDK client and
133
+ * backend controller so both sides interpret every parameter identically.
134
+ **/
135
+ const analyticsChartQuerySchema = z.codec(analyticsChartQueryParamsSchema, analyticsChartQueryOptionsSchema, {
136
+ decode: (params) => ({
137
+ metrics: params.metrics.split(","),
138
+ range: params.range,
139
+ ...params.chainIds === void 0 ? {} : { chainIds: params.chainIds === "" ? [] : params.chainIds.split(",").map(Number) }
140
+ }),
141
+ encode: (query) => ({
142
+ metrics: query.metrics.join(","),
143
+ range: query.range,
144
+ chainIds: query.chainIds?.join(",")
145
+ })
146
+ });
107
147
  //#endregion
108
- export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema };
148
+ export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema };
@@ -84,6 +84,18 @@ const STRATEGY_POSITION_CHART_METRICS = [
84
84
  "netApy7d"
85
85
  ];
86
86
  /**
87
+ * Every metric the protocol as a whole can chart.
88
+ *
89
+ * Protocol-wide rather than per subject: the series describes Gearbox itself
90
+ * over every chain the read covers, so it has no address to hang off and is
91
+ * read from the analytics namespace rather than from an opportunity.
92
+ *
93
+ * `tvlUsd` is deliberately not spelled `tvl`: that key is already the credit
94
+ * manager's TVL in whole underlying tokens, and one metric has exactly one
95
+ * unit in {@link CHART_METRIC_UNITS}.
96
+ **/
97
+ const PROTOCOL_CHART_METRICS = ["tvlUsd"];
98
+ /**
87
99
  * Unit of every metric, the one place either side decides it.
88
100
  *
89
101
  * A metric added to a union above fails to compile here until its unit is
@@ -113,7 +125,8 @@ const CHART_METRIC_UNITS = {
113
125
  totalValueUnderlying: "token",
114
126
  debt: "token",
115
127
  healthFactor: "bps",
116
- netApy7d: "bps"
128
+ netApy7d: "bps",
129
+ tvlUsd: "usd"
117
130
  };
118
131
  /**
119
132
  * Reason a series could not be produced at all, which is not the same as a
@@ -127,4 +140,4 @@ const CHART_UNAVAILABLE_CODES = [
127
140
  "internal"
128
141
  ];
129
142
  //#endregion
130
- export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS };
143
+ export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS };
@@ -1,5 +1,5 @@
1
+ import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS } from "./charts.js";
1
2
  import { timestampSchema, tokenSchema } from "./primitives.schema.js";
2
- import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS } from "./charts.js";
3
3
  import { z } from "zod/v4";
4
4
  //#region src/model/charts.schema.ts
5
5
  /**
@@ -32,13 +32,18 @@ const poolPositionChartMetricSchema = z.enum(POOL_POSITION_CHART_METRICS);
32
32
  **/
33
33
  const strategyPositionChartMetricSchema = z.enum(STRATEGY_POSITION_CHART_METRICS);
34
34
  /**
35
- * {@link ChartMetric}, every metric either kind of subject can chart.
35
+ * {@link ProtocolChartMetric}
36
+ **/
37
+ const protocolChartMetricSchema = z.enum(PROTOCOL_CHART_METRICS);
38
+ /**
39
+ * {@link ChartMetric}, every metric any subject can chart.
36
40
  **/
37
41
  const chartMetricSchema = z.union([
38
42
  poolOpportunityChartMetricSchema,
39
43
  strategyOpportunityChartMetricSchema,
40
44
  poolPositionChartMetricSchema,
41
- strategyPositionChartMetricSchema
45
+ strategyPositionChartMetricSchema,
46
+ protocolChartMetricSchema
42
47
  ]);
43
48
  /**
44
49
  * {@link ChartQuery}
@@ -223,4 +228,4 @@ function chartBundleSchemaFor(metrics, range) {
223
228
  return chartBundleSchemaWith(z.union(literals), range);
224
229
  }
225
230
  //#endregion
226
- export { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema };
231
+ export { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, protocolChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema };
@@ -1,15 +1,15 @@
1
1
  import "./analytics.js";
2
+ import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS } from "./charts.js";
3
+ import { backendPreferred, compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
4
+ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
5
+ import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, protocolChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
2
6
  import { FILTER_ALL, isFilterSet } from "./filters.js";
3
7
  import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
4
- import { backendPreferred, compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
5
8
  import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
6
- import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
7
9
  import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
8
10
  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";
9
11
  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";
10
- import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
11
- import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS } from "./charts.js";
12
- import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
12
+ import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
13
13
  import "./curators.js";
14
14
  import "./delayed-intents.js";
15
15
  import "./errors.js";
@@ -25,4 +25,4 @@ import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourc
25
25
  import { isSDKError, safeValue, sdkErr, sdkOk } from "./result.js";
26
26
  import "./withdrawals.js";
27
27
  import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
28
- export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, 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, isSDKError, 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, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, withdrawalOutputAmountSchema };
28
+ export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, 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, isSDKError, 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, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, withdrawalOutputAmountSchema };
@@ -1,7 +1,7 @@
1
1
  import { ZodAddress } from "../onchain/utils/zod.js";
2
+ import { assetTypeSchema, bpsSchema, chainIdSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
2
3
  import { filterable } from "./filters.schema.js";
3
4
  import { curatorSchema } from "./curators.schema.js";
4
- import { assetTypeSchema, bpsSchema, chainIdSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
5
5
  import { z } from "zod/v4";
6
6
  //#region src/model/liquidations.schema.ts
7
7
  /**
@@ -1,9 +1,9 @@
1
1
  import { ZodAddress } from "../onchain/utils/zod.js";
2
+ import { offchainOnly, tolerance } from "./compare.schema.js";
3
+ import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenSchema, underlyingTokenSchema } from "./primitives.schema.js";
2
4
  import { isFilterSet } from "./filters.js";
3
5
  import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
4
- import { offchainOnly, tolerance } from "./compare.schema.js";
5
6
  import { curatorSchema } from "./curators.schema.js";
6
- import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenSchema, underlyingTokenSchema } from "./primitives.schema.js";
7
7
  import { z } from "zod/v4";
8
8
  //#region src/model/opportunities.schema.ts
9
9
  /**
@@ -1,8 +1,8 @@
1
1
  import { ZodAddress, ZodBigInt, ZodHex } from "../onchain/utils/zod.js";
2
- import { isFilterSet } from "./filters.js";
3
- import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
4
2
  import { backendPreferred, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
5
3
  import { assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, underlyingTokenSchema } from "./primitives.schema.js";
4
+ import { isFilterSet } from "./filters.js";
5
+ import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
6
6
  import { delayedReceivedAssetSchema, liquidationPositionSchema } from "./liquidations.schema.js";
7
7
  import { apyBreakdownSchema, pointsProgramSchema } from "./opportunities.schema.js";
8
8
  import { z } from "zod/v4";
@@ -1,11 +1,34 @@
1
+ import { chartBundleSchemaFor } from "../../model/charts.schema.js";
2
+ import { analyticsChartQuerySchema } from "../../model/analytics.schema.js";
3
+ import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
1
4
  import { OffchainAnalyticsPositions } from "./OffchainAnalyticsPositions.js";
5
+ import { z } from "zod/v4";
2
6
  //#region src/offchain/analytics/OffchainAnalytics.ts
3
- /** Backend-only protocol analytics, grouped by subject. */
4
- var OffchainAnalytics = class {
7
+ /**
8
+ * Backend-only protocol analytics, grouped by subject.
9
+ *
10
+ * It owns the protocol-wide charts itself rather than through a sub-namespace:
11
+ * their subject is Gearbox as a whole, so there is nothing narrower for them to
12
+ * hang off.
13
+ **/
14
+ var OffchainAnalytics = class extends AbstractOffchainNamespace {
5
15
  positions;
6
16
  constructor(options) {
17
+ super("OffchainAnalytics", options);
7
18
  this.positions = new OffchainAnalyticsPositions(options);
8
19
  }
20
+ /** {@inheritDoc IOffchainAnalytics.getCharts} */
21
+ async getCharts(metrics, range, filter) {
22
+ return this.get({
23
+ path: "/v2/analytics/charts",
24
+ query: z.encode(analyticsChartQuerySchema, {
25
+ metrics,
26
+ range,
27
+ chainIds: this.scopedChainIds(filter)
28
+ }),
29
+ schema: chartBundleSchemaFor(metrics, range)
30
+ });
31
+ }
9
32
  };
10
33
  //#endregion
11
34
  export { OffchainAnalytics };
@@ -54,7 +54,7 @@ var TokensMeta = class extends AddressMap {
54
54
  * Returns the display symbol for a token.
55
55
  *
56
56
  * This is not always the on-chain ERC-20 `symbol()`: curated pretty names
57
- * and redemption phantom tokens (`"source -> target"`) replace it.
57
+ * and redemption phantom tokens (`"target redemption from source"`) replace it.
58
58
  *
59
59
  * @param token - Token address.
60
60
  * @throws If the token is not in the registry.
@@ -153,7 +153,7 @@ var TokensMeta = class extends AddressMap {
153
153
  }
154
154
  /**
155
155
  * Rewrites display symbols of redemption phantom tokens to
156
- * `"${source} -> ${target}"`.
156
+ * `"${target} redemption from ${source}"`.
157
157
  *
158
158
  * @param renames - Phantom / source / target address triples.
159
159
  **/
@@ -163,7 +163,7 @@ var TokensMeta = class extends AddressMap {
163
163
  if (!meta || !this.has(source) || !this.has(target)) continue;
164
164
  this.upsert(phantom, {
165
165
  ...meta,
166
- symbol: `${this.symbol(source)} -> ${this.symbol(target)}`
166
+ symbol: `${this.symbol(target)} redemption from ${this.symbol(source)}`
167
167
  });
168
168
  }
169
169
  }
@@ -125,6 +125,13 @@ const chains = {
125
125
  symbol: "USDC"
126
126
  },
127
127
  tokenPrettyNames: AddressMap.fromRecord({
128
+ "0xab7d50fc2486a1ac06516e2ece9dadc95ba8cd20": "wstETH redemption from cp0xLRT",
129
+ "0x6252467c2fefb61cb55180282943139baeea36c5": "wstETH redemption from rstETH",
130
+ "0xd412ca00d177eba2843348f9c50dd17bfce32c40": "wstETH redemption from pzETH",
131
+ "0x26c98674e623647f11909791593fa3b6e9406c67": "wstETH redemption from steak7LRT",
132
+ "0x9fb930eacadad079683a4758424a53b9b3692775": "wstETH redemption from Re7LRT",
133
+ "0xd7f1a4e3aba92a9d20987c752bd4a6cc759d7738": "rsETH redemption from hgETH",
134
+ "0xc71219dca5a671aa6268ab8fb35e570bd72f372b": "iUSD redemption from liUSD-1w",
128
135
  "0x924d24c238db7ecae2aa3a19430239ed684bde4a": "Beefy WBTC/cbBTC/hemiBTC",
129
136
  "0x403cc0d2694ec2639101f32b146b90d766461ce9": "Beefy wstETH/tETH",
130
137
  "0x02a4cceed3c400b5ba9fd22ad6ec18d8f7a3d48e": "Beefy ETH+/WETH",
@@ -4,7 +4,7 @@
4
4
  * borrowed underlying, e.g. `"wstETH / WETH"`.
5
5
  *
6
6
  * Uses each token's display {@link Token.symbol}, which may already be a
7
- * curated pretty name or a `"source -> target"` redemption rewrite.
7
+ * curated pretty name or a `"target redemption from source"` redemption rewrite.
8
8
  *
9
9
  * @param target - Collateral the position is built around.
10
10
  * @param underlying - Token the position borrows.
@@ -2,9 +2,15 @@
2
2
  /** Backend-only protocol analytics exposed by {@link GearboxSDK}. */
3
3
  var AnalyticsNamespace = class {
4
4
  positions;
5
+ #backend;
5
6
  constructor(backend) {
7
+ this.#backend = backend;
6
8
  this.positions = backend.analytics.positions;
7
9
  }
10
+ /** {@inheritDoc IAnalytics.charts} */
11
+ async charts(metrics, range, filter) {
12
+ return this.#backend.analytics.getCharts(metrics, range, filter);
13
+ }
8
14
  };
9
15
  //#endregion
10
16
  export { AnalyticsNamespace };
@@ -38,11 +38,11 @@ declare const iDegenNftv2Abi: readonly [{
38
38
  }];
39
39
  readonly outputs: readonly [];
40
40
  }];
41
- declare const faucetAbi: readonly [{
41
+ declare const iFaucetAbi: readonly [{
42
42
  readonly type: "function";
43
43
  readonly name: "assets";
44
44
  readonly inputs: readonly [{
45
- readonly name: "";
45
+ readonly name: "index";
46
46
  readonly type: "uint256";
47
47
  readonly internalType: "uint256";
48
48
  }];
@@ -87,6 +87,92 @@ declare const faucetAbi: readonly [{
87
87
  }];
88
88
  readonly outputs: readonly [];
89
89
  readonly stateMutability: "nonpayable";
90
+ }, {
91
+ readonly type: "function";
92
+ readonly name: "claimOnBehalfOf";
93
+ readonly inputs: readonly [{
94
+ readonly name: "receiver";
95
+ readonly type: "address";
96
+ readonly internalType: "address";
97
+ }, {
98
+ readonly name: "claims";
99
+ readonly type: "tuple[]";
100
+ readonly internalType: "struct TokenClaim[]";
101
+ readonly components: readonly [{
102
+ readonly name: "token";
103
+ readonly type: "address";
104
+ readonly internalType: "address";
105
+ }, {
106
+ readonly name: "amount";
107
+ readonly type: "uint256";
108
+ readonly internalType: "uint256";
109
+ }];
110
+ }];
111
+ readonly outputs: readonly [{
112
+ readonly name: "";
113
+ readonly type: "bool";
114
+ readonly internalType: "bool";
115
+ }];
116
+ readonly stateMutability: "nonpayable";
117
+ }, {
118
+ readonly type: "function";
119
+ readonly name: "claimOnBehalfOf";
120
+ readonly inputs: readonly [{
121
+ readonly name: "receiver";
122
+ readonly type: "address";
123
+ readonly internalType: "address";
124
+ }, {
125
+ readonly name: "amountUSD";
126
+ readonly type: "uint256";
127
+ readonly internalType: "uint256";
128
+ }];
129
+ readonly outputs: readonly [{
130
+ readonly name: "";
131
+ readonly type: "bool";
132
+ readonly internalType: "bool";
133
+ }];
134
+ readonly stateMutability: "nonpayable";
135
+ }, {
136
+ readonly type: "function";
137
+ readonly name: "claimOnBehalfOf";
138
+ readonly inputs: readonly [{
139
+ readonly name: "receiver";
140
+ readonly type: "address";
141
+ readonly internalType: "address";
142
+ }];
143
+ readonly outputs: readonly [{
144
+ readonly name: "";
145
+ readonly type: "bool";
146
+ readonly internalType: "bool";
147
+ }];
148
+ readonly stateMutability: "nonpayable";
149
+ }, {
150
+ readonly type: "function";
151
+ readonly name: "configure";
152
+ readonly inputs: readonly [{
153
+ readonly name: "minAmountUSD";
154
+ readonly type: "uint256";
155
+ readonly internalType: "uint256";
156
+ }, {
157
+ readonly name: "tokens";
158
+ readonly type: "tuple[]";
159
+ readonly internalType: "struct FaucetToken[]";
160
+ readonly components: readonly [{
161
+ readonly name: "token";
162
+ readonly type: "address";
163
+ readonly internalType: "address";
164
+ }, {
165
+ readonly name: "price";
166
+ readonly type: "uint256";
167
+ readonly internalType: "uint256";
168
+ }, {
169
+ readonly name: "decimals";
170
+ readonly type: "uint8";
171
+ readonly internalType: "uint8";
172
+ }];
173
+ }];
174
+ readonly outputs: readonly [];
175
+ readonly stateMutability: "nonpayable";
90
176
  }, {
91
177
  readonly type: "function";
92
178
  readonly name: "getAssets";
@@ -121,21 +207,11 @@ declare const faucetAbi: readonly [{
121
207
  readonly internalType: "uint256";
122
208
  }];
123
209
  readonly stateMutability: "view";
124
- }, {
125
- readonly type: "function";
126
- readonly name: "owner";
127
- readonly inputs: readonly [];
128
- readonly outputs: readonly [{
129
- readonly name: "";
130
- readonly type: "address";
131
- readonly internalType: "address";
132
- }];
133
- readonly stateMutability: "view";
134
210
  }, {
135
211
  readonly type: "function";
136
212
  readonly name: "prices";
137
213
  readonly inputs: readonly [{
138
- readonly name: "";
214
+ readonly name: "token";
139
215
  readonly type: "address";
140
216
  readonly internalType: "address";
141
217
  }];
@@ -149,7 +225,7 @@ declare const faucetAbi: readonly [{
149
225
  readonly type: "function";
150
226
  readonly name: "scales";
151
227
  readonly inputs: readonly [{
152
- readonly name: "";
228
+ readonly name: "token";
153
229
  readonly type: "address";
154
230
  readonly internalType: "address";
155
231
  }];
@@ -218,4 +294,4 @@ declare const iOnchainExecutionIdAbi: readonly [{
218
294
  readonly stateMutability: "view";
219
295
  }];
220
296
  //#endregion
221
- export { faucetAbi, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi };
297
+ export { iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi };
@@ -2,7 +2,7 @@ import { AccountOpener, AccountOpenerOptions, OpenAccountHumanizedPreview, OpenA
2
2
  import { RpcErrorResult, RpcResponse, RpcSuccessResult } from "./types.js";
3
3
  import { CheckMulticallFn, DetectedCall, EthCallMethod, EthCallRequest, EthCallSpy } from "./EthCallSpy.js";
4
4
  import { NoAvailableTransportsError, ProviderConfig, ProviderStatus, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, SelectionStrategy, providerConfigSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema } from "./RevolverTransport.js";
5
- import { faucetAbi, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi } from "./abi.js";
5
+ import { iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi } from "./abi.js";
6
6
  import { calcLiquidatableLTs } from "./calcLiquidatableLTs.js";
7
7
  import { claimFromFaucet } from "./claimFromFaucet.js";
8
8
  import { Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, EnsureExistsUsingPublicCreate2ReturnType, GetCreate2AddressParameters, PUBLIC_CREATE2_FACTORY, deployUsingPublicCreate2, getPublicCreate2Address, isDeployedUsingPublicCreate2 } from "./create2.js";
@@ -26,4 +26,4 @@ import { EnableDSTokenBackDatingProps, RestoreDSTokenBackDating, claimDSToken, c
26
26
  import { httpTransportOptionsSchema } from "./transports.js";
27
27
  import { ONCHAIN_EXECUTION_ID_ADDRESS, VerifyTestnetParams, verifyTestnet } from "./verifyTestnet.js";
28
28
  import { MakePendingWithdrawalsClaimableOptions, makePendingWithdrawalsClaimable } from "./withdrawalUtils.js";
29
- export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, EnableDSTokenBackDatingProps, EnsureExistsUsingPublicCreate2ReturnType, EthCallMethod, EthCallRequest, EthCallSpy, GetCreate2AddressParameters, GreenlistMidasGatewayProps, IMinter, type LogSplitterTransportOptions, MakePendingWithdrawalsClaimableOptions, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenAccountHumanizedPreview, OpenAccountResult, OpenAccountsResult, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, PoolDepositResult, ProviderConfig, ProviderStatus, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, ReplaceStorageParams, ResilientTransportOptions, RestoreDSTokenBackDating, RestoreMidasIssuanceVaultPause, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, UnpauseMidasIssuanceVaultProps, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, faucetAbi, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeAndWait };
29
+ export { AccountOpener, AccountOpenerOptions, AnvilActions, AnvilClient, AnvilClientConfig, AnvilDealParameters, AnvilNodeInfo, AnvilRPCSchema, CheckMulticallFn, Create2Deployer, Create2Parameters, DEFAULT_CREATE2_SALT, DetectedCall, EnableDSTokenBackDatingProps, EnsureExistsUsingPublicCreate2ReturnType, EthCallMethod, EthCallRequest, EthCallSpy, GetCreate2AddressParameters, GreenlistMidasGatewayProps, IMinter, type LogSplitterTransportOptions, MakePendingWithdrawalsClaimableOptions, NoAvailableTransportsError, ONCHAIN_EXECUTION_ID_ADDRESS, OpenAccountHumanizedPreview, OpenAccountResult, OpenAccountsResult, OpenTxRevertedError, PUBLIC_CREATE2_FACTORY, PoolDepositResult, ProviderConfig, ProviderStatus, RWAKycFailure, RegisterMidasInvestorProps, RegisterRWAInvestorProps, RegisterRWAInvestorResult, RegisterSecuritizeInvestorProps, ReplaceStorageParams, ResilientTransportOptions, RestoreDSTokenBackDating, RestoreMidasIssuanceVaultPause, RevolverTransport, RevolverTransportConfig, RevolverTransportValue, RpcErrorResult, RpcProvider, RpcResponse, RpcSuccessResult, SUPPORTED_RPC_PROVIDERS, SelectionStrategy, TargetAccount, UnpauseMidasIssuanceVaultProps, VerifyTestnetParams, anvilNodeInfo, calcLiquidatableLTs, claimDSToken, claimDSTokens, claimFromFaucet, createAnvilClient, createMinter, deployUsingPublicCreate2, detectChain, enableDSTokenBackDating, evmMineDetailed, extendAnvilClient, getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getPublicCreate2Address, getRpcProviderUrl, getThirdWebUrl, greenlistMidasGateway, httpTransportOptionsSchema, iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi, isAnvil, isDeployedUsingPublicCreate2, isOutOfSyncError, isRangeError, isRateLimitError, isTransientError, logSplitterTransport, makePendingWithdrawalsClaimable, migrateFaucet, providerConfigSchema, registerMidasInvestor, registerRWAInvestor, registerSecuritizeInvestor, replaceStorage, resilientTransport, resilientTransportOptionsSchema, revolverTransportConfigBaseSchema, revolverTransportConfigSchema, rpcProvidersSchema, setLTZero, setLTs, unpauseMidasIssuanceVault, verifyTestnet, writeAndWait };
@@ -1,3 +1,5 @@
1
+ import { ChartRange, ProtocolChartMetric } from "./charts.js";
2
+ import { ChainScopedFilter } from "./filters.js";
1
3
  import { PoolPosition, PositionFilter, StrategyPosition } from "./positions.js";
2
4
  import { LiquidationPosition } from "./liquidations.js";
3
5
  import { Address } from "viem";
@@ -58,5 +60,24 @@ interface AnalyticsPositionPage {
58
60
  /** Effective maximum number of rows returned. */
59
61
  limit: number;
60
62
  }
63
+ /**
64
+ * What one protocol-wide chart read asks for.
65
+ *
66
+ * A {@link ChartQuery} that also carries its chain scope: the series is a sum
67
+ * over chains rather than a property of one subject, so which chains are in it
68
+ * is part of the question and not something a path segment already answered.
69
+ * Omitting `chainIds` asks for every chain the backend serves.
70
+ **/
71
+ interface AnalyticsChartQuery extends ChainScopedFilter {
72
+ /**
73
+ * Metrics to chart, at least one and each named once. They become the keys of
74
+ * {@link ChartBundle.series}.
75
+ **/
76
+ metrics: readonly ProtocolChartMetric[];
77
+ /**
78
+ * Window to cover, echoed back in {@link ChartWindow.range}.
79
+ **/
80
+ range: ChartRange;
81
+ }
61
82
  //#endregion
62
- export { AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition };
83
+ export { AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition };
@@ -145,5 +145,69 @@ declare const analyticsPositionPageSchema: z.ZodObject<{
145
145
  offset: z.ZodNumber;
146
146
  limit: z.ZodNumber;
147
147
  }, z.core.$strip>;
148
+ /**
149
+ * {@link AnalyticsChartQuery}
150
+ *
151
+ * The metric list is narrowed to {@link ProtocolChartMetric} here rather than
152
+ * on the route, so asking the protocol chart for an opportunity metric is
153
+ * rejected by the one codec both sides share instead of by a check only the
154
+ * backend runs.
155
+ **/
156
+ declare const analyticsChartQueryOptionsSchema: z.ZodObject<{
157
+ metrics: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
158
+ tvlUsd: "tvlUsd";
159
+ }>>>;
160
+ range: z.ZodEnum<{
161
+ "1d": "1d";
162
+ "1m": "1m";
163
+ "1w": "1w";
164
+ "1y": "1y";
165
+ max: "max";
166
+ }>;
167
+ chainIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
168
+ }, z.core.$strip>;
169
+ /**
170
+ * {@link AnalyticsChartQuery} as URL query parameters: the metrics comma-joined
171
+ * like every other chart read, and the chains comma-joined like every other
172
+ * analytics read.
173
+ **/
174
+ declare const analyticsChartQueryParamsSchema: z.ZodObject<{
175
+ metrics: z.ZodString;
176
+ range: z.ZodEnum<{
177
+ "1d": "1d";
178
+ "1m": "1m";
179
+ "1w": "1w";
180
+ "1y": "1y";
181
+ max: "max";
182
+ }>;
183
+ chainIds: z.ZodOptional<z.ZodString>;
184
+ }, z.core.$strip>;
185
+ /**
186
+ * Codec for a protocol-wide chart query. It is shared by the SDK client and
187
+ * backend controller so both sides interpret every parameter identically.
188
+ **/
189
+ declare const analyticsChartQuerySchema: z.ZodCodec<z.ZodObject<{
190
+ metrics: z.ZodString;
191
+ range: z.ZodEnum<{
192
+ "1d": "1d";
193
+ "1m": "1m";
194
+ "1w": "1w";
195
+ "1y": "1y";
196
+ max: "max";
197
+ }>;
198
+ chainIds: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ metrics: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
201
+ tvlUsd: "tvlUsd";
202
+ }>>>;
203
+ range: z.ZodEnum<{
204
+ "1d": "1d";
205
+ "1m": "1m";
206
+ "1w": "1w";
207
+ "1y": "1y";
208
+ max: "max";
209
+ }>;
210
+ chainIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
211
+ }, z.core.$strip>>;
148
212
  //#endregion
149
- export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema };
213
+ export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema };