@gearbox-protocol/sdk 16.0.0-next.10 → 16.0.0-next.12
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/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +20 -0
- package/dist/cjs/dev/mode-parity/comparePositions.js +3 -2
- package/dist/cjs/dev/mode-parity/compareRules.js +12 -1
- package/dist/cjs/dev/mode-parity/scriptUtils.js +1 -1
- package/dist/cjs/model/compare.schema.js +8 -0
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/model/positions.schema.js +2 -2
- package/dist/esm/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.js +20 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/mode-parity/comparePositions.js +3 -2
- package/dist/esm/dev/mode-parity/compareRules.js +12 -1
- package/dist/esm/dev/mode-parity/scriptUtils.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/compare.schema.js +8 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/model/positions.schema.js +3 -3
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/chain/detectNetwork.js +1 -1
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/pools/PoolService.js +1 -1
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/types/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.d.ts +16 -0
- package/dist/types/dev/mode-parity/comparePositions.d.ts +5 -3
- package/dist/types/dev/mode-parity/fieldDiff.d.ts +3 -1
- package/dist/types/model/compare.schema.d.ts +9 -2
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/model/positions.d.ts +6 -0
- package/package.json +1 -1
|
@@ -80,6 +80,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
80
80
|
internalType: "bytes"
|
|
81
81
|
}]
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
name: "redeemer",
|
|
85
|
+
type: "address",
|
|
86
|
+
internalType: "address"
|
|
87
|
+
},
|
|
83
88
|
{
|
|
84
89
|
name: "extraData",
|
|
85
90
|
type: "bytes",
|
|
@@ -128,6 +133,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
128
133
|
type: "uint256",
|
|
129
134
|
internalType: "uint256"
|
|
130
135
|
},
|
|
136
|
+
{
|
|
137
|
+
name: "redeemer",
|
|
138
|
+
type: "address",
|
|
139
|
+
internalType: "address"
|
|
140
|
+
},
|
|
131
141
|
{
|
|
132
142
|
name: "extraData",
|
|
133
143
|
type: "bytes",
|
|
@@ -205,6 +215,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
205
215
|
internalType: "bytes"
|
|
206
216
|
}]
|
|
207
217
|
},
|
|
218
|
+
{
|
|
219
|
+
name: "redeemer",
|
|
220
|
+
type: "address",
|
|
221
|
+
internalType: "address"
|
|
222
|
+
},
|
|
208
223
|
{
|
|
209
224
|
name: "extraData",
|
|
210
225
|
type: "bytes",
|
|
@@ -253,6 +268,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
253
268
|
type: "uint256",
|
|
254
269
|
internalType: "uint256"
|
|
255
270
|
},
|
|
271
|
+
{
|
|
272
|
+
name: "redeemer",
|
|
273
|
+
type: "address",
|
|
274
|
+
internalType: "address"
|
|
275
|
+
},
|
|
256
276
|
{
|
|
257
277
|
name: "extraData",
|
|
258
278
|
type: "bytes",
|
|
@@ -15,8 +15,9 @@ const tagDiff = require_dev_mode_parity_compareRules.makeTagDiff({
|
|
|
15
15
|
* Matches two position listings per wallet by {@link positionId} and reports
|
|
16
16
|
* every field the two sources disagree on.
|
|
17
17
|
*
|
|
18
|
-
* Nothing is filtered out. A field only one mode can fill,
|
|
19
|
-
*
|
|
18
|
+
* Nothing is filtered out. A field only one mode can fill, a strategy field
|
|
19
|
+
* both-mode merge overlays from the backend, or a USD value that drifted
|
|
20
|
+
* within snapshot-lag noise, is still reported — tagged
|
|
20
21
|
* {@link FieldDiff.expected} so that {@link CompareCounts.clean} can ignore it
|
|
21
22
|
* while {@link CompareCounts.identical} stays strict.
|
|
22
23
|
**/
|
|
@@ -25,15 +25,26 @@ function makeTagDiff(rulesByKind) {
|
|
|
25
25
|
if (!rules) return diff;
|
|
26
26
|
const path = require_dev_mode_parity_fieldDiff.collapseArrayKeys(diff.path);
|
|
27
27
|
if (isModeScoped(path, rules)) return require_dev_mode_parity_fieldDiff.withExpected(diff, "mode-scoped");
|
|
28
|
+
if (isBackendPreferred(path, rules)) return require_dev_mode_parity_fieldDiff.withExpected(diff, "backend-preferred");
|
|
28
29
|
const tag = rules.get(path);
|
|
29
30
|
if (tag && typeof tag === "object" && withinTolerance(tag.tolerance, diff)) return require_dev_mode_parity_fieldDiff.withExpected(diff, "tolerance");
|
|
30
31
|
return diff;
|
|
31
32
|
};
|
|
32
33
|
}
|
|
34
|
+
function pathMatchesRule(path, rulePath) {
|
|
35
|
+
return path === rulePath || path.startsWith(`${rulePath}.`) || path.startsWith(`${rulePath}[`);
|
|
36
|
+
}
|
|
33
37
|
function isModeScoped(path, rules) {
|
|
34
38
|
for (const [rulePath, tag] of rules) {
|
|
35
39
|
if (tag !== "offchainOnly" && tag !== "onchainOnly") continue;
|
|
36
|
-
if (path
|
|
40
|
+
if (pathMatchesRule(path, rulePath)) return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function isBackendPreferred(path, rules) {
|
|
45
|
+
for (const [rulePath, tag] of rules) {
|
|
46
|
+
if (tag !== "backendPreferred") continue;
|
|
47
|
+
if (pathMatchesRule(path, rulePath)) return true;
|
|
37
48
|
}
|
|
38
49
|
return false;
|
|
39
50
|
}
|
|
@@ -108,7 +108,7 @@ function printCompareSummary(noun, report, extraLines = []) {
|
|
|
108
108
|
})));
|
|
109
109
|
}
|
|
110
110
|
if (expected.length) {
|
|
111
|
-
console.log("\nexpected fields (mode-scoped or within tolerance):");
|
|
111
|
+
console.log("\nexpected fields (mode-scoped, backend-preferred, or within tolerance):");
|
|
112
112
|
console.table(expected.slice(0, 25).map((entry) => ({
|
|
113
113
|
field: entry.path,
|
|
114
114
|
rows: entry.expected,
|
|
@@ -13,6 +13,13 @@ function onchainOnly(schema) {
|
|
|
13
13
|
return schema.meta({ compare: "onchainOnly" });
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
+
* Marks a field whose backend value both-mode merge overlays onto the chain
|
|
17
|
+
* row, so a source disagreement is expected.
|
|
18
|
+
**/
|
|
19
|
+
function backendPreferred(schema) {
|
|
20
|
+
return schema.meta({ compare: "backendPreferred" });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
16
23
|
* Marks a numeric field whose two sources may drift within {@link kind}.
|
|
17
24
|
**/
|
|
18
25
|
function tolerance(schema, kind) {
|
|
@@ -27,6 +34,7 @@ function compareTagOf(schema) {
|
|
|
27
34
|
return meta.compare;
|
|
28
35
|
}
|
|
29
36
|
//#endregion
|
|
37
|
+
exports.backendPreferred = backendPreferred;
|
|
30
38
|
exports.compareTagOf = compareTagOf;
|
|
31
39
|
exports.offchainOnly = offchainOnly;
|
|
32
40
|
exports.onchainOnly = onchainOnly;
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.STRATEGY_POSITION_CHART_METRICS = require_model_charts.STRATEGY_POSITION
|
|
|
38
38
|
exports.amountSchema = require_model_primitives_schema.amountSchema;
|
|
39
39
|
exports.apyBreakdownSchema = require_model_opportunities_schema.apyBreakdownSchema;
|
|
40
40
|
exports.assetTypeSchema = require_model_primitives_schema.assetTypeSchema;
|
|
41
|
+
exports.backendPreferred = require_model_compare_schema.backendPreferred;
|
|
41
42
|
exports.booleanParamSchema = require_model_filters_schema.booleanParamSchema;
|
|
42
43
|
exports.borrowRateBreakdownSchema = require_model_positions_schema.borrowRateBreakdownSchema;
|
|
43
44
|
exports.bpsSchema = require_model_primitives_schema.bpsSchema;
|
|
@@ -96,12 +96,12 @@ const borrowRateBreakdownSchema = zod_v4.z.object({
|
|
|
96
96
|
**/
|
|
97
97
|
const strategyPositionSchema = zod_v4.z.object({
|
|
98
98
|
kind: zod_v4.z.literal("strategy"),
|
|
99
|
-
name: zod_v4.z.string(),
|
|
99
|
+
name: require_model_compare_schema.backendPreferred(zod_v4.z.string()),
|
|
100
100
|
chainId: require_model_primitives_schema.chainIdSchema,
|
|
101
101
|
creditManager: require_onchain_utils_zod.ZodAddress(),
|
|
102
102
|
creditAccount: require_onchain_utils_zod.ZodAddress(),
|
|
103
103
|
underlyingToken: require_model_primitives_schema.underlyingTokenSchema,
|
|
104
|
-
targetCollateral: require_model_primitives_schema.tokenSchema.nullable(),
|
|
104
|
+
targetCollateral: require_model_compare_schema.backendPreferred(require_model_primitives_schema.tokenSchema.nullable()),
|
|
105
105
|
leverage: require_model_compare_schema.tolerance(require_model_primitives_schema.leverageSchema, "float"),
|
|
106
106
|
borrowApy: require_model_compare_schema.tolerance(require_model_primitives_schema.bpsSchema, "bps"),
|
|
107
107
|
borrowApyAvg7D: require_model_compare_schema.offchainOnly(require_model_primitives_schema.bpsSchema).optional(),
|
|
@@ -79,6 +79,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
79
79
|
internalType: "bytes"
|
|
80
80
|
}]
|
|
81
81
|
},
|
|
82
|
+
{
|
|
83
|
+
name: "redeemer",
|
|
84
|
+
type: "address",
|
|
85
|
+
internalType: "address"
|
|
86
|
+
},
|
|
82
87
|
{
|
|
83
88
|
name: "extraData",
|
|
84
89
|
type: "bytes",
|
|
@@ -127,6 +132,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
127
132
|
type: "uint256",
|
|
128
133
|
internalType: "uint256"
|
|
129
134
|
},
|
|
135
|
+
{
|
|
136
|
+
name: "redeemer",
|
|
137
|
+
type: "address",
|
|
138
|
+
internalType: "address"
|
|
139
|
+
},
|
|
130
140
|
{
|
|
131
141
|
name: "extraData",
|
|
132
142
|
type: "bytes",
|
|
@@ -204,6 +214,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
204
214
|
internalType: "bytes"
|
|
205
215
|
}]
|
|
206
216
|
},
|
|
217
|
+
{
|
|
218
|
+
name: "redeemer",
|
|
219
|
+
type: "address",
|
|
220
|
+
internalType: "address"
|
|
221
|
+
},
|
|
207
222
|
{
|
|
208
223
|
name: "extraData",
|
|
209
224
|
type: "bytes",
|
|
@@ -252,6 +267,11 @@ const mellowWithdrawalSubcompressorAbi = [
|
|
|
252
267
|
type: "uint256",
|
|
253
268
|
internalType: "uint256"
|
|
254
269
|
},
|
|
270
|
+
{
|
|
271
|
+
name: "redeemer",
|
|
272
|
+
type: "address",
|
|
273
|
+
internalType: "address"
|
|
274
|
+
},
|
|
255
275
|
{
|
|
256
276
|
name: "extraData",
|
|
257
277
|
type: "bytes",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ierc20Abi } from "../abi/iERC20.js";
|
|
1
2
|
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../onchain/utils/AddressMap.js";
|
|
3
4
|
import { AddressSet } from "../onchain/utils/AddressSet.js";
|
|
4
5
|
import { AssetsMap } from "../onchain/utils/AssetsMap.js";
|
|
5
6
|
import { childLogger } from "../onchain/utils/childLogger.js";
|
|
6
|
-
import { ierc20Abi } from "../abi/iERC20.js";
|
|
7
7
|
import "../onchain/constants/addresses.js";
|
|
8
8
|
import { MAX_UINT256, PERCENTAGE_FACTOR } from "../onchain/constants/math.js";
|
|
9
9
|
import { SDKConstruct } from "../onchain/base/SDKConstruct.js";
|
|
@@ -14,8 +14,9 @@ const tagDiff = makeTagDiff({
|
|
|
14
14
|
* Matches two position listings per wallet by {@link positionId} and reports
|
|
15
15
|
* every field the two sources disagree on.
|
|
16
16
|
*
|
|
17
|
-
* Nothing is filtered out. A field only one mode can fill,
|
|
18
|
-
*
|
|
17
|
+
* Nothing is filtered out. A field only one mode can fill, a strategy field
|
|
18
|
+
* both-mode merge overlays from the backend, or a USD value that drifted
|
|
19
|
+
* within snapshot-lag noise, is still reported — tagged
|
|
19
20
|
* {@link FieldDiff.expected} so that {@link CompareCounts.clean} can ignore it
|
|
20
21
|
* while {@link CompareCounts.identical} stays strict.
|
|
21
22
|
**/
|
|
@@ -24,15 +24,26 @@ function makeTagDiff(rulesByKind) {
|
|
|
24
24
|
if (!rules) return diff;
|
|
25
25
|
const path = collapseArrayKeys(diff.path);
|
|
26
26
|
if (isModeScoped(path, rules)) return withExpected(diff, "mode-scoped");
|
|
27
|
+
if (isBackendPreferred(path, rules)) return withExpected(diff, "backend-preferred");
|
|
27
28
|
const tag = rules.get(path);
|
|
28
29
|
if (tag && typeof tag === "object" && withinTolerance(tag.tolerance, diff)) return withExpected(diff, "tolerance");
|
|
29
30
|
return diff;
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
function pathMatchesRule(path, rulePath) {
|
|
34
|
+
return path === rulePath || path.startsWith(`${rulePath}.`) || path.startsWith(`${rulePath}[`);
|
|
35
|
+
}
|
|
32
36
|
function isModeScoped(path, rules) {
|
|
33
37
|
for (const [rulePath, tag] of rules) {
|
|
34
38
|
if (tag !== "offchainOnly" && tag !== "onchainOnly") continue;
|
|
35
|
-
if (path
|
|
39
|
+
if (pathMatchesRule(path, rulePath)) return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
function isBackendPreferred(path, rules) {
|
|
44
|
+
for (const [rulePath, tag] of rules) {
|
|
45
|
+
if (tag !== "backendPreferred") continue;
|
|
46
|
+
if (pathMatchesRule(path, rulePath)) return true;
|
|
36
47
|
}
|
|
37
48
|
return false;
|
|
38
49
|
}
|
|
@@ -107,7 +107,7 @@ function printCompareSummary(noun, report, extraLines = []) {
|
|
|
107
107
|
})));
|
|
108
108
|
}
|
|
109
109
|
if (expected.length) {
|
|
110
|
-
console.log("\nexpected fields (mode-scoped or within tolerance):");
|
|
110
|
+
console.log("\nexpected fields (mode-scoped, backend-preferred, or within tolerance):");
|
|
111
111
|
console.table(expected.slice(0, 25).map((entry) => ({
|
|
112
112
|
field: entry.path,
|
|
113
113
|
rows: entry.expected,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
1
2
|
import { getNetworkType } from "../onchain/chain/chains.js";
|
|
2
3
|
import { getWithdrawalCompressorAddress } from "../onchain/accounts/withdrawal-compressor/addresses.js";
|
|
3
|
-
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import "../onchain/index.js";
|
|
5
5
|
import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
|
|
6
6
|
import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
|
|
@@ -12,6 +12,13 @@ function onchainOnly(schema) {
|
|
|
12
12
|
return schema.meta({ compare: "onchainOnly" });
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
+
* Marks a field whose backend value both-mode merge overlays onto the chain
|
|
16
|
+
* row, so a source disagreement is expected.
|
|
17
|
+
**/
|
|
18
|
+
function backendPreferred(schema) {
|
|
19
|
+
return schema.meta({ compare: "backendPreferred" });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
15
22
|
* Marks a numeric field whose two sources may drift within {@link kind}.
|
|
16
23
|
**/
|
|
17
24
|
function tolerance(schema, kind) {
|
|
@@ -26,4 +33,4 @@ function compareTagOf(schema) {
|
|
|
26
33
|
return meta.compare;
|
|
27
34
|
}
|
|
28
35
|
//#endregion
|
|
29
|
-
export { compareTagOf, offchainOnly, onchainOnly, tolerance };
|
|
36
|
+
export { backendPreferred, compareTagOf, offchainOnly, onchainOnly, tolerance };
|
package/dist/esm/model/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS } from "./charts.js";
|
|
2
|
-
import { compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
|
|
2
|
+
import { backendPreferred, compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
|
|
3
3
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
|
|
4
4
|
import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
|
|
5
5
|
import "./curators.js";
|
|
@@ -19,4 +19,4 @@ import { ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ER
|
|
|
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_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, amountSchema, apyBreakdownSchema, assetTypeSchema, 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_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, 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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ZodAddress, ZodBigInt, ZodHex } from "../onchain/utils/zod.js";
|
|
2
|
-
import { offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
|
|
2
|
+
import { backendPreferred, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
|
|
3
3
|
import { assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, underlyingTokenSchema } from "./primitives.schema.js";
|
|
4
4
|
import { isFilterSet } from "./filters.js";
|
|
5
5
|
import { booleanParamSchema, encodeFlag, filterable } from "./filters.schema.js";
|
|
@@ -95,12 +95,12 @@ const borrowRateBreakdownSchema = z.object({
|
|
|
95
95
|
**/
|
|
96
96
|
const strategyPositionSchema = z.object({
|
|
97
97
|
kind: z.literal("strategy"),
|
|
98
|
-
name: z.string(),
|
|
98
|
+
name: backendPreferred(z.string()),
|
|
99
99
|
chainId: chainIdSchema,
|
|
100
100
|
creditManager: ZodAddress(),
|
|
101
101
|
creditAccount: ZodAddress(),
|
|
102
102
|
underlyingToken: underlyingTokenSchema,
|
|
103
|
-
targetCollateral: tokenSchema.nullable(),
|
|
103
|
+
targetCollateral: backendPreferred(tokenSchema.nullable()),
|
|
104
104
|
leverage: tolerance(leverageSchema, "float"),
|
|
105
105
|
borrowApy: tolerance(bpsSchema, "bps"),
|
|
106
106
|
borrowApyAvg7D: offchainOnly(bpsSchema).optional(),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
1
3
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
2
4
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
3
5
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
@@ -8,8 +10,6 @@ import "../base/index.js";
|
|
|
8
10
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
9
11
|
import "./bots/index.js";
|
|
10
12
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
11
|
-
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
|
-
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
13
13
|
import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
|
|
14
14
|
import "../market/index.js";
|
|
15
15
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
1
2
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
2
3
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
3
4
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -19,7 +20,6 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
|
|
|
19
20
|
import "../../market/rwa/securitize/index.js";
|
|
20
21
|
import "../../market/index.js";
|
|
21
22
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
22
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
23
23
|
//#region src/onchain/accounts/liquidations/LiquidationsService.ts
|
|
24
24
|
/**
|
|
25
25
|
* Service for discovering liquidatable credit accounts and previewing manual
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
4
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
4
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
5
5
|
import { InvalidDelayedIntentError } from "./errors.js";
|
|
6
6
|
//#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
7
7
|
const abi = iRedemptionLoggerV310Abi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
1
|
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
1
|
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
|
+
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV311Abi;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
1
2
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
2
3
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
|
-
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import { toWithdrawalStatus } from "./types.js";
|
|
5
5
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
|
|
6
6
|
const abi = iWithdrawalCompressorV313Abi;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
2
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
3
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
1
4
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
5
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
3
6
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
4
7
|
import { getAssetType } from "../chain/chains.js";
|
|
5
8
|
import { formatBN } from "../utils/formatter.js";
|
|
6
9
|
import "../utils/index.js";
|
|
7
|
-
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
8
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
9
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
10
10
|
import { SdkRWADataNotLoadedError } from "../core/errors.js";
|
|
11
11
|
import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
|
|
12
12
|
//#region src/onchain/base/TokensMeta.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
1
2
|
import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
|
|
2
3
|
import { isV310 } from "../constants/versions.js";
|
|
3
4
|
import "../constants/index.js";
|
|
4
5
|
import { hexEq } from "../utils/hex.js";
|
|
5
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
6
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
7
7
|
//#region src/onchain/core/createAddressProvider.ts
|
|
8
8
|
const OVERRIDE_ADDRESSES = { Mainnet: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
1
|
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
|
+
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
3
3
|
//#region src/onchain/market/adapters/contracts/AccountMigratorAdapterContract.ts
|
|
4
4
|
const abi = accountMigratorAbi;
|
|
5
5
|
const protocolAbi = accountMigratorAbi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
1
2
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
2
3
|
import "../../../base/index.js";
|
|
3
|
-
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
4
4
|
import { iERC4626Abi } from "../abi/targetContractAbi.js";
|
|
5
5
|
import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
|
|
6
6
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
1
2
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
2
3
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
4
|
import "../../base/index.js";
|
|
4
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
1
2
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
3
4
|
import { RAY } from "../../constants/math.js";
|
|
@@ -7,7 +8,6 @@ import "../../utils/index.js";
|
|
|
7
8
|
import { SdkRWADataNotLoadedError } from "../../core/errors.js";
|
|
8
9
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
10
|
import "../../base/index.js";
|
|
10
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
11
11
|
//#region src/onchain/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
13
13
|
var PoolV310Contract = class extends BaseContract {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ZapperContract } from "./ZapperContract.js";
|
|
2
1
|
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
|
+
import { ZapperContract } from "./ZapperContract.js";
|
|
3
3
|
//#region src/onchain/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
1
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
2
3
|
import "../../base/index.js";
|
|
3
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
4
4
|
import { UnsupportedZapperFunctionError } from "./errors.js";
|
|
5
5
|
//#region src/onchain/market/zapper/ZapperContract.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AddressSet } from "../utils/AddressSet.js";
|
|
2
1
|
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
|
+
import { AddressSet } from "../utils/AddressSet.js";
|
|
3
3
|
import "../constants/addresses.js";
|
|
4
4
|
import { PERCENTAGE_FACTOR, RAY } from "../constants/math.js";
|
|
5
5
|
import "../constants/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { generateCastTraceCall } from "./cast.js";
|
|
3
2
|
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
|
+
import { generateCastTraceCall } from "./cast.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
1
|
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
2
|
+
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
3
3
|
import { asPreviewSimulationError } from "./errors.js";
|
|
4
4
|
//#region src/preview/simulate/simulatePoolOperation.ts
|
|
5
5
|
function previewRead(operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
1
2
|
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
2
3
|
import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
3
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
4
4
|
import "../../onchain/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
6
6
|
import { getAddress, isAddressEqual, parseEventLogs } from "viem";
|
package/dist/types/abi/compressors/subcompressors/withdrawal/mellowWithdrawalSubcompressor.d.ts
CHANGED
|
@@ -67,6 +67,10 @@ declare const mellowWithdrawalSubcompressorAbi: readonly [{
|
|
|
67
67
|
readonly type: "bytes";
|
|
68
68
|
readonly internalType: "bytes";
|
|
69
69
|
}];
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "redeemer";
|
|
72
|
+
readonly type: "address";
|
|
73
|
+
readonly internalType: "address";
|
|
70
74
|
}, {
|
|
71
75
|
readonly name: "extraData";
|
|
72
76
|
readonly type: "bytes";
|
|
@@ -105,6 +109,10 @@ declare const mellowWithdrawalSubcompressorAbi: readonly [{
|
|
|
105
109
|
readonly name: "claimableAt";
|
|
106
110
|
readonly type: "uint256";
|
|
107
111
|
readonly internalType: "uint256";
|
|
112
|
+
}, {
|
|
113
|
+
readonly name: "redeemer";
|
|
114
|
+
readonly type: "address";
|
|
115
|
+
readonly internalType: "address";
|
|
108
116
|
}, {
|
|
109
117
|
readonly name: "extraData";
|
|
110
118
|
readonly type: "bytes";
|
|
@@ -170,6 +178,10 @@ declare const mellowWithdrawalSubcompressorAbi: readonly [{
|
|
|
170
178
|
readonly type: "bytes";
|
|
171
179
|
readonly internalType: "bytes";
|
|
172
180
|
}];
|
|
181
|
+
}, {
|
|
182
|
+
readonly name: "redeemer";
|
|
183
|
+
readonly type: "address";
|
|
184
|
+
readonly internalType: "address";
|
|
173
185
|
}, {
|
|
174
186
|
readonly name: "extraData";
|
|
175
187
|
readonly type: "bytes";
|
|
@@ -208,6 +220,10 @@ declare const mellowWithdrawalSubcompressorAbi: readonly [{
|
|
|
208
220
|
readonly name: "claimableAt";
|
|
209
221
|
readonly type: "uint256";
|
|
210
222
|
readonly internalType: "uint256";
|
|
223
|
+
}, {
|
|
224
|
+
readonly name: "redeemer";
|
|
225
|
+
readonly type: "address";
|
|
226
|
+
readonly internalType: "address";
|
|
211
227
|
}, {
|
|
212
228
|
readonly name: "extraData";
|
|
213
229
|
readonly type: "bytes";
|
|
@@ -39,7 +39,8 @@ interface PositionMatch {
|
|
|
39
39
|
**/
|
|
40
40
|
identical: boolean;
|
|
41
41
|
/**
|
|
42
|
-
* No unexpected diffs: every disagreement is mode-scoped
|
|
42
|
+
* No unexpected diffs: every disagreement is mode-scoped, backend-preferred,
|
|
43
|
+
* or within tolerance.
|
|
43
44
|
**/
|
|
44
45
|
clean: boolean;
|
|
45
46
|
diffs: FieldDiff[];
|
|
@@ -135,8 +136,9 @@ interface ComparePositionsInput {
|
|
|
135
136
|
* Matches two position listings per wallet by {@link positionId} and reports
|
|
136
137
|
* every field the two sources disagree on.
|
|
137
138
|
*
|
|
138
|
-
* Nothing is filtered out. A field only one mode can fill,
|
|
139
|
-
*
|
|
139
|
+
* Nothing is filtered out. A field only one mode can fill, a strategy field
|
|
140
|
+
* both-mode merge overlays from the backend, or a USD value that drifted
|
|
141
|
+
* within snapshot-lag noise, is still reported — tagged
|
|
140
142
|
* {@link FieldDiff.expected} so that {@link CompareCounts.clean} can ignore it
|
|
141
143
|
* while {@link CompareCounts.identical} stays strict.
|
|
142
144
|
**/
|
|
@@ -16,10 +16,12 @@ type DiffKind = "presence" | "usd" | "numeric" | "other";
|
|
|
16
16
|
*
|
|
17
17
|
* - `"mode-scoped"` — a field documented `@mode offchain` or `@mode onchain`,
|
|
18
18
|
* so the other source has nothing to put there.
|
|
19
|
+
* - `"backend-preferred"` — both sources fill the field, but both-mode merge
|
|
20
|
+
* overlays the backend value.
|
|
19
21
|
* - `"tolerance"` — snapshot lag or float-path noise within the thresholds
|
|
20
22
|
* below, not a formula or membership mismatch.
|
|
21
23
|
**/
|
|
22
|
-
type ExpectedDiffReason = "mode-scoped" | "tolerance";
|
|
24
|
+
type ExpectedDiffReason = "mode-scoped" | "backend-preferred" | "tolerance";
|
|
23
25
|
/**
|
|
24
26
|
* One field of one row where the two sources disagree.
|
|
25
27
|
**/
|
|
@@ -23,10 +23,12 @@ interface ToleranceCompareTag {
|
|
|
23
23
|
*
|
|
24
24
|
* - `"offchainOnly"` / `"onchainOnly"` — the other source typically leaves
|
|
25
25
|
* the field empty, so a disagreement is expected.
|
|
26
|
+
* - `"backendPreferred"` — both sources fill the field, but both-mode merge
|
|
27
|
+
* overlays the backend value, so a disagreement is expected.
|
|
26
28
|
* - {@link ToleranceCompareTag} — a numeric disagreement within the named
|
|
27
29
|
* formula is expected snapshot noise.
|
|
28
30
|
**/
|
|
29
|
-
type CompareTag = "offchainOnly" | "onchainOnly" | ToleranceCompareTag;
|
|
31
|
+
type CompareTag = "offchainOnly" | "onchainOnly" | "backendPreferred" | ToleranceCompareTag;
|
|
30
32
|
/**
|
|
31
33
|
* Marks a field that only the backend fills.
|
|
32
34
|
**/
|
|
@@ -35,6 +37,11 @@ declare function offchainOnly<S extends z.ZodType>(schema: S): S;
|
|
|
35
37
|
* Marks a field that only the chain fills.
|
|
36
38
|
**/
|
|
37
39
|
declare function onchainOnly<S extends z.ZodType>(schema: S): S;
|
|
40
|
+
/**
|
|
41
|
+
* Marks a field whose backend value both-mode merge overlays onto the chain
|
|
42
|
+
* row, so a source disagreement is expected.
|
|
43
|
+
**/
|
|
44
|
+
declare function backendPreferred<S extends z.ZodType>(schema: S): S;
|
|
38
45
|
/**
|
|
39
46
|
* Marks a numeric field whose two sources may drift within {@link kind}.
|
|
40
47
|
**/
|
|
@@ -44,4 +51,4 @@ declare function tolerance<S extends z.ZodType>(schema: S, kind: CompareToleranc
|
|
|
44
51
|
**/
|
|
45
52
|
declare function compareTagOf(schema: z.ZodType): CompareTag | undefined;
|
|
46
53
|
//#endregion
|
|
47
|
-
export { CompareTag, CompareTolerance, ToleranceCompareTag, compareTagOf, offchainOnly, onchainOnly, tolerance };
|
|
54
|
+
export { CompareTag, CompareTolerance, ToleranceCompareTag, backendPreferred, compareTagOf, offchainOnly, onchainOnly, tolerance };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall, UnderlyingToken } from "./primitives.js";
|
|
2
2
|
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
|
|
3
3
|
import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
|
|
4
|
-
import { CompareTag, CompareTolerance, ToleranceCompareTag, compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
|
|
4
|
+
import { CompareTag, CompareTolerance, ToleranceCompareTag, backendPreferred, compareTagOf, offchainOnly, onchainOnly, tolerance } from "./compare.schema.js";
|
|
5
5
|
import { Curator, CuratorName } from "./curators.js";
|
|
6
6
|
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
7
7
|
import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedWithdrawCollateralIntent } from "./delayed-intents.js";
|
|
@@ -19,4 +19,4 @@ import { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAcc
|
|
|
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_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, 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, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, 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_UNPREVIEWABLE_RWA_WRAP_UNWRAP, ERROR_UNPRICEABLE_TOKEN, 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, 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 };
|
|
@@ -192,6 +192,9 @@ interface StrategyPosition {
|
|
|
192
192
|
/**
|
|
193
193
|
* Human-readable strategy name, e.g. `"wstETH / WETH"`. Derived from
|
|
194
194
|
* {@link targetCollateral}.
|
|
195
|
+
*
|
|
196
|
+
* In both-mode merge the backend value overlays the chain row, so a
|
|
197
|
+
* source disagreement is expected.
|
|
195
198
|
**/
|
|
196
199
|
name: string;
|
|
197
200
|
/**
|
|
@@ -215,6 +218,9 @@ interface StrategyPosition {
|
|
|
215
218
|
underlyingToken: UnderlyingToken;
|
|
216
219
|
/**
|
|
217
220
|
* Collateral token this position is a strategy in.
|
|
221
|
+
*
|
|
222
|
+
* In both-mode merge the backend value overlays the chain row, so a
|
|
223
|
+
* source disagreement is expected.
|
|
218
224
|
**/
|
|
219
225
|
targetCollateral: Token | null;
|
|
220
226
|
/**
|