@morpho-dev/router 0.0.20 → 0.0.21
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 +15 -27
- package/dist/index.browser.d.ts +15 -27
- package/dist/index.browser.js +4 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +4 -13
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +118 -69
- package/dist/index.node.d.ts +118 -69
- package/dist/index.node.js +1449 -56989
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +1454 -56969
- package/dist/index.node.mjs.map +1 -1
- package/package.json +5 -6
- package/dist/bytecode/erc20.txt +0 -1
package/dist/index.browser.d.cts
CHANGED
|
@@ -88,8 +88,8 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
88
88
|
* @param input - The router offer to create.
|
|
89
89
|
* @returns The created router offer with its hash.
|
|
90
90
|
*/
|
|
91
|
-
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
92
|
-
declare namespace from {
|
|
91
|
+
declare function from$1(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
92
|
+
declare namespace from$1 {
|
|
93
93
|
type ErrorType = InvalidRouterOfferError;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
@@ -121,12 +121,11 @@ type RouterOffer$1_OfferStatus = OfferStatus;
|
|
|
121
121
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
122
122
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
123
123
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
124
|
-
declare const RouterOffer$1_from: typeof from;
|
|
125
124
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
126
125
|
declare const RouterOffer$1_random: typeof random;
|
|
127
126
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
128
127
|
declare namespace RouterOffer$1 {
|
|
129
|
-
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,
|
|
128
|
+
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 };
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
type OfferResponse = {
|
|
@@ -422,37 +421,26 @@ declare namespace index$1 {
|
|
|
422
421
|
|
|
423
422
|
declare const types: readonly ["offer_created", "offer_matched", "offer_validation"];
|
|
424
423
|
type Type = (typeof types)[number];
|
|
425
|
-
type
|
|
426
|
-
offer_created: {
|
|
427
|
-
readonly offer: Offer.Offer;
|
|
428
|
-
};
|
|
429
|
-
offer_matched: {
|
|
430
|
-
readonly offer: Offer.Offer;
|
|
431
|
-
};
|
|
432
|
-
offer_validation: {
|
|
433
|
-
readonly offer: Offer.Offer;
|
|
434
|
-
};
|
|
435
|
-
};
|
|
436
|
-
type BaseEvent<T extends Type> = {
|
|
424
|
+
type BaseEvent<type extends Type = Type> = {
|
|
437
425
|
readonly id: string;
|
|
438
|
-
readonly type:
|
|
426
|
+
readonly type: type;
|
|
439
427
|
};
|
|
440
|
-
type RouterEvent = Compute<{
|
|
441
|
-
|
|
442
|
-
}
|
|
428
|
+
type RouterEvent<type extends Type = Type> = type extends "offer_created" | "offer_matched" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
429
|
+
readonly offer: Offer.Offer;
|
|
430
|
+
}> : never;
|
|
443
431
|
/**
|
|
444
|
-
*
|
|
445
|
-
* For `offer_created` it returns `offer_created:${offer.hash.toLowerCase()}`.
|
|
446
|
-
* For `offer_matched` it returns `offer_matched:${offer.hash.toLowerCase()}`.
|
|
432
|
+
* Creates a RouterEvent with a deterministic id.
|
|
447
433
|
*/
|
|
448
|
-
declare function
|
|
434
|
+
declare function from<T extends Type = Type>(base: Omit<RouterEvent<T>, "id" | "type"> & {
|
|
435
|
+
type: T;
|
|
436
|
+
}): Compute<RouterEvent<T>>;
|
|
449
437
|
|
|
450
|
-
type RouterEvent$1_RouterEvent = RouterEvent
|
|
438
|
+
type RouterEvent$1_RouterEvent<type extends Type = Type> = RouterEvent<type>;
|
|
451
439
|
type RouterEvent$1_Type = Type;
|
|
452
|
-
declare const RouterEvent$
|
|
440
|
+
declare const RouterEvent$1_from: typeof from;
|
|
453
441
|
declare const RouterEvent$1_types: typeof types;
|
|
454
442
|
declare namespace RouterEvent$1 {
|
|
455
|
-
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$
|
|
443
|
+
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$1_from as from, RouterEvent$1_types as types };
|
|
456
444
|
}
|
|
457
445
|
|
|
458
446
|
/**
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -88,8 +88,8 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
88
88
|
* @param input - The router offer to create.
|
|
89
89
|
* @returns The created router offer with its hash.
|
|
90
90
|
*/
|
|
91
|
-
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
92
|
-
declare namespace from {
|
|
91
|
+
declare function from$1(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
92
|
+
declare namespace from$1 {
|
|
93
93
|
type ErrorType = InvalidRouterOfferError;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
@@ -121,12 +121,11 @@ type RouterOffer$1_OfferStatus = OfferStatus;
|
|
|
121
121
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
122
122
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
123
123
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
124
|
-
declare const RouterOffer$1_from: typeof from;
|
|
125
124
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
126
125
|
declare const RouterOffer$1_random: typeof random;
|
|
127
126
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
128
127
|
declare namespace RouterOffer$1 {
|
|
129
|
-
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,
|
|
128
|
+
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 };
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
type OfferResponse = {
|
|
@@ -422,37 +421,26 @@ declare namespace index$1 {
|
|
|
422
421
|
|
|
423
422
|
declare const types: readonly ["offer_created", "offer_matched", "offer_validation"];
|
|
424
423
|
type Type = (typeof types)[number];
|
|
425
|
-
type
|
|
426
|
-
offer_created: {
|
|
427
|
-
readonly offer: Offer.Offer;
|
|
428
|
-
};
|
|
429
|
-
offer_matched: {
|
|
430
|
-
readonly offer: Offer.Offer;
|
|
431
|
-
};
|
|
432
|
-
offer_validation: {
|
|
433
|
-
readonly offer: Offer.Offer;
|
|
434
|
-
};
|
|
435
|
-
};
|
|
436
|
-
type BaseEvent<T extends Type> = {
|
|
424
|
+
type BaseEvent<type extends Type = Type> = {
|
|
437
425
|
readonly id: string;
|
|
438
|
-
readonly type:
|
|
426
|
+
readonly type: type;
|
|
439
427
|
};
|
|
440
|
-
type RouterEvent = Compute<{
|
|
441
|
-
|
|
442
|
-
}
|
|
428
|
+
type RouterEvent<type extends Type = Type> = type extends "offer_created" | "offer_matched" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
429
|
+
readonly offer: Offer.Offer;
|
|
430
|
+
}> : never;
|
|
443
431
|
/**
|
|
444
|
-
*
|
|
445
|
-
* For `offer_created` it returns `offer_created:${offer.hash.toLowerCase()}`.
|
|
446
|
-
* For `offer_matched` it returns `offer_matched:${offer.hash.toLowerCase()}`.
|
|
432
|
+
* Creates a RouterEvent with a deterministic id.
|
|
447
433
|
*/
|
|
448
|
-
declare function
|
|
434
|
+
declare function from<T extends Type = Type>(base: Omit<RouterEvent<T>, "id" | "type"> & {
|
|
435
|
+
type: T;
|
|
436
|
+
}): Compute<RouterEvent<T>>;
|
|
449
437
|
|
|
450
|
-
type RouterEvent$1_RouterEvent = RouterEvent
|
|
438
|
+
type RouterEvent$1_RouterEvent<type extends Type = Type> = RouterEvent<type>;
|
|
451
439
|
type RouterEvent$1_Type = Type;
|
|
452
|
-
declare const RouterEvent$
|
|
440
|
+
declare const RouterEvent$1_from: typeof from;
|
|
453
441
|
declare const RouterEvent$1_types: typeof types;
|
|
454
442
|
declare namespace RouterEvent$1 {
|
|
455
|
-
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$
|
|
443
|
+
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$1_from as from, RouterEvent$1_types as types };
|
|
456
444
|
}
|
|
457
445
|
|
|
458
446
|
/**
|
package/dist/index.browser.js
CHANGED
|
@@ -1417,22 +1417,13 @@ function memory(parameters) {
|
|
|
1417
1417
|
// src/RouterEvent.ts
|
|
1418
1418
|
var RouterEvent_exports = {};
|
|
1419
1419
|
__export(RouterEvent_exports, {
|
|
1420
|
-
|
|
1420
|
+
from: () => from2,
|
|
1421
1421
|
types: () => types
|
|
1422
1422
|
});
|
|
1423
1423
|
var types = ["offer_created", "offer_matched", "offer_validation"];
|
|
1424
|
-
function
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
return `offer_created:${event.offer.hash.toLowerCase()}`;
|
|
1428
|
-
case "offer_matched":
|
|
1429
|
-
return `offer_matched:${event.offer.hash.toLowerCase()}`;
|
|
1430
|
-
case "offer_validation":
|
|
1431
|
-
return `offer_validation:${event.offer.hash.toLowerCase()}`;
|
|
1432
|
-
default: {
|
|
1433
|
-
throw new Error("Unhandled event type");
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1424
|
+
function from2(base) {
|
|
1425
|
+
const id = `${base.type}:${base.offer.hash.toLowerCase()}`;
|
|
1426
|
+
return { id, ...base };
|
|
1436
1427
|
}
|
|
1437
1428
|
|
|
1438
1429
|
// src/Validation.ts
|