@morpho-dev/router 0.0.16 → 0.0.18

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.
Files changed (32) hide show
  1. package/dist/index.browser.d.cts +136 -9
  2. package/dist/index.browser.d.ts +136 -9
  3. package/dist/index.browser.js +377 -9
  4. package/dist/index.browser.js.map +1 -1
  5. package/dist/index.browser.mjs +377 -5
  6. package/dist/index.browser.mjs.map +1 -1
  7. package/dist/index.node.d.cts +108 -726
  8. package/dist/index.node.d.ts +108 -726
  9. package/dist/index.node.js +735 -1215
  10. package/dist/index.node.js.map +1 -1
  11. package/dist/index.node.mjs +734 -1204
  12. package/dist/index.node.mjs.map +1 -1
  13. package/package.json +3 -12
  14. package/dist/drizzle/0000_add-offers-table.sql +0 -37
  15. package/dist/drizzle/0001_create_offer_status_relation.sql +0 -10
  16. package/dist/drizzle/0002_add_created_at_in_offer_status_relation.sql +0 -3
  17. package/dist/drizzle/0003_add-cursor-indices-to-offers.sql +0 -6
  18. package/dist/drizzle/0004_offer-start.sql +0 -1
  19. package/dist/drizzle/0005_rename-price-token-buy.sql +0 -8
  20. package/dist/drizzle/0006_rename-buy.sql +0 -3
  21. package/dist/drizzle/0007_rename-offering.sql +0 -3
  22. package/dist/drizzle/0008_add-consumed-relation.sql +0 -10
  23. package/dist/drizzle/meta/0000_snapshot.json +0 -344
  24. package/dist/drizzle/meta/0001_snapshot.json +0 -426
  25. package/dist/drizzle/meta/0002_snapshot.json +0 -439
  26. package/dist/drizzle/meta/0003_snapshot.json +0 -553
  27. package/dist/drizzle/meta/0004_snapshot.json +0 -559
  28. package/dist/drizzle/meta/0005_snapshot.json +0 -559
  29. package/dist/drizzle/meta/0006_snapshot.json +0 -559
  30. package/dist/drizzle/meta/0007_snapshot.json +0 -559
  31. package/dist/drizzle/meta/0008_snapshot.json +0 -635
  32. package/dist/drizzle/meta/_journal.json +0 -69
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morpho-dev/router",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Router package for Morpho protocol",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,11 +37,9 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tevm/memory-client": "1.0.0-next.147",
40
- "@types/pg": "^8.15.5",
41
40
  "@vitest/coverage-v8": "^3.1.4",
42
41
  "@vitest/ui": "^3.1.4",
43
42
  "dotenv": "^17.2.1",
44
- "drizzle-kit": "^0.31.1",
45
43
  "tsup": "^8.3.5",
46
44
  "typescript": "^5.8.3",
47
45
  "vitest": "^3.1.4",
@@ -49,14 +47,10 @@
49
47
  },
50
48
  "dependencies": {
51
49
  "@hono/node-server": "^1.17.1",
52
- "@electric-sql/pglite": "^0.3.1",
53
- "@morpho-org/blue-sdk-viem": "^3.1.1",
54
- "drizzle-orm": "^0.43.1",
55
50
  "hono": "^4.8.5",
56
- "pg": "^8.16.0",
57
51
  "zod": "^3.25.7",
58
52
  "zod-openapi": "^5.3.0",
59
- "@morpho-dev/mempool": "0.0.18"
53
+ "@morpho-dev/mempool": "0.0.20"
60
54
  },
