@morpho-dev/router 0.0.25 → 0.0.27
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/index.browser.d.cts +61 -13
- package/dist/index.browser.d.ts +61 -13
- package/dist/index.browser.js +64 -86
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +65 -87
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +69 -21
- package/dist/index.node.d.ts +69 -21
- package/dist/index.node.js +64 -86
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +65 -87
- package/dist/index.node.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.node.d.cts
CHANGED
|
@@ -34,6 +34,7 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
|
34
34
|
};
|
|
35
35
|
}>;
|
|
36
36
|
declare function getChain(chainId: ChainId): Chain | undefined;
|
|
37
|
+
declare const getWhitelistedChains: () => Chain[];
|
|
37
38
|
declare const chains: Record<ChainName, Chain>;
|
|
38
39
|
|
|
39
40
|
type Chain$1_Chain = Chain;
|
|
@@ -43,8 +44,9 @@ declare const Chain$1_chainIds: typeof chainIds;
|
|
|
43
44
|
declare const Chain$1_chainNames: typeof chainNames;
|
|
44
45
|
declare const Chain$1_chains: typeof chains;
|
|
45
46
|
declare const Chain$1_getChain: typeof getChain;
|
|
47
|
+
declare const Chain$1_getWhitelistedChains: typeof getWhitelistedChains;
|
|
46
48
|
declare namespace Chain$1 {
|
|
47
|
-
export { type Chain$1_Chain as Chain, type Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, Chain$1_chains as chains, Chain$1_getChain as getChain };
|
|
49
|
+
export { type Chain$1_Chain as Chain, type Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, Chain$1_chains as chains, Chain$1_getChain as getChain, Chain$1_getWhitelistedChains as getWhitelistedChains };
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
@@ -64,8 +66,8 @@ declare const schemas: {
|
|
|
64
66
|
max_amount: z.ZodOptional<z.ZodBigInt>;
|
|
65
67
|
min_rate: z.ZodOptional<z.ZodBigInt>;
|
|
66
68
|
max_rate: z.ZodOptional<z.ZodBigInt>;
|
|
67
|
-
min_maturity: z.ZodOptional<z.
|
|
68
|
-
max_maturity: z.ZodOptional<z.
|
|
69
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
69
71
|
min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
72
|
max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
71
73
|
collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
@@ -75,13 +77,13 @@ declare const schemas: {
|
|
|
75
77
|
oracle: string | undefined;
|
|
76
78
|
lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
|
|
77
79
|
}[], string>>>;
|
|
78
|
-
min_lltv: z.ZodOptional<z.
|
|
79
|
-
max_lltv: z.ZodOptional<z.
|
|
80
|
+
min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
|
+
max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
80
82
|
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
amount: "amount";
|
|
81
84
|
rate: "rate";
|
|
82
85
|
maturity: "maturity";
|
|
83
86
|
expiry: "expiry";
|
|
84
|
-
amount: "amount";
|
|
85
87
|
}>>;
|
|
86
88
|
sort_order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
87
89
|
asc: "asc";
|
|
@@ -102,9 +104,9 @@ declare const schemas: {
|
|
|
102
104
|
oracle: string;
|
|
103
105
|
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
104
106
|
}[], string>>>;
|
|
105
|
-
maturity: z.ZodOptional<z.
|
|
106
|
-
min_maturity: z.ZodOptional<z.
|
|
107
|
-
max_maturity: z.ZodOptional<z.
|
|
107
|
+
maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
108
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
109
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
108
110
|
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
109
111
|
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
110
112
|
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
@@ -126,6 +128,13 @@ type RouterOffer = Offer.Offer & {
|
|
|
126
128
|
status: OfferStatus;
|
|
127
129
|
metadata?: OfferMetadata;
|
|
128
130
|
};
|
|
131
|
+
type OfferConsumed = {
|
|
132
|
+
id: string;
|
|
133
|
+
chainId: bigint;
|
|
134
|
+
offering: Address;
|
|
135
|
+
nonce: bigint;
|
|
136
|
+
amount: bigint;
|
|
137
|
+
};
|
|
129
138
|
declare const RouterOfferSchema: (parameters?: {
|
|
130
139
|
omitHash?: boolean;
|
|
131
140
|
}) => zod_v4.ZodObject<{
|
|
@@ -162,6 +171,30 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
162
171
|
issue: z.ZodString;
|
|
163
172
|
}, z.core.$strip>>;
|
|
164
173
|
}, zod_v4_core.$strip>;
|
|
174
|
+
/**
|
|
175
|
+
* ABI for the Consumed event emitted by the terms contract.
|
|
176
|
+
*/
|
|
177
|
+
declare const consumedEvent: {
|
|
178
|
+
readonly type: "event";
|
|
179
|
+
readonly name: "Consumed";
|
|
180
|
+
readonly inputs: readonly [{
|
|
181
|
+
readonly name: "user";
|
|
182
|
+
readonly type: "address";
|
|
183
|
+
readonly indexed: true;
|
|
184
|
+
readonly internalType: "address";
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "nonce";
|
|
187
|
+
readonly type: "uint256";
|
|
188
|
+
readonly indexed: true;
|
|
189
|
+
readonly internalType: "uint256";
|
|
190
|
+
}, {
|
|
191
|
+
readonly name: "amount";
|
|
192
|
+
readonly type: "uint256";
|
|
193
|
+
readonly indexed: false;
|
|
194
|
+
readonly internalType: "uint256";
|
|
195
|
+
}];
|
|
196
|
+
readonly anonymous: false;
|
|
197
|
+
};
|
|
165
198
|
/**
|
|
166
199
|
* Creates a router offer from a plain object.
|
|
167
200
|
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
@@ -189,6 +222,15 @@ declare namespace fromSnakeCase {
|
|
|
189
222
|
*/
|
|
190
223
|
declare function toSnakeCase(offer: RouterOffer): Format.Snake<RouterOffer>;
|
|
191
224
|
declare function random(): RouterOffer;
|
|
225
|
+
declare function fromConsumedLog(parameters: {
|
|
226
|
+
blockNumber: bigint;
|
|
227
|
+
logIndex: number;
|
|
228
|
+
chainId: number;
|
|
229
|
+
transactionHash: Hex;
|
|
230
|
+
user: Address;
|
|
231
|
+
nonce: bigint;
|
|
232
|
+
amount: bigint;
|
|
233
|
+
}): OfferConsumed;
|
|
192
234
|
declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error> {
|
|
193
235
|
readonly name = "RouterOffer.InvalidRouterOfferError";
|
|
194
236
|
constructor(error: ZodError | Error);
|
|
@@ -196,16 +238,19 @@ declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error>
|
|
|
196
238
|
|
|
197
239
|
type RouterOffer$1_InvalidRouterOfferError = InvalidRouterOfferError;
|
|
198
240
|
declare const RouterOffer$1_InvalidRouterOfferError: typeof InvalidRouterOfferError;
|
|
241
|
+
type RouterOffer$1_OfferConsumed = OfferConsumed;
|
|
199
242
|
type RouterOffer$1_OfferMetadata = OfferMetadata;
|
|
200
243
|
type RouterOffer$1_OfferStatus = OfferStatus;
|
|
201
244
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
202
245
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
203
246
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
247
|
+
declare const RouterOffer$1_consumedEvent: typeof consumedEvent;
|
|
248
|
+
declare const RouterOffer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
204
249
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
205
250
|
declare const RouterOffer$1_random: typeof random;
|
|
206
251
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
207
252
|
declare namespace RouterOffer$1 {
|
|
208
|
-
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, from$1 as from, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
253
|
+
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferConsumed as OfferConsumed, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, RouterOffer$1_consumedEvent as consumedEvent, from$1 as from, RouterOffer$1_fromConsumedLog as fromConsumedLog, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
209
254
|
}
|
|
210
255
|
|
|
211
256
|
type OfferResponse = {
|
|
@@ -423,6 +468,7 @@ type OfferStore = {
|
|
|
423
468
|
metadata?: OfferMetadata;
|
|
424
469
|
}) => Promise<void>;
|
|
425
470
|
updateConsumedAmount: (parameters: {
|
|
471
|
+
id: string;
|
|
426
472
|
chainId: Offer.Offer["chainId"];
|
|
427
473
|
offering: Offer.Offer["offering"];
|
|
428
474
|
nonce: Offer.Offer["nonce"];
|
|
@@ -431,13 +477,13 @@ type OfferStore = {
|
|
|
431
477
|
/** Persist latest indexing progress for a chain and event type. */
|
|
432
478
|
saveLatestBlockNumberProcessed: (parameters: {
|
|
433
479
|
chainId: Offer.Offer["chainId"];
|
|
434
|
-
eventType: "offer_created" | "
|
|
480
|
+
eventType: "offer_created" | "offer_consumed";
|
|
435
481
|
latestBlockNumber: number;
|
|
436
482
|
}) => Promise<void>;
|
|
437
483
|
/** Retrieve latest indexing progress for a chain and event type. */
|
|
438
484
|
getLatestBlockNumberProcessed: (parameters: {
|
|
439
485
|
chainId: Offer.Offer["chainId"];
|
|
440
|
-
eventType: "offer_created" | "
|
|
486
|
+
eventType: "offer_created" | "offer_consumed";
|
|
441
487
|
}) => Promise<{
|
|
442
488
|
latestBlockNumber: number;
|
|
443
489
|
} | null>;
|
|
@@ -453,8 +499,8 @@ type GetOffersFilters = {
|
|
|
453
499
|
maxAmount?: bigint;
|
|
454
500
|
minRate?: bigint;
|
|
455
501
|
maxRate?: bigint;
|
|
456
|
-
minMaturity?:
|
|
457
|
-
maxMaturity?:
|
|
502
|
+
minMaturity?: number;
|
|
503
|
+
maxMaturity?: number;
|
|
458
504
|
minExpiry?: number;
|
|
459
505
|
maxExpiry?: number;
|
|
460
506
|
collateralAssets?: string[];
|
|
@@ -464,8 +510,8 @@ type GetOffersFilters = {
|
|
|
464
510
|
oracle?: string;
|
|
465
511
|
lltv?: LLTV.LLTV;
|
|
466
512
|
}>;
|
|
467
|
-
minLltv?:
|
|
468
|
-
maxLltv?:
|
|
513
|
+
minLltv?: number;
|
|
514
|
+
maxLltv?: number;
|
|
469
515
|
sortBy?: "rate" | "maturity" | "expiry" | "amount";
|
|
470
516
|
sortOrder?: "asc" | "desc";
|
|
471
517
|
cursor?: string;
|
|
@@ -480,9 +526,9 @@ type FindMatchingOffersParams = {
|
|
|
480
526
|
oracle: string;
|
|
481
527
|
lltv: LLTV.LLTV;
|
|
482
528
|
}>;
|
|
483
|
-
maturity?:
|
|
484
|
-
minMaturity?:
|
|
485
|
-
maxMaturity?:
|
|
529
|
+
maturity?: number;
|
|
530
|
+
minMaturity?: number;
|
|
531
|
+
maxMaturity?: number;
|
|
486
532
|
loanToken?: string;
|
|
487
533
|
creator?: string;
|
|
488
534
|
/** Filter by offer status; if omitted defaults to ["valid"] */
|
|
@@ -674,13 +720,15 @@ declare namespace Logger$1 {
|
|
|
674
720
|
export { type Logger$1_LogFn as LogFn, type Logger$1_LogLevel as LogLevel, Logger$1_LogLevelValues as LogLevelValues, type Logger$1_Logger as Logger, Logger$1_defaultLogger as defaultLogger, Logger$1_getLogger as getLogger, Logger$1_runWithLogger as runWithLogger };
|
|
675
721
|
}
|
|
676
722
|
|
|
677
|
-
declare const types: readonly ["offer_created", "
|
|
723
|
+
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
|
678
724
|
type Type = (typeof types)[number];
|
|
679
725
|
type BaseEvent<type extends Type = Type> = {
|
|
680
726
|
readonly id: string;
|
|
681
727
|
readonly type: type;
|
|
682
728
|
};
|
|
683
|
-
type RouterEvent<type extends Type = Type> = type extends "
|
|
729
|
+
type RouterEvent<type extends Type = Type> = type extends "offer_consumed" ? Compute<BaseEvent<type> & {
|
|
730
|
+
readonly offerConsumed: OfferConsumed;
|
|
731
|
+
}> : type extends "offer_created" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
684
732
|
readonly offer: Offer.Offer;
|
|
685
733
|
}> : never;
|
|
686
734
|
/**
|
package/dist/index.node.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
|
34
34
|
};
|
|
35
35
|
}>;
|
|
36
36
|
declare function getChain(chainId: ChainId): Chain | undefined;
|
|
37
|
+
declare const getWhitelistedChains: () => Chain[];
|
|
37
38
|
declare const chains: Record<ChainName, Chain>;
|
|
38
39
|
|
|
39
40
|
type Chain$1_Chain = Chain;
|
|
@@ -43,8 +44,9 @@ declare const Chain$1_chainIds: typeof chainIds;
|
|
|
43
44
|
declare const Chain$1_chainNames: typeof chainNames;
|
|
44
45
|
declare const Chain$1_chains: typeof chains;
|
|
45
46
|
declare const Chain$1_getChain: typeof getChain;
|
|
47
|
+
declare const Chain$1_getWhitelistedChains: typeof getWhitelistedChains;
|
|
46
48
|
declare namespace Chain$1 {
|
|
47
|
-
export { type Chain$1_Chain as Chain, type Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, Chain$1_chains as chains, Chain$1_getChain as getChain };
|
|
49
|
+
export { type Chain$1_Chain as Chain, type Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, Chain$1_chains as chains, Chain$1_getChain as getChain, Chain$1_getWhitelistedChains as getWhitelistedChains };
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
@@ -64,8 +66,8 @@ declare const schemas: {
|
|
|
64
66
|
max_amount: z.ZodOptional<z.ZodBigInt>;
|
|
65
67
|
min_rate: z.ZodOptional<z.ZodBigInt>;
|
|
66
68
|
max_rate: z.ZodOptional<z.ZodBigInt>;
|
|
67
|
-
min_maturity: z.ZodOptional<z.
|
|
68
|
-
max_maturity: z.ZodOptional<z.
|
|
69
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
69
71
|
min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
70
72
|
max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
71
73
|
collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
@@ -75,13 +77,13 @@ declare const schemas: {
|
|
|
75
77
|
oracle: string | undefined;
|
|
76
78
|
lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
|
|
77
79
|
}[], string>>>;
|
|
78
|
-
min_lltv: z.ZodOptional<z.
|
|
79
|
-
max_lltv: z.ZodOptional<z.
|
|
80
|
+
min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
81
|
+
max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
80
82
|
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
amount: "amount";
|
|
81
84
|
rate: "rate";
|
|
82
85
|
maturity: "maturity";
|
|
83
86
|
expiry: "expiry";
|
|
84
|
-
amount: "amount";
|
|
85
87
|
}>>;
|
|
86
88
|
sort_order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
87
89
|
asc: "asc";
|
|
@@ -102,9 +104,9 @@ declare const schemas: {
|
|
|
102
104
|
oracle: string;
|
|
103
105
|
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
104
106
|
}[], string>>>;
|
|
105
|
-
maturity: z.ZodOptional<z.
|
|
106
|
-
min_maturity: z.ZodOptional<z.
|
|
107
|
-
max_maturity: z.ZodOptional<z.
|
|
107
|
+
maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
108
|
+
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
109
|
+
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
108
110
|
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
109
111
|
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
110
112
|
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
@@ -126,6 +128,13 @@ type RouterOffer = Offer.Offer & {
|
|
|
126
128
|
status: OfferStatus;
|
|
127
129
|
metadata?: OfferMetadata;
|
|
128
130
|
};
|
|
131
|
+
type OfferConsumed = {
|
|
132
|
+
id: string;
|
|
133
|
+
chainId: bigint;
|
|
134
|
+
offering: Address;
|
|
135
|
+
nonce: bigint;
|
|
136
|
+
amount: bigint;
|
|
137
|
+
};
|
|
129
138
|
declare const RouterOfferSchema: (parameters?: {
|
|
130
139
|
omitHash?: boolean;
|
|
131
140
|
}) => zod_v4.ZodObject<{
|
|
@@ -162,6 +171,30 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
162
171
|
issue: z.ZodString;
|
|
163
172
|
}, z.core.$strip>>;
|
|
164
173
|
}, zod_v4_core.$strip>;
|
|
174
|
+
/**
|
|
175
|
+
* ABI for the Consumed event emitted by the terms contract.
|
|
176
|
+
*/
|
|
177
|
+
declare const consumedEvent: {
|
|
178
|
+
readonly type: "event";
|
|
179
|
+
readonly name: "Consumed";
|
|
180
|
+
readonly inputs: readonly [{
|
|
181
|
+
readonly name: "user";
|
|
182
|
+
readonly type: "address";
|
|
183
|
+
readonly indexed: true;
|
|
184
|
+
readonly internalType: "address";
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "nonce";
|
|
187
|
+
readonly type: "uint256";
|
|
188
|
+
readonly indexed: true;
|
|
189
|
+
readonly internalType: "uint256";
|
|
190
|
+
}, {
|
|
191
|
+
readonly name: "amount";
|
|
192
|
+
readonly type: "uint256";
|
|
193
|
+
readonly indexed: false;
|
|
194
|
+
readonly internalType: "uint256";
|
|
195
|
+
}];
|
|
196
|
+
readonly anonymous: false;
|
|
197
|
+
};
|
|
165
198
|
/**
|
|
166
199
|
* Creates a router offer from a plain object.
|
|
167
200
|
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
@@ -189,6 +222,15 @@ declare namespace fromSnakeCase {
|
|
|
189
222
|
*/
|
|
190
223
|
declare function toSnakeCase(offer: RouterOffer): Format.Snake<RouterOffer>;
|
|
191
224
|
declare function random(): RouterOffer;
|
|
225
|
+
declare function fromConsumedLog(parameters: {
|
|
226
|
+
blockNumber: bigint;
|
|
227
|
+
logIndex: number;
|
|
228
|
+
chainId: number;
|
|
229
|
+
transactionHash: Hex;
|
|
230
|
+
user: Address;
|
|
231
|
+
nonce: bigint;
|
|
232
|
+
amount: bigint;
|
|
233
|
+
}): OfferConsumed;
|
|
192
234
|
declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error> {
|
|
193
235
|
readonly name = "RouterOffer.InvalidRouterOfferError";
|
|
194
236
|
constructor(error: ZodError | Error);
|
|
@@ -196,16 +238,19 @@ declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error>
|
|
|
196
238
|
|
|
197
239
|
type RouterOffer$1_InvalidRouterOfferError = InvalidRouterOfferError;
|
|
198
240
|
declare const RouterOffer$1_InvalidRouterOfferError: typeof InvalidRouterOfferError;
|
|
241
|
+
type RouterOffer$1_OfferConsumed = OfferConsumed;
|
|
199
242
|
type RouterOffer$1_OfferMetadata = OfferMetadata;
|
|
200
243
|
type RouterOffer$1_OfferStatus = OfferStatus;
|
|
201
244
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
202
245
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
203
246
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
247
|
+
declare const RouterOffer$1_consumedEvent: typeof consumedEvent;
|
|
248
|
+
declare const RouterOffer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
204
249
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
205
250
|
declare const RouterOffer$1_random: typeof random;
|
|
206
251
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
207
252
|
declare namespace RouterOffer$1 {
|
|
208
|
-
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, from$1 as from, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
253
|
+
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferConsumed as OfferConsumed, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, RouterOffer$1_consumedEvent as consumedEvent, from$1 as from, RouterOffer$1_fromConsumedLog as fromConsumedLog, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
209
254
|
}
|
|
210
255
|
|
|
211
256
|
type OfferResponse = {
|
|
@@ -423,6 +468,7 @@ type OfferStore = {
|
|
|
423
468
|
metadata?: OfferMetadata;
|
|
424
469
|
}) => Promise<void>;
|
|
425
470
|
updateConsumedAmount: (parameters: {
|
|
471
|
+
id: string;
|
|
426
472
|
chainId: Offer.Offer["chainId"];
|
|
427
473
|
offering: Offer.Offer["offering"];
|
|
428
474
|
nonce: Offer.Offer["nonce"];
|
|
@@ -431,13 +477,13 @@ type OfferStore = {
|
|
|
431
477
|
/** Persist latest indexing progress for a chain and event type. */
|
|
432
478
|
saveLatestBlockNumberProcessed: (parameters: {
|
|
433
479
|
chainId: Offer.Offer["chainId"];
|
|
434
|
-
eventType: "offer_created" | "
|
|
480
|
+
eventType: "offer_created" | "offer_consumed";
|
|
435
481
|
latestBlockNumber: number;
|
|
436
482
|
}) => Promise<void>;
|
|
437
483
|
/** Retrieve latest indexing progress for a chain and event type. */
|
|
438
484
|
getLatestBlockNumberProcessed: (parameters: {
|
|
439
485
|
chainId: Offer.Offer["chainId"];
|
|
440
|
-
eventType: "offer_created" | "
|
|
486
|
+
eventType: "offer_created" | "offer_consumed";
|
|
441
487
|
}) => Promise<{
|
|
442
488
|
latestBlockNumber: number;
|
|
443
489
|
} | null>;
|
|
@@ -453,8 +499,8 @@ type GetOffersFilters = {
|
|
|
453
499
|
maxAmount?: bigint;
|
|
454
500
|
minRate?: bigint;
|
|
455
501
|
maxRate?: bigint;
|
|
456
|
-
minMaturity?:
|
|
457
|
-
maxMaturity?:
|
|
502
|
+
minMaturity?: number;
|
|
503
|
+
maxMaturity?: number;
|
|
458
504
|
minExpiry?: number;
|
|
459
505
|
maxExpiry?: number;
|
|
460
506
|
collateralAssets?: string[];
|
|
@@ -464,8 +510,8 @@ type GetOffersFilters = {
|
|
|
464
510
|
oracle?: string;
|
|
465
511
|
lltv?: LLTV.LLTV;
|
|
466
512
|
}>;
|
|
467
|
-
minLltv?:
|
|
468
|
-
maxLltv?:
|
|
513
|
+
minLltv?: number;
|
|
514
|
+
maxLltv?: number;
|
|
469
515
|
sortBy?: "rate" | "maturity" | "expiry" | "amount";
|
|
470
516
|
sortOrder?: "asc" | "desc";
|
|
471
517
|
cursor?: string;
|
|
@@ -480,9 +526,9 @@ type FindMatchingOffersParams = {
|
|
|
480
526
|
oracle: string;
|
|
481
527
|
lltv: LLTV.LLTV;
|
|
482
528
|
}>;
|
|
483
|
-
maturity?:
|
|
484
|
-
minMaturity?:
|
|
485
|
-
maxMaturity?:
|
|
529
|
+
maturity?: number;
|
|
530
|
+
minMaturity?: number;
|
|
531
|
+
maxMaturity?: number;
|
|
486
532
|
loanToken?: string;
|
|
487
533
|
creator?: string;
|
|
488
534
|
/** Filter by offer status; if omitted defaults to ["valid"] */
|
|
@@ -674,13 +720,15 @@ declare namespace Logger$1 {
|
|
|
674
720
|
export { type Logger$1_LogFn as LogFn, type Logger$1_LogLevel as LogLevel, Logger$1_LogLevelValues as LogLevelValues, type Logger$1_Logger as Logger, Logger$1_defaultLogger as defaultLogger, Logger$1_getLogger as getLogger, Logger$1_runWithLogger as runWithLogger };
|
|
675
721
|
}
|
|
676
722
|
|
|
677
|
-
declare const types: readonly ["offer_created", "
|
|
723
|
+
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
|
678
724
|
type Type = (typeof types)[number];
|
|
679
725
|
type BaseEvent<type extends Type = Type> = {
|
|
680
726
|
readonly id: string;
|
|
681
727
|
readonly type: type;
|
|
682
728
|
};
|
|
683
|
-
type RouterEvent<type extends Type = Type> = type extends "
|
|
729
|
+
type RouterEvent<type extends Type = Type> = type extends "offer_consumed" ? Compute<BaseEvent<type> & {
|
|
730
|
+
readonly offerConsumed: OfferConsumed;
|
|
731
|
+
}> : type extends "offer_created" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
684
732
|
readonly offer: Offer.Offer;
|
|
685
733
|
}> : never;
|
|
686
734
|
/**
|