@develit-services/blockchain 0.8.2 → 0.8.3

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 (37) hide show
  1. package/dist/database/schema.cjs +5 -1
  2. package/dist/database/schema.d.cts +1 -1
  3. package/dist/database/schema.d.mts +1 -1
  4. package/dist/database/schema.d.ts +1 -1
  5. package/dist/database/schema.mjs +3 -1
  6. package/dist/export/worker.cjs +20 -625
  7. package/dist/export/worker.d.cts +2 -2
  8. package/dist/export/worker.d.mts +2 -2
  9. package/dist/export/worker.d.ts +2 -2
  10. package/dist/export/worker.mjs +20 -625
  11. package/dist/export/workflows.cjs +88 -82
  12. package/dist/export/workflows.mjs +83 -77
  13. package/dist/shared/{blockchain.5Ld6uEay.d.ts → blockchain.7cRY-udH.d.ts} +1 -1
  14. package/dist/shared/blockchain.BUbQBxqd.cjs +335 -0
  15. package/dist/shared/blockchain.BhDiNGPI.mjs +332 -0
  16. package/dist/shared/{blockchain.DTJULMBV.mjs → blockchain.CKh8Fs7w.mjs} +12 -1
  17. package/dist/shared/{blockchain.CtIjPvX8.d.cts → blockchain.CaPQzwns.d.cts} +1 -1
  18. package/dist/shared/blockchain.CbmnjjFl.cjs +70 -0
  19. package/dist/shared/{blockchain.BBjLLe8v.cjs → blockchain.Cjq9eH7Z.cjs} +13 -0
  20. package/dist/shared/{blockchain.DZbyq0JM.d.mts → blockchain.CvNI0YTF.d.mts} +1 -1
  21. package/dist/shared/blockchain.DUhjXgba.d.cts +1107 -0
  22. package/dist/shared/blockchain.DUhjXgba.d.mts +1107 -0
  23. package/dist/shared/blockchain.DUhjXgba.d.ts +1107 -0
  24. package/dist/shared/blockchain._nv3VxNA.mjs +64 -0
  25. package/dist/types.cjs +3 -1
  26. package/dist/types.d.cts +12 -4
  27. package/dist/types.d.mts +12 -4
  28. package/dist/types.d.ts +12 -4
  29. package/dist/types.mjs +1 -1
  30. package/package.json +1 -1
  31. package/dist/shared/blockchain.0tUJ62WT.mjs +0 -6
  32. package/dist/shared/blockchain.BBvwu2_7.cjs +0 -39
  33. package/dist/shared/blockchain.Cx60lJ0c.d.cts +0 -566
  34. package/dist/shared/blockchain.Cx60lJ0c.d.mts +0 -566
  35. package/dist/shared/blockchain.Cx60lJ0c.d.ts +0 -566
  36. package/dist/shared/blockchain.DN735AwB.cjs +0 -8
  37. package/dist/shared/blockchain._wwKu1qP.mjs +0 -35
@@ -3,617 +3,17 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
- const drizzle = require('../shared/blockchain.DN735AwB.cjs');
7
- const syncAddress = require('../shared/blockchain.BBjLLe8v.cjs');
6
+ const blockchain = require('../shared/blockchain.BUbQBxqd.cjs');
7
+ const syncAddress = require('../shared/blockchain.Cjq9eH7Z.cjs');
8
8
  const cloudflare_workers = require('cloudflare:workers');
9
9
  const d1 = require('drizzle-orm/d1');
10
- const viem = require('viem');
11
- require('../shared/blockchain.BBvwu2_7.cjs');
10
+ require('../shared/blockchain.CbmnjjFl.cjs');
12
11
  require('drizzle-orm/sqlite-core');
13
12
  require('drizzle-orm');
13
+ require('viem');
14
+ require('viem/accounts');
14
15
  require('zod');
15
16
 
