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