@gearbox-protocol/sdk 16.0.0-next.13 → 16.0.0-next.15
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/model/charts.js +5 -1
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/model/opportunities.schema.js +9 -0
- package/dist/cjs/model/positions.schema.js +1 -1
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +9 -0
- package/dist/cjs/offchain/positions/OffchainPositions.js +9 -0
- package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +6 -0
- package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/esm/model/charts.js +5 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/model/opportunities.schema.js +9 -1
- package/dist/esm/model/positions.schema.js +1 -1
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +10 -1
- package/dist/esm/offchain/positions/OffchainPositions.js +10 -1
- package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +6 -0
- package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/types/model/charts.d.ts +4 -2
- package/dist/types/model/charts.schema.d.ts +8 -0
- package/dist/types/model/index.d.ts +3 -3
- package/dist/types/model/opportunities.d.ts +19 -1
- package/dist/types/model/opportunities.schema.d.ts +9 -1
- package/dist/types/model/positions.d.ts +2 -2
- package/dist/types/model/positions.schema.d.ts +1 -47
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +5 -1
- package/dist/types/offchain/positions/OffchainPositions.d.ts +6 -1
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
- package/dist/types/sdk/opportunities/types.d.ts +9 -1
- package/dist/types/sdk/positions/PositionsNamespace.d.ts +5 -1
- package/dist/types/sdk/positions/types.d.ts +9 -1
- package/package.json +1 -1
package/dist/cjs/model/charts.js
CHANGED
|
@@ -32,7 +32,8 @@ const POOL_OPPORTUNITY_CHART_METRICS = [
|
|
|
32
32
|
"depositApyAvg7d",
|
|
33
33
|
"dieselRate",
|
|
34
34
|
"supplied",
|
|
35
|
-
"borrowed"
|
|
35
|
+
"borrowed",
|
|
36
|
+
"utilization"
|
|
36
37
|
];
|
|
37
38
|
/**
|
|
38
39
|
* Every metric a strategy opportunity can chart.
|
|
@@ -62,6 +63,7 @@ const STRATEGY_OPPORTUNITY_CHART_METRICS = [
|
|
|
62
63
|
**/
|
|
63
64
|
const POOL_POSITION_CHART_METRICS = [
|
|
64
65
|
"apy",
|
|
66
|
+
"apyAvg7d",
|
|
65
67
|
"pnl",
|
|
66
68
|
"mwr"
|
|
67
69
|
];
|
|
@@ -100,11 +102,13 @@ const CHART_METRIC_UNITS = {
|
|
|
100
102
|
supplied: "token",
|
|
101
103
|
borrowed: "token",
|
|
102
104
|
tvl: "token",
|
|
105
|
+
utilization: "bps",
|
|
103
106
|
dieselRate: "ratio",
|
|
104
107
|
collateralPrice: "ratio",
|
|
105
108
|
collateralUsdPrice: "usd",
|
|
106
109
|
underlyingUsdPrice: "usd",
|
|
107
110
|
apy: "bps",
|
|
111
|
+
apyAvg7d: "bps",
|
|
108
112
|
pnl: "token",
|
|
109
113
|
mwr: "bps",
|
|
110
114
|
totalValueUnderlying: "token",
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -90,6 +90,7 @@ exports.opportunityId = require_model_opportunities.opportunityId;
|
|
|
90
90
|
exports.opportunityKeySchema = require_model_opportunities_schema.opportunityKeySchema;
|
|
91
91
|
exports.opportunityKindSchema = require_model_opportunities_schema.opportunityKindSchema;
|
|
92
92
|
exports.opportunitySchema = require_model_opportunities_schema.opportunitySchema;
|
|
93
|
+
exports.opportunityTotalsSchema = require_model_opportunities_schema.opportunityTotalsSchema;
|
|
93
94
|
exports.pnlBreakdownSchema = require_model_positions_schema.pnlBreakdownSchema;
|
|
94
95
|
exports.pointRewardsSchema = require_model_opportunities_schema.pointRewardsSchema;
|
|
95
96
|
exports.pointsProgramPnLSchema = require_model_positions_schema.pointsProgramPnLSchema;
|
|
@@ -245,6 +245,14 @@ const opportunityKeySchema = zod_v4.z.discriminatedUnion("kind", [zod_v4.z.objec
|
|
|
245
245
|
kind: zod_v4.z.literal("strategy"),
|
|
246
246
|
...strategyOpportunityKeySchema.shape
|
|
247
247
|
})]);
|
|
248
|
+
/**
|
|
249
|
+
* {@link OpportunityTotals}
|
|
250
|
+
**/
|
|
251
|
+
const opportunityTotalsSchema = zod_v4.z.object({
|
|
252
|
+
tvl: zod_v4.z.number(),
|
|
253
|
+
totalBorrowed: zod_v4.z.number(),
|
|
254
|
+
totalSupply: zod_v4.z.number()
|
|
255
|
+
});
|
|
248
256
|
//#endregion
|
|
249
257
|
exports.apyBreakdownSchema = apyBreakdownSchema;
|
|
250
258
|
exports.opportunityBaseSchema = opportunityBaseSchema;
|
|
@@ -255,6 +263,7 @@ exports.opportunityFilterSchema = opportunityFilterSchema;
|
|
|
255
263
|
exports.opportunityKeySchema = opportunityKeySchema;
|
|
256
264
|
exports.opportunityKindSchema = opportunityKindSchema;
|
|
257
265
|
exports.opportunitySchema = opportunitySchema;
|
|
266
|
+
exports.opportunityTotalsSchema = opportunityTotalsSchema;
|
|
258
267
|
exports.pointRewardsSchema = pointRewardsSchema;
|
|
259
268
|
exports.pointsProgramSchema = pointsProgramSchema;
|
|
260
269
|
exports.poolOpportunityDetailSchema = poolOpportunityDetailSchema;
|
|
@@ -194,7 +194,7 @@ const positionKeySchema = zod_v4.z.discriminatedUnion("kind", [zod_v4.z.object({
|
|
|
194
194
|
**/
|
|
195
195
|
const positionsTotalsSchema = zod_v4.z.object({
|
|
196
196
|
currentYield: require_model_opportunities_schema.apyBreakdownSchema.nullable(),
|
|
197
|
-
|
|
197
|
+
pnlUsd: zod_v4.z.number().nullable(),
|
|
198
198
|
netValueUsd: zod_v4.z.number().nullable(),
|
|
199
199
|
claimableUsd: zod_v4.z.number().nullable()
|
|
200
200
|
});
|
|
@@ -44,6 +44,15 @@ var OffchainOpportunities = class extends require_offchain_AbstractOffchainNames
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
+
* Protocol-wide totals across every opportunity the backend serves.
|
|
48
|
+
**/
|
|
49
|
+
async getTotals() {
|
|
50
|
+
return this.get({
|
|
51
|
+
path: `${this.#root}/totals`,
|
|
52
|
+
schema: require_model_opportunities_schema.opportunityTotalsSchema
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
47
56
|
* Charts of one opportunity: one series per metric, on a shared grid.
|
|
48
57
|
**/
|
|
49
58
|
async getCharts(key, metrics, range) {
|
|
@@ -25,6 +25,15 @@ var OffchainPositions = class extends require_offchain_AbstractOffchainNamespace
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
+
* Aggregate over everything a wallet holds, see {@link PositionsTotals}.
|
|
29
|
+
**/
|
|
30
|
+
async getTotals(wallet) {
|
|
31
|
+
return this.get({
|
|
32
|
+
path: `${this.#root}/${wallet}/totals`,
|
|
33
|
+
schema: require_model_positions_schema.positionsTotalsSchema
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
28
37
|
* Charts of one position: one series per metric, on a shared grid.
|
|
29
38
|
**/
|
|
30
39
|
async getCharts(key, metrics, range) {
|
|
@@ -85,6 +85,12 @@ var OpportunitiesNamespace = class extends require_sdk_AbstractNamespace.Abstrac
|
|
|
85
85
|
filter(response, filter) {
|
|
86
86
|
return require_sdk_utils_filterResponse.filterResponse(response, filter, require_model_opportunities.matchesOpportunityFilter);
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* {@inheritDoc OpportunitiesOffchainOnly.totals}
|
|
90
|
+
**/
|
|
91
|
+
async totals() {
|
|
92
|
+
return this.offchain.getTotals();
|
|
93
|
+
}
|
|
88
94
|
async charts(key, metrics, range) {
|
|
89
95
|
return this.offchain.getCharts(key, metrics, range);
|
|
90
96
|
}
|
|
@@ -41,6 +41,12 @@ var PositionsNamespace = class extends require_sdk_AbstractNamespace.AbstractNam
|
|
|
41
41
|
filter(response, filter) {
|
|
42
42
|
return require_sdk_utils_filterResponse.filterResponse(response, filter, require_model_positions.matchesPositionFilter);
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* {@inheritDoc PositionsOffchainOnly.totals}
|
|
46
|
+
**/
|
|
47
|
+
async totals(wallet) {
|
|
48
|
+
return this.offchain.getTotals(wallet);
|
|
49
|
+
}
|
|
44
50
|
async charts(key, metrics, range) {
|
|
45
51
|
return this.offchain.getCharts(key, metrics, range);
|
|
46
52
|
}
|
package/dist/esm/model/charts.js
CHANGED
|
@@ -31,7 +31,8 @@ const POOL_OPPORTUNITY_CHART_METRICS = [
|
|
|
31
31
|
"depositApyAvg7d",
|
|
32
32
|
"dieselRate",
|
|
33
33
|
"supplied",
|
|
34
|
-
"borrowed"
|
|
34
|
+
"borrowed",
|
|
35
|
+
"utilization"
|
|
35
36
|
];
|
|
36
37
|
/**
|
|
37
38
|
* Every metric a strategy opportunity can chart.
|
|
@@ -61,6 +62,7 @@ const STRATEGY_OPPORTUNITY_CHART_METRICS = [
|
|
|
61
62
|
**/
|
|
62
63
|
const POOL_POSITION_CHART_METRICS = [
|
|
63
64
|
"apy",
|
|
65
|
+
"apyAvg7d",
|
|
64
66
|
"pnl",
|
|
65
67
|
"mwr"
|
|
66
68
|
];
|
|
@@ -99,11 +101,13 @@ const CHART_METRIC_UNITS = {
|
|
|
99
101
|
supplied: "token",
|
|
100
102
|
borrowed: "token",
|
|
101
103
|
tvl: "token",
|
|
104
|
+
utilization: "bps",
|
|
102
105
|
dieselRate: "ratio",
|
|
103
106
|
collateralPrice: "ratio",
|
|
104
107
|
collateralUsdPrice: "usd",
|
|
105
108
|
underlyingUsdPrice: "usd",
|
|
106
109
|
apy: "bps",
|
|
110
|
+
apyAvg7d: "bps",
|
|
107
111
|
pnl: "token",
|
|
108
112
|
mwr: "bps",
|
|
109
113
|
totalValueUnderlying: "token",
|
package/dist/esm/model/index.js
CHANGED
|
@@ -12,11 +12,11 @@ import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAcc
|
|
|
12
12
|
import "./notices.js";
|
|
13
13
|
import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
|
|
14
14
|
import { matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
15
|
-
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
15
|
+
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";
|
|
16
16
|
import { STRATEGY_POSITION_COLLATERAL_ERROR, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.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
18
|
import { 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 } from "./previews.js";
|
|
19
19
|
import "./primitives.js";
|
|
20
20
|
import "./response.js";
|
|
21
21
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
22
|
-
export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, 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, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, 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, 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 { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, 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, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, 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 };
|
|
@@ -244,5 +244,13 @@ const opportunityKeySchema = z.discriminatedUnion("kind", [z.object({
|
|
|
244
244
|
kind: z.literal("strategy"),
|
|
245
245
|
...strategyOpportunityKeySchema.shape
|
|
246
246
|
})]);
|
|
247
|
+
/**
|
|
248
|
+
* {@link OpportunityTotals}
|
|
249
|
+
**/
|
|
250
|
+
const opportunityTotalsSchema = z.object({
|
|
251
|
+
tvl: z.number(),
|
|
252
|
+
totalBorrowed: z.number(),
|
|
253
|
+
totalSupply: z.number()
|
|
254
|
+
});
|
|
247
255
|
//#endregion
|
|
248
|
-
export { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema };
|
|
256
|
+
export { 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 };
|
|
@@ -193,7 +193,7 @@ const positionKeySchema = z.discriminatedUnion("kind", [z.object({
|
|
|
193
193
|
**/
|
|
194
194
|
const positionsTotalsSchema = z.object({
|
|
195
195
|
currentYield: apyBreakdownSchema.nullable(),
|
|
196
|
-
|
|
196
|
+
pnlUsd: z.number().nullable(),
|
|
197
197
|
netValueUsd: z.number().nullable(),
|
|
198
198
|
claimableUsd: z.number().nullable()
|
|
199
199
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { opportunityFilterQuerySchema, opportunitySchema, poolOpportunityDetailSchema, strategyOpportunityDetailSchema } from "../../model/opportunities.schema.js";
|
|
1
|
+
import { opportunityFilterQuerySchema, opportunitySchema, opportunityTotalsSchema, poolOpportunityDetailSchema, strategyOpportunityDetailSchema } from "../../model/opportunities.schema.js";
|
|
2
2
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
3
3
|
import { z } from "zod/v4";
|
|
4
4
|
//#region src/offchain/opportunities/OffchainOpportunities.ts
|
|
@@ -43,6 +43,15 @@ var OffchainOpportunities = class extends AbstractOffchainNamespace {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
+
* Protocol-wide totals across every opportunity the backend serves.
|
|
47
|
+
**/
|
|
48
|
+
async getTotals() {
|
|
49
|
+
return this.get({
|
|
50
|
+
path: `${this.#root}/totals`,
|
|
51
|
+
schema: opportunityTotalsSchema
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
46
55
|
* Charts of one opportunity: one series per metric, on a shared grid.
|
|
47
56
|
**/
|
|
48
57
|
async getCharts(key, metrics, range) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { positionFilterQuerySchema, positionSchema } from "../../model/positions.schema.js";
|
|
1
|
+
import { positionFilterQuerySchema, positionSchema, positionsTotalsSchema } from "../../model/positions.schema.js";
|
|
2
2
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
3
3
|
import { z } from "zod/v4";
|
|
4
4
|
//#region src/offchain/positions/OffchainPositions.ts
|
|
@@ -24,6 +24,15 @@ var OffchainPositions = class extends AbstractOffchainNamespace {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
+
* Aggregate over everything a wallet holds, see {@link PositionsTotals}.
|
|
28
|
+
**/
|
|
29
|
+
async getTotals(wallet) {
|
|
30
|
+
return this.get({
|
|
31
|
+
path: `${this.#root}/${wallet}/totals`,
|
|
32
|
+
schema: positionsTotalsSchema
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
27
36
|
* Charts of one position: one series per metric, on a shared grid.
|
|
28
37
|
**/
|
|
29
38
|
async getCharts(key, metrics, range) {
|
|
@@ -84,6 +84,12 @@ var OpportunitiesNamespace = class extends AbstractNamespace {
|
|
|
84
84
|
filter(response, filter) {
|
|
85
85
|
return filterResponse(response, filter, matchesOpportunityFilter);
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* {@inheritDoc OpportunitiesOffchainOnly.totals}
|
|
89
|
+
**/
|
|
90
|
+
async totals() {
|
|
91
|
+
return this.offchain.getTotals();
|
|
92
|
+
}
|
|
87
93
|
async charts(key, metrics, range) {
|
|
88
94
|
return this.offchain.getCharts(key, metrics, range);
|
|
89
95
|
}
|
|
@@ -40,6 +40,12 @@ var PositionsNamespace = class extends AbstractNamespace {
|
|
|
40
40
|
filter(response, filter) {
|
|
41
41
|
return filterResponse(response, filter, matchesPositionFilter);
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* {@inheritDoc PositionsOffchainOnly.totals}
|
|
45
|
+
**/
|
|
46
|
+
async totals(wallet) {
|
|
47
|
+
return this.offchain.getTotals(wallet);
|
|
48
|
+
}
|
|
43
49
|
async charts(key, metrics, range) {
|
|
44
50
|
return this.offchain.getCharts(key, metrics, range);
|
|
45
51
|
}
|
|
@@ -22,7 +22,7 @@ type ChartRange = (typeof CHART_RANGES)[number];
|
|
|
22
22
|
/**
|
|
23
23
|
* Every metric a pool opportunity can chart.
|
|
24
24
|
**/
|
|
25
|
-
declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "depositApyAvg7d", "dieselRate", "supplied", "borrowed"];
|
|
25
|
+
declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "depositApyAvg7d", "dieselRate", "supplied", "borrowed", "utilization"];
|
|
26
26
|
/**
|
|
27
27
|
* Metric a pool opportunity can chart. Derived from the runtime list that also
|
|
28
28
|
* builds the backend's route enum, so the two cannot drift.
|
|
@@ -49,7 +49,7 @@ type StrategyOpportunityChartMetric = (typeof STRATEGY_OPPORTUNITY_CHART_METRICS
|
|
|
49
49
|
* deposits and withdrawals landed. It is anchored at inception, so a narrow
|
|
50
50
|
* `range` only zooms the visible slice and its first point is rarely zero.
|
|
51
51
|
**/
|
|
52
|
-
declare const POOL_POSITION_CHART_METRICS: readonly ["apy", "pnl", "mwr"];
|
|
52
|
+
declare const POOL_POSITION_CHART_METRICS: readonly ["apy", "apyAvg7d", "pnl", "mwr"];
|
|
53
53
|
/**
|
|
54
54
|
* Metric a pool position can chart, derived from
|
|
55
55
|
* {@link POOL_POSITION_CHART_METRICS}.
|
|
@@ -168,11 +168,13 @@ declare const CHART_METRIC_UNITS: {
|
|
|
168
168
|
readonly supplied: "token";
|
|
169
169
|
readonly borrowed: "token";
|
|
170
170
|
readonly tvl: "token";
|
|
171
|
+
readonly utilization: "bps";
|
|
171
172
|
readonly dieselRate: "ratio";
|
|
172
173
|
readonly collateralPrice: "ratio";
|
|
173
174
|
readonly collateralUsdPrice: "usd";
|
|
174
175
|
readonly underlyingUsdPrice: "usd";
|
|
175
176
|
readonly apy: "bps";
|
|
177
|
+
readonly apyAvg7d: "bps";
|
|
176
178
|
readonly pnl: "token";
|
|
177
179
|
readonly mwr: "bps";
|
|
178
180
|
readonly totalValueUnderlying: "token";
|
|
@@ -29,6 +29,7 @@ declare const poolOpportunityChartMetricSchema: z.ZodEnum<{
|
|
|
29
29
|
depositApyAvg7d: "depositApyAvg7d";
|
|
30
30
|
dieselRate: "dieselRate";
|
|
31
31
|
supplied: "supplied";
|
|
32
|
+
utilization: "utilization";
|
|
32
33
|
}>;
|
|
33
34
|
/**
|
|
34
35
|
* {@link StrategyOpportunityChartMetric}
|
|
@@ -49,6 +50,7 @@ declare const strategyOpportunityChartMetricSchema: z.ZodEnum<{
|
|
|
49
50
|
**/
|
|
50
51
|
declare const poolPositionChartMetricSchema: z.ZodEnum<{
|
|
51
52
|
apy: "apy";
|
|
53
|
+
apyAvg7d: "apyAvg7d";
|
|
52
54
|
mwr: "mwr";
|
|
53
55
|
pnl: "pnl";
|
|
54
56
|
}>;
|
|
@@ -74,6 +76,7 @@ declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
|
74
76
|
depositApyAvg7d: "depositApyAvg7d";
|
|
75
77
|
dieselRate: "dieselRate";
|
|
76
78
|
supplied: "supplied";
|
|
79
|
+
utilization: "utilization";
|
|
77
80
|
}>, z.ZodEnum<{
|
|
78
81
|
borrowApy: "borrowApy";
|
|
79
82
|
borrowApyAvg7d: "borrowApyAvg7d";
|
|
@@ -86,6 +89,7 @@ declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
|
86
89
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
87
90
|
}>, z.ZodEnum<{
|
|
88
91
|
apy: "apy";
|
|
92
|
+
apyAvg7d: "apyAvg7d";
|
|
89
93
|
mwr: "mwr";
|
|
90
94
|
pnl: "pnl";
|
|
91
95
|
}>, z.ZodEnum<{
|
|
@@ -108,6 +112,7 @@ declare const chartQuerySchema: z.ZodObject<{
|
|
|
108
112
|
depositApyAvg7d: "depositApyAvg7d";
|
|
109
113
|
dieselRate: "dieselRate";
|
|
110
114
|
supplied: "supplied";
|
|
115
|
+
utilization: "utilization";
|
|
111
116
|
}>, z.ZodEnum<{
|
|
112
117
|
borrowApy: "borrowApy";
|
|
113
118
|
borrowApyAvg7d: "borrowApyAvg7d";
|
|
@@ -120,6 +125,7 @@ declare const chartQuerySchema: z.ZodObject<{
|
|
|
120
125
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
121
126
|
}>, z.ZodEnum<{
|
|
122
127
|
apy: "apy";
|
|
128
|
+
apyAvg7d: "apyAvg7d";
|
|
123
129
|
mwr: "mwr";
|
|
124
130
|
pnl: "pnl";
|
|
125
131
|
}>, z.ZodEnum<{
|
|
@@ -179,6 +185,7 @@ declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
|
|
|
179
185
|
depositApyAvg7d: "depositApyAvg7d";
|
|
180
186
|
dieselRate: "dieselRate";
|
|
181
187
|
supplied: "supplied";
|
|
188
|
+
utilization: "utilization";
|
|
182
189
|
}>, z.ZodEnum<{
|
|
183
190
|
borrowApy: "borrowApy";
|
|
184
191
|
borrowApyAvg7d: "borrowApyAvg7d";
|
|
@@ -191,6 +198,7 @@ declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
|
|
|
191
198
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
192
199
|
}>, z.ZodEnum<{
|
|
193
200
|
apy: "apy";
|
|
201
|
+
apyAvg7d: "apyAvg7d";
|
|
194
202
|
mwr: "mwr";
|
|
195
203
|
pnl: "pnl";
|
|
196
204
|
}>, z.ZodEnum<{
|
|
@@ -9,14 +9,14 @@ import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } fro
|
|
|
9
9
|
import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
|
|
10
10
|
import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
11
11
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
12
|
-
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
12
|
+
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
13
13
|
import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, RewardsPnL, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenQuotaRate, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
14
14
|
import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
|
|
15
15
|
import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
|
|
16
|
-
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
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
18
|
import { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
|
|
19
19
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
|
|
20
20
|
import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
|
|
21
21
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
22
|
-
export { AdjustCreditAccountPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, 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, 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 { 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 };
|
|
@@ -626,5 +626,23 @@ interface StrategyOpportunityRef extends StrategyOpportunityKey {
|
|
|
626
626
|
* Identifies any opportunity, for requests that accept both kinds.
|
|
627
627
|
**/
|
|
628
628
|
type OpportunityKey = PoolOpportunityRef | StrategyOpportunityRef;
|
|
629
|
+
/**
|
|
630
|
+
* Protocol-wide aggregate over every opportunity, served by the backend rather
|
|
631
|
+
* than summed by a consumer: the landing page's headline figures.
|
|
632
|
+
**/
|
|
633
|
+
interface OpportunityTotals {
|
|
634
|
+
/**
|
|
635
|
+
* Total value locked in Gearbox Protocol
|
|
636
|
+
**/
|
|
637
|
+
tvl: number;
|
|
638
|
+
/**
|
|
639
|
+
* Total borrowed from pools in Gearbox Protocol
|
|
640
|
+
**/
|
|
641
|
+
totalBorrowed: number;
|
|
642
|
+
/**
|
|
643
|
+
* Total supplied to pools in Gearbox Protocol
|
|
644
|
+
**/
|
|
645
|
+
totalSupply: number;
|
|
646
|
+
}
|
|
629
647
|
//#endregion
|
|
630
|
-
export { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId };
|
|
648
|
+
export { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId };
|
|
@@ -1446,5 +1446,13 @@ declare const opportunityKeySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1446
1446
|
creditManager: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
1447
1447
|
kind: z.ZodLiteral<"strategy">;
|
|
1448
1448
|
}, z.core.$strip>], "kind">;
|
|
1449
|
+
/**
|
|
1450
|
+
* {@link OpportunityTotals}
|
|
1451
|
+
**/
|
|
1452
|
+
declare const opportunityTotalsSchema: z.ZodObject<{
|
|
1453
|
+
tvl: z.ZodNumber;
|
|
1454
|
+
totalBorrowed: z.ZodNumber;
|
|
1455
|
+
totalSupply: z.ZodNumber;
|
|
1456
|
+
}, z.core.$strip>;
|
|
1449
1457
|
//#endregion
|
|
1450
|
-
export { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema };
|
|
1458
|
+
export { 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 };
|
|
@@ -470,9 +470,9 @@ interface PositionsTotals {
|
|
|
470
470
|
**/
|
|
471
471
|
currentYield: ApyBreakdown | null;
|
|
472
472
|
/**
|
|
473
|
-
* Profit and loss over every position
|
|
473
|
+
* Profit and loss over every position in USD.
|
|
474
474
|
**/
|
|
475
|
-
|
|
475
|
+
pnlUsd: number | null;
|
|
476
476
|
/**
|
|
477
477
|
* Net value of every position in US dollars.
|
|
478
478
|
**/
|
|
@@ -1020,53 +1020,7 @@ declare const positionsTotalsSchema: z.ZodObject<{
|
|
|
1020
1020
|
}, z.core.$strip>>;
|
|
1021
1021
|
}, z.core.$strip>], "kind">>>;
|
|
1022
1022
|
}, z.core.$strip>>;
|
|
1023
|
-
|
|
1024
|
-
organic: z.ZodObject<{
|
|
1025
|
-
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
1026
|
-
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
1027
|
-
token: z.ZodObject<{
|
|
1028
|
-
chainId: z.ZodNumber;
|
|
1029
|
-
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
1030
|
-
symbol: z.ZodString;
|
|
1031
|
-
name: z.ZodString;
|
|
1032
|
-
decimals: z.ZodNumber;
|
|
1033
|
-
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
1034
|
-
}, z.core.$strip>;
|
|
1035
|
-
}, z.core.$strip>;
|
|
1036
|
-
total: z.ZodObject<{
|
|
1037
|
-
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
1038
|
-
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
1039
|
-
token: z.ZodObject<{
|
|
1040
|
-
chainId: z.ZodNumber;
|
|
1041
|
-
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
1042
|
-
symbol: z.ZodString;
|
|
1043
|
-
name: z.ZodString;
|
|
1044
|
-
decimals: z.ZodNumber;
|
|
1045
|
-
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
1046
|
-
}, z.core.$strip>;
|
|
1047
|
-
}, z.core.$strip>;
|
|
1048
|
-
rewards: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1049
|
-
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
1050
|
-
valueUsd: z.ZodNullable<z.ZodNumber>;
|
|
1051
|
-
token: z.ZodObject<{
|
|
1052
|
-
chainId: z.ZodNumber;
|
|
1053
|
-
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
1054
|
-
symbol: z.ZodString;
|
|
1055
|
-
name: z.ZodString;
|
|
1056
|
-
decimals: z.ZodNumber;
|
|
1057
|
-
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
1058
|
-
}, z.core.$strip>;
|
|
1059
|
-
kind: z.ZodLiteral<"token">;
|
|
1060
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1061
|
-
kind: z.ZodLiteral<"point">;
|
|
1062
|
-
points: z.ZodArray<z.ZodObject<{
|
|
1063
|
-
id: z.ZodString;
|
|
1064
|
-
name: z.ZodString;
|
|
1065
|
-
multiplier: z.ZodNullable<z.ZodNumber>;
|
|
1066
|
-
value: z.ZodNumber;
|
|
1067
|
-
}, z.core.$strip>>;
|
|
1068
|
-
}, z.core.$strip>], "kind">>;
|
|
1069
|
-
}, z.core.$strip>>;
|
|
1023
|
+
pnlUsd: z.ZodNullable<z.ZodNumber>;
|
|
1070
1024
|
netValueUsd: z.ZodNullable<z.ZodNumber>;
|
|
1071
1025
|
claimableUsd: z.ZodNullable<z.ZodNumber>;
|
|
1072
1026
|
}, z.core.$strip>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
2
|
-
import { Opportunity, OpportunityFilter, OpportunityKey, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
2
|
+
import { Opportunity, OpportunityFilter, OpportunityKey, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import { GearboxAPIOptions } from "../types.js";
|
|
5
5
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
@@ -27,6 +27,10 @@ declare class OffchainOpportunities extends AbstractOffchainNamespace {
|
|
|
27
27
|
* Detailed view of one strategy opportunity.
|
|
28
28
|
**/
|
|
29
29
|
getStrategy(key: StrategyOpportunityKey): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
30
|
+
/**
|
|
31
|
+
* Protocol-wide totals across every opportunity the backend serves.
|
|
32
|
+
**/
|
|
33
|
+
getTotals(): Promise<DataResponse<OpportunityTotals>>;
|
|
30
34
|
/**
|
|
31
35
|
* Charts of one opportunity: one series per metric, on a shared grid.
|
|
32
36
|
**/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
2
|
-
import { Position, PositionKey } from "../../model/positions.js";
|
|
2
|
+
import { Position, PositionKey, PositionsTotals } from "../../model/positions.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import { ListPositionsPropsBase } from "../../onchain/positions/types.js";
|
|
5
5
|
import { GearboxAPIOptions } from "../types.js";
|
|
6
6
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
7
|
+
import { Address } from "viem";
|
|
7
8
|
//#region src/offchain/positions/OffchainPositions.d.ts
|
|
8
9
|
type PositionChartMetricFor<K extends PositionKey> = {
|
|
9
10
|
pool: PoolPositionChartMetric;
|
|
@@ -19,6 +20,10 @@ declare class OffchainPositions extends AbstractOffchainNamespace {
|
|
|
19
20
|
* Everything a wallet holds, optionally narrowed by {@link PositionFilter}.
|
|
20
21
|
**/
|
|
21
22
|
list(props: ListPositionsPropsBase): Promise<DataResponse<Position[]>>;
|
|
23
|
+
/**
|
|
24
|
+
* Aggregate over everything a wallet holds, see {@link PositionsTotals}.
|
|
25
|
+
**/
|
|
26
|
+
getTotals(wallet: Address): Promise<DataResponse<PositionsTotals>>;
|
|
22
27
|
/**
|
|
23
28
|
* Charts of one position: one series per metric, on a shared grid.
|
|
24
29
|
**/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
2
|
-
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
2
|
+
import { Opportunity, OpportunityFilter, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainSDK } from "../../onchain/MultichainSDK.js";
|
|
@@ -51,6 +51,10 @@ declare class OpportunitiesNamespace extends AbstractNamespace<MultichainSDK["op
|
|
|
51
51
|
* {@inheritDoc OpportunitiesBase.filter}
|
|
52
52
|
**/
|
|
53
53
|
filter<R extends DataResponse<Opportunity[]> | undefined>(response: R, filter?: OpportunityFilter): FilterResult<R, Opportunity>;
|
|
54
|
+
/**
|
|
55
|
+
* {@inheritDoc OpportunitiesOffchainOnly.totals}
|
|
56
|
+
**/
|
|
57
|
+
totals(): Promise<DataResponse<OpportunityTotals>>;
|
|
54
58
|
/**
|
|
55
59
|
* {@inheritDoc OpportunitiesOffchainOnly.charts}
|
|
56
60
|
**/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
2
|
-
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
2
|
+
import { Opportunity, OpportunityFilter, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainOpportunitiesService } from "../../onchain/opportunities/MultichainOpportunitiesService.js";
|
|
@@ -58,6 +58,14 @@ interface OpportunitiesBase {
|
|
|
58
58
|
* Reads only a backend can answer.
|
|
59
59
|
**/
|
|
60
60
|
interface OpportunitiesOffchainOnly {
|
|
61
|
+
/**
|
|
62
|
+
* Protocol-wide totals across every opportunity: the TVL, total borrowed and
|
|
63
|
+
* total supplied the landing page shows.
|
|
64
|
+
*
|
|
65
|
+
* Absent in `onchain` mode: it is served by the backend rather than summed
|
|
66
|
+
* from the chain.
|
|
67
|
+
**/
|
|
68
|
+
totals(): Promise<DataResponse<OpportunityTotals>>;
|
|
61
69
|
/**
|
|
62
70
|
* Historical charts of one opportunity, one series per metric on a shared
|
|
63
71
|
* axis: `charts(key, ["depositApy", "depositApyAvg7d"], "1m")`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
2
|
-
import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
+
import { PoolPositionRef, Position, PositionFilter, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainSDK } from "../../onchain/MultichainSDK.js";
|
|
@@ -31,6 +31,10 @@ declare class PositionsNamespace extends AbstractNamespace<MultichainSDK["positi
|
|
|
31
31
|
* {@inheritDoc PositionsBase.filter}
|
|
32
32
|
**/
|
|
33
33
|
filter<R extends DataResponse<Position[]> | undefined>(response: R, filter?: PositionFilter): FilterResult<R, Position>;
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc PositionsOffchainOnly.totals}
|
|
36
|
+
**/
|
|
37
|
+
totals(wallet: Address): Promise<DataResponse<PositionsTotals>>;
|
|
34
38
|
/**
|
|
35
39
|
* {@inheritDoc PositionsOffchainOnly.charts}
|
|
36
40
|
**/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
2
|
-
import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
+
import { PoolPositionRef, Position, PositionFilter, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainPositionsService } from "../../onchain/positions/MultichainPositionsService.js";
|
|
@@ -48,6 +48,14 @@ interface PositionsBase {
|
|
|
48
48
|
* Reads only a backend can answer.
|
|
49
49
|
**/
|
|
50
50
|
interface PositionsOffchainOnly {
|
|
51
|
+
/**
|
|
52
|
+
* Aggregate over everything a wallet holds: the list screen's badges, see
|
|
53
|
+
* {@link PositionsTotals}.
|
|
54
|
+
*
|
|
55
|
+
* Absent in `onchain` mode: it is served by the backend rather than summed
|
|
56
|
+
* from the chain.
|
|
57
|
+
**/
|
|
58
|
+
totals(wallet: Address): Promise<DataResponse<PositionsTotals>>;
|
|
51
59
|
/**
|
|
52
60
|
* Historical charts of one position, one series per metric on a shared axis:
|
|
53
61
|
* `charts(key, ["apy", "mwr"], "1m")`.
|