@develit-services/blockchain 0.8.2 → 0.8.4

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 +100 -85
  12. package/dist/export/workflows.mjs +96 -81
  13. package/dist/shared/blockchain.BKGlFbOW.mjs +68 -0
  14. package/dist/shared/{blockchain.CtIjPvX8.d.cts → blockchain.Br6esGv4.d.cts} +3 -3
  15. package/dist/shared/{blockchain.DTJULMBV.mjs → blockchain.CKh8Fs7w.mjs} +12 -1
  16. package/dist/shared/{blockchain.BBjLLe8v.cjs → blockchain.Cjq9eH7Z.cjs} +13 -0
  17. package/dist/shared/blockchain.DUhjXgba.d.cts +1107 -0
  18. package/dist/shared/blockchain.DUhjXgba.d.mts +1107 -0
  19. package/dist/shared/blockchain.DUhjXgba.d.ts +1107 -0
  20. package/dist/shared/{blockchain.DZbyq0JM.d.mts → blockchain.DcWSUM60.d.mts} +3 -3
  21. package/dist/shared/{blockchain.5Ld6uEay.d.ts → blockchain.DurPotrN.d.ts} +3 -3
  22. package/dist/shared/blockchain.JBv4ipVR.cjs +335 -0
  23. package/dist/shared/blockchain.ZJPECySM.cjs +74 -0
  24. package/dist/shared/blockchain.wsLSmIaf.mjs +332 -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 +2 -2
  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,332 @@
1
+ import { s as schema } from './blockchain.BKGlFbOW.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 };
package/dist/types.cjs CHANGED
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const syncAddress = require('./shared/blockchain.BBjLLe8v.cjs');
3
+ const syncAddress = require('./shared/blockchain.Cjq9eH7Z.cjs');
4
4
  require('zod');
5
5
  require('@develit-io/backend-sdk');
6
6
 
7
7
 
8
8
 
9
+ exports.CHAIN_KEYS = syncAddress.CHAIN_KEYS;
10
+ exports.CREDENTIALS_TYPES = syncAddress.CREDENTIALS_TYPES;
9
11
  exports.chainSchema = syncAddress.chainSchema;
10
12
  exports.getBlockInputSchema = syncAddress.getBlockInputSchema;
11
13
  exports.getBlockOutputSchema = syncAddress.getBlockOutputSchema;
package/dist/types.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- export { L as LastSyncMetadata } from './shared/blockchain.Cx60lJ0c.cjs';
1
+ export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, b as CredentialsType, L as LastSyncMetadata } from './shared/blockchain.DUhjXgba.cjs';
2
2
  import { BaseEvent } from '@develit-io/backend-sdk';
3
- import { t as tables } from './shared/blockchain.CtIjPvX8.cjs';
4
- export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, S as SyncAddressInput, a as SyncAddressOutput, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.CtIjPvX8.cjs';
3
+ import { t as tables } from './shared/blockchain.Br6esGv4.cjs';
4
+ export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, S as SyncAddressInput, a as SyncAddressOutput, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.Br6esGv4.cjs';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
6
  export { a as BlockchainServiceEnv, b as BlockchainServiceEnvironmentConfig, B as BlockchainServiceWranglerConfig } from './shared/blockchain.C1Jdisxn.cjs';
7
7
  import 'drizzle-orm/sqlite-core';
@@ -21,6 +21,9 @@ type BlockchainTransactionEvent = BaseEvent & {
21
21
  gasPrice: string;
22
22
  timestamp: number;
23
23
  status: string;
24
+ decimals: number;
25
+ connector: string | null;
26
+ ticker: string;
24
27
  };
25
28
  };
26
29
 
@@ -32,5 +35,10 @@ interface AddressSelectType extends InferSelectModel<typeof tables.address> {
32
35
  }
33
36
  interface AddressInsertType extends InferInsertModel<typeof tables.address> {
34
37
  }
