@morpho-org/midnight-sdk 1.7.0 → 2.0.0
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/MIGRATION-v1-to-v2.md +6 -0
- package/README.md +63 -61
- package/lib/cjs/abis.d.ts +1962 -759
- package/lib/cjs/abis.js +2021 -995
- package/lib/cjs/api/helpers.d.ts +1 -17
- package/lib/cjs/api/helpers.js +0 -4
- package/lib/cjs/api/types.d.ts +5 -4
- package/lib/cjs/api/version.generated.d.ts +1 -1
- package/lib/cjs/api/version.generated.js +2 -2
- package/lib/cjs/bundlesV2.d.ts +15 -0
- package/lib/cjs/bundlesV2.js +2 -0
- package/lib/cjs/constants.d.ts +34 -0
- package/lib/cjs/constants.js +35 -1
- package/lib/cjs/errors.d.ts +107 -0
- package/lib/cjs/errors.js +139 -1
- package/lib/cjs/fetch/Ratifier.d.ts +4 -3
- package/lib/cjs/fetch/Ratifier.js +6 -4
- package/lib/cjs/index.d.ts +8 -0
- package/lib/cjs/index.js +16 -1
- package/lib/cjs/offers/Offer.d.ts +10 -0
- package/lib/cjs/offers/Offer.js +15 -1
- package/lib/cjs/offers/OfferUtils.d.ts +3 -0
- package/lib/cjs/offers/OfferUtils.js +3 -0
- package/lib/cjs/signatures/{EcrecoverRatifierUtils.d.ts → EcrecoverRatifier.d.ts} +118 -2
- package/lib/cjs/signatures/{EcrecoverRatifierUtils.js → EcrecoverRatifier.js} +146 -9
- package/lib/cjs/signatures/GroupUtils.d.ts +55 -2
- package/lib/cjs/signatures/GroupUtils.js +64 -5
- package/lib/cjs/signatures/Payload.d.ts +3 -3
- package/lib/cjs/signatures/PriceRatifierV1.d.ts +472 -0
- package/lib/cjs/signatures/PriceRatifierV1.js +521 -0
- package/lib/cjs/signatures/RateRatifierV1.d.ts +581 -0
- package/lib/cjs/signatures/RateRatifierV1.js +696 -0
- package/lib/{esm/signatures/RatifierUtils.d.ts → cjs/signatures/Ratifier.d.ts} +14 -12
- package/lib/cjs/signatures/{RatifierUtils.js → Ratifier.js} +29 -29
- package/lib/cjs/signatures/{SetterRatifierUtils.d.ts → SetterRatifier.d.ts} +50 -3
- package/lib/cjs/signatures/{SetterRatifierUtils.js → SetterRatifier.js} +65 -7
- package/lib/cjs/signatures/Tree.d.ts +94 -17
- package/lib/cjs/signatures/Tree.js +146 -111
- package/lib/cjs/signatures/TreeUtils.d.ts +191 -21
- package/lib/cjs/signatures/TreeUtils.js +320 -134
- package/lib/cjs/signatures/index.d.ts +7 -3
- package/lib/cjs/signatures/index.js +5 -3
- package/lib/cjs/signatures/ratifierRequests.d.ts +55 -0
- package/lib/cjs/signatures/ratifierRequests.js +2 -0
- package/lib/cjs/signatures/ratifierV1Internal.d.ts +57 -0
- package/lib/cjs/signatures/ratifierV1Internal.js +183 -0
- package/lib/cjs/signatures/standardRatifierInternal.d.ts +4 -0
- package/lib/cjs/signatures/standardRatifierInternal.js +12 -0
- package/lib/cjs/signatures/treeMathInternal.d.ts +4 -0
- package/lib/cjs/signatures/treeMathInternal.js +12 -0
- package/lib/cjs/signatures/treeTypes.d.ts +109 -0
- package/lib/cjs/signatures/treeTypes.js +2 -0
- package/lib/esm/abis.d.ts +1962 -759
- package/lib/esm/abis.js +2020 -994
- package/lib/esm/api/helpers.d.ts +1 -17
- package/lib/esm/api/helpers.js +4 -4
- package/lib/esm/api/types.d.ts +5 -4
- package/lib/esm/api/version.generated.d.ts +1 -1
- package/lib/esm/api/version.generated.js +2 -2
- package/lib/esm/bundlesV2.d.ts +15 -0
- package/lib/esm/bundlesV2.js +1 -0
- package/lib/esm/constants.d.ts +34 -0
- package/lib/esm/constants.js +34 -0
- package/lib/esm/errors.d.ts +107 -0
- package/lib/esm/errors.js +132 -0
- package/lib/esm/fetch/Ratifier.d.ts +4 -3
- package/lib/esm/fetch/Ratifier.js +6 -4
- package/lib/esm/index.d.ts +8 -0
- package/lib/esm/index.js +5 -0
- package/lib/esm/offers/Offer.d.ts +10 -0
- package/lib/esm/offers/Offer.js +15 -1
- package/lib/esm/offers/OfferUtils.d.ts +3 -0
- package/lib/esm/offers/OfferUtils.js +3 -0
- package/lib/esm/signatures/{EcrecoverRatifierUtils.d.ts → EcrecoverRatifier.d.ts} +118 -2
- package/lib/esm/signatures/{EcrecoverRatifierUtils.js → EcrecoverRatifier.js} +146 -9
- package/lib/esm/signatures/GroupUtils.d.ts +55 -2
- package/lib/esm/signatures/GroupUtils.js +64 -5
- package/lib/esm/signatures/Payload.d.ts +3 -3
- package/lib/esm/signatures/PriceRatifierV1.d.ts +472 -0
- package/lib/esm/signatures/PriceRatifierV1.js +520 -0
- package/lib/esm/signatures/RateRatifierV1.d.ts +581 -0
- package/lib/esm/signatures/RateRatifierV1.js +695 -0
- package/lib/{cjs/signatures/RatifierUtils.d.ts → esm/signatures/Ratifier.d.ts} +14 -12
- package/lib/esm/signatures/{RatifierUtils.js → Ratifier.js} +31 -29
- package/lib/esm/signatures/{SetterRatifierUtils.d.ts → SetterRatifier.d.ts} +50 -3
- package/lib/esm/signatures/{SetterRatifierUtils.js → SetterRatifier.js} +65 -7
- package/lib/esm/signatures/Tree.d.ts +94 -17
- package/lib/esm/signatures/Tree.js +147 -112
- package/lib/esm/signatures/TreeUtils.d.ts +191 -21
- package/lib/esm/signatures/TreeUtils.js +318 -132
- package/lib/esm/signatures/index.d.ts +7 -3
- package/lib/esm/signatures/index.js +5 -3
- package/lib/esm/signatures/ratifierRequests.d.ts +55 -0
- package/lib/esm/signatures/ratifierRequests.js +1 -0
- package/lib/esm/signatures/ratifierV1Internal.d.ts +57 -0
- package/lib/esm/signatures/ratifierV1Internal.js +176 -0
- package/lib/esm/signatures/standardRatifierInternal.d.ts +4 -0
- package/lib/esm/signatures/standardRatifierInternal.js +9 -0
- package/lib/esm/signatures/treeMathInternal.d.ts +4 -0
- package/lib/esm/signatures/treeMathInternal.js +8 -0
- package/lib/esm/signatures/treeTypes.d.ts +109 -0
- package/lib/esm/signatures/treeTypes.js +1 -0
- package/package.json +9 -8
package/lib/cjs/api/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hash } from "viem";
|
|
2
|
-
import { type ApiBookMarketResponse, type
|
|
2
|
+
import { type ApiBookMarketResponse, type ApiPriceLevelResponse, type ApiRequestParams, type ApiTakeableOfferResponse, type MempoolPayloadValidationResult, type MidnightApiBookMarket, type MidnightApiBookSide, type MidnightApiPriceLevel, type MidnightApiTake } from "./types.js";
|
|
3
3
|
/** @internal Sends one Midnight API request and maps non-2xx responses to SDK errors. */
|
|
4
4
|
export declare function requestMidnightApi<Response = unknown>(params: ApiRequestParams): Promise<Response>;
|
|
5
5
|
/** @internal Builds a book endpoint path with encoded path segments. */
|
|
@@ -8,16 +8,6 @@ export declare function buildBookPath(params: {
|
|
|
8
8
|
readonly side?: MidnightApiBookSide;
|
|
9
9
|
readonly suffix?: "quote" | "takeable-offers";
|
|
10
10
|
}): string;
|
|
11
|
-
/**
|
|
12
|
-
* @internal Maps a book market API payload to the SDK response shape, rejecting any
|
|
13
|
-
* response whose advertised `market_id` cannot be derived from — or does not match —
|
|
14
|
-
* its own market params. Recomputing the id with `MarketUtils.toId` (mirroring the
|
|
15
|
-
* takeable-offers path) stops a hostile API from pairing a trusted id with foreign
|
|
16
|
-
* metadata; every book flows through here, so both bound paths reject the same substitution.
|
|
17
|
-
* Collaterals are returned in the protocol's canonical order so their array index matches
|
|
18
|
-
* the onchain `collateralIndex`.
|
|
19
|
-
*/
|
|
20
|
-
export declare function mapBookMarket(book: ApiBookMarketResponse): MidnightApiBookMarket;
|
|
21
11
|
/** @internal Maps a book market, binding its verified id to the requested market. */
|
|
22
12
|
export declare function mapBoundBookMarket(book: ApiBookMarketResponse, requestedMarketId: Hash): MidnightApiBookMarket;
|
|
23
13
|
/** @internal Requested `fetchBooks` filters that every returned book must satisfy. */
|
|
@@ -30,14 +20,8 @@ export interface BookFilterContext {
|
|
|
30
20
|
}
|
|
31
21
|
/** @internal Maps listed book markets, binding each verified id to requested filters when present. */
|
|
32
22
|
export declare function mapBoundBooks(books: readonly ApiBookMarketResponse[], context?: BookFilterContext): MidnightApiBookMarket[];
|
|
33
|
-
/** @internal Maps a collateral API payload to the SDK response shape. */
|
|
34
|
-
export declare function mapCollateral(collateral: ApiCollateralResponse): MidnightApiCollateral;
|
|
35
|
-
/** @internal Maps a price-level API payload to the SDK response shape. */
|
|
36
|
-
export declare function mapPriceLevel(level: ApiPriceLevelResponse): MidnightApiPriceLevel;
|
|
37
23
|
/** @internal Maps API price levels and sorts them best first: asks by ascending tick, bids by descending tick. */
|
|
38
24
|
export declare function mapPriceLevels(levels: readonly ApiPriceLevelResponse[], side: MidnightApiBookSide): MidnightApiPriceLevel[];
|
|
39
|
-
/** @internal Maps a takeable-offer API payload to the SDK response shape. */
|
|
40
|
-
export declare function mapTakeableOffer(takeableOffer: ApiTakeableOfferResponse): MidnightApiTake;
|
|
41
25
|
/** @internal API response context required for a takeable offer to be executable for the caller's request. */
|
|
42
26
|
export interface TakeableOfferContext {
|
|
43
27
|
readonly marketId?: Hash;
|
package/lib/cjs/api/helpers.js
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requestMidnightApi = requestMidnightApi;
|
|
4
4
|
exports.buildBookPath = buildBookPath;
|
|
5
|
-
exports.mapBookMarket = mapBookMarket;
|
|
6
5
|
exports.mapBoundBookMarket = mapBoundBookMarket;
|
|
7
6
|
exports.mapBoundBooks = mapBoundBooks;
|
|
8
|
-
exports.mapCollateral = mapCollateral;
|
|
9
|
-
exports.mapPriceLevel = mapPriceLevel;
|
|
10
7
|
exports.mapPriceLevels = mapPriceLevels;
|
|
11
|
-
exports.mapTakeableOffer = mapTakeableOffer;
|
|
12
8
|
exports.mapBoundTakeableOffers = mapBoundTakeableOffers;
|
|
13
9
|
exports.parseValidationResponse = parseValidationResponse;
|
|
14
10
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
package/lib/cjs/api/types.d.ts
CHANGED
|
@@ -440,9 +440,9 @@ export interface MidnightApiTakeableOffersResult {
|
|
|
440
440
|
readonly data: readonly MidnightApiTake[];
|
|
441
441
|
}
|
|
442
442
|
/** @internal HTTP method owned by Midnight API helpers. */
|
|
443
|
-
|
|
443
|
+
type ApiMethod = "GET" | "POST";
|
|
444
444
|
/** @internal Query values serializable by Midnight API helpers. */
|
|
445
|
-
|
|
445
|
+
type QueryValue = string | number | bigint | boolean | Date | readonly string[] | readonly number[] | undefined;
|
|
446
446
|
/** @internal Request descriptor consumed by the Midnight API HTTP helper. */
|
|
447
447
|
export type ApiRequestParams = MidnightApiConfig & {
|
|
448
448
|
readonly method: ApiMethod;
|
|
@@ -493,7 +493,7 @@ export type ApiPriceLevelsResponse = {
|
|
|
493
493
|
readonly data: readonly ApiPriceLevelResponse[];
|
|
494
494
|
};
|
|
495
495
|
/** @internal Offer market response shape returned by the API. */
|
|
496
|
-
|
|
496
|
+
type ApiOfferMarketResponse = {
|
|
497
497
|
readonly chain_id: number;
|
|
498
498
|
readonly midnight: Address;
|
|
499
499
|
readonly loan_token: Address;
|
|
@@ -504,7 +504,7 @@ export type ApiOfferMarketResponse = {
|
|
|
504
504
|
readonly liquidator_gate: Address;
|
|
505
505
|
};
|
|
506
506
|
/** @internal Inline offer response shape returned by the API. */
|
|
507
|
-
|
|
507
|
+
type ApiOfferResponse = {
|
|
508
508
|
readonly market: ApiOfferMarketResponse;
|
|
509
509
|
readonly buy: boolean;
|
|
510
510
|
readonly maker: Address;
|
|
@@ -547,3 +547,4 @@ export type ApiTakeableOffersResponse = {
|
|
|
547
547
|
readonly cursor: string | null;
|
|
548
548
|
readonly data: readonly ApiTakeableOfferResponse[];
|
|
549
549
|
};
|
|
550
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal Installed Midnight SDK package version. */
|
|
2
|
-
export declare const MIDNIGHT_SDK_VERSION = "
|
|
2
|
+
export declare const MIDNIGHT_SDK_VERSION = "2.0.0";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated by scripts/
|
|
2
|
+
// Generated by scripts/generate-midnight-package-version.ts. Do not edit.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.MIDNIGHT_SDK_VERSION = void 0;
|
|
5
5
|
/** @internal Installed Midnight SDK package version. */
|
|
6
|
-
exports.MIDNIGHT_SDK_VERSION = "
|
|
6
|
+
exports.MIDNIGHT_SDK_VERSION = "2.0.0";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Hex } from "viem";
|
|
2
|
+
/** `MidnightBundlesV2` group cancellation: marks `group` fully consumed if its consumption is at most `maxConsumed`. */
|
|
3
|
+
export interface GroupCancellation {
|
|
4
|
+
/** Offer group id. */
|
|
5
|
+
readonly group: Hex;
|
|
6
|
+
/** Largest current group consumption accepted (uint128); the whole call reverts above it. */
|
|
7
|
+
readonly maxConsumed: bigint;
|
|
8
|
+
}
|
|
9
|
+
/** `MidnightBundlesV2` collateral transfer: `assets` of the market collateral at `collateralIndex`. */
|
|
10
|
+
export interface CollateralTransfer {
|
|
11
|
+
/** Index of the collateral in the market's `collateralParams`. */
|
|
12
|
+
readonly collateralIndex: bigint;
|
|
13
|
+
/** Collateral assets. */
|
|
14
|
+
readonly assets: bigint;
|
|
15
|
+
}
|
package/lib/cjs/constants.d.ts
CHANGED
|
@@ -111,6 +111,18 @@ export declare const MAX_CONTINUOUS_FEE = 317097919n;
|
|
|
111
111
|
* ```
|
|
112
112
|
*/
|
|
113
113
|
export declare const MAX_OFFER_CAP: bigint;
|
|
114
|
+
/**
|
|
115
|
+
* Maximum Merkle tree height supported by the Midnight offer-tree typehash
|
|
116
|
+
* tables, enforced by every ratifier tree helper (Ecrecover, Setter, and V1).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { MAX_TREE_HEIGHT } from "@morpho-org/midnight-sdk";
|
|
121
|
+
*
|
|
122
|
+
* console.log(MAX_TREE_HEIGHT);
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare const MAX_TREE_HEIGHT = 20;
|
|
114
126
|
/**
|
|
115
127
|
* Seconds after maturity over which post-maturity LIF reaches the computed
|
|
116
128
|
* maximum liquidation incentive factor.
|
|
@@ -156,6 +168,28 @@ export declare const MARKET_TYPEHASH = "0x510b3862f3816a109c9340b76972e8a3098424
|
|
|
156
168
|
* ```
|
|
157
169
|
*/
|
|
158
170
|
export declare const OFFER_TYPEHASH = "0x9905214264a9fb7b6cc1b0e33db7a04687c6e4185a84755d29914314aa9d8906";
|
|
171
|
+
/**
|
|
172
|
+
* HashLib PriceRatifierV1 offer typehash.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { PRICE_RATIFIER_V1_OFFER_TYPEHASH } from "@morpho-org/midnight-sdk";
|
|
177
|
+
*
|
|
178
|
+
* console.log(PRICE_RATIFIER_V1_OFFER_TYPEHASH);
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export declare const PRICE_RATIFIER_V1_OFFER_TYPEHASH = "0x62a94097fbcb9b56e3cf7b4f7bb075b49540b1364815434ff4b16bc4decb303d";
|
|
182
|
+
/**
|
|
183
|
+
* HashLib RateRatifierV1 offer typehash.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* import { RATE_RATIFIER_V1_OFFER_TYPEHASH } from "@morpho-org/midnight-sdk";
|
|
188
|
+
*
|
|
189
|
+
* console.log(RATE_RATIFIER_V1_OFFER_TYPEHASH);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export declare const RATE_RATIFIER_V1_OFFER_TYPEHASH = "0x8e0f9c17bf7e919b5f22e8c6c4e787905f45864a4be441067bbd2e65b35c3de1";
|
|
159
193
|
/**
|
|
160
194
|
* EcrecoverRatifier EIP-712 domain typehash.
|
|
161
195
|
*
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EIP712_DOMAIN_TYPEHASH = exports.OFFER_TYPEHASH = exports.MARKET_TYPEHASH = exports.COLLATERAL_PARAMS_TYPEHASH = exports.TIME_TO_MAX_LIF = exports.MAX_OFFER_CAP = exports.MAX_CONTINUOUS_FEE = exports.MAX_SETTLEMENT_FEES = exports.MAX_COLLATERALS_PER_BORROWER = exports.MAX_COLLATERALS = exports.DEFAULT_TICK_SPACING = exports.PRICE_ROUNDING_STEP = exports.MAX_TICK = exports.SETTLEMENT_FEE_BREAKPOINTS = exports.CBP = void 0;
|
|
3
|
+
exports.EIP712_DOMAIN_TYPEHASH = exports.RATE_RATIFIER_V1_OFFER_TYPEHASH = exports.PRICE_RATIFIER_V1_OFFER_TYPEHASH = exports.OFFER_TYPEHASH = exports.MARKET_TYPEHASH = exports.COLLATERAL_PARAMS_TYPEHASH = exports.TIME_TO_MAX_LIF = exports.MAX_TREE_HEIGHT = exports.MAX_OFFER_CAP = exports.MAX_CONTINUOUS_FEE = exports.MAX_SETTLEMENT_FEES = exports.MAX_COLLATERALS_PER_BORROWER = exports.MAX_COLLATERALS = exports.DEFAULT_TICK_SPACING = exports.PRICE_ROUNDING_STEP = exports.MAX_TICK = exports.SETTLEMENT_FEE_BREAKPOINTS = exports.CBP = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
/**
|
|
6
6
|
* Centibip scale used by settlement fees.
|
|
@@ -131,6 +131,18 @@ exports.MAX_CONTINUOUS_FEE = 317097919n;
|
|
|
131
131
|
* ```
|
|
132
132
|
*/
|
|
133
133
|
exports.MAX_OFFER_CAP = viem_1.maxUint128;
|
|
134
|
+
/**
|
|
135
|
+
* Maximum Merkle tree height supported by the Midnight offer-tree typehash
|
|
136
|
+
* tables, enforced by every ratifier tree helper (Ecrecover, Setter, and V1).
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* import { MAX_TREE_HEIGHT } from "@morpho-org/midnight-sdk";
|
|
141
|
+
*
|
|
142
|
+
* console.log(MAX_TREE_HEIGHT);
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
exports.MAX_TREE_HEIGHT = 20;
|
|
134
146
|
/**
|
|
135
147
|
* Seconds after maturity over which post-maturity LIF reaches the computed
|
|
136
148
|
* maximum liquidation incentive factor.
|
|
@@ -176,6 +188,28 @@ exports.MARKET_TYPEHASH = "0x510b3862f3816a109c9340b76972e8a30984246be06e034ae12
|
|
|
176
188
|
* ```
|
|
177
189
|
*/
|
|
178
190
|
exports.OFFER_TYPEHASH = "0x9905214264a9fb7b6cc1b0e33db7a04687c6e4185a84755d29914314aa9d8906";
|
|
191
|
+
/**
|
|
192
|
+
* HashLib PriceRatifierV1 offer typehash.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { PRICE_RATIFIER_V1_OFFER_TYPEHASH } from "@morpho-org/midnight-sdk";
|
|
197
|
+
*
|
|
198
|
+
* console.log(PRICE_RATIFIER_V1_OFFER_TYPEHASH);
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
exports.PRICE_RATIFIER_V1_OFFER_TYPEHASH = "0x62a94097fbcb9b56e3cf7b4f7bb075b49540b1364815434ff4b16bc4decb303d";
|
|
202
|
+
/**
|
|
203
|
+
* HashLib RateRatifierV1 offer typehash.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* import { RATE_RATIFIER_V1_OFFER_TYPEHASH } from "@morpho-org/midnight-sdk";
|
|
208
|
+
*
|
|
209
|
+
* console.log(RATE_RATIFIER_V1_OFFER_TYPEHASH);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
exports.RATE_RATIFIER_V1_OFFER_TYPEHASH = "0x8e0f9c17bf7e919b5f22e8c6c4e787905f45864a4be441067bbd2e65b35c3de1";
|
|
179
213
|
/**
|
|
180
214
|
* EcrecoverRatifier EIP-712 domain typehash.
|
|
181
215
|
*
|
package/lib/cjs/errors.d.ts
CHANGED
|
@@ -228,6 +228,113 @@ export declare class InvalidTreeHeightError extends Error {
|
|
|
228
228
|
export declare class InvalidTreeError extends Error {
|
|
229
229
|
constructor(message: string);
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Thrown when a RateRatifierV1 leaf receives a negative rate.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```ts
|
|
236
|
+
* import { InvalidRateRatifierV1RateError } from "@morpho-org/midnight-sdk";
|
|
237
|
+
*
|
|
238
|
+
* throw new InvalidRateRatifierV1RateError(-1n);
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
export declare class InvalidRateRatifierV1RateError extends Error {
|
|
242
|
+
/** Negative rate that was rejected. */
|
|
243
|
+
readonly rate: bigint;
|
|
244
|
+
constructor(rate: bigint);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Thrown when RateRatifierV1 price-bound arithmetic overflows uint256.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* import { RateRatifierV1BoundOverflowError } from "@morpho-org/midnight-sdk";
|
|
252
|
+
*
|
|
253
|
+
* throw new RateRatifierV1BoundOverflowError(2n ** 255n, 10n);
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export declare class RateRatifierV1BoundOverflowError extends Error {
|
|
257
|
+
/** Rate whose bound arithmetic overflowed. */
|
|
258
|
+
readonly rate: bigint;
|
|
259
|
+
/** Time to maturity used in the overflowing bound. */
|
|
260
|
+
readonly timeToMaturity: bigint;
|
|
261
|
+
constructor(rate: bigint, timeToMaturity: bigint);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Thrown when a RateRatifierV1 leaf offer commits a nominal tick below the
|
|
265
|
+
* router's minimum takeable tick.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* import { InvalidRateRatifierV1TickError } from "@morpho-org/midnight-sdk";
|
|
270
|
+
*
|
|
271
|
+
* throw new InvalidRateRatifierV1TickError(0n, 3372n);
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export declare class InvalidRateRatifierV1TickError extends Error {
|
|
275
|
+
/** Nominal tick that was rejected. */
|
|
276
|
+
readonly tick: bigint;
|
|
277
|
+
/** Minimum accepted tick. */
|
|
278
|
+
readonly minTick: bigint;
|
|
279
|
+
constructor(tick: bigint, minTick: bigint);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Thrown when a RateRatifierV1 time parameter is negative.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* import { InvalidRateRatifierV1TimeError } from "@morpho-org/midnight-sdk";
|
|
287
|
+
*
|
|
288
|
+
* throw new InvalidRateRatifierV1TimeError(-1n, "timestamp");
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
export declare class InvalidRateRatifierV1TimeError extends Error {
|
|
292
|
+
/** Negative time value that was rejected. */
|
|
293
|
+
readonly value: bigint;
|
|
294
|
+
/** Parameter that carried the negative value. */
|
|
295
|
+
readonly field: "timeToMaturity" | "timestamp";
|
|
296
|
+
constructor(value: bigint, field: "timeToMaturity" | "timestamp");
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Thrown when a V1 ratifier address is the zero address.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```ts
|
|
303
|
+
* import { InvalidRatifierV1AddressError } from "@morpho-org/midnight-sdk";
|
|
304
|
+
*
|
|
305
|
+
* throw new InvalidRatifierV1AddressError(
|
|
306
|
+
* "0x0000000000000000000000000000000000000000",
|
|
307
|
+
* );
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
export declare class InvalidRatifierV1AddressError extends Error {
|
|
311
|
+
/** Zero ratifier address that was rejected. */
|
|
312
|
+
readonly ratifier: Address;
|
|
313
|
+
constructor(ratifier: Address);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Thrown when a taker is not the allowed taker of a V1 ratifier leaf.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* import { RatifierV1TakerNotAllowedError } from "@morpho-org/midnight-sdk";
|
|
321
|
+
*
|
|
322
|
+
* throw new RatifierV1TakerNotAllowedError({
|
|
323
|
+
* taker: "0x0000000000000000000000000000000000000001",
|
|
324
|
+
* allowedTaker: "0x0000000000000000000000000000000000000002",
|
|
325
|
+
* });
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
export declare class RatifierV1TakerNotAllowedError extends Error {
|
|
329
|
+
/** Taker that attempted to take the offer. */
|
|
330
|
+
readonly taker: Address;
|
|
331
|
+
/** Taker allowed by the ratified leaf. */
|
|
332
|
+
readonly allowedTaker: Address;
|
|
333
|
+
constructor(params: {
|
|
334
|
+
readonly taker: Address;
|
|
335
|
+
readonly allowedTaker: Address;
|
|
336
|
+
});
|
|
337
|
+
}
|
|
231
338
|
/**
|
|
232
339
|
* Thrown when a viem client's chain id does not match the chain id required by a signing flow.
|
|
233
340
|
*
|
package/lib/cjs/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightApiResponseError = exports.MidnightApiError = exports.InvalidEcrecoverSignatureVError = exports.InvalidTypedDataSignatureError = exports.MidnightMempoolValidationError = exports.ChainIdMismatchError = exports.InvalidTreeError = exports.InvalidTreeHeightError = exports.PayloadDecodeError = exports.InvalidOfferParameterError = exports.UnknownCollateralIndexError = exports.InvalidMarketParameterError = exports.InvalidPositionAccrualStateError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.SettlementFeeExceedsPriceError = exports.InvalidTickSpacingError = exports.PriceGreaterThanOneError = exports.TickOutOfRangeError = exports.InvalidOfferGroupError = void 0;
|
|
3
|
+
exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightApiResponseError = exports.MidnightApiError = exports.InvalidEcrecoverSignatureVError = exports.InvalidTypedDataSignatureError = exports.MidnightMempoolValidationError = exports.ChainIdMismatchError = exports.RatifierV1TakerNotAllowedError = exports.InvalidRatifierV1AddressError = exports.InvalidRateRatifierV1TimeError = exports.InvalidRateRatifierV1TickError = exports.RateRatifierV1BoundOverflowError = exports.InvalidRateRatifierV1RateError = exports.InvalidTreeError = exports.InvalidTreeHeightError = exports.PayloadDecodeError = exports.InvalidOfferParameterError = exports.UnknownCollateralIndexError = exports.InvalidMarketParameterError = exports.InvalidPositionAccrualStateError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.SettlementFeeExceedsPriceError = exports.InvalidTickSpacingError = exports.PriceGreaterThanOneError = exports.TickOutOfRangeError = exports.InvalidOfferGroupError = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Thrown when a Midnight offer group violates protocol-level group mechanics.
|
|
6
6
|
*
|
|
@@ -280,6 +280,144 @@ class InvalidTreeError extends Error {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
exports.InvalidTreeError = InvalidTreeError;
|
|
283
|
+
/**
|
|
284
|
+
* Thrown when a RateRatifierV1 leaf receives a negative rate.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* import { InvalidRateRatifierV1RateError } from "@morpho-org/midnight-sdk";
|
|
289
|
+
*
|
|
290
|
+
* throw new InvalidRateRatifierV1RateError(-1n);
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
class InvalidRateRatifierV1RateError extends Error {
|
|
294
|
+
/** Negative rate that was rejected. */
|
|
295
|
+
rate;
|
|
296
|
+
constructor(rate) {
|
|
297
|
+
super(`Rate "${rate}" is negative. Use a non-negative WAD-scaled rate.`);
|
|
298
|
+
this.name = "InvalidRateRatifierV1RateError";
|
|
299
|
+
this.rate = rate;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.InvalidRateRatifierV1RateError = InvalidRateRatifierV1RateError;
|
|
303
|
+
/**
|
|
304
|
+
* Thrown when RateRatifierV1 price-bound arithmetic overflows uint256.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* import { RateRatifierV1BoundOverflowError } from "@morpho-org/midnight-sdk";
|
|
309
|
+
*
|
|
310
|
+
* throw new RateRatifierV1BoundOverflowError(2n ** 255n, 10n);
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
class RateRatifierV1BoundOverflowError extends Error {
|
|
314
|
+
/** Rate whose bound arithmetic overflowed. */
|
|
315
|
+
rate;
|
|
316
|
+
/** Time to maturity used in the overflowing bound. */
|
|
317
|
+
timeToMaturity;
|
|
318
|
+
constructor(rate, timeToMaturity) {
|
|
319
|
+
super(`Rate bound arithmetic overflows uint256 for rate "${rate}" and timeToMaturity "${timeToMaturity}". Lower the rate or time to maturity.`);
|
|
320
|
+
this.name = "RateRatifierV1BoundOverflowError";
|
|
321
|
+
this.rate = rate;
|
|
322
|
+
this.timeToMaturity = timeToMaturity;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
exports.RateRatifierV1BoundOverflowError = RateRatifierV1BoundOverflowError;
|
|
326
|
+
/**
|
|
327
|
+
* Thrown when a RateRatifierV1 leaf offer commits a nominal tick below the
|
|
328
|
+
* router's minimum takeable tick.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* import { InvalidRateRatifierV1TickError } from "@morpho-org/midnight-sdk";
|
|
333
|
+
*
|
|
334
|
+
* throw new InvalidRateRatifierV1TickError(0n, 3372n);
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
class InvalidRateRatifierV1TickError extends Error {
|
|
338
|
+
/** Nominal tick that was rejected. */
|
|
339
|
+
tick;
|
|
340
|
+
/** Minimum accepted tick. */
|
|
341
|
+
minTick;
|
|
342
|
+
constructor(tick, minTick) {
|
|
343
|
+
super(`Offer tick "${tick}" is below the minimum "${minTick}" (price >= 0.5 WAD). RateRatifierV1 prices from \`rate\`, but the router still validates the committed tick; set a nominal tick of at least "${minTick}".`);
|
|
344
|
+
this.name = "InvalidRateRatifierV1TickError";
|
|
345
|
+
this.tick = tick;
|
|
346
|
+
this.minTick = minTick;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.InvalidRateRatifierV1TickError = InvalidRateRatifierV1TickError;
|
|
350
|
+
/**
|
|
351
|
+
* Thrown when a RateRatifierV1 time parameter is negative.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* import { InvalidRateRatifierV1TimeError } from "@morpho-org/midnight-sdk";
|
|
356
|
+
*
|
|
357
|
+
* throw new InvalidRateRatifierV1TimeError(-1n, "timestamp");
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
class InvalidRateRatifierV1TimeError extends Error {
|
|
361
|
+
/** Negative time value that was rejected. */
|
|
362
|
+
value;
|
|
363
|
+
/** Parameter that carried the negative value. */
|
|
364
|
+
field;
|
|
365
|
+
constructor(value, field) {
|
|
366
|
+
super(`${field} "${value}" is negative. Use a non-negative number of seconds.`);
|
|
367
|
+
this.name = "InvalidRateRatifierV1TimeError";
|
|
368
|
+
this.value = value;
|
|
369
|
+
this.field = field;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
exports.InvalidRateRatifierV1TimeError = InvalidRateRatifierV1TimeError;
|
|
373
|
+
/**
|
|
374
|
+
* Thrown when a V1 ratifier address is the zero address.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* import { InvalidRatifierV1AddressError } from "@morpho-org/midnight-sdk";
|
|
379
|
+
*
|
|
380
|
+
* throw new InvalidRatifierV1AddressError(
|
|
381
|
+
* "0x0000000000000000000000000000000000000000",
|
|
382
|
+
* );
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
class InvalidRatifierV1AddressError extends Error {
|
|
386
|
+
/** Zero ratifier address that was rejected. */
|
|
387
|
+
ratifier;
|
|
388
|
+
constructor(ratifier) {
|
|
389
|
+
super(`Ratifier address "${ratifier}" is the zero address. Use a deployed PriceRatifierV1 or RateRatifierV1 address.`);
|
|
390
|
+
this.name = "InvalidRatifierV1AddressError";
|
|
391
|
+
this.ratifier = ratifier;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
exports.InvalidRatifierV1AddressError = InvalidRatifierV1AddressError;
|
|
395
|
+
/**
|
|
396
|
+
* Thrown when a taker is not the allowed taker of a V1 ratifier leaf.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```ts
|
|
400
|
+
* import { RatifierV1TakerNotAllowedError } from "@morpho-org/midnight-sdk";
|
|
401
|
+
*
|
|
402
|
+
* throw new RatifierV1TakerNotAllowedError({
|
|
403
|
+
* taker: "0x0000000000000000000000000000000000000001",
|
|
404
|
+
* allowedTaker: "0x0000000000000000000000000000000000000002",
|
|
405
|
+
* });
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
class RatifierV1TakerNotAllowedError extends Error {
|
|
409
|
+
/** Taker that attempted to take the offer. */
|
|
410
|
+
taker;
|
|
411
|
+
/** Taker allowed by the ratified leaf. */
|
|
412
|
+
allowedTaker;
|
|
413
|
+
constructor(params) {
|
|
414
|
+
super(`Taker "${params.taker}" is not the allowed taker "${params.allowedTaker}". Use the allowed taker or an offer without a taker restriction.`);
|
|
415
|
+
this.name = "RatifierV1TakerNotAllowedError";
|
|
416
|
+
this.taker = params.taker;
|
|
417
|
+
this.allowedTaker = params.allowedTaker;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
exports.RatifierV1TakerNotAllowedError = RatifierV1TakerNotAllowedError;
|
|
283
421
|
/**
|
|
284
422
|
* Thrown when a viem client's chain id does not match the chain id required by a signing flow.
|
|
285
423
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, Client } from "viem";
|
|
2
|
-
import { type RatifierInfo } from "../signatures/
|
|
2
|
+
import { type RatifierInfo } from "../signatures/Ratifier.js";
|
|
3
3
|
import type { MidnightCallParameters } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Fetches maker bytecode and classifies the ratifier route for new offers.
|
|
@@ -9,7 +9,7 @@ import type { MidnightCallParameters } from "./types.js";
|
|
|
9
9
|
* the maker is an EOA or EIP-7702 account that can use Ecrecover signatures, or
|
|
10
10
|
* a deployed-code account that should use Setter root approval. Put the returned
|
|
11
11
|
* `ratifier` address on `Offer.create`, then use the returned `type` to choose
|
|
12
|
-
* `
|
|
12
|
+
* `EcrecoverRatifier.ratify` or `SetterRatifier.ratify` after the tree
|
|
13
13
|
* has been built.
|
|
14
14
|
*
|
|
15
15
|
* Reads `eth_chainId` only when the viem client has no configured chain id,
|
|
@@ -29,7 +29,8 @@ import type { MidnightCallParameters } from "./types.js";
|
|
|
29
29
|
* const maker = "0x7b093658BE7f90B63D7c359e8f408e503c2D9401";
|
|
30
30
|
* const info = await fetchRatifierInfo(client, { maker });
|
|
31
31
|
* // Pass info.ratifier to Offer.create(...), then use info.type after
|
|
32
|
-
* // Tree.create([...]) to choose the Ecrecover
|
|
32
|
+
* // Tree.create({ type: info.type, entries: [...] }) to choose the Ecrecover
|
|
33
|
+
* // or Setter ratifier flow.
|
|
33
34
|
* console.log(info.type, info.ratifier);
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fetchRatifierInfo = fetchRatifierInfo;
|
|
4
4
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
5
|
const actions_1 = require("viem/actions");
|
|
6
|
-
const
|
|
6
|
+
const Ratifier_js_1 = require("../signatures/Ratifier.js");
|
|
7
7
|
const utils_js_1 = require("./utils.js");
|
|
8
8
|
/**
|
|
9
9
|
* Fetches maker bytecode and classifies the ratifier route for new offers.
|
|
@@ -13,7 +13,7 @@ const utils_js_1 = require("./utils.js");
|
|
|
13
13
|
* the maker is an EOA or EIP-7702 account that can use Ecrecover signatures, or
|
|
14
14
|
* a deployed-code account that should use Setter root approval. Put the returned
|
|
15
15
|
* `ratifier` address on `Offer.create`, then use the returned `type` to choose
|
|
16
|
-
* `
|
|
16
|
+
* `EcrecoverRatifier.ratify` or `SetterRatifier.ratify` after the tree
|
|
17
17
|
* has been built.
|
|
18
18
|
*
|
|
19
19
|
* Reads `eth_chainId` only when the viem client has no configured chain id,
|
|
@@ -33,7 +33,8 @@ const utils_js_1 = require("./utils.js");
|
|
|
33
33
|
* const maker = "0x7b093658BE7f90B63D7c359e8f408e503c2D9401";
|
|
34
34
|
* const info = await fetchRatifierInfo(client, { maker });
|
|
35
35
|
* // Pass info.ratifier to Offer.create(...), then use info.type after
|
|
36
|
-
* // Tree.create([...]) to choose the Ecrecover
|
|
36
|
+
* // Tree.create({ type: info.type, entries: [...] }) to choose the Ecrecover
|
|
37
|
+
* // or Setter ratifier flow.
|
|
37
38
|
* console.log(info.type, info.ratifier);
|
|
38
39
|
* ```
|
|
39
40
|
*/
|
|
@@ -41,6 +42,7 @@ async function fetchRatifierInfo(client, params) {
|
|
|
41
42
|
const chainId = await (0, utils_js_1.resolveChainId)(client);
|
|
42
43
|
const ecrecoverRatifier = (0, morpho_ts_1.getChainAddress)(chainId, "ecrecoverRatifier");
|
|
43
44
|
const setterRatifier = (0, morpho_ts_1.getChainAddress)(chainId, "setterRatifier");
|
|
45
|
+
// eth_getCode is trusted; the returned ratifier is a suggestion the caller commits to on Offer.create. See THREAT_MODEL.md, RPC.
|
|
44
46
|
const bytecode = await (0, actions_1.getBytecode)(client, {
|
|
45
47
|
...(params.blockNumber != null
|
|
46
48
|
? { blockNumber: params.blockNumber }
|
|
@@ -49,7 +51,7 @@ async function fetchRatifierInfo(client, params) {
|
|
|
49
51
|
: {}),
|
|
50
52
|
address: params.maker,
|
|
51
53
|
});
|
|
52
|
-
return
|
|
54
|
+
return Ratifier_js_1.Ratifier.getRatifierInfo({
|
|
53
55
|
bytecode,
|
|
54
56
|
ecrecoverRatifier,
|
|
55
57
|
setterRatifier,
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./abis.js";
|
|
2
|
+
export type { CollateralTransfer, GroupCancellation } from "./bundlesV2.js";
|
|
2
3
|
export * from "./constants.js";
|
|
3
4
|
export * from "./errors.js";
|
|
4
5
|
export * from "./fetch/index.js";
|
|
@@ -6,6 +7,7 @@ export * from "./market/index.js";
|
|
|
6
7
|
export * from "./math/index.js";
|
|
7
8
|
export * from "./offers/index.js";
|
|
8
9
|
export * from "./position/index.js";
|
|
10
|
+
export { EcrecoverRatifier, EcrecoverRatifierUtils, } from "./signatures/EcrecoverRatifier.js";
|
|
9
11
|
export * from "./signatures/index.js";
|
|
10
12
|
/**
|
|
11
13
|
* Namespace for Midnight mempool payload utilities.
|
|
@@ -17,3 +19,9 @@ export * from "./signatures/index.js";
|
|
|
17
19
|
* mempool submission calldata.
|
|
18
20
|
*/
|
|
19
21
|
export { Payload } from "./signatures/Payload.js";
|
|
22
|
+
export { PriceRatifierV1, PriceRatifierV1Utils, } from "./signatures/PriceRatifierV1.js";
|
|
23
|
+
export { RateRatifierV1, RateRatifierV1Utils, } from "./signatures/RateRatifierV1.js";
|
|
24
|
+
export { Ratifier, RatifierUtils } from "./signatures/Ratifier.js";
|
|
25
|
+
export type { EcrecoverRatifierDataRequest, EcrecoverRatifierRatifyRequest, EcrecoverRatifierSignRequest, EcrecoverRatifierTypedDataRequest, SetterRatifierDataRequest, SetterRatifierRatifyRequest, } from "./signatures/ratifierRequests.js";
|
|
26
|
+
export { SetterRatifier, SetterRatifierUtils, } from "./signatures/SetterRatifier.js";
|
|
27
|
+
export type { AnyTree, AnyTreeSnapshot, EcrecoverTreeCreateRequest, PriceRatifierV1TreeCreateRequest, RateRatifierV1TreeCreateRequest, RatifierKind, RatifierTypes, SetterTreeCreateRequest, TreeCreateRequest, TreeData, TreeEntry, TreeSnapshot, TypedRatifierTreeInput, TypedTreeMempoolValidateParams, } from "./signatures/treeTypes.js";
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Payload = void 0;
|
|
17
|
+
exports.SetterRatifierUtils = exports.SetterRatifier = exports.RatifierUtils = exports.Ratifier = exports.RateRatifierV1Utils = exports.RateRatifierV1 = exports.PriceRatifierV1Utils = exports.PriceRatifierV1 = exports.Payload = exports.EcrecoverRatifierUtils = exports.EcrecoverRatifier = void 0;
|
|
18
18
|
__exportStar(require("./abis.js"), exports);
|
|
19
19
|
__exportStar(require("./constants.js"), exports);
|
|
20
20
|
__exportStar(require("./errors.js"), exports);
|
|
@@ -23,6 +23,9 @@ __exportStar(require("./market/index.js"), exports);
|
|
|
23
23
|
__exportStar(require("./math/index.js"), exports);
|
|
24
24
|
__exportStar(require("./offers/index.js"), exports);
|
|
25
25
|
__exportStar(require("./position/index.js"), exports);
|
|
26
|
+
var EcrecoverRatifier_js_1 = require("./signatures/EcrecoverRatifier.js");
|
|
27
|
+
Object.defineProperty(exports, "EcrecoverRatifier", { enumerable: true, get: function () { return EcrecoverRatifier_js_1.EcrecoverRatifier; } });
|
|
28
|
+
Object.defineProperty(exports, "EcrecoverRatifierUtils", { enumerable: true, get: function () { return EcrecoverRatifier_js_1.EcrecoverRatifierUtils; } });
|
|
26
29
|
__exportStar(require("./signatures/index.js"), exports);
|
|
27
30
|
/**
|
|
28
31
|
* Namespace for Midnight mempool payload utilities.
|
|
@@ -35,3 +38,15 @@ __exportStar(require("./signatures/index.js"), exports);
|
|
|
35
38
|
*/
|
|
36
39
|
var Payload_js_1 = require("./signatures/Payload.js");
|
|
37
40
|
Object.defineProperty(exports, "Payload", { enumerable: true, get: function () { return Payload_js_1.Payload; } });
|
|
41
|
+
var PriceRatifierV1_js_1 = require("./signatures/PriceRatifierV1.js");
|
|
42
|
+
Object.defineProperty(exports, "PriceRatifierV1", { enumerable: true, get: function () { return PriceRatifierV1_js_1.PriceRatifierV1; } });
|
|
43
|
+
Object.defineProperty(exports, "PriceRatifierV1Utils", { enumerable: true, get: function () { return PriceRatifierV1_js_1.PriceRatifierV1Utils; } });
|
|
44
|
+
var RateRatifierV1_js_1 = require("./signatures/RateRatifierV1.js");
|
|
45
|
+
Object.defineProperty(exports, "RateRatifierV1", { enumerable: true, get: function () { return RateRatifierV1_js_1.RateRatifierV1; } });
|
|
46
|
+
Object.defineProperty(exports, "RateRatifierV1Utils", { enumerable: true, get: function () { return RateRatifierV1_js_1.RateRatifierV1Utils; } });
|
|
47
|
+
var Ratifier_js_1 = require("./signatures/Ratifier.js");
|
|
48
|
+
Object.defineProperty(exports, "Ratifier", { enumerable: true, get: function () { return Ratifier_js_1.Ratifier; } });
|
|
49
|
+
Object.defineProperty(exports, "RatifierUtils", { enumerable: true, get: function () { return Ratifier_js_1.RatifierUtils; } });
|
|
50
|
+
var SetterRatifier_js_1 = require("./signatures/SetterRatifier.js");
|
|
51
|
+
Object.defineProperty(exports, "SetterRatifier", { enumerable: true, get: function () { return SetterRatifier_js_1.SetterRatifier; } });
|
|
52
|
+
Object.defineProperty(exports, "SetterRatifierUtils", { enumerable: true, get: function () { return SetterRatifier_js_1.SetterRatifierUtils; } });
|
|
@@ -150,6 +150,16 @@ export declare class Offer {
|
|
|
150
150
|
readonly tick: bigint;
|
|
151
151
|
private cachedGroup;
|
|
152
152
|
private cachedHash;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the group id was supplied at construction rather than derived.
|
|
155
|
+
*
|
|
156
|
+
* Ratifier-specific tree builders only substitute their scheme's
|
|
157
|
+
* content-addressed singleton group when this is `false`; an explicit
|
|
158
|
+
* group is always committed as-is.
|
|
159
|
+
*
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
readonly hasExplicitGroup: boolean;
|
|
153
163
|
/** Optional maker callback. */
|
|
154
164
|
readonly callback: Address;
|
|
155
165
|
/** Callback payload. */
|