@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.node.d.cts
CHANGED
|
@@ -2,12 +2,16 @@ import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
|
2
2
|
import { Compute, Offer, Errors, Format, Maturity, LLTV } from '@morpho-dev/mempool';
|
|
3
3
|
export * from '@morpho-dev/mempool';
|
|
4
4
|
import * as viem from 'viem';
|
|
5
|
-
import { Address, Hex,
|
|
5
|
+
import { Address, Hex, PublicClient } from 'viem';
|
|
6
6
|
import { Chain as Chain$2 } from 'viem/chains';
|
|
7
7
|
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
8
8
|
import * as zod_v4 from 'zod/v4';
|
|
9
9
|
import { z, ZodError } from 'zod/v4';
|
|
10
10
|
import * as zod_v4_core from 'zod/v4/core';
|
|
11
|
+
import * as hono_utils_types from 'hono/utils/types';
|
|
12
|
+
import * as hono from 'hono';
|
|
13
|
+
import { Context } from 'hono';
|
|
14
|
+
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
11
15
|
|
|
12
16
|
declare const chainNames: readonly ["ethereum", "base"];
|
|
13
17
|
type ChainName = (typeof chainNames)[number];
|
|
@@ -158,8 +162,8 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
158
162
|
* @param input - The router offer to create.
|
|
159
163
|
* @returns The created router offer with its hash.
|
|
160
164
|
*/
|
|
161
|
-
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
162
|
-
declare namespace from {
|
|
165
|
+
declare function from$1(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
166
|
+
declare namespace from$1 {
|
|
163
167
|
type ErrorType = InvalidRouterOfferError;
|
|
164
168
|
}
|
|
165
169
|
/**
|
|
@@ -191,12 +195,11 @@ type RouterOffer$1_OfferStatus = OfferStatus;
|
|
|
191
195
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
192
196
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
193
197
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
194
|
-
declare const RouterOffer$1_from: typeof from;
|
|
195
198
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
196
199
|
declare const RouterOffer$1_random: typeof random;
|
|
197
200
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
198
201
|
declare namespace RouterOffer$1 {
|
|
199
|
-
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,
|
|
202
|
+
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 };
|
|
200
203
|
}
|
|
201
204
|
|
|
202
205
|
type OfferResponse = {
|
|
@@ -503,7 +506,94 @@ declare function serve(parameters: {
|
|
|
503
506
|
port: number;
|
|
504
507
|
store?: OfferStore;
|
|
505
508
|
}): Promise<void>;
|
|
509
|
+
declare function error(error: unknown, c: Context): Response & hono.TypedResponse<{
|
|
510
|
+
statusCode: number;
|
|
511
|
+
body: string;
|
|
512
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">;
|
|
513
|
+
declare function success<T>(c: Context, { data, cursor, }: {
|
|
514
|
+
data: T | T[];
|
|
515
|
+
cursor?: string | null;
|
|
516
|
+
}): Response & hono.TypedResponse<{
|
|
517
|
+
status: string;
|
|
518
|
+
cursor: string | null | undefined;
|
|
519
|
+
data: T | T[];
|
|
520
|
+
meta: {
|
|
521
|
+
timestamp: string;
|
|
522
|
+
};
|
|
523
|
+
} extends hono_utils_types.JSONValue ? { [K in keyof {
|
|
524
|
+
status: string;
|
|
525
|
+
cursor: string | null | undefined;
|
|
526
|
+
data: T | T[];
|
|
527
|
+
meta: {
|
|
528
|
+
timestamp: string;
|
|
529
|
+
};
|
|
530
|
+
} as ({
|
|
531
|
+
status: string;
|
|
532
|
+
cursor: string | null | undefined;
|
|
533
|
+
data: T | T[];
|
|
534
|
+
meta: {
|
|
535
|
+
timestamp: string;
|
|
536
|
+
};
|
|
537
|
+
}[K] extends infer T_1 ? T_1 extends {
|
|
538
|
+
status: string;
|
|
539
|
+
cursor: string | null | undefined;
|
|
540
|
+
data: T | T[];
|
|
541
|
+
meta: {
|
|
542
|
+
timestamp: string;
|
|
543
|
+
};
|
|
544
|
+
}[K] ? T_1 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({
|
|
545
|
+
status: string;
|
|
546
|
+
cursor: string | null | undefined;
|
|
547
|
+
data: T | T[];
|
|
548
|
+
meta: {
|
|
549
|
+
timestamp: string;
|
|
550
|
+
};
|
|
551
|
+
}[K] extends infer T_2 ? T_2 extends {
|
|
552
|
+
status: string;
|
|
553
|
+
cursor: string | null | undefined;
|
|
554
|
+
data: T | T[];
|
|
555
|
+
meta: {
|
|
556
|
+
timestamp: string;
|
|
557
|
+
};
|
|
558
|
+
}[K] ? T_2 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) ? hono_utils_types.JSONParsed<{
|
|
559
|
+
status: string;
|
|
560
|
+
cursor: string | null | undefined;
|
|
561
|
+
data: T | T[];
|
|
562
|
+
meta: {
|
|
563
|
+
timestamp: string;
|
|
564
|
+
};
|
|
565
|
+
}[K]> | undefined : hono_utils_types.JSONParsed<{
|
|
566
|
+
status: string;
|
|
567
|
+
cursor: string | null | undefined;
|
|
568
|
+
data: T | T[];
|
|
569
|
+
meta: {
|
|
570
|
+
timestamp: string;
|
|
571
|
+
};
|
|
572
|
+
}[K]>; } : never, hono_utils_http_status.ContentfulStatusCode, "json">;
|
|
573
|
+
declare class APIError extends Error {
|
|
574
|
+
statusCode: number;
|
|
575
|
+
code: string;
|
|
576
|
+
details?: unknown | undefined;
|
|
577
|
+
constructor(statusCode: number, message: string, code: string, details?: unknown | undefined);
|
|
578
|
+
}
|
|
579
|
+
declare class ValidationError extends APIError {
|
|
580
|
+
constructor(message: string, details?: unknown);
|
|
581
|
+
}
|
|
582
|
+
declare class NotFoundError extends APIError {
|
|
583
|
+
constructor(message: string);
|
|
584
|
+
}
|
|
585
|
+
declare class InternalServerError extends APIError {
|
|
586
|
+
constructor(message?: string);
|
|
587
|
+
}
|
|
588
|
+
declare class BadRequestError extends APIError {
|
|
589
|
+
constructor(message?: string, details?: unknown);
|
|
590
|
+
}
|
|
591
|
+
declare function handleZodError(error: z.ZodError): ValidationError;
|
|
506
592
|
|
|
593
|
+
type index$1_APIError = APIError;
|
|
594
|
+
declare const index$1_APIError: typeof APIError;
|
|
595
|
+
type index$1_BadRequestError = BadRequestError;
|
|
596
|
+
declare const index$1_BadRequestError: typeof BadRequestError;
|
|
507
597
|
type index$1_Client = Client;
|
|
508
598
|
type index$1_GetParameters = GetParameters;
|
|
509
599
|
type index$1_HttpForbiddenError = HttpForbiddenError;
|
|
@@ -514,55 +604,25 @@ type index$1_HttpRateLimitError = HttpRateLimitError;
|
|
|
514
604
|
declare const index$1_HttpRateLimitError: typeof HttpRateLimitError;
|
|
515
605
|
type index$1_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
516
606
|
declare const index$1_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
607
|
+
type index$1_InternalServerError = InternalServerError;
|
|
608
|
+
declare const index$1_InternalServerError: typeof InternalServerError;
|
|
517
609
|
type index$1_InvalidUrlError = InvalidUrlError;
|
|
518
610
|
declare const index$1_InvalidUrlError: typeof InvalidUrlError;
|
|
519
611
|
type index$1_MatchParameters = MatchParameters;
|
|
612
|
+
type index$1_NotFoundError = NotFoundError;
|
|
613
|
+
declare const index$1_NotFoundError: typeof NotFoundError;
|
|
520
614
|
type index$1_RouterClientConfig = RouterClientConfig;
|
|
615
|
+
type index$1_ValidationError = ValidationError;
|
|
616
|
+
declare const index$1_ValidationError: typeof ValidationError;
|
|
521
617
|
declare const index$1_connect: typeof connect;
|
|
618
|
+
declare const index$1_error: typeof error;
|
|
522
619
|
declare const index$1_get: typeof get;
|
|
620
|
+
declare const index$1_handleZodError: typeof handleZodError;
|
|
523
621
|
declare const index$1_match: typeof match;
|
|
524
622
|
declare const index$1_serve: typeof serve;
|
|
623
|
+
declare const index$1_success: typeof success;
|
|
525
624
|
declare namespace index$1 {
|
|
526
|
-
export { type index$1_Client as Client, type index$1_GetParameters as GetParameters, index$1_HttpForbiddenError as HttpForbiddenError, index$1_HttpGetOffersFailedError as HttpGetOffersFailedError, index$1_HttpRateLimitError as HttpRateLimitError, index$1_HttpUnauthorizedError as HttpUnauthorizedError, index$1_InvalidUrlError as InvalidUrlError, type index$1_MatchParameters as MatchParameters, type index$1_RouterClientConfig as RouterClientConfig, index$1_connect as connect, index$1_get as get, index$1_match as match, index$1_serve as serve };
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
declare const users: Account[];
|
|
530
|
-
declare const assetList: readonly ["USDC", "DAI"];
|
|
531
|
-
declare const mockAddress: (asset: (typeof assetList)[number]) => `0x${string}`;
|
|
532
|
-
declare const assetMethods: readonly ["balanceOf", "allowance"];
|
|
533
|
-
type AssetMethod = (typeof assetMethods)[number];
|
|
534
|
-
type MethodParameters = {
|
|
535
|
-
balanceOf: {
|
|
536
|
-
address: Address;
|
|
537
|
-
value: bigint;
|
|
538
|
-
};
|
|
539
|
-
allowance: {
|
|
540
|
-
owner: Address;
|
|
541
|
-
spender: Address;
|
|
542
|
-
value: bigint;
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
type MockedAsset = {
|
|
546
|
-
address: Address;
|
|
547
|
-
set: (slot: Hex | AssetMethod, parameters: Hex | bigint | MethodParameters[AssetMethod]) => Promise<void>;
|
|
548
|
-
};
|
|
549
|
-
type Mocked = {
|
|
550
|
-
name: string;
|
|
551
|
-
publicClient: PublicClient;
|
|
552
|
-
} & Record<(typeof assetList)[number], MockedAsset>;
|
|
553
|
-
declare function mock(name: string): Promise<Mocked>;
|
|
554
|
-
|
|
555
|
-
type EVM_AssetMethod = AssetMethod;
|
|
556
|
-
type EVM_MethodParameters = MethodParameters;
|
|
557
|
-
type EVM_Mocked = Mocked;
|
|
558
|
-
type EVM_MockedAsset = MockedAsset;
|
|
559
|
-
declare const EVM_assetList: typeof assetList;
|
|
560
|
-
declare const EVM_assetMethods: typeof assetMethods;
|
|
561
|
-
declare const EVM_mock: typeof mock;
|
|
562
|
-
declare const EVM_mockAddress: typeof mockAddress;
|
|
563
|
-
declare const EVM_users: typeof users;
|
|
564
|
-
declare namespace EVM {
|
|
565
|
-
export { type EVM_AssetMethod as AssetMethod, type EVM_MethodParameters as MethodParameters, type EVM_Mocked as Mocked, type EVM_MockedAsset as MockedAsset, EVM_assetList as assetList, EVM_assetMethods as assetMethods, EVM_mock as mock, EVM_mockAddress as mockAddress, EVM_users as users };
|
|
625
|
+
export { index$1_APIError as APIError, index$1_BadRequestError as BadRequestError, type index$1_Client as Client, type index$1_GetParameters as GetParameters, index$1_HttpForbiddenError as HttpForbiddenError, index$1_HttpGetOffersFailedError as HttpGetOffersFailedError, index$1_HttpRateLimitError as HttpRateLimitError, index$1_HttpUnauthorizedError as HttpUnauthorizedError, index$1_InternalServerError as InternalServerError, index$1_InvalidUrlError as InvalidUrlError, type index$1_MatchParameters as MatchParameters, index$1_NotFoundError as NotFoundError, type index$1_RouterClientConfig as RouterClientConfig, index$1_ValidationError as ValidationError, index$1_connect as connect, index$1_error as error, index$1_get as get, index$1_handleZodError as handleZodError, index$1_match as match, index$1_serve as serve, index$1_success as success };
|
|
566
626
|
}
|
|
567
627
|
|
|
568
628
|
declare const LogLevelValues: readonly ["silent", "trace", "debug", "info", "warn", "error", "fatal"];
|
|
@@ -597,37 +657,26 @@ declare namespace Logger$1 {
|
|
|
597
657
|
|
|
598
658
|
declare const types: readonly ["offer_created", "offer_matched", "offer_validation"];
|
|
599
659
|
type Type = (typeof types)[number];
|
|
600
|
-
type
|
|
601
|
-
offer_created: {
|
|
602
|
-
readonly offer: Offer.Offer;
|
|
603
|
-
};
|
|
604
|
-
offer_matched: {
|
|
605
|
-
readonly offer: Offer.Offer;
|
|
606
|
-
};
|
|
607
|
-
offer_validation: {
|
|
608
|
-
readonly offer: Offer.Offer;
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
type BaseEvent<T extends Type> = {
|
|
660
|
+
type BaseEvent<type extends Type = Type> = {
|
|
612
661
|
readonly id: string;
|
|
613
|
-
readonly type:
|
|
662
|
+
readonly type: type;
|
|
614
663
|
};
|
|
615
|
-
type RouterEvent = Compute<{
|
|
616
|
-
|
|
617
|
-
}
|
|
664
|
+
type RouterEvent<type extends Type = Type> = type extends "offer_created" | "offer_matched" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
665
|
+
readonly offer: Offer.Offer;
|
|
666
|
+
}> : never;
|
|
618
667
|
/**
|
|
619
|
-
*
|
|
620
|
-
* For `offer_created` it returns `offer_created:${offer.hash.toLowerCase()}`.
|
|
621
|
-
* For `offer_matched` it returns `offer_matched:${offer.hash.toLowerCase()}`.
|
|
668
|
+
* Creates a RouterEvent with a deterministic id.
|
|
622
669
|
*/
|
|
623
|
-
declare function
|
|
670
|
+
declare function from<T extends Type = Type>(base: Omit<RouterEvent<T>, "id" | "type"> & {
|
|
671
|
+
type: T;
|
|
672
|
+
}): Compute<RouterEvent<T>>;
|
|
624
673
|
|
|
625
|
-
type RouterEvent$1_RouterEvent = RouterEvent
|
|
674
|
+
type RouterEvent$1_RouterEvent<type extends Type = Type> = RouterEvent<type>;
|
|
626
675
|
type RouterEvent$1_Type = Type;
|
|
627
|
-
declare const RouterEvent$
|
|
676
|
+
declare const RouterEvent$1_from: typeof from;
|
|
628
677
|
declare const RouterEvent$1_types: typeof types;
|
|
629
678
|
declare namespace RouterEvent$1 {
|
|
630
|
-
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$
|
|
679
|
+
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$1_from as from, RouterEvent$1_types as types };
|
|
631
680
|
}
|
|
632
681
|
|
|
633
682
|
/**
|
|
@@ -934,4 +983,4 @@ declare namespace Validation {
|
|
|
934
983
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
935
984
|
}
|
|
936
985
|
|
|
937
|
-
export { index$3 as ApiSchema, Chain$1 as Chain,
|
|
986
|
+
export { index$3 as ApiSchema, Chain$1 as Chain, Logger$1 as Logger, index$2 as OfferStore, index$1 as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, index as Utils, Validation, ValidationRule };
|
package/dist/index.node.d.ts
CHANGED
|
@@ -2,12 +2,16 @@ import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
|
2
2
|
import { Compute, Offer, Errors, Format, Maturity, LLTV } from '@morpho-dev/mempool';
|
|
3
3
|
export * from '@morpho-dev/mempool';
|
|
4
4
|
import * as viem from 'viem';
|
|
5
|
-
import { Address, Hex,
|
|
5
|
+
import { Address, Hex, PublicClient } from 'viem';
|
|
6
6
|
import { Chain as Chain$2 } from 'viem/chains';
|
|
7
7
|
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
8
8
|
import * as zod_v4 from 'zod/v4';
|
|
9
9
|
import { z, ZodError } from 'zod/v4';
|
|
10
10
|
import * as zod_v4_core from 'zod/v4/core';
|
|
11
|
+
import * as hono_utils_types from 'hono/utils/types';
|
|
12
|
+
import * as hono from 'hono';
|
|
13
|
+
import { Context } from 'hono';
|
|
14
|
+
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
11
15
|
|
|
12
16
|
declare const chainNames: readonly ["ethereum", "base"];
|
|
13
17
|
type ChainName = (typeof chainNames)[number];
|
|
@@ -158,8 +162,8 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
158
162
|
* @param input - The router offer to create.
|
|
159
163
|
* @returns The created router offer with its hash.
|
|
160
164
|
*/
|
|
161
|
-
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
162
|
-
declare namespace from {
|
|
165
|
+
declare function from$1(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
166
|
+
declare namespace from$1 {
|
|
163
167
|
type ErrorType = InvalidRouterOfferError;
|
|
164
168
|
}
|
|
165
169
|
/**
|
|
@@ -191,12 +195,11 @@ type RouterOffer$1_OfferStatus = OfferStatus;
|
|
|
191
195
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
192
196
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
193
197
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
194
|
-
declare const RouterOffer$1_from: typeof from;
|
|
195
198
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
196
199
|
declare const RouterOffer$1_random: typeof random;
|
|
197
200
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
198
201
|
declare namespace RouterOffer$1 {
|
|
199
|
-
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,
|
|
202
|
+
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 };
|
|
200
203
|
}
|
|
201
204
|
|
|
202
205
|
type OfferResponse = {
|
|
@@ -503,7 +506,94 @@ declare function serve(parameters: {
|
|
|
503
506
|
port: number;
|
|
504
507
|
store?: OfferStore;
|
|
505
508
|
}): Promise<void>;
|
|
509
|
+
declare function error(error: unknown, c: Context): Response & hono.TypedResponse<{
|
|
510
|
+
statusCode: number;
|
|
511
|
+
body: string;
|
|
512
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">;
|
|
513
|
+
declare function success<T>(c: Context, { data, cursor, }: {
|
|
514
|
+
data: T | T[];
|
|
515
|
+
cursor?: string | null;
|
|
516
|
+
}): Response & hono.TypedResponse<{
|
|
517
|
+
status: string;
|
|
518
|
+
cursor: string | null | undefined;
|
|
519
|
+
data: T | T[];
|
|
520
|
+
meta: {
|
|
521
|
+
timestamp: string;
|
|
522
|
+
};
|
|
523
|
+
} extends hono_utils_types.JSONValue ? { [K in keyof {
|
|
524
|
+
status: string;
|
|
525
|
+
cursor: string | null | undefined;
|
|
526
|
+
data: T | T[];
|
|
527
|
+
meta: {
|
|
528
|
+
timestamp: string;
|
|
529
|
+
};
|
|
530
|
+
} as ({
|
|
531
|
+
status: string;
|
|
532
|
+
cursor: string | null | undefined;
|
|
533
|
+
data: T | T[];
|
|
534
|
+
meta: {
|
|
535
|
+
timestamp: string;
|
|
536
|
+
};
|
|
537
|
+
}[K] extends infer T_1 ? T_1 extends {
|
|
538
|
+
status: string;
|
|
539
|
+
cursor: string | null | undefined;
|
|
540
|
+
data: T | T[];
|
|
541
|
+
meta: {
|
|
542
|
+
timestamp: string;
|
|
543
|
+
};
|
|
544
|
+
}[K] ? T_1 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({
|
|
545
|
+
status: string;
|
|
546
|
+
cursor: string | null | undefined;
|
|
547
|
+
data: T | T[];
|
|
548
|
+
meta: {
|
|
549
|
+
timestamp: string;
|
|
550
|
+
};
|
|
551
|
+
}[K] extends infer T_2 ? T_2 extends {
|
|
552
|
+
status: string;
|
|
553
|
+
cursor: string | null | undefined;
|
|
554
|
+
data: T | T[];
|
|
555
|
+
meta: {
|
|
556
|
+
timestamp: string;
|
|
557
|
+
};
|
|
558
|
+
}[K] ? T_2 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) ? hono_utils_types.JSONParsed<{
|
|
559
|
+
status: string;
|
|
560
|
+
cursor: string | null | undefined;
|
|
561
|
+
data: T | T[];
|
|
562
|
+
meta: {
|
|
563
|
+
timestamp: string;
|
|
564
|
+
};
|
|
565
|
+
}[K]> | undefined : hono_utils_types.JSONParsed<{
|
|
566
|
+
status: string;
|
|
567
|
+
cursor: string | null | undefined;
|
|
568
|
+
data: T | T[];
|
|
569
|
+
meta: {
|
|
570
|
+
timestamp: string;
|
|
571
|
+
};
|
|
572
|
+
}[K]>; } : never, hono_utils_http_status.ContentfulStatusCode, "json">;
|
|
573
|
+
declare class APIError extends Error {
|
|
574
|
+
statusCode: number;
|
|
575
|
+
code: string;
|
|
576
|
+
details?: unknown | undefined;
|
|
577
|
+
constructor(statusCode: number, message: string, code: string, details?: unknown | undefined);
|
|
578
|
+
}
|
|
579
|
+
declare class ValidationError extends APIError {
|
|
580
|
+
constructor(message: string, details?: unknown);
|
|
581
|
+
}
|
|
582
|
+
declare class NotFoundError extends APIError {
|
|
583
|
+
constructor(message: string);
|
|
584
|
+
}
|
|
585
|
+
declare class InternalServerError extends APIError {
|
|
586
|
+
constructor(message?: string);
|
|
587
|
+
}
|
|
588
|
+
declare class BadRequestError extends APIError {
|
|
589
|
+
constructor(message?: string, details?: unknown);
|
|
590
|
+
}
|
|
591
|
+
declare function handleZodError(error: z.ZodError): ValidationError;
|
|
506
592
|
|
|
593
|
+
type index$1_APIError = APIError;
|
|
594
|
+
declare const index$1_APIError: typeof APIError;
|
|
595
|
+
type index$1_BadRequestError = BadRequestError;
|
|
596
|
+
declare const index$1_BadRequestError: typeof BadRequestError;
|
|
507
597
|
type index$1_Client = Client;
|
|
508
598
|
type index$1_GetParameters = GetParameters;
|
|
509
599
|
type index$1_HttpForbiddenError = HttpForbiddenError;
|
|
@@ -514,55 +604,25 @@ type index$1_HttpRateLimitError = HttpRateLimitError;
|
|
|
514
604
|
declare const index$1_HttpRateLimitError: typeof HttpRateLimitError;
|
|
515
605
|
type index$1_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
516
606
|
declare const index$1_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
607
|
+
type index$1_InternalServerError = InternalServerError;
|
|
608
|
+
declare const index$1_InternalServerError: typeof InternalServerError;
|
|
517
609
|
type index$1_InvalidUrlError = InvalidUrlError;
|
|
518
610
|
declare const index$1_InvalidUrlError: typeof InvalidUrlError;
|
|
519
611
|
type index$1_MatchParameters = MatchParameters;
|
|
612
|
+
type index$1_NotFoundError = NotFoundError;
|
|
613
|
+
declare const index$1_NotFoundError: typeof NotFoundError;
|
|
520
614
|
type index$1_RouterClientConfig = RouterClientConfig;
|
|
615
|
+
type index$1_ValidationError = ValidationError;
|
|
616
|
+
declare const index$1_ValidationError: typeof ValidationError;
|
|
521
617
|
declare const index$1_connect: typeof connect;
|
|
618
|
+
declare const index$1_error: typeof error;
|
|
522
619
|
declare const index$1_get: typeof get;
|
|
620
|
+
declare const index$1_handleZodError: typeof handleZodError;
|
|
523
621
|
declare const index$1_match: typeof match;
|
|
524
622
|
declare const index$1_serve: typeof serve;
|
|
623
|
+
declare const index$1_success: typeof success;
|
|
525
624
|
declare namespace index$1 {
|
|
526
|
-
export { type index$1_Client as Client, type index$1_GetParameters as GetParameters, index$1_HttpForbiddenError as HttpForbiddenError, index$1_HttpGetOffersFailedError as HttpGetOffersFailedError, index$1_HttpRateLimitError as HttpRateLimitError, index$1_HttpUnauthorizedError as HttpUnauthorizedError, index$1_InvalidUrlError as InvalidUrlError, type index$1_MatchParameters as MatchParameters, type index$1_RouterClientConfig as RouterClientConfig, index$1_connect as connect, index$1_get as get, index$1_match as match, index$1_serve as serve };
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
declare const users: Account[];
|
|
530
|
-
declare const assetList: readonly ["USDC", "DAI"];
|
|
531
|
-
declare const mockAddress: (asset: (typeof assetList)[number]) => `0x${string}`;
|
|
532
|
-
declare const assetMethods: readonly ["balanceOf", "allowance"];
|
|
533
|
-
type AssetMethod = (typeof assetMethods)[number];
|
|
534
|
-
type MethodParameters = {
|
|
535
|
-
balanceOf: {
|
|
536
|
-
address: Address;
|
|
537
|
-
value: bigint;
|
|
538
|
-
};
|
|
539
|
-
allowance: {
|
|
540
|
-
owner: Address;
|
|
541
|
-
spender: Address;
|
|
542
|
-
value: bigint;
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
type MockedAsset = {
|
|
546
|
-
address: Address;
|
|
547
|
-
set: (slot: Hex | AssetMethod, parameters: Hex | bigint | MethodParameters[AssetMethod]) => Promise<void>;
|
|
548
|
-
};
|
|
549
|
-
type Mocked = {
|
|
550
|
-
name: string;
|
|
551
|
-
publicClient: PublicClient;
|
|
552
|
-
} & Record<(typeof assetList)[number], MockedAsset>;
|
|
553
|
-
declare function mock(name: string): Promise<Mocked>;
|
|
554
|
-
|
|
555
|
-
type EVM_AssetMethod = AssetMethod;
|
|
556
|
-
type EVM_MethodParameters = MethodParameters;
|
|
557
|
-
type EVM_Mocked = Mocked;
|
|
558
|
-
type EVM_MockedAsset = MockedAsset;
|
|
559
|
-
declare const EVM_assetList: typeof assetList;
|
|
560
|
-
declare const EVM_assetMethods: typeof assetMethods;
|
|
561
|
-
declare const EVM_mock: typeof mock;
|
|
562
|
-
declare const EVM_mockAddress: typeof mockAddress;
|
|
563
|
-
declare const EVM_users: typeof users;
|
|
564
|
-
declare namespace EVM {
|
|
565
|
-
export { type EVM_AssetMethod as AssetMethod, type EVM_MethodParameters as MethodParameters, type EVM_Mocked as Mocked, type EVM_MockedAsset as MockedAsset, EVM_assetList as assetList, EVM_assetMethods as assetMethods, EVM_mock as mock, EVM_mockAddress as mockAddress, EVM_users as users };
|
|
625
|
+
export { index$1_APIError as APIError, index$1_BadRequestError as BadRequestError, type index$1_Client as Client, type index$1_GetParameters as GetParameters, index$1_HttpForbiddenError as HttpForbiddenError, index$1_HttpGetOffersFailedError as HttpGetOffersFailedError, index$1_HttpRateLimitError as HttpRateLimitError, index$1_HttpUnauthorizedError as HttpUnauthorizedError, index$1_InternalServerError as InternalServerError, index$1_InvalidUrlError as InvalidUrlError, type index$1_MatchParameters as MatchParameters, index$1_NotFoundError as NotFoundError, type index$1_RouterClientConfig as RouterClientConfig, index$1_ValidationError as ValidationError, index$1_connect as connect, index$1_error as error, index$1_get as get, index$1_handleZodError as handleZodError, index$1_match as match, index$1_serve as serve, index$1_success as success };
|
|
566
626
|
}
|
|
567
627
|
|
|
568
628
|
declare const LogLevelValues: readonly ["silent", "trace", "debug", "info", "warn", "error", "fatal"];
|
|
@@ -597,37 +657,26 @@ declare namespace Logger$1 {
|
|
|
597
657
|
|
|
598
658
|
declare const types: readonly ["offer_created", "offer_matched", "offer_validation"];
|
|
599
659
|
type Type = (typeof types)[number];
|
|
600
|
-
type
|
|
601
|
-
offer_created: {
|
|
602
|
-
readonly offer: Offer.Offer;
|
|
603
|
-
};
|
|
604
|
-
offer_matched: {
|
|
605
|
-
readonly offer: Offer.Offer;
|
|
606
|
-
};
|
|
607
|
-
offer_validation: {
|
|
608
|
-
readonly offer: Offer.Offer;
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
type BaseEvent<T extends Type> = {
|
|
660
|
+
type BaseEvent<type extends Type = Type> = {
|
|
612
661
|
readonly id: string;
|
|
613
|
-
readonly type:
|
|
662
|
+
readonly type: type;
|
|
614
663
|
};
|
|
615
|
-
type RouterEvent = Compute<{
|
|
616
|
-
|
|
617
|
-
}
|
|
664
|
+
type RouterEvent<type extends Type = Type> = type extends "offer_created" | "offer_matched" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
665
|
+
readonly offer: Offer.Offer;
|
|
666
|
+
}> : never;
|
|
618
667
|
/**
|
|
619
|
-
*
|
|
620
|
-
* For `offer_created` it returns `offer_created:${offer.hash.toLowerCase()}`.
|
|
621
|
-
* For `offer_matched` it returns `offer_matched:${offer.hash.toLowerCase()}`.
|
|
668
|
+
* Creates a RouterEvent with a deterministic id.
|
|
622
669
|
*/
|
|
623
|
-
declare function
|
|
670
|
+
declare function from<T extends Type = Type>(base: Omit<RouterEvent<T>, "id" | "type"> & {
|
|
671
|
+
type: T;
|
|
672
|
+
}): Compute<RouterEvent<T>>;
|
|
624
673
|
|
|
625
|
-
type RouterEvent$1_RouterEvent = RouterEvent
|
|
674
|
+
type RouterEvent$1_RouterEvent<type extends Type = Type> = RouterEvent<type>;
|
|
626
675
|
type RouterEvent$1_Type = Type;
|
|
627
|
-
declare const RouterEvent$
|
|
676
|
+
declare const RouterEvent$1_from: typeof from;
|
|
628
677
|
declare const RouterEvent$1_types: typeof types;
|
|
629
678
|
declare namespace RouterEvent$1 {
|
|
630
|
-
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$
|
|
679
|
+
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$1_from as from, RouterEvent$1_types as types };
|
|
631
680
|
}
|
|
632
681
|
|
|
633
682
|
/**
|
|
@@ -934,4 +983,4 @@ declare namespace Validation {
|
|
|
934
983
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
935
984
|
}
|
|
936
985
|
|
|
937
|
-
export { index$3 as ApiSchema, Chain$1 as Chain,
|
|
986
|
+
export { index$3 as ApiSchema, Chain$1 as Chain, Logger$1 as Logger, index$2 as OfferStore, index$1 as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, index as Utils, Validation, ValidationRule };
|