16
- class IBlockchainConnector {
17
- constructor() {
18
- this.rpcUrl = "";
19
- }
20
- get rpcSecretName() {
21
- return `BLOCKCHAIN_SERVICE_${this.connectorKey}_RPC_URL`;
22
- }
23
- init(rpcUrl) {
24
- this.rpcUrl = rpcUrl;
25
- return this;
26
- }
27
- }
28
-
29
- class ArbitrumConnector extends IBlockchainConnector {
30
- constructor() {
31
- super(...arguments);
32
- this.connectorKey = "ARBITRUM";
33
- this.client = null;
34
- }
35
- createClient() {
36
- if (!this.client) {
37
- this.client = viem.createPublicClient({
38
- transport: viem.http(this.rpcUrl)
39
- });
40
- }
41
- return this.client;
42
- }
43
- async getTransaction(txHash) {
44
- const client = this.createClient();
45
- const [tx, txError] = await backendSdk.useResult(
46
- client.getTransaction({ hash: txHash })
47
- );
48
- if (txError || !tx) {
49
- throw backendSdk.createInternalError(txError);
50
- }
51
- let status = "pending";
52
- let gasUsed = null;
53
- let timestamp = null;
54
- if (tx.blockNumber) {
55
- const [receipt, receiptError] = await backendSdk.useResult(
56
- client.getTransactionReceipt({ hash: txHash })
57
- );
58
- if (receiptError || !receipt) {
59
- throw backendSdk.createInternalError(receiptError);
60
- }
61
- const [block, blockError] = await backendSdk.useResult(
62
- client.getBlock({ blockNumber: tx.blockNumber })
63
- );
64
- if (blockError || !block) {
65
- throw backendSdk.createInternalError(blockError);
66
- }
67
- status = receipt.status === "success" ? "success" : "reverted";
68
- gasUsed = receipt.gasUsed.toString();
69
- timestamp = Number(block.timestamp) * 1e3;
70
- }
71
- return {
72
- hash: tx.hash,
73
- from: tx.from,
74
- to: tx.to,
75
- value: tx.value.toString(),
76
- blockNumber: tx.blockNumber?.toString() ?? null,
77
- blockHash: tx.blockHash ?? null,
78
- gasPrice: tx.gasPrice?.toString() ?? null,
79
- gas: tx.gas.toString(),
80
- nonce: tx.nonce,
81
- transactionIndex: tx.transactionIndex,
82
- status,
83
- gasUsed,
84
- timestamp
85
- };
86
- }
87
- async getTransactionReceipt(txHash) {
88
- const client = this.createClient();
89
- const [receipt, error] = await backendSdk.useResult(
90
- client.getTransactionReceipt({ hash: txHash })
91
- );
92
- if (error || !receipt) {
93
- throw backendSdk.createInternalError(error);
94
- }
95
- return receipt;
96
- }
97
- async getBlock({
98
- blockHash,
99
- blockNumber,
100
- blockTag
101
- }) {
102
- const client = this.createClient();
103
- const [block, error] = await backendSdk.useResult(
104
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
105
- );
106
- if (error || !block) {
107
- throw error;
108
- }
109
- return block;
110
- }
111
- }
112
-
113
- class AvalancheConnector extends IBlockchainConnector {
114
- constructor() {
115
- super(...arguments);
116
- this.connectorKey = "AVALANCHE";
117
- this.client = null;
118
- }
119
- createClient() {
120
- if (!this.client) {
121
- this.client = viem.createPublicClient({
122
- transport: viem.http(this.rpcUrl)
123
- });
124
- }
125
- return this.client;
126
- }
127
- async getTransaction(txHash) {
128
- const client = this.createClient();
129
- const [tx, txError] = await backendSdk.useResult(
130
- client.getTransaction({ hash: txHash })
131
- );
132
- if (txError || !tx) {
133
- throw backendSdk.createInternalError(txError);
134
- }
135
- let status = "pending";
136
- let gasUsed = null;
137
- let timestamp = null;
138
- if (tx.blockNumber) {
139
- const [receipt, receiptError] = await backendSdk.useResult(
140
- client.getTransactionReceipt({ hash: txHash })
141
- );
142
- if (receiptError || !receipt) {
143
- throw backendSdk.createInternalError(receiptError);
144
- }
145
- const [block, blockError] = await backendSdk.useResult(
146
- client.getBlock({ blockNumber: tx.blockNumber })
147
- );
148
- if (blockError || !block) {
149
- throw backendSdk.createInternalError(blockError);
150
- }
151
- status = receipt.status === "success" ? "success" : "reverted";
152
- gasUsed = receipt.gasUsed.toString();
153
- timestamp = Number(block.timestamp) * 1e3;
154
- }
155
- return {
156
- hash: tx.hash,
157
- from: tx.from,
158
- to: tx.to,
159
- value: tx.value.toString(),
160
- blockNumber: tx.blockNumber?.toString() ?? null,
161
- blockHash: tx.blockHash ?? null,
162
- gasPrice: tx.gasPrice?.toString() ?? null,
163
- gas: tx.gas.toString(),
164
- nonce: tx.nonce,
165
- transactionIndex: tx.transactionIndex,
166
- status,
167
- gasUsed,
168
- timestamp
169
- };
170
- }
171
- async getTransactionReceipt(txHash) {
172
- const client = this.createClient();
173
- const [receipt, error] = await backendSdk.useResult(
174
- client.getTransactionReceipt({ hash: txHash })
175
- );
176
- if (error || !receipt) {
177
- throw backendSdk.createInternalError(error);
178
- }
179
- return receipt;
180
- }
181
- async getBlock({
182
- blockHash,
183
- blockNumber,
184
- blockTag
185
- }) {
186
- const client = this.createClient();
187
- const [block, error] = await backendSdk.useResult(
188
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
189
- );
190
- if (error || !block) {
191
- throw error;
192
- }
193
- return block;
194
- }
195
- }
196
-
197
- class BaseConnector extends IBlockchainConnector {
198
- constructor() {
199
- super(...arguments);
200
- this.connectorKey = "BASE";
201
- this.client = null;
202
- }
203
- createClient() {
204
- if (!this.client) {
205
- this.client = viem.createPublicClient({
206
- transport: viem.http(this.rpcUrl)
207
- });
208
- }
209
- return this.client;
210
- }
211
- async getTransaction(txHash) {
212
- const client = this.createClient();
213
- const [tx, txError] = await backendSdk.useResult(
214
- client.getTransaction({ hash: txHash })
215
- );
216
- if (txError || !tx) {
217
- throw backendSdk.createInternalError(txError);
218
- }
219
- let status = "pending";
220
- let gasUsed = null;
221
- let timestamp = null;
222
- if (tx.blockNumber) {
223
- const [receipt, receiptError] = await backendSdk.useResult(
224
- client.getTransactionReceipt({ hash: txHash })
225
- );
226
- if (receiptError || !receipt) {
227
- throw backendSdk.createInternalError(receiptError);
228
- }
229
- const [block, blockError] = await backendSdk.useResult(
230
- client.getBlock({ blockNumber: tx.blockNumber })
231
- );
232
- if (blockError || !block) {
233
- throw backendSdk.createInternalError(blockError);
234
- }
235
- status = receipt.status === "success" ? "success" : "reverted";
236
- gasUsed = receipt.gasUsed.toString();
237
- timestamp = Number(block.timestamp) * 1e3;
238
- }
239
- return {
240
- hash: tx.hash,
241
- from: tx.from,
242
- to: tx.to,
243
- value: tx.value.toString(),
244
- blockNumber: tx.blockNumber?.toString() ?? null,
245
- blockHash: tx.blockHash ?? null,
246
- gasPrice: tx.gasPrice?.toString() ?? null,
247
- gas: tx.gas.toString(),
248
- nonce: tx.nonce,
249
- transactionIndex: tx.transactionIndex,
250
- status,
251
- gasUsed,
252
- timestamp
253
- };
254
- }
255
- async getTransactionReceipt(txHash) {
256
- const client = this.createClient();
257
- const [receipt, error] = await backendSdk.useResult(
258
- client.getTransactionReceipt({ hash: txHash })
259
- );
260
- if (error || !receipt) {
261
- throw backendSdk.createInternalError(error);
262
- }
263
- return receipt;
264
- }
265
- async getBlock({
266
- blockHash,
267
- blockNumber,
268
- blockTag
269
- }) {
270
- const client = this.createClient();
271
- const [block, error] = await backendSdk.useResult(
272
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
273
- );
274
- if (error || !block) {
275
- throw error;
276
- }
277
- return block;
278
- }
279
- }
280
-
281
- class EthereumConnector extends IBlockchainConnector {
282
- constructor() {
283
- super(...arguments);
284
- this.connectorKey = "ETHEREUM";
285
- this.client = null;
286
- }
287
- createClient() {
288
- if (!this.client) {
289
- this.client = viem.createPublicClient({
290
- transport: viem.http(this.rpcUrl)
291
- });
292
- }
293
- return this.client;
294
- }
295
- async getTransaction(txHash) {
296
- const client = this.createClient();
297
- const [tx, txError] = await backendSdk.useResult(
298
- client.getTransaction({ hash: txHash })
299
- );
300
- if (txError || !tx) {
301
- throw backendSdk.createInternalError(txError);
302
- }
303
- let status = "pending";
304
- let gasUsed = null;
305
- let timestamp = null;
306
- if (tx.blockNumber) {
307
- const [receipt, receiptError] = await backendSdk.useResult(
308
- client.getTransactionReceipt({ hash: txHash })
309
- );
310
- if (receiptError || !receipt) {
311
- throw backendSdk.createInternalError(receiptError);
312
- }
313
- const [block, blockError] = await backendSdk.useResult(
314
- client.getBlock({ blockNumber: tx.blockNumber })
315
- );
316
- if (blockError || !block) {
317
- throw backendSdk.createInternalError(blockError);
318
- }
319
- status = receipt.status === "success" ? "success" : "reverted";
320
- gasUsed = receipt.gasUsed.toString();
321
- timestamp = Number(block.timestamp) * 1e3;
322
- }
323
- return {
324
- hash: tx.hash,
325
- from: tx.from,
326
- to: tx.to,
327
- value: tx.value.toString(),
328
- blockNumber: tx.blockNumber?.toString() ?? null,
329
- blockHash: tx.blockHash ?? null,
330
- gasPrice: tx.gasPrice?.toString() ?? null,
331
- gas: tx.gas.toString(),
332
- nonce: tx.nonce,
333
- transactionIndex: tx.transactionIndex,
334
- status,
335
- gasUsed,
336
- timestamp
337
- };
338
- }
339
- async getTransactionReceipt(txHash) {
340
- const client = this.createClient();
341
- const [receipt, error] = await backendSdk.useResult(
342
- client.getTransactionReceipt({ hash: txHash })
343
- );
344
- if (error || !receipt) {
345
- throw backendSdk.createInternalError(error);
346
- }
347
- return receipt;
348
- }
349
- async getBlock({
350
- blockHash,
351
- blockNumber,
352
- blockTag
353
- }) {
354
- const client = this.createClient();
355
- const [block, error] = await backendSdk.useResult(
356
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
357
- );
358
- if (error || !block) {
359
- throw error;
360
- }
361
- return block;
362
- }
363
- }
364
-
365
- class GnosisConnector extends IBlockchainConnector {
366
- constructor() {
367
- super(...arguments);
368
- this.connectorKey = "GNOSIS";
369
- this.client = null;
370
- }
371
- createClient() {
372
- if (!this.client) {
373
- this.client = viem.createPublicClient({
374
- transport: viem.http(this.rpcUrl)
375
- });
376
- }
377
- return this.client;
378
- }
379
- async getTransaction(txHash) {
380
- const client = this.createClient();
381
- const [tx, txError] = await backendSdk.useResult(
382
- client.getTransaction({ hash: txHash })
383
- );
384
- if (txError || !tx) {
385
- throw backendSdk.createInternalError(txError);
386
- }
387
- let status = "pending";
388
- let gasUsed = null;
389
- let timestamp = null;
390
- if (tx.blockNumber) {
391
- const [receipt, receiptError] = await backendSdk.useResult(
392
- client.getTransactionReceipt({ hash: txHash })
393
- );
394
- if (receiptError || !receipt) {
395
- throw backendSdk.createInternalError(receiptError);
396
- }
397
- const [block, blockError] = await backendSdk.useResult(
398
- client.getBlock({ blockNumber: tx.blockNumber })
399
- );
400
- if (blockError || !block) {
401
- throw backendSdk.createInternalError(blockError);
402
- }
403
- status = receipt.status === "success" ? "success" : "reverted";
404
- gasUsed = receipt.gasUsed.toString();
405
- timestamp = Number(block.timestamp) * 1e3;
406
- }
407
- return {
408
- hash: tx.hash,
409
- from: tx.from,
410
- to: tx.to,
411
- value: tx.value.toString(),
412
- blockNumber: tx.blockNumber?.toString() ?? null,
413
- blockHash: tx.blockHash ?? null,
414
- gasPrice: tx.gasPrice?.toString() ?? null,
415
- gas: tx.gas.toString(),
416
- nonce: tx.nonce,
417
- transactionIndex: tx.transactionIndex,
418
- status,
419
- gasUsed,
420
- timestamp
421
- };
422
- }
423
- async getTransactionReceipt(txHash) {
424
- const client = this.createClient();
425
- const [receipt, error] = await backendSdk.useResult(
426
- client.getTransactionReceipt({ hash: txHash })
427
- );
428
- if (error || !receipt) {
429
- throw backendSdk.createInternalError(error);
430
- }
431
- return receipt;
432
- }
433
- async getBlock({
434
- blockHash,
435
- blockNumber,
436
- blockTag
437
- }) {
438
- const client = this.createClient();
439
- const [block, error] = await backendSdk.useResult(
440
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
441
- );
442
- if (error || !block) {
443
- throw error;
444
- }
445
- return block;
446
- }
447
- }
448
-
449
- class OptimismConnector extends IBlockchainConnector {
450
- constructor() {
451
- super(...arguments);
452
- this.connectorKey = "OPTIMISM";
453
- this.client = null;
454
- }
455
- createClient() {
456
- if (!this.client) {
457
- this.client = viem.createPublicClient({
458
- transport: viem.http(this.rpcUrl)
459
- });
460
- }
461
- return this.client;
462
- }
463
- async getTransaction(txHash) {
464
- const client = this.createClient();
465
- const [tx, txError] = await backendSdk.useResult(
466
- client.getTransaction({ hash: txHash })
467
- );
468
- if (txError || !tx) {
469
- throw backendSdk.createInternalError(txError);
470
- }
471
- let status = "pending";
472
- let gasUsed = null;
473
- let timestamp = null;
474
- if (tx.blockNumber) {
475
- const [receipt, receiptError] = await backendSdk.useResult(
476
- client.getTransactionReceipt({ hash: txHash })
477
- );
478
- if (receiptError || !receipt) {
479
- throw backendSdk.createInternalError(receiptError);
480
- }
481
- const [block, blockError] = await backendSdk.useResult(
482
- client.getBlock({ blockNumber: tx.blockNumber })
483
- );
484
- if (blockError || !block) {
485
- throw backendSdk.createInternalError(blockError);
486
- }
487
- status = receipt.status === "success" ? "success" : "reverted";
488
- gasUsed = receipt.gasUsed.toString();
489
- timestamp = Number(block.timestamp) * 1e3;
490
- }
491
- return {
492
- hash: tx.hash,
493
- from: tx.from,
494
- to: tx.to,
495
- value: tx.value.toString(),
496
- blockNumber: tx.blockNumber?.toString() ?? null,
497
- blockHash: tx.blockHash ?? null,
498
- gasPrice: tx.gasPrice?.toString() ?? null,
499
- gas: tx.gas.toString(),
500
- nonce: tx.nonce,
501
- transactionIndex: tx.transactionIndex,
502
- status,
503
- gasUsed,
504
- timestamp
505
- };
506
- }
507
- async getTransactionReceipt(txHash) {
508
- const client = this.createClient();
509
- const [receipt, error] = await backendSdk.useResult(
510
- client.getTransactionReceipt({ hash: txHash })
511
- );
512
- if (error || !receipt) {
513
- throw backendSdk.createInternalError(error);
514
- }
515
- return receipt;
516
- }
517
- async getBlock({
518
- blockHash,
519
- blockNumber,
520
- blockTag
521
- }) {
522
- const client = this.createClient();
523
- const [block, error] = await backendSdk.useResult(
524
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
525
- );
526
- if (error || !block) {
527
- throw error;
528
- }
529
- return block;
530
- }
531
- }
532
-
533
- class ScrollConnector extends IBlockchainConnector {
534
- constructor() {
535
- super(...arguments);
536
- this.connectorKey = "SCROLL";
537
- this.client = null;
538
- }
539
- createClient() {
540
- if (!this.client) {
541
- this.client = viem.createPublicClient({
542
- transport: viem.http(this.rpcUrl)
543
- });
544
- }
545
- return this.client;
546
- }
547
- async getTransaction(txHash) {
548
- const client = this.createClient();
549
- const [tx, txError] = await backendSdk.useResult(
550
- client.getTransaction({ hash: txHash })
551
- );
552
- if (txError || !tx) {
553
- throw backendSdk.createInternalError(txError);
554
- }
555
- let status = "pending";
556
- let gasUsed = null;
557
- let timestamp = null;
558
- if (tx.blockNumber) {
559
- const [receipt, receiptError] = await backendSdk.useResult(
560
- client.getTransactionReceipt({ hash: txHash })
561
- );
562
- if (receiptError || !receipt) {
563
- throw backendSdk.createInternalError(receiptError);
564
- }
565
- const [block, blockError] = await backendSdk.useResult(
566
- client.getBlock({ blockNumber: tx.blockNumber })
567
- );
568
- if (blockError || !block) {
569
- throw backendSdk.createInternalError(blockError);
570
- }
571
- status = receipt.status === "success" ? "success" : "reverted";
572
- gasUsed = receipt.gasUsed.toString();
573
- timestamp = Number(block.timestamp) * 1e3;
574
- }
575
- return {
576
- hash: tx.hash,
577
- from: tx.from,
578
- to: tx.to,
579
- value: tx.value.toString(),
580
- blockNumber: tx.blockNumber?.toString() ?? null,
581
- blockHash: tx.blockHash ?? null,
582
- gasPrice: tx.gasPrice?.toString() ?? null,
583
- gas: tx.gas.toString(),
584
- nonce: tx.nonce,
585
- transactionIndex: tx.transactionIndex,
586
- status,
587
- gasUsed,
588
- timestamp
589
- };
590
- }
591
- async getTransactionReceipt(txHash) {
592
- const client = this.createClient();
593
- const [receipt, error] = await backendSdk.useResult(
594
- client.getTransactionReceipt({ hash: txHash })
595
- );
596
- if (error || !receipt) {
597
- throw backendSdk.createInternalError(error);
598
- }
599
- return receipt;
600
- }
601
- async getBlock({
602
- blockHash,
603
- blockNumber,
604
- blockTag
605
- }) {
606
- const client = this.createClient();
607
- const [block, error] = await backendSdk.useResult(
608
- blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
609
- );
610
- if (error || !block) {
611
- throw error;
612
- }
613
- return block;
614
- }
615
- }
616
-
617
17
  var __defProp = Object.defineProperty;
