@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
@@ -0,0 +1,335 @@
1
+ 'use strict';
2
+
3
+ const database_schema = require('./blockchain.CbmnjjFl.cjs');
4
+ require('drizzle-orm');
5
+ const backendSdk = require('@develit-io/backend-sdk');
6
+ const viem = require('viem');
7
+ const accounts = require('viem/accounts');
8
+
9
+ const tables = database_schema.schema;
10
+
11
+ class IBlockchainConnector {
12
+ }
13
+
14
+ const TRANSFER_EVENT_ABI = [
15
+ {
16
+ type: "event",
17
+ name: "Transfer",
18
+ inputs: [
19
+ { indexed: true, name: "from", type: "address" },
20
+ { indexed: true, name: "to", type: "address" },
21
+ { indexed: false, name: "value", type: "uint256" }
22
+ ]
23
+ }
24
+ ];
25
+ const ERC20_TRANSFER_ABI = [
26
+ {
27
+ type: "function",
28
+ name: "transfer",
29
+ inputs: [
30
+ { name: "to", type: "address" },
31
+ { name: "amount", type: "uint256" }
32
+ ],
33
+ outputs: [{ name: "", type: "bool" }],
34
+ stateMutability: "nonpayable"
35
+ }
36
+ ];
37
+ class EvmConnector extends IBlockchainConnector {
38
+ constructor(config) {
39
+ super();
40
+ this.client = null;
41
+ this.rpcUrl = config.RPC_URL;
42
+ this.tokens = config.tokens;
43
+ this.connectedAddresses = config.connectedAddresses;
44
+ this.resolveCredentials = config.resolveCredentials;
45
+ }
46
+ createClient() {
47
+ if (!this.client) {
48
+ this.client = viem.createPublicClient({
49
+ transport: viem.http(this.rpcUrl)
50
+ });
51
+ }
52
+ return this.client;
53
+ }
54
+ async getTransaction(txHash) {
55
+ const client = this.createClient();
56
+ const [tx, txError] = await backendSdk.useResult(
57
+ client.getTransaction({ hash: txHash })
58
+ );
59
+ if (txError || !tx) {
60
+ throw backendSdk.createInternalError(txError);
61
+ }
62
+ let status = "pending";
63
+ let gasUsed = null;
64
+ let timestamp = null;
65
+ if (tx.blockNumber) {
66
+ const [receipt, receiptError] = await backendSdk.useResult(
67
+ client.getTransactionReceipt({ hash: txHash })
68
+ );
69
+ if (receiptError || !receipt) {
70
+ throw backendSdk.createInternalError(receiptError);
71
+ }
72
+ const [block, blockError] = await backendSdk.useResult(
73
+ client.getBlock({ blockNumber: tx.blockNumber })
74
+ );
75
+ if (blockError || !block) {
76
+ throw backendSdk.createInternalError(blockError);
77
+ }
78
+ status = receipt.status === "success" ? "success" : "reverted";
79
+ gasUsed = receipt.gasUsed.toString();
80
+ timestamp = Number(block.timestamp) * 1e3;
81
+ }
82
+ return {
83
+ hash: tx.hash,
84
+ from: tx.from,
85
+ to: tx.to,
86
+ value: tx.value.toString(),
87
+ blockNumber: tx.blockNumber?.toString() ?? null,
88
+ blockHash: tx.blockHash ?? null,
89
+ gasPrice: tx.gasPrice?.toString() ?? null,
90
+ gas: tx.gas.toString(),
91
+ nonce: tx.nonce,
92
+ transactionIndex: tx.transactionIndex,
93
+ status,
94
+ gasUsed,
95
+ timestamp
96
+ };
97
+ }
98
+ async getTransactionReceipt(txHash) {
99
+ const client = this.createClient();
100
+ const [receipt, error] = await backendSdk.useResult(
101
+ client.getTransactionReceipt({ hash: txHash })
102
+ );
103
+ if (error || !receipt) {
104
+ throw backendSdk.createInternalError(error);
105
+ }
106
+ return receipt;
107
+ }
108
+ async getBlock({
109
+ blockHash,
110
+ blockNumber,
111
+ blockTag
112
+ }) {
113
+ const client = this.createClient();
114
+ const [block, error] = await backendSdk.useResult(
115
+ blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
116
+ );
117
+ if (error || !block) {
118
+ throw error;
119
+ }
120
+ return block;
121
+ }
122
+ async getAllAddressTransactions({
123
+ address,
124
+ filter
125
+ }) {
126
+ const client = this.createClient();
127
+ const latestBlock = await client.getBlockNumber();
128
+ const transactions = [];
129
+ const allTransactionsFromContracts = await Promise.all(
130
+ this.tokens.map(async (token) => {
131
+ const events = await client.getContractEvents({
132
+ abi: TRANSFER_EVENT_ABI,
133
+ address: token.smartContractAddress,
134
+ eventName: "Transfer",
135
+ args: {
136
+ to: address
137
+ },
138
+ fromBlock: filter.fromBlock ?? latestBlock - 900n,
139
+ toBlock: "latest"
140
+ });
141
+ return { events, token };
142
+ })
143
+ );
144
+ for (const { events, token } of allTransactionsFromContracts) {
145
+ for (const tx of events) {
146
+ const [receipt, block] = await Promise.all([
147
+ client.getTransactionReceipt({ hash: tx.transactionHash }),
148
+ client.getBlock({ blockNumber: tx.blockNumber })
149
+ ]);
150
+ transactions.push({
151
+ hash: tx.transactionHash,
152
+ from: tx.args.from ?? "",
153
+ to: tx.args.to ?? "",
154
+ value: (tx.args.value ?? 0n).toString(),
155
+ blockNumber: tx.blockNumber.toString(),
156
+ blockHash: tx.blockHash,
157
+ gasUsed: receipt.gasUsed.toString(),
158
+ gasPrice: receipt.effectiveGasPrice?.toString() ?? "",
159
+ timestamp: Number(block.timestamp),
160
+ status: receipt.status,
161
+ decimals: token.decimals,
162
+ connector: this.connectorKey,
163
+ ticker: token.ticker
164
+ });
165
+ }
166
+ }
167
+ return { transactions, latestBlock };
168
+ }
169
+ async sendTransaction({
170
+ from,
171
+ to,
172
+ value,
173
+ token
174
+ }) {
175
+ const address = this.connectedAddresses.find(
176
+ (a) => a.number.toLowerCase() === from.toLowerCase()
177
+ );
178
+ if (!address) {
179
+ throw backendSdk.createInternalError(null, {
180
+ message: `Address not found: ${from}`
181
+ });
182
+ }
183
+ if (!this.resolveCredentials) {
184
+ throw backendSdk.createInternalError(null, {
185
+ message: `Credentials resolver not provided`
186
+ });
187
+ }
188
+ const credentials = await this.resolveCredentials(address.id);
189
+ if (!credentials) {
190
+ throw backendSdk.createInternalError(null, {
191
+ message: `No private key found for address: ${from}`
192
+ });
193
+ }
194
+ const account = accounts.privateKeyToAccount(credentials.value);
195
+ const walletClient = viem.createWalletClient({
196
+ account,
197
+ transport: viem.http(this.rpcUrl)
198
+ });
199
+ let hash;
200
+ if (token) {
201
+ const data = viem.encodeFunctionData({
202
+ abi: ERC20_TRANSFER_ABI,
203
+ functionName: "transfer",
204
+ args: [to, viem.parseUnits(value, token.decimals)]
205
+ });
206
+ hash = await walletClient.sendTransaction({
207
+ chain: null,
208
+ to: token.smartContractAddress,
209
+ data
210
+ });
211
+ } else {
212
+ hash = await walletClient.sendTransaction({
213
+ chain: null,
214
+ to,
215
+ value: BigInt(value)
216
+ });
217
+ }
218
+ return { hash };
219
+ }
220
+ }
221
+
222
+ class ArbitrumConnector extends EvmConnector {
223
+ constructor(config) {
224
+ super(config);
225
+ this.connectorKey = "ARBITRUM";
226
+ }
227
+ }
228
+
229
+ class AvalancheConnector extends EvmConnector {
230
+ constructor(config) {
231
+ super(config);
232
+ this.connectorKey = "AVALANCHE";
233
+ }
234
+ }
235
+
236
+ class BaseConnector extends EvmConnector {
237
+ constructor(config) {
238
+ super(config);
239
+ this.connectorKey = "BASE";
240
+ }
241
+ }
242
+
243
+ class EthereumConnector extends EvmConnector {
244
+ constructor(config) {
245
+ super(config);
246
+ this.connectorKey = "ETHEREUM";
247
+ }
248
+ }
249
+
250
+ class GnosisConnector extends EvmConnector {
251
+ constructor(config) {
252
+ super(config);
253
+ this.connectorKey = "GNOSIS";
254
+ }
255
+ }
256
+
257
+ class OptimismConnector extends EvmConnector {
258
+ constructor(config) {
259
+ super(config);
260
+ this.connectorKey = "OPTIMISM";
261
+ }
262
+ }
263
+
264
+ class ScrollConnector extends EvmConnector {
265
+ constructor(config) {
266
+ super(config);
267
+ this.connectorKey = "SCROLL";
268
+ }
269
+ }
270
+
271
+ const initiateConnector = async ({
272
+ chain,
273
+ env,
274
+ tokens,
275
+ connectedAddresses,
276
+ resolveCredentials
277
+ }) => {
278
+ const getRpcUrl = async (secretName) => (await env.SECRETS_STORE.get({ secretName })).data?.secretValue || "";
279
+ switch (chain) {
280
+ case "ETHEREUM":
281
+ return new EthereumConnector({
282
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_ETHEREUM_RPC_URL"),
283
+ tokens,
284
+ connectedAddresses,
285
+ resolveCredentials
286
+ });
287
+ case "ARBITRUM":
288
+ return new ArbitrumConnector({
289
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_ARBITRUM_RPC_URL"),
290
+ tokens,
291
+ connectedAddresses,
292
+ resolveCredentials
293
+ });
294
+ case "AVALANCHE":
295
+ return new AvalancheConnector({
296
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_AVALANCHE_RPC_URL"),
297
+ tokens,
298
+ connectedAddresses,
299
+ resolveCredentials
300
+ });
301
+ case "BASE":
302
+ return new BaseConnector({
303
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_BASE_RPC_URL"),
304
+ tokens,
305
+ connectedAddresses,
306
+ resolveCredentials
307
+ });
308
+ case "GNOSIS":
309
+ return new GnosisConnector({
310
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_GNOSIS_RPC_URL"),
311
+ tokens,
312
+ connectedAddresses,
313
+ resolveCredentials
314
+ });
315
+ case "OPTIMISM":
316
+ return new OptimismConnector({
317
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_OPTIMISM_RPC_URL"),
318
+ tokens,
319
+ connectedAddresses,
320
+ resolveCredentials
321
+ });
322
+ case "SCROLL":
323
+ return new ScrollConnector({
324
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_SCROLL_RPC_URL"),
325
+ tokens,
326
+ connectedAddresses,
327
+ resolveCredentials
328
+ });
329
+ default:
330
+ throw new Error(`Unsupported chain: ${chain}`);
331
+ }
332
+ };
333
+
334
+ exports.initiateConnector = initiateConnector;
335
+ exports.tables = tables;
@@ -0,0 +1,332 @@
1
+ import { s as schema } from './blockchain._nv3VxNA.mjs';
2
+ import 'drizzle-orm';
3
+ import { useResult, createInternalError } from '@develit-io/backend-sdk';
4
+ import { createPublicClient, http, createWalletClient, encodeFunctionData, parseUnits } from 'viem';
5
+ import { privateKeyToAccount } from 'viem/accounts';
6
+
7
+ const tables = schema;
8
+
9
+ class IBlockchainConnector {
10
+ }
11
+
12
+ const TRANSFER_EVENT_ABI = [
13
+ {
14
+ type: "event",
15
+ name: "Transfer",
16
+ inputs: [
17
+ { indexed: true, name: "from", type: "address" },
18
+ { indexed: true, name: "to", type: "address" },
19
+ { indexed: false, name: "value", type: "uint256" }
20
+ ]
21
+ }
22
+ ];
23
+ const ERC20_TRANSFER_ABI = [
24
+ {
25
+ type: "function",
26
+ name: "transfer",
27
+ inputs: [
28
+ { name: "to", type: "address" },
29
+ { name: "amount", type: "uint256" }
30
+ ],
31
+ outputs: [{ name: "", type: "bool" }],
32
+ stateMutability: "nonpayable"
33
+ }
34
+ ];
35
+ class EvmConnector extends IBlockchainConnector {
36
+ constructor(config) {
37
+ super();
38
+ this.client = null;
39
+ this.rpcUrl = config.RPC_URL;
40
+ this.tokens = config.tokens;
41
+ this.connectedAddresses = config.connectedAddresses;
42
+ this.resolveCredentials = config.resolveCredentials;
43
+ }
44
+ createClient() {
45
+ if (!this.client) {
46
+ this.client = createPublicClient({
47
+ transport: http(this.rpcUrl)
48
+ });
49
+ }
50
+ return this.client;
51
+ }
52
+ async getTransaction(txHash) {
53
+ const client = this.createClient();
54
+ const [tx, txError] = await useResult(
55
+ client.getTransaction({ hash: txHash })
56
+ );
57
+ if (txError || !tx) {
58
+ throw createInternalError(txError);
59
+ }
60
+ let status = "pending";
61
+ let gasUsed = null;
62
+ let timestamp = null;
63
+ if (tx.blockNumber) {
64
+ const [receipt, receiptError] = await useResult(
65
+ client.getTransactionReceipt({ hash: txHash })
66
+ );
67
+ if (receiptError || !receipt) {
68
+ throw createInternalError(receiptError);
69
+ }
70
+ const [block, blockError] = await useResult(
71
+ client.getBlock({ blockNumber: tx.blockNumber })
72
+ );
73
+ if (blockError || !block) {
74
+ throw createInternalError(blockError);
75
+ }
76
+ status = receipt.status === "success" ? "success" : "reverted";
77
+ gasUsed = receipt.gasUsed.toString();
78
+ timestamp = Number(block.timestamp) * 1e3;
79
+ }
80
+ return {
81
+ hash: tx.hash,
82
+ from: tx.from,
83
+ to: tx.to,
84
+ value: tx.value.toString(),
85
+ blockNumber: tx.blockNumber?.toString() ?? null,
86
+ blockHash: tx.blockHash ?? null,
87
+ gasPrice: tx.gasPrice?.toString() ?? null,
88
+ gas: tx.gas.toString(),
89
+ nonce: tx.nonce,
90
+ transactionIndex: tx.transactionIndex,
91
+ status,
92
+ gasUsed,
93
+ timestamp
94
+ };
95
+ }
96
+ async getTransactionReceipt(txHash) {
97
+ const client = this.createClient();
98
+ const [receipt, error] = await useResult(
99
+ client.getTransactionReceipt({ hash: txHash })
100
+ );
101
+ if (error || !receipt) {
102
+ throw createInternalError(error);
103
+ }
104
+ return receipt;
105
+ }
106
+ async getBlock({
107
+ blockHash,
108
+ blockNumber,
109
+ blockTag
110
+ }) {
111
+ const client = this.createClient();
112
+ const [block, error] = await useResult(
113
+ blockHash !== void 0 ? client.getBlock({ blockHash }) : blockNumber !== void 0 ? client.getBlock({ blockNumber }) : client.getBlock({ blockTag: blockTag ?? "finalized" })
114
+ );
115
+ if (error || !block) {
116
+ throw error;
117
+ }
118
+ return block;
119
+ }
120
+ async getAllAddressTransactions({
121
+ address,
122
+ filter
123
+ }) {
124
+ const client = this.createClient();
125
+ const latestBlock = await client.getBlockNumber();
126
+ const transactions = [];
127
+ const allTransactionsFromContracts = await Promise.all(
128
+ this.tokens.map(async (token) => {
129
+ const events = await client.getContractEvents({
130
+ abi: TRANSFER_EVENT_ABI,
131
+ address: token.smartContractAddress,
132
+ eventName: "Transfer",
133
+ args: {
134
+ to: address
135
+ },
136
+ fromBlock: filter.fromBlock ?? latestBlock - 900n,
137
+ toBlock: "latest"
138
+ });
139
+ return { events, token };
140
+ })
141
+ );
142
+ for (const { events, token } of allTransactionsFromContracts) {
143
+ for (const tx of events) {
144
+ const [receipt, block] = await Promise.all([
145
+ client.getTransactionReceipt({ hash: tx.transactionHash }),
146
+ client.getBlock({ blockNumber: tx.blockNumber })
147
+ ]);
148
+ transactions.push({
149
+ hash: tx.transactionHash,
150
+ from: tx.args.from ?? "",
151
+ to: tx.args.to ?? "",
152
+ value: (tx.args.value ?? 0n).toString(),
153
+ blockNumber: tx.blockNumber.toString(),
154
+ blockHash: tx.blockHash,
155
+ gasUsed: receipt.gasUsed.toString(),
156
+ gasPrice: receipt.effectiveGasPrice?.toString() ?? "",
157
+ timestamp: Number(block.timestamp),
158
+ status: receipt.status,
159
+ decimals: token.decimals,
160
+ connector: this.connectorKey,
161
+ ticker: token.ticker
162
+ });
163
+ }
164
+ }
165
+ return { transactions, latestBlock };
166
+ }
167
+ async sendTransaction({
168
+ from,
169
+ to,
170
+ value,
171
+ token
172
+ }) {
173
+ const address = this.connectedAddresses.find(
174
+ (a) => a.number.toLowerCase() === from.toLowerCase()
175
+ );
176
+ if (!address) {
177
+ throw createInternalError(null, {
178
+ message: `Address not found: ${from}`
179
+ });
180
+ }
181
+ if (!this.resolveCredentials) {
182
+ throw createInternalError(null, {
183
+ message: `Credentials resolver not provided`
184
+ });
185
+ }
186
+ const credentials = await this.resolveCredentials(address.id);
187
+ if (!credentials) {
188
+ throw createInternalError(null, {
189
+ message: `No private key found for address: ${from}`
190
+ });
191
+ }
192
+ const account = privateKeyToAccount(credentials.value);
193
+ const walletClient = createWalletClient({
194
+ account,
195
+ transport: http(this.rpcUrl)
196
+ });
197
+ let hash;
198
+ if (token) {
199
+ const data = encodeFunctionData({
200
+ abi: ERC20_TRANSFER_ABI,
201
+ functionName: "transfer",
202
+ args: [to, parseUnits(value, token.decimals)]
203
+ });
204
+ hash = await walletClient.sendTransaction({
205
+ chain: null,
206
+ to: token.smartContractAddress,
207
+ data
208
+ });
209
+ } else {
210
+ hash = await walletClient.sendTransaction({
211
+ chain: null,
212
+ to,
213
+ value: BigInt(value)
214
+ });
215
+ }
216
+ return { hash };
217
+ }
218
+ }
219
+
220
+ class ArbitrumConnector extends EvmConnector {
221
+ constructor(config) {
222
+ super(config);
223
+ this.connectorKey = "ARBITRUM";
224
+ }
225
+ }
226
+
227
+ class AvalancheConnector extends EvmConnector {
228
+ constructor(config) {
229
+ super(config);
230
+ this.connectorKey = "AVALANCHE";
231
+ }
232
+ }
233
+
234
+ class BaseConnector extends EvmConnector {
235
+ constructor(config) {
236
+ super(config);
237
+ this.connectorKey = "BASE";
238
+ }
239
+ }
240
+
241
+ class EthereumConnector extends EvmConnector {
242
+ constructor(config) {
243
+ super(config);
244
+ this.connectorKey = "ETHEREUM";
245
+ }
246
+ }
247
+
248
+ class GnosisConnector extends EvmConnector {
249
+ constructor(config) {
250
+ super(config);
251
+ this.connectorKey = "GNOSIS";
252
+ }
253
+ }
254
+
255
+ class OptimismConnector extends EvmConnector {
256
+ constructor(config) {
257
+ super(config);
258
+ this.connectorKey = "OPTIMISM";
259
+ }
260
+ }
261
+
262
+ class ScrollConnector extends EvmConnector {
263
+ constructor(config) {
264
+ super(config);
265
+ this.connectorKey = "SCROLL";
266
+ }
267
+ }
268
+
269
+ const initiateConnector = async ({
270
+ chain,
271
+ env,
272
+ tokens,
273
+ connectedAddresses,
274
+ resolveCredentials
275
+ }) => {
276
+ const getRpcUrl = async (secretName) => (await env.SECRETS_STORE.get({ secretName })).data?.secretValue || "";
277
+ switch (chain) {
278
+ case "ETHEREUM":
279
+ return new EthereumConnector({
280
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_ETHEREUM_RPC_URL"),
281
+ tokens,
282
+ connectedAddresses,
283
+ resolveCredentials
284
+ });
285
+ case "ARBITRUM":
286
+ return new ArbitrumConnector({
287
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_ARBITRUM_RPC_URL"),
288
+ tokens,
289
+ connectedAddresses,
290
+ resolveCredentials
291
+ });
292
+ case "AVALANCHE":
293
+ return new AvalancheConnector({
294
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_AVALANCHE_RPC_URL"),
295
+ tokens,
296
+ connectedAddresses,
297
+ resolveCredentials
298
+ });
299
+ case "BASE":
300
+ return new BaseConnector({
301
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_BASE_RPC_URL"),
302
+ tokens,
303
+ connectedAddresses,
304
+ resolveCredentials
305
+ });
306
+ case "GNOSIS":
307
+ return new GnosisConnector({
308
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_GNOSIS_RPC_URL"),
309
+ tokens,
310
+ connectedAddresses,
311
+ resolveCredentials
312
+ });
313
+ case "OPTIMISM":
314
+ return new OptimismConnector({
315
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_OPTIMISM_RPC_URL"),
316
+ tokens,
317
+ connectedAddresses,
318
+ resolveCredentials
319
+ });
320
+ case "SCROLL":
321
+ return new ScrollConnector({
322
+ RPC_URL: await getRpcUrl("BLOCKCHAIN_SERVICE_SCROLL_RPC_URL"),
323
+ tokens,
324
+ connectedAddresses,
325
+ resolveCredentials
326
+ });
327
+ default:
328
+ throw new Error(`Unsupported chain: ${chain}`);
329
+ }
330
+ };
331
+
332
+ export { initiateConnector as i, tables as t };
@@ -1,6 +1,17 @@
1
1
  import { z } from 'zod';