61
55
  "peerDependencies": {
62
56
  "viem": "^2.32.1"
@@ -65,10 +59,7 @@
65
59
  "dev": "tsup src/index.node.ts src/index.browser.ts --watch --format esm,cjs --dts --out-dir dist --target node20,es2020 --onSuccess 'cp -r ./src/evm/bytecode dist && echo \"Router package rebuilt\"'",
66
60
  "build:node": "tsup src/index.node.ts --format esm,cjs --dts --out-dir dist --target node20 --no-clean",
67
61
  "build:browser": "tsup src/index.browser.ts --format esm,cjs --dts --out-dir dist --target es2020 --no-clean",
68
- "build": "npm run build:node && npm run build:browser && cp -r ./src/evm/bytecode dist/ && cp -r ./src/OfferDB/drizzle dist/",
69
- "migrations:create": "drizzle-kit generate --config src/OfferDB/drizzle.config.ts --name",
70
- "migrations:run": "drizzle-kit migrate --config src/OfferDB/drizzle.config.ts",
71
- "db:drop": "drizzle-kit drop --config src/OfferDB/drizzle.config.ts",
62
+ "build": "npm run build:node && npm run build:browser && cp -r ./src/evm/bytecode dist/",
72
63
  "format": "biome format --write src/",
73
64
  "lint": "biome check src/",
74
65
  "lint:ci": "biome ci src/",
@@ -1,37 +0,0 @@
1
- CREATE TABLE "offer_collaterals" (
2
- "id" serial PRIMARY KEY NOT NULL,
3
- "offer_hash" varchar(66) NOT NULL,
4
- "asset" varchar(42) NOT NULL,
5
- "oracle" varchar(42) NOT NULL,
6
- "lltv" bigint NOT NULL
7
- );
8
- --> statement-breakpoint
9
- CREATE TABLE "offers" (
10
- "hash" varchar(66) PRIMARY KEY NOT NULL,
11
- "address" varchar(42) NOT NULL,
12
- "assets" bigint NOT NULL,
13
- "price" bigint NOT NULL,
14
- "maturity" integer NOT NULL,
15
- "expiry" integer NOT NULL,
16
- "nonce" bigint NOT NULL,
17
- "is_buy" boolean NOT NULL,
18
- "chain_id" bigint NOT NULL,
19
- "loan_asset" varchar(42) NOT NULL,
20
- "callback_address" varchar(42) NOT NULL,
21
- "callback_data" text NOT NULL,
22
- "callback_gas_limit" bigint NOT NULL,
23
- "signature" varchar(132),
24
- "created_at" timestamp DEFAULT now() NOT NULL
25
- );
26
- --> statement-breakpoint
27
- ALTER TABLE "offer_collaterals" ADD CONSTRAINT "offer_collaterals_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "public"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
28
- CREATE INDEX "offer_collaterals_offer_hash_idx" ON "offer_collaterals" USING btree ("offer_hash");--> statement-breakpoint
29
- CREATE INDEX "offer_collaterals_asset_idx" ON "offer_collaterals" USING btree ("asset");--> statement-breakpoint
30
- CREATE INDEX "offer_collaterals_oracle_idx" ON "offer_collaterals" USING btree ("oracle");--> statement-breakpoint
31
- CREATE INDEX "offer_collaterals_tuple_idx" ON "offer_collaterals" USING btree ("asset","oracle","lltv");--> statement-breakpoint
32
- CREATE INDEX "offers_address_idx" ON "offers" USING btree ("address");--> statement-breakpoint
33
- CREATE INDEX "offers_is_buy_idx" ON "offers" USING btree ("is_buy");--> statement-breakpoint
34
- CREATE INDEX "offers_chain_id_idx" ON "offers" USING btree ("chain_id");--> statement-breakpoint
35
- CREATE INDEX "offers_loan_asset_idx" ON "offers" USING btree ("loan_asset");--> statement-breakpoint
36
- CREATE INDEX "offers_maturity_idx" ON "offers" USING btree ("maturity");--> statement-breakpoint
37
- CREATE INDEX "offers_expiry_idx" ON "offers" USING btree ("expiry");
@@ -1,10 +0,0 @@
1
- CREATE TABLE "offer_status" (
2
- "id" serial PRIMARY KEY NOT NULL,
3
- "offer_hash" varchar(66) NOT NULL,
4
- "status" text NOT NULL,
5
- "metadata" jsonb
6
- );
7
- --> statement-breakpoint
8
- ALTER TABLE "offer_status" ADD CONSTRAINT "offer_status_offer_hash_offers_hash_fk" FOREIGN KEY ("offer_hash") REFERENCES "public"."offers"("hash") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
9
- CREATE INDEX "offer_status_offer_hash_idx" ON "offer_status" USING btree ("offer_hash");--> statement-breakpoint
10
- CREATE INDEX "offer_status_status_idx" ON "offer_status" USING btree ("status");
@@ -1,3 +0,0 @@
1
- DROP INDEX "offer_status_offer_hash_idx";--> statement-breakpoint
2
- ALTER TABLE "offer_status" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint
3
- CREATE INDEX "offer_status_offer_hash_created_at_idx" ON "offer_status" USING btree ("offer_hash","created_at" desc);
@@ -1,6 +0,0 @@
1
- CREATE INDEX "offers_price_idx" ON "offers" USING btree ("price");--> statement-breakpoint
2
- CREATE INDEX "offers_assets_idx" ON "offers" USING btree ("assets");--> statement-breakpoint
3
- CREATE INDEX "offers_price_hash_idx" ON "offers" USING btree ("price","hash");--> statement-breakpoint
4
- CREATE INDEX "offers_maturity_hash_idx" ON "offers" USING btree ("maturity","hash");--> statement-breakpoint
5
- CREATE INDEX "offers_expiry_hash_idx" ON "offers" USING btree ("expiry","hash");--> statement-breakpoint
6
- CREATE INDEX "offers_assets_hash_idx" ON "offers" USING btree ("assets","hash");
@@ -1 +0,0 @@
1
- ALTER TABLE "offers" ADD COLUMN "start" integer NOT NULL;
@@ -1,8 +0,0 @@
1
- ALTER TABLE "offers" RENAME COLUMN "price" TO "rate";--> statement-breakpoint
2
- ALTER TABLE "offers" RENAME COLUMN "loan_asset" TO "loan_token";--> statement-breakpoint
3
- DROP INDEX "offers_loan_asset_idx";--> statement-breakpoint
4
- DROP INDEX "offers_price_idx";--> statement-breakpoint
5
- DROP INDEX "offers_price_hash_idx";--> statement-breakpoint
6
- CREATE INDEX "offers_loan_token_idx" ON "offers" USING btree ("loan_token");--> statement-breakpoint
7
- CREATE INDEX "offers_rate_idx" ON "offers" USING btree ("rate");--> statement-breakpoint
8
- CREATE INDEX "offers_rate_hash_idx" ON "offers" USING btree ("rate","hash");
@@ -1,3 +0,0 @@
1
- ALTER TABLE "offers" RENAME COLUMN "is_buy" TO "buy";--> statement-breakpoint
2
- DROP INDEX "offers_is_buy_idx";--> statement-breakpoint
3
- CREATE INDEX "offers_buy_idx" ON "offers" USING btree ("buy");
@@ -1,3 +0,0 @@
1
- ALTER TABLE "offers" RENAME COLUMN "address" TO "offering";--> statement-breakpoint
2
- DROP INDEX "offers_address_idx";--> statement-breakpoint
3
- CREATE INDEX "offers_offering_idx" ON "offers" USING btree ("offering");
@@ -1,10 +0,0 @@
1
- CREATE TABLE "consumed_per_user_and_nonce" (
2
- "id" serial PRIMARY KEY NOT NULL,
3
- "chain_id" bigint NOT NULL,
4
- "offering" varchar(42) NOT NULL,
5
- "nonce" bigint NOT NULL,
6
- "consumed" bigint NOT NULL,
7
- "created_at" timestamp DEFAULT now() NOT NULL
8
- );
9
- --> statement-breakpoint
10
- CREATE INDEX "consumed_per_user_and_nonce_chain_id_offering_nonce_created_at_idx" ON "consumed_per_user_and_nonce" USING btree ("chain_id","offering","nonce","created_at" desc);
@@ -1,344 +0,0 @@
1
- {
2
- "id": "5633b428-6ca8-4994-95c9-4f8f6f320d95",
3
- "prevId": "00000000-0000-0000-0000-000000000000",
4
- "version": "7",
5
- "dialect": "postgresql",
6
- "tables": {
7
- "public.offer_collaterals": {
8
- "name": "offer_collaterals",
9
- "schema": "",
10
- "columns": {
11
- "id": {
12
- "name": "id",
13
- "type": "serial",
14
- "primaryKey": true,
15
- "notNull": true
16
- },
17
- "offer_hash": {
18
- "name": "offer_hash",
19
- "type": "varchar(66)",
20
- "primaryKey": false,
21
- "notNull": true
22
- },
23
- "asset": {
24
- "name": "asset",
25
- "type": "varchar(42)",
26
- "primaryKey": false,
27
- "notNull": true
28
- },
29
- "oracle": {
30
- "name": "oracle",
31
- "type": "varchar(42)",
32
- "primaryKey": false,
33
- "notNull": true
34
- },
35
- "lltv": {
36
- "name": "lltv",
37
- "type": "bigint",
38
- "primaryKey": false,
39
- "notNull": true
40
- }
41
- },
42
- "indexes": {
43
- "offer_collaterals_offer_hash_idx": {
44
- "name": "offer_collaterals_offer_hash_idx",
45
- "columns": [
46
- {
47
- "expression": "offer_hash",
48
- "isExpression": false,
49
- "asc": true,
50
- "nulls": "last"
51
- }
52
- ],
53
- "isUnique": false,
54
- "concurrently": false,
55
- "method": "btree",
56
- "with": {}
57
- },
58
- "offer_collaterals_asset_idx": {
59
- "name": "offer_collaterals_asset_idx",
60
- "columns": [
61
- {
62
- "expression": "asset",
63
- "isExpression": false,
64
- "asc": true,
65
- "nulls": "last"
66
- }
67
- ],
68
- "isUnique": false,
69
- "concurrently": false,
70
- "method": "btree",
71
- "with": {}
72
- },
73
- "offer_collaterals_oracle_idx": {
74
- "name": "offer_collaterals_oracle_idx",
75
- "columns": [
76
- {
77
- "expression": "oracle",
78
- "isExpression": false,
79
- "asc": true,
80
- "nulls": "last"
81
- }
82
- ],
83
- "isUnique": false,
84
- "concurrently": false,
85
- "method": "btree",
86
- "with": {}
87
- },
88
- "offer_collaterals_tuple_idx": {
89
- "name": "offer_collaterals_tuple_idx",
90
- "columns": [
91
- {
92
- "expression": "asset",
93
- "isExpression": false,
94
- "asc": true,
95
- "nulls": "last"
96
- },
97
- {
98
- "expression": "oracle",
99
- "isExpression": false,
100
- "asc": true,
101
- "nulls": "last"
102
- },
103
- {
104
- "expression": "lltv",
105
- "isExpression": false,
106
- "asc": true,
107
- "nulls": "last"
108
- }
109
- ],
110
- "isUnique": false,
111
- "concurrently": false,
112
- "method": "btree",
113
- "with": {}
114
- }
115
- },
116
- "foreignKeys": {
117
- "offer_collaterals_offer_hash_offers_hash_fk": {
118
- "name": "offer_collaterals_offer_hash_offers_hash_fk",
119
- "tableFrom": "offer_collaterals",
120
- "tableTo": "offers",
121
- "columnsFrom": [
122
- "offer_hash"
123
- ],
124
- "columnsTo": [
125
- "hash"
126
- ],
127
- "onDelete": "cascade",
128
- "onUpdate": "no action"
129
- }
130
- },
131
- "compositePrimaryKeys": {},
132
- "uniqueConstraints": {},
133
- "policies": {},
134
- "checkConstraints": {},
135
- "isRLSEnabled": false
136
- },
137
- "public.offers": {
138
- "name": "offers",
139
- "schema": "",
140
- "columns": {
141
- "hash": {
142
- "name": "hash",
143
- "type": "varchar(66)",
144
- "primaryKey": true,
145
- "notNull": true
146
- },
147
- "address": {
148
- "name": "address",
149
- "type": "varchar(42)",
150
- "primaryKey": false,
151
- "notNull": true
152
- },
153
- "assets": {
154
- "name": "assets",
155
- "type": "bigint",
156
- "primaryKey": false,
157
- "notNull": true
158
- },
159
- "price": {
160
- "name": "price",
161
- "type": "bigint",
162
- "primaryKey": false,
163
- "notNull": true
164
- },
165
- "maturity": {
166
- "name": "maturity",
167
- "type": "integer",
168
- "primaryKey": false,
169
- "notNull": true
170
- },
171
- "expiry": {
172
- "name": "expiry",
173
- "type": "integer",
174
- "primaryKey": false,
175
- "notNull": true
176
- },
177
- "nonce": {
178
- "name": "nonce",
179
- "type": "bigint",
180
- "primaryKey": false,
181
- "notNull": true
182
- },
183
- "is_buy": {
184
- "name": "is_buy",
185
- "type": "boolean",
186
- "primaryKey": false,
187
- "notNull": true
188
- },
189
- "chain_id": {
190
- "name": "chain_id",
191
- "type": "bigint",
192
- "primaryKey": false,
193
- "notNull": true
194
- },
195
- "loan_asset": {
196
- "name": "loan_asset",
197
- "type": "varchar(42)",
198
- "primaryKey": false,
199
- "notNull": true
200
- },
201
- "callback_address": {
202
- "name": "callback_address",
203
- "type": "varchar(42)",
204
- "primaryKey": false,
205
- "notNull": true
206
- },
207
- "callback_data": {
208
- "name": "callback_data",
209
- "type": "text",
210
- "primaryKey": false,
211
- "notNull": true
212
- },
213
- "callback_gas_limit": {
214
- "name": "callback_gas_limit",
215
- "type": "bigint",
216
- "primaryKey": false,
217
- "notNull": true
218
- },
219
- "signature": {
220
- "name": "signature",
221
- "type": "varchar(132)",
222
- "primaryKey": false,
223
- "notNull": false
224
- },
225
- "created_at": {
226
- "name": "created_at",
227
- "type": "timestamp",
228
- "primaryKey": false,
229
- "notNull": true,
230
- "default": "now()"
231
- }
232
- },
233
- "indexes": {
234
- "offers_address_idx": {
235
- "name": "offers_address_idx",
236
- "columns": [
237
- {
238
- "expression": "address",
239
- "isExpression": false,
240
- "asc": true,
241
- "nulls": "last"
242
- }
243
- ],
244
- "isUnique": false,
245
- "concurrently": false,
246
- "method": "btree",
247
- "with": {}
248
- },
249
- "offers_is_buy_idx": {
250
- "name": "offers_is_buy_idx",
251
- "columns": [
252
- {
253
- "expression": "is_buy",
254
- "isExpression": false,
255
- "asc": true,
256
- "nulls": "last"
257
- }
258
- ],
259
- "isUnique": false,
260
- "concurrently": false,
261
- "method": "btree",
262
- "with": {}
263
- },
264
- "offers_chain_id_idx": {
265
- "name": "offers_chain_id_idx",
266
- "columns": [
267
- {
268
- "expression": "chain_id",
269
- "isExpression": false,
270
- "asc": true,
271
- "nulls": "last"
272
- }
273
- ],
274
- "isUnique": false,
275
- "concurrently": false,
276
- "method": "btree",
277
- "with": {}
278
- },
279
- "offers_loan_asset_idx": {
280
- "name": "offers_loan_asset_idx",
281
- "columns": [
282
- {
283
- "expression": "loan_asset",
284
- "isExpression": false,
285
- "asc": true,
286
- "nulls": "last"
287
- }
288
- ],
289
- "isUnique": false,
290
- "concurrently": false,
291
- "method": "btree",
292
- "with": {}
293
- },
294
- "offers_maturity_idx": {
295
- "name": "offers_maturity_idx",
296
- "columns": [
297
- {
298
- "expression": "maturity",
299
- "isExpression": false,
300
- "asc": true,
301
- "nulls": "last"
302
- }
303
- ],
304
- "isUnique": false,
305
- "concurrently": false,
306
- "method": "btree",
307
- "with": {}
308
- },
309
- "offers_expiry_idx": {
310
- "name": "offers_expiry_idx",
311
- "columns": [
312
- {
313
- "expression": "expiry",
314
- "isExpression": false,
315
- "asc": true,
316
- "nulls": "last"
317
- }
318
- ],
319
- "isUnique": false,
320
- "concurrently": false,
321
- "method": "btree",
322
- "with": {}
323
- }
324
- },
325
- "foreignKeys": {},
326
- "compositePrimaryKeys": {},
327
- "uniqueConstraints": {},
328
- "policies": {},
329
- "checkConstraints": {},
330
- "isRLSEnabled": false
331
- }
332
- },
333
- "enums": {},
334
- "schemas": {},
335
- "sequences": {},
336
- "roles": {},
337
- "policies": {},
338
- "views": {},
339
- "_meta": {
340
- "columns": {},
341
- "schemas": {},
342
- "tables": {}
343
- }
344
- }