@gearbox-protocol/sdk 16.0.0-next.53 → 16.0.0-next.55
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/mode-parity/compareOpportunities.js +4 -5
- package/dist/cjs/dev/mode-parity/comparePositions.js +6 -7
- package/dist/cjs/dev/mode-parity/fieldDiff.js +4 -6
- package/dist/cjs/dev/mode-parity/scriptUtils.js +145 -5
- package/dist/cjs/model/analytics.schema.js +117 -0
- package/dist/cjs/model/charts.schema.js +1 -1
- package/dist/cjs/model/index.js +18 -7
- package/dist/cjs/model/liquidations.schema.js +2 -2
- package/dist/cjs/model/opportunities.schema.js +3 -3
- package/dist/cjs/model/positions.schema.js +2 -2
- package/dist/cjs/offchain/GearboxAPI.js +5 -0
- package/dist/cjs/offchain/analytics/OffchainAnalytics.js +12 -0
- package/dist/cjs/offchain/analytics/OffchainAnalyticsPositions.js +24 -0
- package/dist/cjs/offchain/analytics/index.js +6 -0
- package/dist/cjs/offchain/index.js +5 -0
- package/dist/cjs/rewards/errors.js +27 -0
- package/dist/cjs/rewards/index.js +6 -7
- package/dist/cjs/rewards/merkl-api.js +45 -0
- package/dist/cjs/rewards/multichain.js +40 -0
- package/dist/cjs/rewards/{rewards/api.js → toMerklRewards.js} +26 -28
- package/dist/cjs/sdk/GearboxSDK.js +5 -0
- package/dist/cjs/sdk/analytics/AnalyticsNamespace.js +11 -0
- package/dist/cjs/sdk/analytics/index.js +4 -0
- package/dist/cjs/sdk/index.js +3 -0
- package/dist/esm/dev/mode-parity/compareOpportunities.js +4 -5
- package/dist/esm/dev/mode-parity/comparePositions.js +6 -7
- package/dist/esm/dev/mode-parity/fieldDiff.js +4 -6
- package/dist/esm/dev/mode-parity/scriptUtils.js +142 -6
- package/dist/esm/model/analytics.schema.js +108 -0
- package/dist/esm/model/charts.schema.js +1 -1
- package/dist/esm/model/index.js +10 -8
- package/dist/esm/model/liquidations.schema.js +2 -2
- package/dist/esm/model/opportunities.schema.js +3 -3
- package/dist/esm/model/positions.schema.js +2 -2
- package/dist/esm/offchain/GearboxAPI.js +5 -0
- package/dist/esm/offchain/analytics/OffchainAnalytics.js +11 -0
- package/dist/esm/offchain/analytics/OffchainAnalyticsPositions.js +23 -0
- package/dist/esm/offchain/analytics/index.js +4 -0
- package/dist/esm/offchain/index.js +4 -1
- package/dist/esm/rewards/errors.js +26 -0
- package/dist/esm/rewards/index.js +4 -5
- package/dist/esm/rewards/merkl-api.js +42 -0
- package/dist/esm/rewards/multichain.js +39 -0
- package/dist/esm/rewards/{rewards/api.js → toMerklRewards.js} +26 -28
- package/dist/esm/sdk/GearboxSDK.js +5 -0
- package/dist/esm/sdk/analytics/AnalyticsNamespace.js +10 -0
- package/dist/esm/sdk/analytics/index.js +3 -0
- package/dist/esm/sdk/index.js +3 -1
- package/dist/types/dev/mode-parity/compareOpportunities.d.ts +3 -7
- package/dist/types/dev/mode-parity/comparePositions.d.ts +4 -8
- package/dist/types/dev/mode-parity/fieldDiff.d.ts +9 -8
- package/dist/types/dev/mode-parity/scriptUtils.d.ts +26 -1
- package/dist/types/model/analytics.d.ts +62 -0
- package/dist/types/model/analytics.schema.d.ts +149 -0
- package/dist/types/model/index.d.ts +10 -8
- package/dist/types/model/opportunities.d.ts +1 -1
- package/dist/types/model/previews.d.ts +2 -2
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
- package/dist/types/offchain/GearboxAPI.d.ts +4 -0
- package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +11 -0
- package/dist/types/offchain/analytics/OffchainAnalyticsPositions.d.ts +14 -0
- package/dist/types/offchain/analytics/index.d.ts +4 -0
- package/dist/types/offchain/analytics/types.d.ts +17 -0
- package/dist/types/offchain/index.d.ts +5 -1
- 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/rewards/errors.d.ts +18 -0
- package/dist/types/rewards/index.d.ts +4 -7
- package/dist/types/rewards/merkl-api.d.ts +64 -0
- package/dist/types/rewards/multichain.d.ts +33 -0
- package/dist/types/rewards/toMerklRewards.d.ts +42 -0
- package/dist/types/sdk/GearboxSDK.d.ts +4 -0
- package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +11 -0
- package/dist/types/sdk/analytics/index.d.ts +3 -0
- package/dist/types/sdk/analytics/types.d.ts +15 -0
- package/dist/types/sdk/index.d.ts +4 -1
- 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/dist/types/sdk/types.d.ts +3 -0
- package/package.json +1 -3
- package/dist/cjs/_virtual/_rolldown/runtime.js +0 -23
- package/dist/cjs/rewards/apy/index.js +0 -3
- package/dist/cjs/rewards/rewards/extra-apy.js +0 -71
- package/dist/cjs/rewards/rewards/index.js +0 -6
- package/dist/cjs/rewards/rewards/merkl-api.js +0 -22
- package/dist/esm/rewards/apy/index.js +0 -3
- package/dist/esm/rewards/rewards/extra-apy.js +0 -67
- package/dist/esm/rewards/rewards/index.js +0 -3
- package/dist/esm/rewards/rewards/merkl-api.js +0 -19
- package/dist/types/rewards/apy/index.d.ts +0 -3
- package/dist/types/rewards/apy/output-details.d.ts +0 -99
- package/dist/types/rewards/apy/output.d.ts +0 -25
- package/dist/types/rewards/rewards/api.d.ts +0 -60
- package/dist/types/rewards/rewards/common.d.ts +0 -9
- package/dist/types/rewards/rewards/extra-apy.d.ts +0 -37
- package/dist/types/rewards/rewards/index.d.ts +0 -3
- package/dist/types/rewards/rewards/merkl-api.d.ts +0 -54
- /package/dist/cjs/{rewards/apy/output-details.js → model/analytics.js} +0 -0
- /package/dist/cjs/{rewards/apy/output.js → offchain/analytics/types.js} +0 -0
- /package/dist/cjs/{rewards/rewards/common.js → sdk/analytics/types.js} +0 -0
- /package/dist/esm/{rewards/apy/output-details.js → model/analytics.js} +0 -0
- /package/dist/esm/{rewards/apy/output.js → offchain/analytics/types.js} +0 -0
- /package/dist/esm/{rewards/rewards/common.js → sdk/analytics/types.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_model_opportunities = require("../../model/opportunities.js");
|
|
3
2
|
const require_model_opportunities_schema = require("../../model/opportunities.schema.js");
|
|
3
|
+
const require_model_opportunities = require("../../model/opportunities.js");
|
|
4
4
|
require("../../model/index.js");
|
|
5
5
|
const require_dev_mode_parity_fieldDiff = require("./fieldDiff.js");
|
|
6
6
|
const require_dev_mode_parity_compareRules = require("./compareRules.js");
|
|
@@ -15,8 +15,8 @@ const tagDiff = require_dev_mode_parity_compareRules.makeTagDiff({
|
|
|
15
15
|
*
|
|
16
16
|
* Nothing is filtered out. A field only the backend can fill, or a USD value
|
|
17
17
|
* that drifted within snapshot-lag noise, is still reported — tagged
|
|
18
|
-
* {@link FieldDiff.expected} so that {@link CompareCounts.
|
|
19
|
-
*
|
|
18
|
+
* {@link FieldDiff.expected} so that {@link CompareCounts.similar} can ignore
|
|
19
|
+
* it.
|
|
20
20
|
**/
|
|
21
21
|
function compareOpportunities(input) {
|
|
22
22
|
const onchainRows = indexById(input.onchain.data);
|
|
@@ -37,8 +37,7 @@ function compareOpportunities(input) {
|
|
|
37
37
|
chainId: row.chainId,
|
|
38
38
|
onchainName: row.name,
|
|
39
39
|
offchainName: counterpart.name,
|
|
40
|
-
|
|
41
|
-
clean: diffs.every((diff) => diff.expected),
|
|
40
|
+
similar: diffs.every((diff) => diff.expected),
|
|
42
41
|
diffs
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_model_liquidations_schema = require("../../model/liquidations.schema.js");
|
|
3
|
-
const require_model_positions = require("../../model/positions.js");
|
|
4
3
|
const require_model_positions_schema = require("../../model/positions.schema.js");
|
|
4
|
+
const require_model_positions = require("../../model/positions.js");
|
|
5
5
|
require("../../model/index.js");
|
|
6
6
|
const require_dev_mode_parity_fieldDiff = require("./fieldDiff.js");
|
|
7
7
|
const require_dev_mode_parity_compareRules = require("./compareRules.js");
|
|
@@ -18,8 +18,8 @@ const tagDiff = require_dev_mode_parity_compareRules.makeTagDiff({
|
|
|
18
18
|
* Nothing is filtered out. A field only one mode can fill, a strategy field
|
|
19
19
|
* both-mode merge overlays from the backend, or a USD value that drifted
|
|
20
20
|
* within snapshot-lag noise, is still reported — tagged
|
|
21
|
-
* {@link FieldDiff.expected} so that {@link CompareCounts.
|
|
22
|
-
*
|
|
21
|
+
* {@link FieldDiff.expected} so that {@link CompareCounts.similar} can ignore
|
|
22
|
+
* it.
|
|
23
23
|
**/
|
|
24
24
|
function comparePositions(input) {
|
|
25
25
|
const failures = input.failures ?? [];
|
|
@@ -66,8 +66,7 @@ function compareWallet(input) {
|
|
|
66
66
|
chainId: row.chainId,
|
|
67
67
|
onchainName: row.name,
|
|
68
68
|
offchainName: counterpart.name,
|
|
69
|
-
|
|
70
|
-
clean: diffs.every((diff) => diff.expected),
|
|
69
|
+
similar: diffs.every((diff) => diff.expected),
|
|
71
70
|
diffs
|
|
72
71
|
});
|
|
73
72
|
}
|
|
@@ -130,11 +129,11 @@ function summarize(inputs, wallets, failed) {
|
|
|
130
129
|
...wallet.error ? { error: wallet.error } : {},
|
|
131
130
|
...require_dev_mode_parity_fieldDiff.toCompareCounts(wallet.matched.length + wallet.onlyOnchain.length, wallet.matched.length + wallet.onlyOffchain.length, wallet.onlyOnchain.length, wallet.onlyOffchain.length, wallet.matched)
|
|
132
131
|
}));
|
|
133
|
-
const
|
|
132
|
+
const walletsSimilar = compared.filter((wallet) => wallet.onlyOnchain.length === 0 && wallet.onlyOffchain.length === 0 && wallet.matched.every((match) => match.similar)).length;
|
|
134
133
|
return {
|
|
135
134
|
...require_dev_mode_parity_fieldDiff.toCompareCounts(allOnchain.length, allOffchain.length, onlyOnchain.length, onlyOffchain.length, matched),
|
|
136
135
|
wallets: wallets.length,
|
|
137
|
-
|
|
136
|
+
walletsSimilar,
|
|
138
137
|
walletsFailed: failed,
|
|
139
138
|
byChain,
|
|
140
139
|
byWallet,
|
|
@@ -54,7 +54,7 @@ function diffObjects(onchain, offchain, options) {
|
|
|
54
54
|
return diffs;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Mark a diff expected, so a later `
|
|
57
|
+
* Mark a diff expected, so a later `similar` count can ignore it.
|
|
58
58
|
**/
|
|
59
59
|
function withExpected(diff, reason) {
|
|
60
60
|
return {
|
|
@@ -118,15 +118,13 @@ function collapseArrayKeys(path) {
|
|
|
118
118
|
* Membership and match totals of one comparison, from already-built lists.
|
|
119
119
|
**/
|
|
120
120
|
function toCompareCounts(onchainRows, offchainRows, onlyOnchain, onlyOffchain, matched) {
|
|
121
|
-
const
|
|
122
|
-
const clean = matched.filter((match) => match.clean).length;
|
|
121
|
+
const similar = matched.filter((match) => match.similar).length;
|
|
123
122
|
return {
|
|
124
123
|
onchainRows,
|
|
125
124
|
offchainRows,
|
|
126
125
|
matched: matched.length,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
differing: matched.length - identical,
|
|
126
|
+
similar,
|
|
127
|
+
different: matched.length - similar,
|
|
130
128
|
onlyOnchain,
|
|
131
129
|
onlyOffchain
|
|
132
130
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_dev_providers = require("../providers.js");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
3
4
|
let pino = require("pino");
|
|
4
5
|
//#region src/dev/mode-parity/scriptUtils.ts
|
|
5
6
|
const NETWORKS = [
|
|
@@ -77,6 +78,40 @@ function worstColumns(worst) {
|
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
81
|
+
* Reasons a compare run should fail CI: unexpected membership or field diffs,
|
|
82
|
+
* both sources empty, a chain that could not be read, or wallets that failed
|
|
83
|
+
* to list. Expected diffs (mode-scoped, backend-preferred, tolerance) do not
|
|
84
|
+
* fail the run.
|
|
85
|
+
**/
|
|
86
|
+
function evaluateCompareFailure(report) {
|
|
87
|
+
const { summary } = report;
|
|
88
|
+
const reasons = [];
|
|
89
|
+
if (summary.onchainRows === 0 && summary.offchainRows === 0) reasons.push("both sources produced no data");
|
|
90
|
+
if (summary.different > 0) reasons.push(`${summary.different} matched rows are different`);
|
|
91
|
+
if (summary.onlyOnchain > 0) reasons.push(`${summary.onlyOnchain} rows only onchain`);
|
|
92
|
+
if (summary.onlyOffchain > 0) reasons.push(`${summary.onlyOffchain} rows only offchain`);
|
|
93
|
+
if ((summary.walletsFailed ?? 0) > 0) reasons.push(`${summary.walletsFailed} wallets failed to list`);
|
|
94
|
+
for (const chain of [...report.onchainChains, ...report.offchainChains]) if (chain.status === "error") reasons.push(`chain ${chain.chainId} failed on ${chain.source ?? "unknown"}: ${errorMessage(chain.error)}`);
|
|
95
|
+
return reasons;
|
|
96
|
+
}
|
|
97
|
+
function splitDiffs(summary) {
|
|
98
|
+
return {
|
|
99
|
+
unexpected: summary.diffsByPath.filter((entry) => entry.unexpected > 0),
|
|
100
|
+
expected: summary.diffsByPath.filter((entry) => entry.unexpected === 0 && entry.expected > 0)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function markdownCell(value) {
|
|
104
|
+
return String(value).replaceAll("|", "\\|").replaceAll("\n", " ");
|
|
105
|
+
}
|
|
106
|
+
function markdownTable(headers, rows) {
|
|
107
|
+
const line = (cells) => `| ${cells.map(markdownCell).join(" | ")} |`;
|
|
108
|
+
return [
|
|
109
|
+
line(headers),
|
|
110
|
+
line(headers.map(() => "---")),
|
|
111
|
+
...rows.map(line)
|
|
112
|
+
].join("\n");
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
80
115
|
* Prints the shared membership table, the fields that differed most often,
|
|
81
116
|
* and any chain that failed to answer.
|
|
82
117
|
**/
|
|
@@ -88,15 +123,13 @@ function printCompareSummary(noun, report, extraLines = []) {
|
|
|
88
123
|
onchain: chain.onchainRows,
|
|
89
124
|
offchain: chain.offchainRows,
|
|
90
125
|
matched: chain.matched,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
differing: chain.differing,
|
|
126
|
+
similar: chain.similar,
|
|
127
|
+
different: chain.different,
|
|
94
128
|
"only onchain": chain.onlyOnchain,
|
|
95
129
|
"only offchain": chain.onlyOffchain
|
|
96
130
|
})));
|
|
97
131
|
for (const line of extraLines) console.log(line);
|
|
98
|
-
const unexpected = summary
|
|
99
|
-
const expected = summary.diffsByPath.filter((entry) => entry.unexpected === 0 && entry.expected > 0);
|
|
132
|
+
const { unexpected, expected } = splitDiffs(summary);
|
|
100
133
|
if (unexpected.length) {
|
|
101
134
|
console.log("\nunexpected fields that differed most often:");
|
|
102
135
|
console.table(unexpected.slice(0, 25).map((entry) => ({
|
|
@@ -118,14 +151,121 @@ function printCompareSummary(noun, report, extraLines = []) {
|
|
|
118
151
|
}
|
|
119
152
|
for (const chain of [...report.onchainChains, ...report.offchainChains]) if (chain.status === "error") console.log(`chain ${chain.chainId} failed on ${chain.source}:`, chain.error);
|
|
120
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Markdown of the same summary printed to the console, for GitHub job summaries.
|
|
156
|
+
**/
|
|
157
|
+
function formatCompareMarkdown(noun, report, extraLines = [], reasons = []) {
|
|
158
|
+
const { summary } = report;
|
|
159
|
+
const { unexpected, expected } = splitDiffs(summary);
|
|
160
|
+
const parts = [
|
|
161
|
+
`# ${noun} compare`,
|
|
162
|
+
"",
|
|
163
|
+
reasons.length ? "**Failed**" : "**Passed**",
|
|
164
|
+
"",
|
|
165
|
+
`${noun} from \`${report.backendUrl}\` vs the chain`,
|
|
166
|
+
""
|
|
167
|
+
];
|
|
168
|
+
if (reasons.length) {
|
|
169
|
+
parts.push("## Failures", "");
|
|
170
|
+
for (const reason of reasons) parts.push(`- ${reason}`);
|
|
171
|
+
parts.push("");
|
|
172
|
+
}
|
|
173
|
+
if (extraLines.length) {
|
|
174
|
+
for (const line of extraLines) parts.push(line);
|
|
175
|
+
parts.push("");
|
|
176
|
+
}
|
|
177
|
+
if (summary.byChain.length) parts.push(markdownTable([
|
|
178
|
+
"chain",
|
|
179
|
+
"onchain",
|
|
180
|
+
"offchain",
|
|
181
|
+
"matched",
|
|
182
|
+
"similar",
|
|
183
|
+
"different",
|
|
184
|
+
"only onchain",
|
|
185
|
+
"only offchain"
|
|
186
|
+
], summary.byChain.map((chain) => [
|
|
187
|
+
chain.chainId,
|
|
188
|
+
chain.onchainRows,
|
|
189
|
+
chain.offchainRows,
|
|
190
|
+
chain.matched,
|
|
191
|
+
chain.similar,
|
|
192
|
+
chain.different,
|
|
193
|
+
chain.onlyOnchain,
|
|
194
|
+
chain.onlyOffchain
|
|
195
|
+
])), "");
|
|
196
|
+
if (unexpected.length) parts.push("## Unexpected fields that differed most often", "", markdownTable([
|
|
197
|
+
"field",
|
|
198
|
+
"unexpected",
|
|
199
|
+
"expected",
|
|
200
|
+
"kinds",
|
|
201
|
+
"max diff",
|
|
202
|
+
"worst entity"
|
|
203
|
+
], unexpected.slice(0, 25).map((entry) => {
|
|
204
|
+
const worst = worstColumns(entry.worstUnexpected);
|
|
205
|
+
return [
|
|
206
|
+
entry.path,
|
|
207
|
+
entry.unexpected,
|
|
208
|
+
entry.expected,
|
|
209
|
+
entry.kinds.join(", "),
|
|
210
|
+
worst["max diff"],
|
|
211
|
+
worst["worst entity"]
|
|
212
|
+
];
|
|
213
|
+
})), "");
|
|
214
|
+
if (expected.length) parts.push("## Expected fields (mode-scoped, backend-preferred, or within tolerance)", "", markdownTable([
|
|
215
|
+
"field",
|
|
216
|
+
"rows",
|
|
217
|
+
"kinds",
|
|
218
|
+
"max diff",
|
|
219
|
+
"worst entity"
|
|
220
|
+
], expected.slice(0, 25).map((entry) => {
|
|
221
|
+
const worst = worstColumns(entry.worstExpected);
|
|
222
|
+
return [
|
|
223
|
+
entry.path,
|
|
224
|
+
entry.expected,
|
|
225
|
+
entry.kinds.join(", "),
|
|
226
|
+
worst["max diff"],
|
|
227
|
+
worst["worst entity"]
|
|
228
|
+
];
|
|
229
|
+
})), "");
|
|
230
|
+
const failedChains = [...report.onchainChains, ...report.offchainChains].filter((chain) => chain.status === "error");
|
|
231
|
+
if (failedChains.length) {
|
|
232
|
+
parts.push("## Chain errors", "");
|
|
233
|
+
for (const chain of failedChains) parts.push(`- chain ${chain.chainId} failed on ${chain.source ?? "unknown"}: ${errorMessage(chain.error)}`);
|
|
234
|
+
parts.push("");
|
|
235
|
+
}
|
|
236
|
+
return parts.join("\n");
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Appends {@link formatCompareMarkdown} to `GITHUB_STEP_SUMMARY` when running
|
|
240
|
+
* in GitHub Actions. No-op locally.
|
|
241
|
+
**/
|
|
242
|
+
function writeGithubJobSummary(noun, report, extraLines = [], reasons = []) {
|
|
243
|
+
const path = process.env.GITHUB_STEP_SUMMARY;
|
|
244
|
+
if (!path) return;
|
|
245
|
+
(0, node_fs.appendFileSync)(path, `${formatCompareMarkdown(noun, report, extraLines, reasons)}\n`);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Console + job-summary output for a compare run. Returns the failure reasons
|
|
249
|
+
* so the caller can exit 1 when the report is not similar.
|
|
250
|
+
**/
|
|
251
|
+
function reportCompare(noun, report, extraLines = []) {
|
|
252
|
+
printCompareSummary(noun, report, extraLines);
|
|
253
|
+
const reasons = evaluateCompareFailure(report);
|
|
254
|
+
writeGithubJobSummary(noun, report, extraLines, reasons);
|
|
255
|
+
return reasons;
|
|
256
|
+
}
|
|
121
257
|
//#endregion
|
|
122
258
|
exports.BACKEND_URL = BACKEND_URL;
|
|
123
259
|
exports.NETWORKS = NETWORKS;
|
|
124
260
|
exports.TIMEOUT = TIMEOUT;
|
|
125
261
|
exports.createLogger = createLogger;
|
|
126
262
|
exports.errorMessage = errorMessage;
|
|
263
|
+
exports.evaluateCompareFailure = evaluateCompareFailure;
|
|
127
264
|
exports.formatBpsAsPercent = formatBpsAsPercent;
|
|
265
|
+
exports.formatCompareMarkdown = formatCompareMarkdown;
|
|
128
266
|
exports.mapPool = mapPool;
|
|
129
267
|
exports.printCompareSummary = printCompareSummary;
|
|
268
|
+
exports.reportCompare = reportCompare;
|
|
130
269
|
exports.requireEnv = requireEnv;
|
|
131
270
|
exports.rpcUrls = rpcUrls;
|
|
271
|
+
exports.writeGithubJobSummary = writeGithubJobSummary;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
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
|
+
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
6
|
+
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
7
|
+
const require_model_positions_schema = require("./positions.schema.js");
|
|
8
|
+
let viem = require("viem");
|
|
9
|
+
let zod_v4 = require("zod/v4");
|
|
10
|
+
//#region src/model/analytics.schema.ts
|
|
11
|
+
/** Default page size of the protocol-wide positions list. */
|
|
12
|
+
const ANALYTICS_POSITIONS_DEFAULT_LIMIT = 25;
|
|
13
|
+
/** Largest page the protocol-wide positions list accepts. */
|
|
14
|
+
const ANALYTICS_POSITIONS_MAX_LIMIT = 100;
|
|
15
|
+
/** {@link AnalyticsPositionSortField} */
|
|
16
|
+
const analyticsPositionSortFieldSchema = zod_v4.z.enum([
|
|
17
|
+
"netValueUsd",
|
|
18
|
+
"totalValueUsd",
|
|
19
|
+
"totalDebtUsd",
|
|
20
|
+
"pnlUsd",
|
|
21
|
+
"apy",
|
|
22
|
+
"healthFactor",
|
|
23
|
+
"leverage",
|
|
24
|
+
"chainId",
|
|
25
|
+
"name",
|
|
26
|
+
"borrower"
|
|
27
|
+
]);
|
|
28
|
+
/** {@link AnalyticsSortDirection} */
|
|
29
|
+
const analyticsSortDirectionSchema = zod_v4.z.enum(["asc", "desc"]);
|
|
30
|
+
const analyticsOwnerShape = { borrower: require_onchain_utils_zod.ZodAddress() };
|
|
31
|
+
const addressSchema = zod_v4.z.custom((value) => typeof value === "string" && (0, viem.isAddress)(value, { strict: false }));
|
|
32
|
+
/** {@link AnalyticsPosition} */
|
|
33
|
+
const analyticsPositionSchema = zod_v4.z.discriminatedUnion("kind", [
|
|
34
|
+
zod_v4.z.object({
|
|
35
|
+
...require_model_positions_schema.poolPositionSchema.shape,
|
|
36
|
+
...analyticsOwnerShape
|
|
37
|
+
}),
|
|
38
|
+
zod_v4.z.object({
|
|
39
|
+
...require_model_positions_schema.strategyPositionSchema.shape,
|
|
40
|
+
...analyticsOwnerShape
|
|
41
|
+
}),
|
|
42
|
+
zod_v4.z.object({
|
|
43
|
+
...require_model_liquidations_schema.liquidationPositionSchema.shape,
|
|
44
|
+
...analyticsOwnerShape
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
/** {@link AnalyticsPositionListOptions} */
|
|
48
|
+
const analyticsPositionListOptionsSchema = zod_v4.z.object({
|
|
49
|
+
borrower: addressSchema.optional(),
|
|
50
|
+
kind: require_model_filters_schema.filterable(require_model_positions_schema.positionKindSchema).optional(),
|
|
51
|
+
isZeroDebt: require_model_filters_schema.filterable(zod_v4.z.boolean()).optional(),
|
|
52
|
+
chainIds: zod_v4.z.array(require_model_primitives_schema.chainIdSchema).optional(),
|
|
53
|
+
underlyingType: require_model_filters_schema.filterable(require_model_primitives_schema.assetTypeSchema).optional(),
|
|
54
|
+
sortBy: analyticsPositionSortFieldSchema.optional(),
|
|
55
|
+
sortDirection: analyticsSortDirectionSchema.optional(),
|
|
56
|
+
offset: zod_v4.z.number().int().nonnegative().optional(),
|
|
57
|
+
limit: zod_v4.z.number().int().positive().max(100).optional()
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* {@link AnalyticsPositionListOptions} as URL query parameters.
|
|
61
|
+
**/
|
|
62
|
+
const analyticsPositionListQueryParamsSchema = zod_v4.z.object({
|
|
63
|
+
borrower: zod_v4.z.string().refine((value) => (0, viem.isAddress)(value, { strict: false }), "invalid address").optional(),
|
|
64
|
+
kind: require_model_positions_schema.positionKindSchema.optional(),
|
|
65
|
+
isZeroDebt: zod_v4.z.enum(["true", "false"]).optional(),
|
|
66
|
+
chainIds: zod_v4.z.string().regex(/^$|^\d+(,\d+)*$/).optional(),
|
|
67
|
+
underlyingType: require_model_primitives_schema.assetTypeSchema.optional(),
|
|
68
|
+
sortBy: analyticsPositionSortFieldSchema.optional(),
|
|
69
|
+
sortDirection: analyticsSortDirectionSchema.optional(),
|
|
70
|
+
offset: zod_v4.z.string().regex(/^\d+$/).optional(),
|
|
71
|
+
limit: zod_v4.z.string().regex(/^[1-9]\d*$/).optional()
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Codec for an analytics position-list query. It is shared by the SDK client
|
|
75
|
+
* and backend controller so both sides interpret every parameter identically.
|
|
76
|
+
**/
|
|
77
|
+
const analyticsPositionListQuerySchema = zod_v4.z.codec(analyticsPositionListQueryParamsSchema, analyticsPositionListOptionsSchema, {
|
|
78
|
+
decode: (params) => ({
|
|
79
|
+
...params.borrower === void 0 ? {} : { borrower: params.borrower },
|
|
80
|
+
...params.kind === void 0 ? {} : { kind: params.kind },
|
|
81
|
+
...params.isZeroDebt === void 0 ? {} : { isZeroDebt: params.isZeroDebt === "true" },
|
|
82
|
+
...params.chainIds === void 0 ? {} : { chainIds: params.chainIds === "" ? [] : params.chainIds.split(",").map(Number) },
|
|
83
|
+
...params.underlyingType === void 0 ? {} : { underlyingType: params.underlyingType },
|
|
84
|
+
...params.sortBy === void 0 ? {} : { sortBy: params.sortBy },
|
|
85
|
+
...params.sortDirection === void 0 ? {} : { sortDirection: params.sortDirection },
|
|
86
|
+
...params.offset === void 0 ? {} : { offset: Number(params.offset) },
|
|
87
|
+
...params.limit === void 0 ? {} : { limit: Number(params.limit) }
|
|
88
|
+
}),
|
|
89
|
+
encode: (options) => ({
|
|
90
|
+
borrower: options.borrower,
|
|
91
|
+
kind: require_model_filters.isFilterSet(options.kind) ? options.kind : void 0,
|
|
92
|
+
isZeroDebt: require_model_filters_schema.encodeFlag(options.isZeroDebt),
|
|
93
|
+
chainIds: options.chainIds?.join(","),
|
|
94
|
+
underlyingType: require_model_filters.isFilterSet(options.underlyingType) ? options.underlyingType : void 0,
|
|
95
|
+
sortBy: options.sortBy,
|
|
96
|
+
sortDirection: options.sortDirection,
|
|
97
|
+
offset: options.offset?.toString(),
|
|
98
|
+
limit: options.limit?.toString()
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
/** {@link AnalyticsPositionPage} */
|
|
102
|
+
const analyticsPositionPageSchema = zod_v4.z.object({
|
|
103
|
+
items: zod_v4.z.array(analyticsPositionSchema),
|
|
104
|
+
total: zod_v4.z.number().int().nonnegative(),
|
|
105
|
+
offset: zod_v4.z.number().int().nonnegative(),
|
|
106
|
+
limit: zod_v4.z.number().int().positive().max(100)
|
|
107
|
+
});
|
|
108
|
+
//#endregion
|
|
109
|
+
exports.ANALYTICS_POSITIONS_DEFAULT_LIMIT = ANALYTICS_POSITIONS_DEFAULT_LIMIT;
|
|
110
|
+
exports.ANALYTICS_POSITIONS_MAX_LIMIT = ANALYTICS_POSITIONS_MAX_LIMIT;
|
|
111
|
+
exports.analyticsPositionListOptionsSchema = analyticsPositionListOptionsSchema;
|
|
112
|
+
exports.analyticsPositionListQueryParamsSchema = analyticsPositionListQueryParamsSchema;
|
|
113
|
+
exports.analyticsPositionListQuerySchema = analyticsPositionListQuerySchema;
|
|
114
|
+
exports.analyticsPositionPageSchema = analyticsPositionPageSchema;
|
|
115
|
+
exports.analyticsPositionSchema = analyticsPositionSchema;
|
|
116
|
+
exports.analyticsPositionSortFieldSchema = analyticsPositionSortFieldSchema;
|
|
117
|
+
exports.analyticsSortDirectionSchema = analyticsSortDirectionSchema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_model_charts = require("./charts.js");
|
|
3
2
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
3
|
+
const require_model_charts = require("./charts.js");
|
|
4
4
|
let zod_v4 = require("zod/v4");
|
|
5
5
|
//#region src/model/charts.schema.ts
|
|
6
6
|
/**
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
require("./analytics.js");
|
|
3
|
+
const require_model_filters = require("./filters.js");
|
|
4
|
+
const require_model_filters_schema = require("./filters.schema.js");
|
|
3
5
|
const require_model_compare_schema = require("./compare.schema.js");
|
|
6
|
+
const require_model_curators_schema = require("./curators.schema.js");
|
|
4
7
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
8
|
+
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
9
|
+
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
10
|
+
const require_model_positions_schema = require("./positions.schema.js");
|
|
11
|
+
const require_model_analytics_schema = require("./analytics.schema.js");
|
|
12
|
+
const require_model_charts = require("./charts.js");
|
|
5
13
|
const require_model_charts_schema = require("./charts.schema.js");
|
|
6
14
|
require("./curators.js");
|
|
7
|
-
const require_model_curators_schema = require("./curators.schema.js");
|
|
8
15
|
require("./delayed-intents.js");
|
|
9
16
|
require("./errors.js");
|
|
10
|
-
const require_model_filters = require("./filters.js");
|
|
11
|
-
const require_model_filters_schema = require("./filters.schema.js");
|
|
12
17
|
const require_model_liquidations = require("./liquidations.js");
|
|
13
|
-
const require_model_liquidations_schema = require("./liquidations.schema.js");
|
|
14
18
|
require("./notices.js");
|
|
15
19
|
const require_model_notices_schema = require("./notices.schema.js");
|
|
16
20
|
const require_model_opportunities = require("./opportunities.js");
|
|
17
|
-
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
18
21
|
const require_model_positions = require("./positions.js");
|
|
19
|
-
const require_model_positions_schema = require("./positions.schema.js");
|
|
20
22
|
const require_model_previews = require("./previews.js");
|
|
21
23
|
require("./primitives.js");
|
|
22
24
|
require("./response.js");
|
|
@@ -24,6 +26,8 @@ const require_model_response_schema = require("./response.schema.js");
|
|
|
24
26
|
const require_model_result = require("./result.js");
|
|
25
27
|
require("./withdrawals.js");
|
|
26
28
|
const require_model_withdrawals_schema = require("./withdrawals.schema.js");
|
|
29
|
+
exports.ANALYTICS_POSITIONS_DEFAULT_LIMIT = require_model_analytics_schema.ANALYTICS_POSITIONS_DEFAULT_LIMIT;
|
|
30
|
+
exports.ANALYTICS_POSITIONS_MAX_LIMIT = require_model_analytics_schema.ANALYTICS_POSITIONS_MAX_LIMIT;
|
|
27
31
|
exports.CHART_METRIC_UNITS = require_model_charts.CHART_METRIC_UNITS;
|
|
28
32
|
exports.CHART_RANGES = require_model_charts.CHART_RANGES;
|
|
29
33
|
exports.CHART_UNAVAILABLE_CODES = require_model_charts.CHART_UNAVAILABLE_CODES;
|
|
@@ -34,6 +38,13 @@ exports.STRATEGY_OPPORTUNITY_CHART_METRICS = require_model_charts.STRATEGY_OPPOR
|
|
|
34
38
|
exports.STRATEGY_POSITION_CHART_METRICS = require_model_charts.STRATEGY_POSITION_CHART_METRICS;
|
|
35
39
|
exports.STRATEGY_POSITION_COLLATERAL_ERROR = require_model_positions.STRATEGY_POSITION_COLLATERAL_ERROR;
|
|
36
40
|
exports.amountSchema = require_model_primitives_schema.amountSchema;
|
|
41
|
+
exports.analyticsPositionListOptionsSchema = require_model_analytics_schema.analyticsPositionListOptionsSchema;
|
|
42
|
+
exports.analyticsPositionListQueryParamsSchema = require_model_analytics_schema.analyticsPositionListQueryParamsSchema;
|
|
43
|
+
exports.analyticsPositionListQuerySchema = require_model_analytics_schema.analyticsPositionListQuerySchema;
|
|
44
|
+
exports.analyticsPositionPageSchema = require_model_analytics_schema.analyticsPositionPageSchema;
|
|
45
|
+
exports.analyticsPositionSchema = require_model_analytics_schema.analyticsPositionSchema;
|
|
46
|
+
exports.analyticsPositionSortFieldSchema = require_model_analytics_schema.analyticsPositionSortFieldSchema;
|
|
47
|
+
exports.analyticsSortDirectionSchema = require_model_analytics_schema.analyticsSortDirectionSchema;
|
|
37
48
|
exports.apyBreakdownSchema = require_model_opportunities_schema.apyBreakdownSchema;
|
|
38
49
|
exports.asEstimated = require_model_previews.asEstimated;
|
|
39
50
|
exports.assetTypeSchema = require_model_primitives_schema.assetTypeSchema;
|
|
@@ -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");
|
|
4
|
-
const require_model_curators_schema = require("./curators.schema.js");
|
|
5
3
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
4
|
+
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");
|
|
5
|
-
const require_model_curators_schema = require("./curators.schema.js");
|
|
6
3
|
const require_model_filters = require("./filters.js");
|
|
7
4
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
5
|
+
const require_model_compare_schema = require("./compare.schema.js");
|
|
6
|
+
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_compare_schema = require("./compare.schema.js");
|
|
4
|
-
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
5
3
|
const require_model_filters = require("./filters.js");
|
|
6
4
|
const require_model_filters_schema = require("./filters.schema.js");
|
|
5
|
+
const require_model_compare_schema = require("./compare.schema.js");
|
|
6
|
+
const require_model_primitives_schema = require("./primitives.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,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_offchain_analytics_OffchainAnalytics = require("./analytics/OffchainAnalytics.js");
|
|
3
|
+
require("./analytics/index.js");
|
|
2
4
|
const require_offchain_notices_OffchainNotices = require("./notices/OffchainNotices.js");
|
|
3
5
|
require("./notices/index.js");
|
|
4
6
|
const require_offchain_opportunities_OffchainOpportunities = require("./opportunities/OffchainOpportunities.js");
|
|
@@ -28,6 +30,8 @@ var GearboxAPI = class {
|
|
|
28
30
|
* Chains every read of this client is scoped to.
|
|
29
31
|
**/
|
|
30
32
|
chainIds;
|
|
33
|
+
/** Protocol-wide, backend-only analytics. */
|
|
34
|
+
analytics;
|
|
31
35
|
/**
|
|
32
36
|
* Namespace for pool and strategy opportunities.
|
|
33
37
|
**/
|
|
@@ -42,6 +46,7 @@ var GearboxAPI = class {
|
|
|
42
46
|
notices;
|
|
43
47
|
constructor(options) {
|
|
44
48
|
this.chainIds = [...options.chainIds];
|
|
49
|
+
this.analytics = new require_offchain_analytics_OffchainAnalytics.OffchainAnalytics(options);
|
|
45
50
|
this.opportunities = new require_offchain_opportunities_OffchainOpportunities.OffchainOpportunities(options);
|
|
46
51
|
this.positions = new require_offchain_positions_OffchainPositions.OffchainPositions(options);
|
|
47
52
|
this.notices = new require_offchain_notices_OffchainNotices.OffchainNotices(options);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_offchain_analytics_OffchainAnalyticsPositions = require("./OffchainAnalyticsPositions.js");
|
|
3
|
+
//#region src/offchain/analytics/OffchainAnalytics.ts
|
|
4
|
+
/** Backend-only protocol analytics, grouped by subject. */
|
|
5
|
+
var OffchainAnalytics = class {
|
|
6
|
+
positions;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.positions = new require_offchain_analytics_OffchainAnalyticsPositions.OffchainAnalyticsPositions(options);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.OffchainAnalytics = OffchainAnalytics;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_analytics_schema = require("../../model/analytics.schema.js");
|
|
3
|
+
const require_offchain_AbstractOffchainNamespace = require("../AbstractOffchainNamespace.js");
|
|
4
|
+
let zod_v4 = require("zod/v4");
|
|
5
|
+
//#region src/offchain/analytics/OffchainAnalyticsPositions.ts
|
|
6
|
+
/** Backend client for protocol-wide position analytics. */
|
|
7
|
+
var OffchainAnalyticsPositions = class extends require_offchain_AbstractOffchainNamespace.AbstractOffchainNamespace {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super("OffchainAnalyticsPositions", options);
|
|
10
|
+
}
|
|
11
|
+
/** {@inheritDoc IOffchainAnalyticsPositions.list} */
|
|
12
|
+
async list(options) {
|
|
13
|
+
return this.get({
|
|
14
|
+
path: "/v2/analytics/positions",
|
|
15
|
+
query: zod_v4.z.encode(require_model_analytics_schema.analyticsPositionListQuerySchema, {
|
|
16
|
+
...options,
|
|
17
|
+
chainIds: this.scopedChainIds(options)
|
|
18
|
+
}),
|
|
19
|
+
schema: require_model_analytics_schema.analyticsPositionPageSchema
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.OffchainAnalyticsPositions = OffchainAnalyticsPositions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_offchain_analytics_OffchainAnalyticsPositions = require("./OffchainAnalyticsPositions.js");
|
|
3
|
+
const require_offchain_analytics_OffchainAnalytics = require("./OffchainAnalytics.js");
|
|
4
|
+
require("./types.js");
|
|
5
|
+
exports.OffchainAnalytics = require_offchain_analytics_OffchainAnalytics.OffchainAnalytics;
|
|
6
|
+
exports.OffchainAnalyticsPositions = require_offchain_analytics_OffchainAnalyticsPositions.OffchainAnalyticsPositions;
|
|
@@ -11,6 +11,9 @@ const require_offchain_errors_OffchainValidationError = require("./errors/Offcha
|
|
|
11
11
|
const require_offchain_errors_readResponseBody = require("./errors/readResponseBody.js");
|
|
12
12
|
require("./errors/index.js");
|
|
13
13
|
const require_offchain_AbstractOffchainNamespace = require("./AbstractOffchainNamespace.js");
|
|
14
|
+
const require_offchain_analytics_OffchainAnalyticsPositions = require("./analytics/OffchainAnalyticsPositions.js");
|
|
15
|
+
const require_offchain_analytics_OffchainAnalytics = require("./analytics/OffchainAnalytics.js");
|
|
16
|
+
require("./analytics/index.js");
|
|
14
17
|
const require_offchain_notices_OffchainNotices = require("./notices/OffchainNotices.js");
|
|
15
18
|
require("./notices/index.js");
|
|
16
19
|
const require_offchain_opportunities_OffchainOpportunities = require("./opportunities/OffchainOpportunities.js");
|
|
@@ -21,6 +24,8 @@ const require_offchain_GearboxAPI = require("./GearboxAPI.js");
|
|
|
21
24
|
require("./types.js");
|
|
22
25
|
exports.AbstractOffchainNamespace = require_offchain_AbstractOffchainNamespace.AbstractOffchainNamespace;
|
|
23
26
|
exports.GearboxAPI = require_offchain_GearboxAPI.GearboxAPI;
|
|
27
|
+
exports.OffchainAnalytics = require_offchain_analytics_OffchainAnalytics.OffchainAnalytics;
|
|
28
|
+
exports.OffchainAnalyticsPositions = require_offchain_analytics_OffchainAnalyticsPositions.OffchainAnalyticsPositions;
|
|
24
29
|
exports.OffchainInvalidJsonError = require_offchain_errors_OffchainInvalidJsonError.OffchainInvalidJsonError;
|
|
25
30
|
exports.OffchainNotConfiguredError = require_offchain_errors_OffchainNotConfiguredError.OffchainNotConfiguredError;
|
|
26
31
|
exports.OffchainNotImplementedError = require_offchain_errors_OffchainNotImplementedError.OffchainNotImplementedError;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let viem = require("viem");
|
|
3
|
+
//#region src/rewards/errors.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when none of Merkl's domains answered for a chain.
|
|
6
|
+
*
|
|
7
|
+
* Everything a reader needs is in the message: this error travels to consumers
|
|
8
|
+
* inside a chain's {@link ChainFailed} metadata, where it is typed `unknown`
|
|
9
|
+
* and may be serialised by something that turns an arbitrary object into `{}`.
|
|
10
|
+
*/
|
|
11
|
+
var MerklRequestFailedError = class extends viem.BaseError {
|
|
12
|
+
name = "MerklRequestFailedError";
|
|
13
|
+
chainId;
|
|
14
|
+
constructor(chainId, path, attempts) {
|
|
15
|
+
super(`Merkl could not be reached for chain ${chainId}.`, {
|
|
16
|
+
cause: attempts.find(([, c]) => c instanceof Error)?.[1],
|
|
17
|
+
metaMessages: attempts.map(([domain, cause]) => `${domain}${path} — ${describe(cause)}`)
|
|
18
|
+
});
|
|
19
|
+
this.chainId = chainId;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function describe(cause) {
|
|
23
|
+
if (cause instanceof Error) return cause.name === "TimeoutError" ? "timed out" : cause.message;
|
|
24
|
+
return String(cause);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.MerklRequestFailedError = MerklRequestFailedError;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.getMerklRewards = require_rewards_rewards_api.getMerklRewards;
|
|
2
|
+
const require_rewards_errors = require("./errors.js");
|
|
3
|
+
const require_rewards_toMerklRewards = require("./toMerklRewards.js");
|
|
4
|
+
const require_rewards_multichain = require("./multichain.js");
|
|
5
|
+
exports.MerklRequestFailedError = require_rewards_errors.MerklRequestFailedError;
|
|
6
|
+
exports.getMerklRewardsMultichain = require_rewards_multichain.getMerklRewardsMultichain;
|
|
7
|
+
exports.toMerklRewards = require_rewards_toMerklRewards.toMerklRewards;
|