38
+ interface AddressCredentialsSelectType extends InferSelectModel<typeof tables.addressCredentials> {
39
+ }
40
+ interface AddressCredentialsInsertType extends Omit<InferInsertModel<typeof tables.addressCredentials>, 'id'> {
41
+ id?: string;
42
+ }
35
43
 
36
- export type { AddressInsertType, AddressSelectType, BlockchainTransactionEvent, TransactionInsertType, TransactionSelectType };
44
+ export type { AddressCredentialsInsertType, AddressCredentialsSelectType, AddressInsertType, AddressSelectType, BlockchainTransactionEvent, TransactionInsertType, TransactionSelectType };
package/dist/types.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- export { L as LastSyncMetadata } from './shared/blockchain.Cx60lJ0c.mjs';
1
+ export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, b as CredentialsType, L as LastSyncMetadata } from './shared/blockchain.DUhjXgba.mjs';
2
2
  import { BaseEvent } from '@develit-io/backend-sdk';
3
- import { t as tables } from './shared/blockchain.DZbyq0JM.mjs';
4
- export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, S as SyncAddressInput, a as SyncAddressOutput, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.DZbyq0JM.mjs';
3
+ import { t as tables } from './shared/blockchain.DcWSUM60.mjs';
4
+ export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, S as SyncAddressInput, a as SyncAddressOutput, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.DcWSUM60.mjs';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
6
  export { a as BlockchainServiceEnv, b as BlockchainServiceEnvironmentConfig, B as BlockchainServiceWranglerConfig } from './shared/blockchain.C1Jdisxn.mjs';
7
7
  import 'drizzle-orm/sqlite-core';
@@ -21,6 +21,9 @@ type BlockchainTransactionEvent = BaseEvent & {
21
21
  gasPrice: string;
22
22
  timestamp: number;
23
23
  status: string;
24
+ decimals: number;
25
+ connector: string | null;
26
+ ticker: string;
24
27
  };
25
28
  };
26
29
 
@@ -32,5 +35,10 @@ interface AddressSelectType extends InferSelectModel<typeof tables.address> {
32
35
  }
33
36
  interface AddressInsertType extends InferInsertModel<typeof tables.address> {
34
37
  }
38
+ interface AddressCredentialsSelectType extends InferSelectModel<typeof tables.addressCredentials> {
39
+ }
40
+ interface AddressCredentialsInsertType extends Omit<InferInsertModel<typeof tables.addressCredentials>, 'id'> {
41
+ id?: string;
42
+ }
35
43
 
36
- export type { AddressInsertType, AddressSelectType, BlockchainTransactionEvent, TransactionInsertType, TransactionSelectType };
44
+ export type { AddressCredentialsInsertType, AddressCredentialsSelectType, AddressInsertType, AddressSelectType, BlockchainTransactionEvent, TransactionInsertType, TransactionSelectType };
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { L as LastSyncMetadata } from './shared/blockchain.Cx60lJ0c.js';
1
+ export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, b as CredentialsType, L as LastSyncMetadata } from './shared/blockchain.DUhjXgba.js';
2
2
  import { BaseEvent } from '@develit-io/backend-sdk';
3
- import { t as tables } from './shared/blockchain.5Ld6uEay.js';
4
- export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, S as SyncAddressInput, a as SyncAddressOutput, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.5Ld6uEay.js';
3
+ import { t as tables } from './shared/blockchain.DurPotrN.js';
4
+ export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, S as SyncAddressInput, a as SyncAddressOutput, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.DurPotrN.js';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
6
  export { a as BlockchainServiceEnv, b as BlockchainServiceEnvironmentConfig, B as BlockchainServiceWranglerConfig } from './shared/blockchain.C1Jdisxn.js';
7
7
  import 'drizzle-orm/sqlite-core';