618
18
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
619
19
  var __decorateClass = (decorators, target, key, kind) => {
@@ -624,21 +24,12 @@ var __decorateClass = (decorators, target, key, kind) => {
624
24
  if (kind && result) __defProp(target, key, result);
625
25
  return result;
626
26
  };
627
- const CHAIN_CONNECTOR = {
628
- ARBITRUM: ArbitrumConnector,
629
- AVALANCHE: AvalancheConnector,
630
- BASE: BaseConnector,
631
- ETHEREUM: EthereumConnector,
632
- GNOSIS: GnosisConnector,
633
- OPTIMISM: OptimismConnector,
634
- SCROLL: ScrollConnector
635
- };
636
27
  let BlockchainServiceBase = class extends backendSdk.develitWorker(
637
28
  cloudflare_workers.WorkerEntrypoint
638
29
  ) {
639
30
  constructor(ctx, env) {
640
31
  super(ctx, env);
641
- this.db = d1.drizzle(this.env.BLOCKCHAIN_D1, { schema: drizzle.tables });
32
+ this.db = d1.drizzle(this.env.BLOCKCHAIN_D1, { schema: blockchain.tables });
642
33
  }
643
34
  async syncAddress(input) {
644
35
  return this.handleAction(
@@ -663,11 +54,13 @@ let BlockchainServiceBase = class extends backendSdk.develitWorker(
663
54
  { data: input, schema: syncAddress.getTransactionInputSchema },
664
55
  { successMessage: "Transaction retrieved successfully." },
665
56
  async ({ chain, txHash }) => {
666
- const connector = new CHAIN_CONNECTOR[chain]();
667
- const rpcUrl = (await this.env.SECRETS_STORE.get({
668
- secretName: connector.rpcSecretName
669
- })).data?.secretValue || "";
670
- return connector.init(rpcUrl).getTransaction(txHash);
57
+ const connector = await blockchain.initiateConnector({
58
+ chain,
59
+ env: this.env,
60
+ tokens: [],
61
+ connectedAddresses: []
62
+ });
63
+ return connector.getTransaction(txHash);
671
64
  }
672
65
  );
673
66
  }
@@ -676,11 +69,13 @@ let BlockchainServiceBase = class extends backendSdk.develitWorker(
676
69
  { data: input, schema: syncAddress.getBlockInputSchema },
677
70
  { successMessage: "Block retrieved successfully." },
678
71
  async ({ chain, blockHash, blockNumber, blockTag }) => {
679
- const connector = new CHAIN_CONNECTOR[chain]();
680
- const rpcUrl = (await this.env.SECRETS_STORE.get({
681
- secretName: connector.rpcSecretName
682
- })).data?.secretValue || "";
683
- return connector.init(rpcUrl).getBlock({
72
+ const connector = await blockchain.initiateConnector({
73
+ chain,
74
+ env: this.env,
75
+ tokens: [],
76
+ connectedAddresses: []
77
+ });
78
+ return connector.getBlock({
684
79
  blockHash,
685
80
  blockNumber,
686
81
  blockTag
@@ -1,10 +1,10 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetBlockInput, d as GetBlockOutput } from '../shared/blockchain.CtIjPvX8.cjs';
3
+ import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetBlockInput, d as GetBlockOutput } from '../shared/blockchain.CaPQzwns.cjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
7
- import '../shared/blockchain.Cx60lJ0c.cjs';
7
+ import '../shared/blockchain.DUhjXgba.cjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
 
10
10
  declare const BlockchainServiceBase_base: (abstract new (ctx: ExecutionContext, env: BlockchainEnv) => WorkerEntrypoint<BlockchainEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);
@@ -1,10 +1,10 @@
1
1
  import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
2
2
  import { IRPCResponse } from '@develit-io/backend-sdk';
3
- import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetBlockInput, d as GetBlockOutput } from '../shared/blockchain.DZbyq0JM.mjs';
3
+ import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetBlockInput, d as GetBlockOutput } from '../shared/blockchain.CvNI0YTF.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
7
- import '../shared/blockchain.Cx60lJ0c.mjs';
7
+ import '../shared/blockchain.DUhjXgba.mjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
 
10
10
  declare const BlockchainServiceBase_base: (abstract new (ctx: ExecutionContext, env: BlockchainEnv) => WorkerEntrypoint<BlockchainEnv, {}>) & (abstract new (...args: any[]) => _develit_io_backend_sdk.DevelitWorkerMethods);