@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.
- package/dist/cjs/dev/abi.js +99 -16
- package/dist/cjs/dev/claimFromFaucet.js +3 -3
- package/dist/cjs/dev/index.js +1 -1
- package/dist/cjs/model/analytics.schema.js +44 -1
- package/dist/cjs/model/charts.js +15 -1
- package/dist/cjs/model/charts.schema.js +9 -3
- package/dist/cjs/model/index.js +9 -4
- package/dist/cjs/model/liquidations.schema.js +1 -1
- package/dist/cjs/model/opportunities.schema.js +2 -2
- package/dist/cjs/model/positions.schema.js +2 -2
- package/dist/cjs/offchain/analytics/OffchainAnalytics.js +25 -2
- package/dist/cjs/onchain/base/TokensMeta.js +3 -3
- package/dist/cjs/onchain/chain/chains.js +7 -0
- package/dist/cjs/onchain/market/strategyName.js +1 -1
- package/dist/cjs/sdk/analytics/AnalyticsNamespace.js +6 -0
- package/dist/esm/dev/abi.js +99 -16
- package/dist/esm/dev/claimFromFaucet.js +4 -4
- package/dist/esm/dev/index.js +2 -2
- package/dist/esm/model/analytics.schema.js +42 -2
- package/dist/esm/model/charts.js +15 -2
- package/dist/esm/model/charts.schema.js +9 -4
- package/dist/esm/model/index.js +6 -6
- package/dist/esm/model/liquidations.schema.js +1 -1
- package/dist/esm/model/opportunities.schema.js +2 -2
- package/dist/esm/model/positions.schema.js +2 -2
- package/dist/esm/offchain/analytics/OffchainAnalytics.js +25 -2
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/chain/chains.js +7 -0
- package/dist/esm/onchain/market/strategyName.js +1 -1
- package/dist/esm/sdk/analytics/AnalyticsNamespace.js +6 -0
- package/dist/types/dev/abi.d.ts +91 -15
- package/dist/types/dev/index.d.ts +2 -2
- package/dist/types/model/analytics.d.ts +22 -1
- package/dist/types/model/analytics.schema.d.ts +65 -1
- package/dist/types/model/charts.d.ts +20 -2
- package/dist/types/model/charts.schema.d.ts +14 -2
- package/dist/types/model/index.d.ts +5 -5
- package/dist/types/model/primitives.d.ts +1 -1
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
- package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +14 -2
- package/dist/types/offchain/analytics/types.d.ts +11 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
- package/dist/types/offchain/opportunities/types.d.ts +1 -1
- package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
- package/dist/types/offchain/positions/types.d.ts +1 -1
- package/dist/types/onchain/base/TokensMeta.d.ts +3 -3
- package/dist/types/onchain/base/token-types.d.ts +1 -1
- package/dist/types/onchain/market/strategyName.d.ts +1 -1
- package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +6 -0
- package/dist/types/sdk/analytics/types.d.ts +16 -0
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
- package/dist/types/sdk/opportunities/types.d.ts +1 -1
- package/dist/types/sdk/positions/PositionsNamespace.d.ts +1 -1
- package/dist/types/sdk/positions/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/dev/abi.js
CHANGED
|
@@ -4,12 +4,12 @@ let viem = require("viem");
|
|
|
4
4
|
const iaclTraitAbi = (0, viem.parseAbi)(["function acl() external view returns (address)"]);
|
|
5
5
|
const iOwnableAbi = (0, viem.parseAbi)(["function owner() external view returns (address)"]);
|
|
6
6
|
const iDegenNftv2Abi = (0, viem.parseAbi)(["function minter() external view returns (address)", "function mint(address to, uint256 amount) external"]);
|
|
7
|
-
const
|
|
7
|
+
const iFaucetAbi = [
|
|
8
8
|
{
|
|
9
9
|
type: "function",
|
|
10
10
|
name: "assets",
|
|
11
11
|
inputs: [{
|
|
12
|
-
name: "",
|
|
12
|
+
name: "index",
|
|
13
13
|
type: "uint256",
|
|
14
14
|
internalType: "uint256"
|
|
15
15
|
}],
|
|
@@ -58,6 +58,100 @@ const faucetAbi = [
|
|
|
58
58
|
outputs: [],
|
|
59
59
|
stateMutability: "nonpayable"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
type: "function",
|
|
63
|
+
name: "claimOnBehalfOf",
|
|
64
|
+
inputs: [{
|
|
65
|
+
name: "receiver",
|
|
66
|
+
type: "address",
|
|
67
|
+
internalType: "address"
|
|
68
|
+
}, {
|
|
69
|
+
name: "claims",
|
|
70
|
+
type: "tuple[]",
|
|
71
|
+
internalType: "struct TokenClaim[]",
|
|
72
|
+
components: [{
|
|
73
|
+
name: "token",
|
|
74
|
+
type: "address",
|
|
75
|
+
internalType: "address"
|
|
76
|
+
}, {
|
|
77
|
+
name: "amount",
|
|
78
|
+
type: "uint256",
|
|
79
|
+
internalType: "uint256"
|
|
80
|
+
}]
|
|
81
|
+
}],
|
|
82
|
+
outputs: [{
|
|
83
|
+
name: "",
|
|
84
|
+
type: "bool",
|
|
85
|
+
internalType: "bool"
|
|
86
|
+
}],
|
|
87
|
+
stateMutability: "nonpayable"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: "function",
|
|
91
|
+
name: "claimOnBehalfOf",
|
|
92
|
+
inputs: [{
|
|
93
|
+
name: "receiver",
|
|
94
|
+
type: "address",
|
|
95
|
+
internalType: "address"
|
|
96
|
+
}, {
|
|
97
|
+
name: "amountUSD",
|
|
98
|
+
type: "uint256",
|
|
99
|
+
internalType: "uint256"
|
|
100
|
+
}],
|
|
101
|
+
outputs: [{
|
|
102
|
+
name: "",
|
|
103
|
+
type: "bool",
|
|
104
|
+
internalType: "bool"
|
|
105
|
+
}],
|
|
106
|
+
stateMutability: "nonpayable"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: "function",
|
|
110
|
+
name: "claimOnBehalfOf",
|
|
111
|
+
inputs: [{
|
|
112
|
+
name: "receiver",
|
|
113
|
+
type: "address",
|
|
114
|
+
internalType: "address"
|
|
115
|
+
}],
|
|
116
|
+
outputs: [{
|
|
117
|
+
name: "",
|
|
118
|
+
type: "bool",
|
|
119
|
+
internalType: "bool"
|
|
120
|
+
}],
|
|
121
|
+
stateMutability: "nonpayable"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: "function",
|
|
125
|
+
name: "configure",
|
|
126
|
+
inputs: [{
|
|
127
|
+
name: "minAmountUSD",
|
|
128
|
+
type: "uint256",
|
|
129
|
+
internalType: "uint256"
|
|
130
|
+
}, {
|
|
131
|
+
name: "tokens",
|
|
132
|
+
type: "tuple[]",
|
|
133
|
+
internalType: "struct FaucetToken[]",
|
|
134
|
+
components: [
|
|
135
|
+
{
|
|
136
|
+
name: "token",
|
|
137
|
+
type: "address",
|
|
138
|
+
internalType: "address"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "price",
|
|
142
|
+
type: "uint256",
|
|
143
|
+
internalType: "uint256"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "decimals",
|
|
147
|
+
type: "uint8",
|
|
148
|
+
internalType: "uint8"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}],
|
|
152
|
+
outputs: [],
|
|
153
|
+
stateMutability: "nonpayable"
|
|
154
|
+
},
|
|
61
155
|
{
|
|
62
156
|
type: "function",
|
|
63
157
|
name: "getAssets",
|
|
@@ -95,22 +189,11 @@ const faucetAbi = [
|
|
|
95
189
|
}],
|
|
96
190
|
stateMutability: "view"
|
|
97
191
|
},
|
|
98
|
-
{
|
|
99
|
-
type: "function",
|
|
100
|
-
name: "owner",
|
|
101
|
-
inputs: [],
|
|
102
|
-
outputs: [{
|
|
103
|
-
name: "",
|
|
104
|
-
type: "address",
|
|
105
|
-
internalType: "address"
|
|
106
|
-
}],
|
|
107
|
-
stateMutability: "view"
|
|
108
|
-
},
|
|
109
192
|
{
|
|
110
193
|
type: "function",
|
|
111
194
|
name: "prices",
|
|
112
195
|
inputs: [{
|
|
113
|
-
name: "",
|
|
196
|
+
name: "token",
|
|
114
197
|
type: "address",
|
|
115
198
|
internalType: "address"
|
|
116
199
|
}],
|
|
@@ -125,7 +208,7 @@ const faucetAbi = [
|
|
|
125
208
|
type: "function",
|
|
126
209
|
name: "scales",
|
|
127
210
|
inputs: [{
|
|
128
|
-
name: "",
|
|
211
|
+
name: "token",
|
|
129
212
|
type: "address",
|
|
130
213
|
internalType: "address"
|
|
131
214
|
}],
|
|
@@ -204,8 +287,8 @@ const iOnchainExecutionIdAbi = [
|
|
|
204
287
|
}
|
|
205
288
|
];
|
|
206
289
|
//#endregion
|
|
207
|
-
exports.faucetAbi = faucetAbi;
|
|
208
290
|
exports.iDegenNftv2Abi = iDegenNftv2Abi;
|
|
291
|
+
exports.iFaucetAbi = iFaucetAbi;
|
|
209
292
|
exports.iOnchainExecutionIdAbi = iOnchainExecutionIdAbi;
|
|
210
293
|
exports.iOwnableAbi = iOwnableAbi;
|
|
211
294
|
exports.iaclTraitAbi = iaclTraitAbi;
|
|
@@ -23,7 +23,7 @@ async function claimFromFaucet(opts) {
|
|
|
23
23
|
} else if (typeof amount === "function") {
|
|
24
24
|
const minAmountUSD = await (0, viem_actions.readContract)(publicClient, {
|
|
25
25
|
address: faucet,
|
|
26
|
-
abi: require_dev_abi.
|
|
26
|
+
abi: require_dev_abi.iFaucetAbi,
|
|
27
27
|
functionName: "minAmountUSD"
|
|
28
28
|
});
|
|
29
29
|
logger?.debug(`faucet min amount USD: ${minAmountUSD}`);
|
|
@@ -39,7 +39,7 @@ async function claimFromFaucet(opts) {
|
|
|
39
39
|
const gas = await publicClient.estimateContractGas({
|
|
40
40
|
account: claimer,
|
|
41
41
|
address: faucet,
|
|
42
|
-
abi: require_dev_abi.
|
|
42
|
+
abi: require_dev_abi.iFaucetAbi,
|
|
43
43
|
functionName: "claim",
|
|
44
44
|
args
|
|
45
45
|
});
|
|
@@ -47,7 +47,7 @@ async function claimFromFaucet(opts) {
|
|
|
47
47
|
const { request } = await publicClient.simulateContract({
|
|
48
48
|
account: claimer,
|
|
49
49
|
address: faucet,
|
|
50
|
-
abi: require_dev_abi.
|
|
50
|
+
abi: require_dev_abi.iFaucetAbi,
|
|
51
51
|
functionName: "claim",
|
|
52
52
|
args,
|
|
53
53
|
chain: wallet.chain,
|
package/dist/cjs/dev/index.js
CHANGED
|
@@ -49,7 +49,6 @@ exports.detectChain = require_dev_detectChain.detectChain;
|
|
|
49
49
|
exports.enableDSTokenBackDating = require_dev_securitizeUtils.enableDSTokenBackDating;
|
|
50
50
|
exports.evmMineDetailed = require_dev_createAnvilClient.evmMineDetailed;
|
|
51
51
|
exports.extendAnvilClient = require_dev_createAnvilClient.extendAnvilClient;
|
|
52
|
-
exports.faucetAbi = require_dev_abi.faucetAbi;
|
|
53
52
|
exports.getAlchemyUrl = require_dev_providers.getAlchemyUrl;
|
|
54
53
|
exports.getAnkrUrl = require_dev_providers.getAnkrUrl;
|
|
55
54
|
exports.getDrpcUrl = require_dev_providers.getDrpcUrl;
|
|
@@ -60,6 +59,7 @@ exports.getThirdWebUrl = require_dev_providers.getThirdWebUrl;
|
|
|
60
59
|
exports.greenlistMidasGateway = require_dev_kycUtils.greenlistMidasGateway;
|
|
61
60
|
exports.httpTransportOptionsSchema = require_dev_transports.httpTransportOptionsSchema;
|
|
62
61
|
exports.iDegenNftv2Abi = require_dev_abi.iDegenNftv2Abi;
|
|
62
|
+
exports.iFaucetAbi = require_dev_abi.iFaucetAbi;
|
|
63
63
|
exports.iOnchainExecutionIdAbi = require_dev_abi.iOnchainExecutionIdAbi;
|
|
64
64
|
exports.iOwnableAbi = require_dev_abi.iOwnableAbi;
|
|
65
65
|
exports.iaclTraitAbi = require_dev_abi.iaclTraitAbi;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_utils_zod = require("../onchain/utils/zod.js");
|
|
3
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
|
+
const require_model_charts_schema = require("./charts.schema.js");
|
|
3
5
|
const require_model_filters = require("./filters.js");
|
|
4
6
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
5
|
-
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
6
7
|
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
7
8
|
const require_model_positions_schema = require("./positions.schema.js");
|
|
8
9
|
let viem = require("viem");
|
|
@@ -105,9 +106,51 @@ const analyticsPositionPageSchema = zod_v4.z.object({
|
|
|
105
106
|
offset: zod_v4.z.number().int().nonnegative(),
|
|
106
107
|
limit: zod_v4.z.number().int().positive().max(100)
|
|
107
108
|
});
|
|
109
|
+
/**
|
|
110
|
+
* {@link AnalyticsChartQuery}
|
|
111
|
+
*
|
|
112
|
+
* The metric list is narrowed to {@link ProtocolChartMetric} here rather than
|
|
113
|
+
* on the route, so asking the protocol chart for an opportunity metric is
|
|
114
|
+
* rejected by the one codec both sides share instead of by a check only the
|
|
115
|
+
* backend runs.
|
|
116
|
+
**/
|
|
117
|
+
const analyticsChartQueryOptionsSchema = zod_v4.z.object({
|
|
118
|
+
metrics: zod_v4.z.array(require_model_charts_schema.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" }),
|
|
119
|
+
range: require_model_charts_schema.chartRangeSchema,
|
|
120
|
+
chainIds: zod_v4.z.array(require_model_primitives_schema.chainIdSchema).optional()
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* {@link AnalyticsChartQuery} as URL query parameters: the metrics comma-joined
|
|
124
|
+
* like every other chart read, and the chains comma-joined like every other
|
|
125
|
+
* analytics read.
|
|
126
|
+
**/
|
|
127
|
+
const analyticsChartQueryParamsSchema = zod_v4.z.object({
|
|
128
|
+
metrics: zod_v4.z.string().regex(/^\w+(,\w+)*$/),
|
|
129
|
+
range: require_model_charts_schema.chartRangeSchema,
|
|
130
|
+
chainIds: zod_v4.z.string().regex(/^$|^\d+(,\d+)*$/).optional()
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* Codec for a protocol-wide chart query. It is shared by the SDK client and
|
|
134
|
+
* backend controller so both sides interpret every parameter identically.
|
|
135
|
+
**/
|
|
136
|
+
const analyticsChartQuerySchema = zod_v4.z.codec(analyticsChartQueryParamsSchema, analyticsChartQueryOptionsSchema, {
|
|
137
|
+
decode: (params) => ({
|
|
138
|
+
metrics: params.metrics.split(","),
|
|
139
|
+
range: params.range,
|
|
140
|
+
...params.chainIds === void 0 ? {} : { chainIds: params.chainIds === "" ? [] : params.chainIds.split(",").map(Number) }
|
|
141
|
+
}),
|
|
142
|
+
encode: (query) => ({
|
|
143
|
+
metrics: query.metrics.join(","),
|
|
144
|
+
range: query.range,
|
|
145
|
+
chainIds: query.chainIds?.join(",")
|
|
146
|
+
})
|
|
147
|
+
});
|
|
108
148
|
//#endregion
|
|
109
149
|
exports.ANALYTICS_POSITIONS_DEFAULT_LIMIT = ANALYTICS_POSITIONS_DEFAULT_LIMIT;
|
|
110
150
|
exports.ANALYTICS_POSITIONS_MAX_LIMIT = ANALYTICS_POSITIONS_MAX_LIMIT;
|
|
151
|
+
exports.analyticsChartQueryOptionsSchema = analyticsChartQueryOptionsSchema;
|
|
152
|
+
exports.analyticsChartQueryParamsSchema = analyticsChartQueryParamsSchema;
|
|
153
|
+
exports.analyticsChartQuerySchema = analyticsChartQuerySchema;
|
|
111
154
|
exports.analyticsPositionListOptionsSchema = analyticsPositionListOptionsSchema;
|
|
112
155
|
exports.analyticsPositionListQueryParamsSchema = analyticsPositionListQueryParamsSchema;
|
|
113
156
|
exports.analyticsPositionListQuerySchema = analyticsPositionListQuerySchema;
|
package/dist/cjs/model/charts.js
CHANGED
|
@@ -85,6 +85,18 @@ const STRATEGY_POSITION_CHART_METRICS = [
|
|
|
85
85
|
"netApy7d"
|
|
86
86
|
];
|
|
87
87
|
/**
|
|
88
|
+
* Every metric the protocol as a whole can chart.
|
|
89
|
+
*
|
|
90
|
+
* Protocol-wide rather than per subject: the series describes Gearbox itself
|
|
91
|
+
* over every chain the read covers, so it has no address to hang off and is
|
|
92
|
+
* read from the analytics namespace rather than from an opportunity.
|
|
93
|
+
*
|
|
94
|
+
* `tvlUsd` is deliberately not spelled `tvl`: that key is already the credit
|
|
95
|
+
* manager's TVL in whole underlying tokens, and one metric has exactly one
|
|
96
|
+
* unit in {@link CHART_METRIC_UNITS}.
|
|
97
|
+
**/
|
|
98
|
+
const PROTOCOL_CHART_METRICS = ["tvlUsd"];
|
|
99
|
+
/**
|
|
88
100
|
* Unit of every metric, the one place either side decides it.
|
|
89
101
|
*
|
|
90
102
|
* A metric added to a union above fails to compile here until its unit is
|
|
@@ -114,7 +126,8 @@ const CHART_METRIC_UNITS = {
|
|
|
114
126
|
totalValueUnderlying: "token",
|
|
115
127
|
debt: "token",
|
|
116
128
|
healthFactor: "bps",
|
|
117
|
-
netApy7d: "bps"
|
|
129
|
+
netApy7d: "bps",
|
|
130
|
+
tvlUsd: "usd"
|
|
118
131
|
};
|
|
119
132
|
/**
|
|
120
133
|
* Reason a series could not be produced at all, which is not the same as a
|
|
@@ -133,5 +146,6 @@ exports.CHART_RANGES = CHART_RANGES;
|
|
|
133
146
|
exports.CHART_UNAVAILABLE_CODES = CHART_UNAVAILABLE_CODES;
|
|
134
147
|
exports.POOL_OPPORTUNITY_CHART_METRICS = POOL_OPPORTUNITY_CHART_METRICS;
|
|
135
148
|
exports.POOL_POSITION_CHART_METRICS = POOL_POSITION_CHART_METRICS;
|
|
149
|
+
exports.PROTOCOL_CHART_METRICS = PROTOCOL_CHART_METRICS;
|
|
136
150
|
exports.STRATEGY_OPPORTUNITY_CHART_METRICS = STRATEGY_OPPORTUNITY_CHART_METRICS;
|
|
137
151
|
exports.STRATEGY_POSITION_CHART_METRICS = STRATEGY_POSITION_CHART_METRICS;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
3
2
|
const require_model_charts = require("./charts.js");
|
|
3
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
4
|
let zod_v4 = require("zod/v4");
|
|
5
5
|
//#region src/model/charts.schema.ts
|
|
6
6
|
/**
|
|
@@ -33,13 +33,18 @@ const poolPositionChartMetricSchema = zod_v4.z.enum(require_model_charts.POOL_PO
|
|
|
33
33
|
**/
|
|
34
34
|
const strategyPositionChartMetricSchema = zod_v4.z.enum(require_model_charts.STRATEGY_POSITION_CHART_METRICS);
|
|
35
35
|
/**
|
|
36
|
-
* {@link
|
|
36
|
+
* {@link ProtocolChartMetric}
|
|
37
|
+
**/
|
|
38
|
+
const protocolChartMetricSchema = zod_v4.z.enum(require_model_charts.PROTOCOL_CHART_METRICS);
|
|
39
|
+
/**
|
|
40
|
+
* {@link ChartMetric}, every metric any subject can chart.
|
|
37
41
|
**/
|
|
38
42
|
const chartMetricSchema = zod_v4.z.union([
|
|
39
43
|
poolOpportunityChartMetricSchema,
|
|
40
44
|
strategyOpportunityChartMetricSchema,
|
|
41
45
|
poolPositionChartMetricSchema,
|
|
42
|
-
strategyPositionChartMetricSchema
|
|
46
|
+
strategyPositionChartMetricSchema,
|
|
47
|
+
protocolChartMetricSchema
|
|
43
48
|
]);
|
|
44
49
|
/**
|
|
45
50
|
* {@link ChartQuery}
|
|
@@ -236,5 +241,6 @@ exports.chartValueSchema = chartValueSchema;
|
|
|
236
241
|
exports.chartWindowSchema = chartWindowSchema;
|
|
237
242
|
exports.poolOpportunityChartMetricSchema = poolOpportunityChartMetricSchema;
|
|
238
243
|
exports.poolPositionChartMetricSchema = poolPositionChartMetricSchema;
|
|
244
|
+
exports.protocolChartMetricSchema = protocolChartMetricSchema;
|
|
239
245
|
exports.strategyOpportunityChartMetricSchema = strategyOpportunityChartMetricSchema;
|
|
240
246
|
exports.strategyPositionChartMetricSchema = strategyPositionChartMetricSchema;
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./analytics.js");
|
|
3
|
+
const require_model_charts = require("./charts.js");
|
|
4
|
+
const require_model_compare_schema = require("./compare.schema.js");
|
|
5
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
6
|
+
const require_model_charts_schema = require("./charts.schema.js");
|
|
3
7
|
const require_model_filters = require("./filters.js");
|
|
4
8
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
5
|
-
const require_model_compare_schema = require("./compare.schema.js");
|
|
6
9
|
const require_model_curators_schema = require("./curators.schema.js");
|
|
7
|
-
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
8
10
|
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
9
11
|
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
10
12
|
const require_model_positions_schema = require("./positions.schema.js");
|
|
11
13
|
const require_model_analytics_schema = require("./analytics.schema.js");
|
|
12
|
-
const require_model_charts = require("./charts.js");
|
|
13
|
-
const require_model_charts_schema = require("./charts.schema.js");
|
|
14
14
|
require("./curators.js");
|
|
15
15
|
require("./delayed-intents.js");
|
|
16
16
|
require("./errors.js");
|
|
@@ -34,10 +34,14 @@ exports.CHART_UNAVAILABLE_CODES = require_model_charts.CHART_UNAVAILABLE_CODES;
|
|
|
34
34
|
exports.FILTER_ALL = require_model_filters.FILTER_ALL;
|
|
35
35
|
exports.POOL_OPPORTUNITY_CHART_METRICS = require_model_charts.POOL_OPPORTUNITY_CHART_METRICS;
|
|
36
36
|
exports.POOL_POSITION_CHART_METRICS = require_model_charts.POOL_POSITION_CHART_METRICS;
|
|
37
|
+
exports.PROTOCOL_CHART_METRICS = require_model_charts.PROTOCOL_CHART_METRICS;
|
|
37
38
|
exports.STRATEGY_OPPORTUNITY_CHART_METRICS = require_model_charts.STRATEGY_OPPORTUNITY_CHART_METRICS;
|
|
38
39
|
exports.STRATEGY_POSITION_CHART_METRICS = require_model_charts.STRATEGY_POSITION_CHART_METRICS;
|
|
39
40
|
exports.STRATEGY_POSITION_COLLATERAL_ERROR = require_model_positions.STRATEGY_POSITION_COLLATERAL_ERROR;
|
|
40
41
|
exports.amountSchema = require_model_primitives_schema.amountSchema;
|
|
42
|
+
exports.analyticsChartQueryOptionsSchema = require_model_analytics_schema.analyticsChartQueryOptionsSchema;
|
|
43
|
+
exports.analyticsChartQueryParamsSchema = require_model_analytics_schema.analyticsChartQueryParamsSchema;
|
|
44
|
+
exports.analyticsChartQuerySchema = require_model_analytics_schema.analyticsChartQuerySchema;
|
|
41
45
|
exports.analyticsPositionListOptionsSchema = require_model_analytics_schema.analyticsPositionListOptionsSchema;
|
|
42
46
|
exports.analyticsPositionListQueryParamsSchema = require_model_analytics_schema.analyticsPositionListQueryParamsSchema;
|
|
43
47
|
exports.analyticsPositionListQuerySchema = require_model_analytics_schema.analyticsPositionListQuerySchema;
|
|
@@ -131,6 +135,7 @@ exports.positionWithdrawalsSchema = require_model_withdrawals_schema.positionWit
|
|
|
131
135
|
exports.positionsTotalsSchema = require_model_positions_schema.positionsTotalsSchema;
|
|
132
136
|
exports.priceFeedDataSchema = require_model_opportunities_schema.priceFeedDataSchema;
|
|
133
137
|
exports.priceFeedSummarySchema = require_model_opportunities_schema.priceFeedSummarySchema;
|
|
138
|
+
exports.protocolChartMetricSchema = require_model_charts_schema.protocolChartMetricSchema;
|
|
134
139
|
exports.quotaAssetSchema = require_model_opportunities_schema.quotaAssetSchema;
|
|
135
140
|
exports.rateCurvePointSchema = require_model_opportunities_schema.rateCurvePointSchema;
|
|
136
141
|
exports.rateCurveSchema = require_model_opportunities_schema.rateCurveSchema;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_utils_zod = require("../onchain/utils/zod.js");
|
|
3
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
3
4
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
4
5
|
const require_model_curators_schema = require("./curators.schema.js");
|
|
5
|
-
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
6
6
|
let zod_v4 = require("zod/v4");
|
|
7
7
|
//#region src/model/liquidations.schema.ts
|
|
8
8
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_utils_zod = require("../onchain/utils/zod.js");
|
|
3
|
+
const require_model_compare_schema = require("./compare.schema.js");
|
|
4
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
3
5
|
const require_model_filters = require("./filters.js");
|
|
4
6
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
5
|
-
const require_model_compare_schema = require("./compare.schema.js");
|
|
6
7
|
const require_model_curators_schema = require("./curators.schema.js");
|
|
7
|
-
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
8
8
|
let zod_v4 = require("zod/v4");
|
|
9
9
|
//#region src/model/opportunities.schema.ts
|
|
10
10
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_onchain_utils_zod = require("../onchain/utils/zod.js");
|
|
3
|
-
const require_model_filters = require("./filters.js");
|
|
4
|
-
const require_model_filters_schema = require("./filters.schema.js");
|
|
5
3
|
const require_model_compare_schema = require("./compare.schema.js");
|
|
6
4
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
5
|
+
const require_model_filters = require("./filters.js");
|
|
6
|
+
const require_model_filters_schema = require("./filters.schema.js");
|
|
7
7
|
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
8
8
|
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
9
9
|
let zod_v4 = require("zod/v4");
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_charts_schema = require("../../model/charts.schema.js");
|
|
3
|
+
const require_model_analytics_schema = require("../../model/analytics.schema.js");
|
|
4
|
+
const require_offchain_AbstractOffchainNamespace = require("../AbstractOffchainNamespace.js");
|
|
2
5
|
const require_offchain_analytics_OffchainAnalyticsPositions = require("./OffchainAnalyticsPositions.js");
|
|
6
|
+
let zod_v4 = require("zod/v4");
|
|
3
7
|
//#region src/offchain/analytics/OffchainAnalytics.ts
|
|
4
|
-
/**
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Backend-only protocol analytics, grouped by subject.
|
|
10
|
+
*
|
|
11
|
+
* It owns the protocol-wide charts itself rather than through a sub-namespace:
|
|
12
|
+
* their subject is Gearbox as a whole, so there is nothing narrower for them to
|
|
13
|
+
* hang off.
|
|
14
|
+
**/
|
|
15
|
+
var OffchainAnalytics = class extends require_offchain_AbstractOffchainNamespace.AbstractOffchainNamespace {
|
|
6
16
|
positions;
|
|
7
17
|
constructor(options) {
|
|
18
|
+
super("OffchainAnalytics", options);
|
|
8
19
|
this.positions = new require_offchain_analytics_OffchainAnalyticsPositions.OffchainAnalyticsPositions(options);
|
|
9
20
|
}
|
|
21
|
+
/** {@inheritDoc IOffchainAnalytics.getCharts} */
|
|
22
|
+
async getCharts(metrics, range, filter) {
|
|
23
|
+
return this.get({
|
|
24
|
+
path: "/v2/analytics/charts",
|
|
25
|
+
query: zod_v4.z.encode(require_model_analytics_schema.analyticsChartQuerySchema, {
|
|
26
|
+
metrics,
|
|
27
|
+
range,
|
|
28
|
+
chainIds: this.scopedChainIds(filter)
|
|
29
|
+
}),
|
|
30
|
+
schema: require_model_charts_schema.chartBundleSchemaFor(metrics, range)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
10
33
|
};
|
|
11
34
|
//#endregion
|
|
12
35
|
exports.OffchainAnalytics = OffchainAnalytics;
|
|
@@ -55,7 +55,7 @@ var TokensMeta = class extends require_onchain_utils_AddressMap.AddressMap {
|
|
|
55
55
|
* Returns the display symbol for a token.
|
|
56
56
|
*
|
|
57
57
|
* This is not always the on-chain ERC-20 `symbol()`: curated pretty names
|
|
58
|
-
* and redemption phantom tokens (`"
|
|
58
|
+
* and redemption phantom tokens (`"target redemption from source"`) replace it.
|
|
59
59
|
*
|
|
60
60
|
* @param token - Token address.
|
|
61
61
|
* @throws If the token is not in the registry.
|
|
@@ -154,7 +154,7 @@ var TokensMeta = class extends require_onchain_utils_AddressMap.AddressMap {
|
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Rewrites display symbols of redemption phantom tokens to
|
|
157
|
-
* `"${
|
|
157
|
+
* `"${target} redemption from ${source}"`.
|
|
158
158
|
*
|
|
159
159
|
* @param renames - Phantom / source / target address triples.
|
|
160
160
|
**/
|
|
@@ -164,7 +164,7 @@ var TokensMeta = class extends require_onchain_utils_AddressMap.AddressMap {
|
|
|
164
164
|
if (!meta || !this.has(source) || !this.has(target)) continue;
|
|
165
165
|
this.upsert(phantom, {
|
|
166
166
|
...meta,
|
|
167
|
-
symbol: `${this.symbol(
|
|
167
|
+
symbol: `${this.symbol(target)} redemption from ${this.symbol(source)}`
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
}
|
|
@@ -126,6 +126,13 @@ const chains = {
|
|
|
126
126
|
symbol: "USDC"
|
|
127
127
|
},
|
|
128
128
|
tokenPrettyNames: require_onchain_utils_AddressMap.AddressMap.fromRecord({
|
|
129
|
+
"0xab7d50fc2486a1ac06516e2ece9dadc95ba8cd20": "wstETH redemption from cp0xLRT",
|
|
130
|
+
"0x6252467c2fefb61cb55180282943139baeea36c5": "wstETH redemption from rstETH",
|
|
131
|
+
"0xd412ca00d177eba2843348f9c50dd17bfce32c40": "wstETH redemption from pzETH",
|
|
132
|
+
"0x26c98674e623647f11909791593fa3b6e9406c67": "wstETH redemption from steak7LRT",
|
|
133
|
+
"0x9fb930eacadad079683a4758424a53b9b3692775": "wstETH redemption from Re7LRT",
|
|
134
|
+
"0xd7f1a4e3aba92a9d20987c752bd4a6cc759d7738": "rsETH redemption from hgETH",
|
|
135
|
+
"0xc71219dca5a671aa6268ab8fb35e570bd72f372b": "iUSD redemption from liUSD-1w",
|
|
129
136
|
"0x924d24c238db7ecae2aa3a19430239ed684bde4a": "Beefy WBTC/cbBTC/hemiBTC",
|
|
130
137
|
"0x403cc0d2694ec2639101f32b146b90d766461ce9": "Beefy wstETH/tETH",
|
|
131
138
|
"0x02a4cceed3c400b5ba9fd22ad6ec18d8f7a3d48e": "Beefy ETH+/WETH",
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
5
5
|
* borrowed underlying, e.g. `"wstETH / WETH"`.
|
|
6
6
|
*
|
|
7
7
|
* Uses each token's display {@link Token.symbol}, which may already be a
|
|
8
|
-
* curated pretty name or a `"
|
|
8
|
+
* curated pretty name or a `"target redemption from source"` redemption rewrite.
|
|
9
9
|
*
|
|
10
10
|
* @param target - Collateral the position is built around.
|
|
11
11
|
* @param underlying - Token the position borrows.
|
|
@@ -3,9 +3,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
/** Backend-only protocol analytics exposed by {@link GearboxSDK}. */
|
|
4
4
|
var AnalyticsNamespace = class {
|
|
5
5
|
positions;
|
|
6
|
+
#backend;
|
|
6
7
|
constructor(backend) {
|
|
8
|
+
this.#backend = backend;
|
|
7
9
|
this.positions = backend.analytics.positions;
|
|
8
10
|
}
|
|
11
|
+
/** {@inheritDoc IAnalytics.charts} */
|
|
12
|
+
async charts(metrics, range, filter) {
|
|
13
|
+
return this.#backend.analytics.getCharts(metrics, range, filter);
|
|
14
|
+
}
|
|
9
15
|
};
|
|
10
16
|
//#endregion
|
|
11
17
|
exports.AnalyticsNamespace = AnalyticsNamespace;
|
package/dist/esm/dev/abi.js
CHANGED
|
@@ -3,12 +3,12 @@ import { parseAbi } from "viem";
|
|
|
3
3
|
const iaclTraitAbi = parseAbi(["function acl() external view returns (address)"]);
|
|
4
4
|
const iOwnableAbi = parseAbi(["function owner() external view returns (address)"]);
|
|
5
5
|
const iDegenNftv2Abi = parseAbi(["function minter() external view returns (address)", "function mint(address to, uint256 amount) external"]);
|
|
6
|
-
const
|
|
6
|
+
const iFaucetAbi = [
|
|
7
7
|
{
|
|
8
8
|
type: "function",
|
|
9
9
|
name: "assets",
|
|
10
10
|
inputs: [{
|
|
11
|
-
name: "",
|
|
11
|
+
name: "index",
|
|
12
12
|
type: "uint256",
|
|
13
13
|
internalType: "uint256"
|
|
14
14
|
}],
|
|
@@ -57,6 +57,100 @@ const faucetAbi = [
|
|
|
57
57
|
outputs: [],
|
|
58
58
|
stateMutability: "nonpayable"
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
type: "function",
|
|
62
|
+
name: "claimOnBehalfOf",
|
|
63
|
+
inputs: [{
|
|
64
|
+
name: "receiver",
|
|
65
|
+
type: "address",
|
|
66
|
+
internalType: "address"
|
|
67
|
+
}, {
|
|
68
|
+
name: "claims",
|
|
69
|
+
type: "tuple[]",
|
|
70
|
+
internalType: "struct TokenClaim[]",
|
|
71
|
+
components: [{
|
|
72
|
+
name: "token",
|
|
73
|
+
type: "address",
|
|
74
|
+
internalType: "address"
|
|
75
|
+
}, {
|
|
76
|
+
name: "amount",
|
|
77
|
+
type: "uint256",
|
|
78
|
+
internalType: "uint256"
|
|
79
|
+
}]
|
|
80
|
+
}],
|
|
81
|
+
outputs: [{
|
|
82
|
+
name: "",
|
|
83
|
+
type: "bool",
|
|
84
|
+
internalType: "bool"
|
|
85
|
+
}],
|
|
86
|
+
stateMutability: "nonpayable"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "function",
|
|
90
|
+
name: "claimOnBehalfOf",
|
|
91
|
+
inputs: [{
|
|
92
|
+
name: "receiver",
|
|
93
|
+
type: "address",
|
|
94
|
+
internalType: "address"
|
|
95
|
+
}, {
|
|
96
|
+
name: "amountUSD",
|
|
97
|
+
type: "uint256",
|
|
98
|
+
internalType: "uint256"
|
|
99
|
+
}],
|
|
100
|
+
outputs: [{
|
|
101
|
+
name: "",
|
|
102
|
+
type: "bool",
|
|
103
|
+
internalType: "bool"
|
|
104
|
+
}],
|
|
105
|
+
stateMutability: "nonpayable"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "function",
|
|
109
|
+
name: "claimOnBehalfOf",
|
|
110
|
+
inputs: [{
|
|
111
|
+
name: "receiver",
|
|
112
|
+
type: "address",
|
|
113
|
+
internalType: "address"
|
|
114
|
+
}],
|
|
115
|
+
outputs: [{
|
|
116
|
+
name: "",
|
|
117
|
+
type: "bool",
|
|
118
|
+
internalType: "bool"
|
|
119
|
+
}],
|
|
120
|
+
stateMutability: "nonpayable"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: "function",
|
|
124
|
+
name: "configure",
|
|
125
|
+
inputs: [{
|
|
126
|
+
name: "minAmountUSD",
|
|
127
|
+
type: "uint256",
|
|
128
|
+
internalType: "uint256"
|
|
129
|
+
}, {
|
|
130
|
+
name: "tokens",
|
|
131
|
+
type: "tuple[]",
|
|
132
|
+
internalType: "struct FaucetToken[]",
|
|
133
|
+
components: [
|
|
134
|
+
{
|
|
135
|
+
name: "token",
|
|
136
|
+
type: "address",
|
|
137
|
+
internalType: "address"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "price",
|
|
141
|
+
type: "uint256",
|
|
142
|
+
internalType: "uint256"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "decimals",
|
|
146
|
+
type: "uint8",
|
|
147
|
+
internalType: "uint8"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}],
|
|
151
|
+
outputs: [],
|
|
152
|
+
stateMutability: "nonpayable"
|
|
153
|
+
},
|
|
60
154
|
{
|
|
61
155
|
type: "function",
|
|
62
156
|
name: "getAssets",
|
|
@@ -94,22 +188,11 @@ const faucetAbi = [
|
|
|
94
188
|
}],
|
|
95
189
|
stateMutability: "view"
|
|
96
190
|
},
|
|
97
|
-
{
|
|
98
|
-
type: "function",
|
|
99
|
-
name: "owner",
|
|
100
|
-
inputs: [],
|
|
101
|
-
outputs: [{
|
|
102
|
-
name: "",
|
|
103
|
-
type: "address",
|
|
104
|
-
internalType: "address"
|
|
105
|
-
}],
|
|
106
|
-
stateMutability: "view"
|
|
107
|
-
},
|
|
108
191
|
{
|
|
109
192
|
type: "function",
|
|
110
193
|
name: "prices",
|
|
111
194
|
inputs: [{
|
|
112
|
-
name: "",
|
|
195
|
+
name: "token",
|
|
113
196
|
type: "address",
|
|
114
197
|
internalType: "address"
|
|
115
198
|
}],
|
|
@@ -124,7 +207,7 @@ const faucetAbi = [
|
|
|
124
207
|
type: "function",
|
|
125
208
|
name: "scales",
|
|
126
209
|
inputs: [{
|
|
127
|
-
name: "",
|
|
210
|
+
name: "token",
|
|
128
211
|
type: "address",
|
|
129
212
|
internalType: "address"
|
|
130
213
|
}],
|
|
@@ -203,4 +286,4 @@ const iOnchainExecutionIdAbi = [
|
|
|
203
286
|
}
|
|
204
287
|
];
|
|
205
288
|
//#endregion
|
|
206
|
-
export {
|
|
289
|
+
export { iDegenNftv2Abi, iFaucetAbi, iOnchainExecutionIdAbi, iOwnableAbi, iaclTraitAbi };
|