@@ -21,6 +21,9 @@ type BlockchainTransactionEvent = BaseEvent & {
21
21
  gasPrice: string;
22
22
  timestamp: number;
23
23
  status: string;
24
+ decimals: number;
25
+ connector: string | null;
26
+ ticker: string;
24
27
  };
25
28
  };
26
29
 
@@ -32,5 +35,10 @@ interface AddressSelectType extends InferSelectModel<typeof tables.address> {
32
35
  }
33
36
  interface AddressInsertType extends InferInsertModel<typeof tables.address> {
34
37
  }
38
+ interface AddressCredentialsSelectType extends InferSelectModel<typeof tables.addressCredentials> {
39
+ }
40
+ interface AddressCredentialsInsertType extends Omit<InferInsertModel<typeof tables.addressCredentials>, 'id'> {
41
+ id?: string;
42
+ }
35
43
 
36
- export type { AddressInsertType, AddressSelectType, BlockchainTransactionEvent, TransactionInsertType, TransactionSelectType };
44
+ export type { AddressCredentialsInsertType, AddressCredentialsSelectType, AddressInsertType, AddressSelectType, BlockchainTransactionEvent, TransactionInsertType, TransactionSelectType };
package/dist/types.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { c as chainSchema, g as getBlockInputSchema, a as getBlockOutputSchema, b as getTransactionInputSchema, d as getTransactionOutputSchema, s as syncAddressInputSchema, e as syncAddressOutputSchema } from './shared/blockchain.DTJULMBV.mjs';
1
+ export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, c as chainSchema, g as getBlockInputSchema, b as getBlockOutputSchema, d as getTransactionInputSchema, e as getTransactionOutputSchema, s as syncAddressInputSchema, f as syncAddressOutputSchema } from './shared/blockchain.CKh8Fs7w.mjs';
2
2
  import 'zod';
3
3
  import '@develit-io/backend-sdk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/blockchain",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -56,6 +56,6 @@
56
56
  "zod": "^4.1.13"
57
57
  },
58
58
  "dependencies": {
59
- "viem": "^2.45.1"
59
+ "viem": "^2.46.1"
60
60
  }
61
61
  }
@@ -1,6 +0,0 @@
1
- import { s as schema } from './blockchain._wwKu1qP.mjs';
2
- import 'drizzle-orm';
3
-
4
- const tables = schema;
5
-
6
- export { tables as t };
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- const backendSdk = require('@develit-io/backend-sdk');
4
- const sqliteCore = require('drizzle-orm/sqlite-core');
5
-
6
- const address = sqliteCore.sqliteTable("address", {
7
- ...backendSdk.base,
8
- number: sqliteCore.text("number").notNull(),
9
- chain: sqliteCore.text("chain").notNull(),
10
- syncIntervalS: sqliteCore.integer("sync_interval_s").notNull().default(600),
11
- lastSyncAt: sqliteCore.integer("last_sync_at", { mode: "timestamp_ms" }),
12
- lastSyncMetadata: sqliteCore.text("last_sync_metadata", {
13
- mode: "json"
14
- }).$type()
15
- });
16
-
17
- const transaction = sqliteCore.sqliteTable("transaction", {
18
- ...backendSdk.base,
19
- hash: sqliteCore.text("hash"),
20
- from: sqliteCore.text("from"),
21
- to: sqliteCore.text("to"),
22
- value: sqliteCore.text("value"),
23
- blockNumber: sqliteCore.text("blockNumber"),
24
- blockHash: sqliteCore.text("blockHash"),
25
- gasUsed: sqliteCore.text("gasUsed"),
26
- gasPrice: sqliteCore.text("gasPrice"),
27
- timestamp: sqliteCore.integer("timestamp"),
28
- status: sqliteCore.text("status")
29
- });
30
-
31
- const schema = {
32
- __proto__: null,
33
- address: address,
34
- transaction: transaction
35
- };
36
-
37
- exports.address = address;
38
- exports.schema = schema;
39
- exports.transaction = transaction;