@morpho-dev/router 0.0.13 → 0.0.15
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/drizzle/0008_add-consumed-relation.sql +10 -0
- package/dist/drizzle/meta/0008_snapshot.json +635 -0
- package/dist/drizzle/meta/_journal.json +8 -1
- package/dist/index.browser.d.cts +83 -5
- package/dist/index.browser.d.ts +83 -5
- package/dist/index.browser.js +50 -18
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +51 -19
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +201 -7
- package/dist/index.node.d.ts +201 -7
- package/dist/index.node.js +264 -101
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +265 -103
- package/dist/index.node.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.node.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Offer, Errors } from '@morpho-dev/mempool';
|
|
1
|
+
import { Offer, Errors, Format } from '@morpho-dev/mempool';
|
|
2
2
|
export * from '@morpho-dev/mempool';
|
|
3
3
|
import * as viem from 'viem';
|
|
4
4
|
import { Address, Account, Hex, PublicClient } from 'viem';
|
|
5
5
|
import { Chain as Chain$2 } from 'viem/chains';
|
|
6
6
|
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
7
|
-
import
|
|
7
|
+
import * as zod_v4 from 'zod/v4';
|
|
8
|
+
import { z, ZodError } from 'zod/v4';
|
|
9
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
8
10
|
import { PGlite } from '@electric-sql/pglite';
|
|
9
11
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
10
12
|
import { drizzle as drizzle$1 } from 'drizzle-orm/pglite';
|
|
@@ -126,16 +128,91 @@ type OfferMetadata = {
|
|
|
126
128
|
issue: string;
|
|
127
129
|
};
|
|
128
130
|
type RouterOffer = Offer.Offer & {
|
|
131
|
+
consumed: bigint;
|
|
129
132
|
status: OfferStatus;
|
|
130
133
|
metadata?: OfferMetadata;
|
|
131
134
|
};
|
|
135
|
+
declare const RouterOfferSchema: (parameters?: {
|
|
136
|
+
omitHash?: boolean;
|
|
137
|
+
}) => zod_v4.ZodObject<{
|
|
138
|
+
offering: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
139
|
+
assets: zod_v4.ZodBigInt;
|
|
140
|
+
rate: zod_v4.ZodBigInt;
|
|
141
|
+
maturity: zod_v4.ZodNumber;
|
|
142
|
+
expiry: zod_v4.ZodNumber;
|
|
143
|
+
start: zod_v4.ZodNumber;
|
|
144
|
+
nonce: zod_v4.ZodBigInt;
|
|
145
|
+
buy: zod_v4.ZodBoolean;
|
|
146
|
+
chainId: zod_v4.ZodBigInt;
|
|
147
|
+
loanToken: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
148
|
+
collaterals: zod_v4.ZodArray<zod_v4.ZodObject<{
|
|
149
|
+
asset: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
150
|
+
oracle: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
151
|
+
lltv: zod_v4.ZodBigInt;
|
|
152
|
+
}, zod_v4_core.$strip>>;
|
|
153
|
+
callback: zod_v4.ZodObject<{
|
|
154
|
+
address: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
155
|
+
data: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
156
|
+
gasLimit: zod_v4.ZodBigInt;
|
|
157
|
+
}, zod_v4_core.$strip>;
|
|
158
|
+
signature: zod_v4.ZodOptional<zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>>;
|
|
159
|
+
createdAt: zod_v4.ZodOptional<zod_v4.ZodNumber>;
|
|
160
|
+
consumed: z.ZodBigInt;
|
|
161
|
+
status: z.ZodEnum<{
|
|
162
|
+
valid: "valid";
|
|
163
|
+
callback_not_supported: "callback_not_supported";
|
|
164
|
+
callback_error: "callback_error";
|
|
165
|
+
unverified: "unverified";
|
|
166
|
+
}>;
|
|
167
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
issue: z.ZodString;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
}, zod_v4_core.$strip>;
|
|
171
|
+
/**
|
|
172
|
+
* Creates a router offer from a plain object.
|
|
173
|
+
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
174
|
+
* @param input - The router offer to create.
|
|
175
|
+
* @returns The created router offer with its hash.
|
|
176
|
+
*/
|
|
177
|
+
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
178
|
+
declare namespace from {
|
|
179
|
+
type ErrorType = InvalidRouterOfferError;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates a router offer from a snake case object.
|
|
183
|
+
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
184
|
+
* @param input - The router offer to create.
|
|
185
|
+
* @returns The created router offer with its hash.
|
|
186
|
+
*/
|
|
187
|
+
declare function fromSnakeCase(input: Format.Snake<Omit<RouterOffer, "hash">>): RouterOffer;
|
|
188
|
+
declare namespace fromSnakeCase {
|
|
189
|
+
type ErrorType = InvalidRouterOfferError;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Converts a router offer to a snake case object.
|
|
193
|
+
* @param offer - The router offer to convert.
|
|
194
|
+
* @returns The converted router offer.
|
|
195
|
+
*/
|
|
196
|
+
declare function toSnakeCase(offer: RouterOffer): Format.Snake<RouterOffer>;
|
|
197
|
+
declare function random(): RouterOffer;
|
|
198
|
+
declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error> {
|
|
199
|
+
readonly name = "RouterOffer.InvalidRouterOfferError";
|
|
200
|
+
constructor(error: ZodError | Error);
|
|
201
|
+
}
|
|
132
202
|
|
|
203
|
+
type RouterOffer$1_InvalidRouterOfferError = InvalidRouterOfferError;
|
|
204
|
+
declare const RouterOffer$1_InvalidRouterOfferError: typeof InvalidRouterOfferError;
|
|
133
205
|
type RouterOffer$1_OfferMetadata = OfferMetadata;
|
|
134
206
|
type RouterOffer$1_OfferStatus = OfferStatus;
|
|
135
207
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
136
208
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
209
|
+
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
210
|
+
declare const RouterOffer$1_from: typeof from;
|
|
211
|
+
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
212
|
+
declare const RouterOffer$1_random: typeof random;
|
|
213
|
+
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
137
214
|
declare namespace RouterOffer$1 {
|
|
138
|
-
export { type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer };
|
|
215
|
+
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, RouterOffer$1_from as from, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
139
216
|
}
|
|
140
217
|
|
|
141
218
|
type GetParameters = {
|
|
@@ -405,6 +482,12 @@ type OfferRepository = {
|
|
|
405
482
|
status: OfferStatus;
|
|
406
483
|
metadata?: OfferMetadata;
|
|
407
484
|
}) => Promise<void>;
|
|
485
|
+
updateConsumedAmount: (parameters: {
|
|
486
|
+
chainId: Offer.Offer["chainId"];
|
|
487
|
+
offering: Offer.Offer["offering"];
|
|
488
|
+
nonce: Offer.Offer["nonce"];
|
|
489
|
+
consumed: bigint;
|
|
490
|
+
}) => Promise<void>;
|
|
408
491
|
};
|
|
409
492
|
/**
|
|
410
493
|
* Creates a new OfferRepository instance.
|
|
@@ -908,6 +991,117 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
908
991
|
};
|
|
909
992
|
dialect: "pg";
|
|
910
993
|
}>;
|
|
994
|
+
declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
995
|
+
name: "consumed_per_user_and_nonce";
|
|
996
|
+
schema: undefined;
|
|
997
|
+
columns: {
|
|
998
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
999
|
+
name: "id";
|
|
1000
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1001
|
+
dataType: "number";
|
|
1002
|
+
columnType: "PgSerial";
|
|
1003
|
+
data: number;
|
|
1004
|
+
driverParam: number;
|
|
1005
|
+
notNull: true;
|
|
1006
|
+
hasDefault: true;
|
|
1007
|
+
isPrimaryKey: true;
|
|
1008
|
+
isAutoincrement: false;
|
|
1009
|
+
hasRuntimeDefault: false;
|
|
1010
|
+
enumValues: undefined;
|
|
1011
|
+
baseColumn: never;
|
|
1012
|
+
identity: undefined;
|
|
1013
|
+
generated: undefined;
|
|
1014
|
+
}, {}, {}>;
|
|
1015
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
1016
|
+
name: "chain_id";
|
|
1017
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1018
|
+
dataType: "bigint";
|
|
1019
|
+
columnType: "PgBigInt64";
|
|
1020
|
+
data: bigint;
|
|
1021
|
+
driverParam: string;
|
|
1022
|
+
notNull: true;
|
|
1023
|
+
hasDefault: false;
|
|
1024
|
+
isPrimaryKey: false;
|
|
1025
|
+
isAutoincrement: false;
|
|
1026
|
+
hasRuntimeDefault: false;
|
|
1027
|
+
enumValues: undefined;
|
|
1028
|
+
baseColumn: never;
|
|
1029
|
+
identity: undefined;
|
|
1030
|
+
generated: undefined;
|
|
1031
|
+
}, {}, {}>;
|
|
1032
|
+
offering: drizzle_orm_pg_core.PgColumn<{
|
|
1033
|
+
name: "offering";
|
|
1034
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1035
|
+
dataType: "string";
|
|
1036
|
+
columnType: "PgVarchar";
|
|
1037
|
+
data: string;
|
|
1038
|
+
driverParam: string;
|
|
1039
|
+
notNull: true;
|
|
1040
|
+
hasDefault: false;
|
|
1041
|
+
isPrimaryKey: false;
|
|
1042
|
+
isAutoincrement: false;
|
|
1043
|
+
hasRuntimeDefault: false;
|
|
1044
|
+
enumValues: [string, ...string[]];
|
|
1045
|
+
baseColumn: never;
|
|
1046
|
+
identity: undefined;
|
|
1047
|
+
generated: undefined;
|
|
1048
|
+
}, {}, {
|
|
1049
|
+
length: 42;
|
|
1050
|
+
}>;
|
|
1051
|
+
nonce: drizzle_orm_pg_core.PgColumn<{
|
|
1052
|
+
name: "nonce";
|
|
1053
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1054
|
+
dataType: "bigint";
|
|
1055
|
+
columnType: "PgBigInt64";
|
|
1056
|
+
data: bigint;
|
|
1057
|
+
driverParam: string;
|
|
1058
|
+
notNull: true;
|
|
1059
|
+
hasDefault: false;
|
|
1060
|
+
isPrimaryKey: false;
|
|
1061
|
+
isAutoincrement: false;
|
|
1062
|
+
hasRuntimeDefault: false;
|
|
1063
|
+
enumValues: undefined;
|
|
1064
|
+
baseColumn: never;
|
|
1065
|
+
identity: undefined;
|
|
1066
|
+
generated: undefined;
|
|
1067
|
+
}, {}, {}>;
|
|
1068
|
+
consumed: drizzle_orm_pg_core.PgColumn<{
|
|
1069
|
+
name: "consumed";
|
|
1070
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1071
|
+
dataType: "bigint";
|
|
1072
|
+
columnType: "PgBigInt64";
|
|
1073
|
+
data: bigint;
|
|
1074
|
+
driverParam: string;
|
|
1075
|
+
notNull: true;
|
|
1076
|
+
hasDefault: false;
|
|
1077
|
+
isPrimaryKey: false;
|
|
1078
|
+
isAutoincrement: false;
|
|
1079
|
+
hasRuntimeDefault: false;
|
|
1080
|
+
enumValues: undefined;
|
|
1081
|
+
baseColumn: never;
|
|
1082
|
+
identity: undefined;
|
|
1083
|
+
generated: undefined;
|
|
1084
|
+
}, {}, {}>;
|
|
1085
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1086
|
+
name: "created_at";
|
|
1087
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1088
|
+
dataType: "date";
|
|
1089
|
+
columnType: "PgTimestamp";
|
|
1090
|
+
data: Date;
|
|
1091
|
+
driverParam: string;
|
|
1092
|
+
notNull: true;
|
|
1093
|
+
hasDefault: true;
|
|
1094
|
+
isPrimaryKey: false;
|
|
1095
|
+
isAutoincrement: false;
|
|
1096
|
+
hasRuntimeDefault: false;
|
|
1097
|
+
enumValues: undefined;
|
|
1098
|
+
baseColumn: never;
|
|
1099
|
+
identity: undefined;
|
|
1100
|
+
generated: undefined;
|
|
1101
|
+
}, {}, {}>;
|
|
1102
|
+
};
|
|
1103
|
+
dialect: "pg";
|
|
1104
|
+
}>;
|
|
911
1105
|
|
|
912
1106
|
/**
|
|
913
1107
|
* Start a local router server.
|
|
@@ -1017,13 +1211,13 @@ declare const types: readonly ["offer_created", "offer_matched", "offer_validati
|
|
|
1017
1211
|
type Type = (typeof types)[number];
|
|
1018
1212
|
type EventPayload = {
|
|
1019
1213
|
offer_created: {
|
|
1020
|
-
readonly offer:
|
|
1214
|
+
readonly offer: Offer.Offer;
|
|
1021
1215
|
};
|
|
1022
1216
|
offer_matched: {
|
|
1023
|
-
readonly offer:
|
|
1217
|
+
readonly offer: Offer.Offer;
|
|
1024
1218
|
};
|
|
1025
1219
|
offer_validation: {
|
|
1026
|
-
readonly offer:
|
|
1220
|
+
readonly offer: Offer.Offer;
|
|
1027
1221
|
};
|
|
1028
1222
|
};
|
|
1029
1223
|
type BaseEvent<T extends Type> = {
|
|
@@ -1339,4 +1533,4 @@ declare namespace Validation {
|
|
|
1339
1533
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
1340
1534
|
}
|
|
1341
1535
|
|
|
1342
|
-
export { index$1 as ApiSchema, Chain$1 as Chain, type Compute, type Cursor, EVM, Logger$1 as Logger, OfferDB, OfferRepository$1 as OfferRepository, index as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, Validation, ValidationRule, batch$1 as batch, decodeCursor, encodeCursor, offerCollaterals, offerStatus, offers, poll, validateCursor, wait };
|
|
1536
|
+
export { index$1 as ApiSchema, Chain$1 as Chain, type Compute, type Cursor, EVM, Logger$1 as Logger, OfferDB, OfferRepository$1 as OfferRepository, index as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, Validation, ValidationRule, batch$1 as batch, consumed, decodeCursor, encodeCursor, offerCollaterals, offerStatus, offers, poll, validateCursor, wait };
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Offer, Errors } from '@morpho-dev/mempool';
|
|
1
|
+
import { Offer, Errors, Format } from '@morpho-dev/mempool';
|
|
2
2
|
export * from '@morpho-dev/mempool';
|
|
3
3
|
import * as viem from 'viem';
|
|
4
4
|
import { Address, Account, Hex, PublicClient } from 'viem';
|
|
5
5
|
import { Chain as Chain$2 } from 'viem/chains';
|
|
6
6
|
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
7
|
-
import
|
|
7
|
+
import * as zod_v4 from 'zod/v4';
|
|
8
|
+
import { z, ZodError } from 'zod/v4';
|
|
9
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
8
10
|
import { PGlite } from '@electric-sql/pglite';
|
|
9
11
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
10
12
|
import { drizzle as drizzle$1 } from 'drizzle-orm/pglite';
|
|
@@ -126,16 +128,91 @@ type OfferMetadata = {
|
|
|
126
128
|
issue: string;
|
|
127
129
|
};
|
|
128
130
|
type RouterOffer = Offer.Offer & {
|
|
131
|
+
consumed: bigint;
|
|
129
132
|
status: OfferStatus;
|
|
130
133
|
metadata?: OfferMetadata;
|
|
131
134
|
};
|
|
135
|
+
declare const RouterOfferSchema: (parameters?: {
|
|
136
|
+
omitHash?: boolean;
|
|
137
|
+
}) => zod_v4.ZodObject<{
|
|
138
|
+
offering: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
139
|
+
assets: zod_v4.ZodBigInt;
|
|
140
|
+
rate: zod_v4.ZodBigInt;
|
|
141
|
+
maturity: zod_v4.ZodNumber;
|
|
142
|
+
expiry: zod_v4.ZodNumber;
|
|
143
|
+
start: zod_v4.ZodNumber;
|
|
144
|
+
nonce: zod_v4.ZodBigInt;
|
|
145
|
+
buy: zod_v4.ZodBoolean;
|
|
146
|
+
chainId: zod_v4.ZodBigInt;
|
|
147
|
+
loanToken: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
148
|
+
collaterals: zod_v4.ZodArray<zod_v4.ZodObject<{
|
|
149
|
+
asset: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
150
|
+
oracle: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
151
|
+
lltv: zod_v4.ZodBigInt;
|
|
152
|
+
}, zod_v4_core.$strip>>;
|
|
153
|
+
callback: zod_v4.ZodObject<{
|
|
154
|
+
address: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
155
|
+
data: zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>;
|
|
156
|
+
gasLimit: zod_v4.ZodBigInt;
|
|
157
|
+
}, zod_v4_core.$strip>;
|
|
158
|
+
signature: zod_v4.ZodOptional<zod_v4.ZodPipe<zod_v4.ZodString, zod_v4.ZodTransform<`0x${string}`, string>>>;
|
|
159
|
+
createdAt: zod_v4.ZodOptional<zod_v4.ZodNumber>;
|
|
160
|
+
consumed: z.ZodBigInt;
|
|
161
|
+
status: z.ZodEnum<{
|
|
162
|
+
valid: "valid";
|
|
163
|
+
callback_not_supported: "callback_not_supported";
|
|
164
|
+
callback_error: "callback_error";
|
|
165
|
+
unverified: "unverified";
|
|
166
|
+
}>;
|
|
167
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
168
|
+
issue: z.ZodString;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
}, zod_v4_core.$strip>;
|
|
171
|
+
/**
|
|
172
|
+
* Creates a router offer from a plain object.
|
|
173
|
+
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
174
|
+
* @param input - The router offer to create.
|
|
175
|
+
* @returns The created router offer with its hash.
|
|
176
|
+
*/
|
|
177
|
+
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
178
|
+
declare namespace from {
|
|
179
|
+
type ErrorType = InvalidRouterOfferError;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates a router offer from a snake case object.
|
|
183
|
+
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
184
|
+
* @param input - The router offer to create.
|
|
185
|
+
* @returns The created router offer with its hash.
|
|
186
|
+
*/
|
|
187
|
+
declare function fromSnakeCase(input: Format.Snake<Omit<RouterOffer, "hash">>): RouterOffer;
|
|
188
|
+
declare namespace fromSnakeCase {
|
|
189
|
+
type ErrorType = InvalidRouterOfferError;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Converts a router offer to a snake case object.
|
|
193
|
+
* @param offer - The router offer to convert.
|
|
194
|
+
* @returns The converted router offer.
|
|
195
|
+
*/
|
|
196
|
+
declare function toSnakeCase(offer: RouterOffer): Format.Snake<RouterOffer>;
|
|
197
|
+
declare function random(): RouterOffer;
|
|
198
|
+
declare class InvalidRouterOfferError extends Errors.BaseError<ZodError | Error> {
|
|
199
|
+
readonly name = "RouterOffer.InvalidRouterOfferError";
|
|
200
|
+
constructor(error: ZodError | Error);
|
|
201
|
+
}
|
|
132
202
|
|
|
203
|
+
type RouterOffer$1_InvalidRouterOfferError = InvalidRouterOfferError;
|
|
204
|
+
declare const RouterOffer$1_InvalidRouterOfferError: typeof InvalidRouterOfferError;
|
|
133
205
|
type RouterOffer$1_OfferMetadata = OfferMetadata;
|
|
134
206
|
type RouterOffer$1_OfferStatus = OfferStatus;
|
|
135
207
|
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
136
208
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
209
|
+
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
210
|
+
declare const RouterOffer$1_from: typeof from;
|
|
211
|
+
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
212
|
+
declare const RouterOffer$1_random: typeof random;
|
|
213
|
+
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
137
214
|
declare namespace RouterOffer$1 {
|
|
138
|
-
export { type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer };
|
|
215
|
+
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, RouterOffer$1_from as from, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
139
216
|
}
|
|
140
217
|
|
|
141
218
|
type GetParameters = {
|
|
@@ -405,6 +482,12 @@ type OfferRepository = {
|
|
|
405
482
|
status: OfferStatus;
|
|
406
483
|
metadata?: OfferMetadata;
|
|
407
484
|
}) => Promise<void>;
|
|
485
|
+
updateConsumedAmount: (parameters: {
|
|
486
|
+
chainId: Offer.Offer["chainId"];
|
|
487
|
+
offering: Offer.Offer["offering"];
|
|
488
|
+
nonce: Offer.Offer["nonce"];
|
|
489
|
+
consumed: bigint;
|
|
490
|
+
}) => Promise<void>;
|
|
408
491
|
};
|
|
409
492
|
/**
|
|
410
493
|
* Creates a new OfferRepository instance.
|
|
@@ -908,6 +991,117 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
908
991
|
};
|
|
909
992
|
dialect: "pg";
|
|
910
993
|
}>;
|
|
994
|
+
declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
995
|
+
name: "consumed_per_user_and_nonce";
|
|
996
|
+
schema: undefined;
|
|
997
|
+
columns: {
|
|
998
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
999
|
+
name: "id";
|
|
1000
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1001
|
+
dataType: "number";
|
|
1002
|
+
columnType: "PgSerial";
|
|
1003
|
+
data: number;
|
|
1004
|
+
driverParam: number;
|
|
1005
|
+
notNull: true;
|
|
1006
|
+
hasDefault: true;
|
|
1007
|
+
isPrimaryKey: true;
|
|
1008
|
+
isAutoincrement: false;
|
|
1009
|
+
hasRuntimeDefault: false;
|
|
1010
|
+
enumValues: undefined;
|
|
1011
|
+
baseColumn: never;
|
|
1012
|
+
identity: undefined;
|
|
1013
|
+
generated: undefined;
|
|
1014
|
+
}, {}, {}>;
|
|
1015
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
1016
|
+
name: "chain_id";
|
|
1017
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1018
|
+
dataType: "bigint";
|
|
1019
|
+
columnType: "PgBigInt64";
|
|
1020
|
+
data: bigint;
|
|
1021
|
+
driverParam: string;
|
|
1022
|
+
notNull: true;
|
|
1023
|
+
hasDefault: false;
|
|
1024
|
+
isPrimaryKey: false;
|
|
1025
|
+
isAutoincrement: false;
|
|
1026
|
+
hasRuntimeDefault: false;
|
|
1027
|
+
enumValues: undefined;
|
|
1028
|
+
baseColumn: never;
|
|
1029
|
+
identity: undefined;
|
|
1030
|
+
generated: undefined;
|
|
1031
|
+
}, {}, {}>;
|
|
1032
|
+
offering: drizzle_orm_pg_core.PgColumn<{
|
|
1033
|
+
name: "offering";
|
|
1034
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1035
|
+
dataType: "string";
|
|
1036
|
+
columnType: "PgVarchar";
|
|
1037
|
+
data: string;
|
|
1038
|
+
driverParam: string;
|
|
1039
|
+
notNull: true;
|
|
1040
|
+
hasDefault: false;
|
|
1041
|
+
isPrimaryKey: false;
|
|
1042
|
+
isAutoincrement: false;
|
|
1043
|
+
hasRuntimeDefault: false;
|
|
1044
|
+
enumValues: [string, ...string[]];
|
|
1045
|
+
baseColumn: never;
|
|
1046
|
+
identity: undefined;
|
|
1047
|
+
generated: undefined;
|
|
1048
|
+
}, {}, {
|
|
1049
|
+
length: 42;
|
|
1050
|
+
}>;
|
|
1051
|
+
nonce: drizzle_orm_pg_core.PgColumn<{
|
|
1052
|
+
name: "nonce";
|
|
1053
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1054
|
+
dataType: "bigint";
|
|
1055
|
+
columnType: "PgBigInt64";
|
|
1056
|
+
data: bigint;
|
|
1057
|
+
driverParam: string;
|
|
1058
|
+
notNull: true;
|
|
1059
|
+
hasDefault: false;
|
|
1060
|
+
isPrimaryKey: false;
|
|
1061
|
+
isAutoincrement: false;
|
|
1062
|
+
hasRuntimeDefault: false;
|
|
1063
|
+
enumValues: undefined;
|
|
1064
|
+
baseColumn: never;
|
|
1065
|
+
identity: undefined;
|
|
1066
|
+
generated: undefined;
|
|
1067
|
+
}, {}, {}>;
|
|
1068
|
+
consumed: drizzle_orm_pg_core.PgColumn<{
|
|
1069
|
+
name: "consumed";
|
|
1070
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1071
|
+
dataType: "bigint";
|
|
1072
|
+
columnType: "PgBigInt64";
|
|
1073
|
+
data: bigint;
|
|
1074
|
+
driverParam: string;
|
|
1075
|
+
notNull: true;
|
|
1076
|
+
hasDefault: false;
|
|
1077
|
+
isPrimaryKey: false;
|
|
1078
|
+
isAutoincrement: false;
|
|
1079
|
+
hasRuntimeDefault: false;
|
|
1080
|
+
enumValues: undefined;
|
|
1081
|
+
baseColumn: never;
|
|
1082
|
+
identity: undefined;
|
|
1083
|
+
generated: undefined;
|
|
1084
|
+
}, {}, {}>;
|
|
1085
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1086
|
+
name: "created_at";
|
|
1087
|
+
tableName: "consumed_per_user_and_nonce";
|
|
1088
|
+
dataType: "date";
|
|
1089
|
+
columnType: "PgTimestamp";
|
|
1090
|
+
data: Date;
|
|
1091
|
+
driverParam: string;
|
|
1092
|
+
notNull: true;
|
|
1093
|
+
hasDefault: true;
|
|
1094
|
+
isPrimaryKey: false;
|
|
1095
|
+
isAutoincrement: false;
|
|
1096
|
+
hasRuntimeDefault: false;
|
|
1097
|
+
enumValues: undefined;
|
|
1098
|
+
baseColumn: never;
|
|
1099
|
+
identity: undefined;
|
|
1100
|
+
generated: undefined;
|
|
1101
|
+
}, {}, {}>;
|
|
1102
|
+
};
|
|
1103
|
+
dialect: "pg";
|
|
1104
|
+
}>;
|
|
911
1105
|
|
|
912
1106
|
/**
|
|
913
1107
|
* Start a local router server.
|
|
@@ -1017,13 +1211,13 @@ declare const types: readonly ["offer_created", "offer_matched", "offer_validati
|
|
|
1017
1211
|
type Type = (typeof types)[number];
|
|
1018
1212
|
type EventPayload = {
|
|
1019
1213
|
offer_created: {
|
|
1020
|
-
readonly offer:
|
|
1214
|
+
readonly offer: Offer.Offer;
|
|
1021
1215
|
};
|
|
1022
1216
|
offer_matched: {
|
|
1023
|
-
readonly offer:
|
|
1217
|
+
readonly offer: Offer.Offer;
|
|
1024
1218
|
};
|
|
1025
1219
|
offer_validation: {
|
|
1026
|
-
readonly offer:
|
|
1220
|
+
readonly offer: Offer.Offer;
|
|
1027
1221
|
};
|
|
1028
1222
|
};
|
|
1029
1223
|
type BaseEvent<T extends Type> = {
|
|
@@ -1339,4 +1533,4 @@ declare namespace Validation {
|
|
|
1339
1533
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
1340
1534
|
}
|
|
1341
1535
|
|
|
1342
|
-
export { index$1 as ApiSchema, Chain$1 as Chain, type Compute, type Cursor, EVM, Logger$1 as Logger, OfferDB, OfferRepository$1 as OfferRepository, index as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, Validation, ValidationRule, batch$1 as batch, decodeCursor, encodeCursor, offerCollaterals, offerStatus, offers, poll, validateCursor, wait };
|
|
1536
|
+
export { index$1 as ApiSchema, Chain$1 as Chain, type Compute, type Cursor, EVM, Logger$1 as Logger, OfferDB, OfferRepository$1 as OfferRepository, index as Router, RouterEvent$1 as RouterEvent, RouterOffer$1 as RouterOffer, Validation, ValidationRule, batch$1 as batch, consumed, decodeCursor, encodeCursor, offerCollaterals, offerStatus, offers, poll, validateCursor, wait };
|