2
2
  import { workflowInstanceStatusSchema } from '@develit-io/backend-sdk';
3
3
 
4
+ const CHAIN_KEYS = [
5
+ "ARBITRUM",
6
+ "AVALANCHE",
7
+ "BASE",
8
+ "ETHEREUM",
9
+ "GNOSIS",
10
+ "OPTIMISM",
11
+ "SCROLL"
12
+ ];
13
+ const CREDENTIALS_TYPES = ["PRIVATE_KEY"];
14
+
4
15
  const chainSchema = z.enum([
5
16
  "ARBITRUM",
6
17
  "AVALANCHE",
@@ -84,4 +95,4 @@ const syncAddressOutputSchema = z.object({
84
95
  details: workflowInstanceStatusSchema
85
96
  });
86
97
 
87
- export { getBlockOutputSchema as a, getTransactionInputSchema as b, chainSchema as c, getTransactionOutputSchema as d, syncAddressOutputSchema as e, getBlockInputSchema as g, syncAddressInputSchema as s };
98
+ export { CHAIN_KEYS as C, CREDENTIALS_TYPES as a, getBlockOutputSchema as b, chainSchema as c, getTransactionInputSchema as d, getTransactionOutputSchema as e, syncAddressOutputSchema as f, getBlockInputSchema as g, syncAddressInputSchema as s };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { s as schema } from './blockchain.Cx60lJ0c.cjs';
2
+ import { s as schema } from './blockchain.DUhjXgba.cjs';
3
3
 
4
4
  declare const getBlockInputSchema: z.ZodObject<{
5
5
  chain: z.ZodEnum<{