@develit-services/blockchain 0.11.1 → 1.0.0

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.
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/blockchain.ByoXNMWP.cjs');
3
+ const database_schema = require('../shared/blockchain.DR86eH-9.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm/sqlite-core');
6
- require('../shared/blockchain.B1DsOJYY.cjs');
6
+ require('../shared/blockchain.BVya3Mud.cjs');
7
7
  require('zod');
8
8
 
9
9
 
@@ -1,5 +1,5 @@
1
- export { a as address, b as addressCredentials, t as tokens, c as transaction } from '../shared/blockchain.C1YDFhjP.mjs';
1
+ export { a as address, b as addressCredentials, t as tokens, c as transaction } from '../shared/blockchain.ChUyJIdK.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm/sqlite-core';
4
- import '../shared/blockchain.CBJdSboV.mjs';
4
+ import '../shared/blockchain.BsFFrNF0.mjs';
5
5
  import 'zod';
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  const backendSdk = require('@develit-io/backend-sdk');
6
- const blockchain = require('../shared/blockchain.CPHf4-ak.cjs');
7
- const address = require('../shared/blockchain.B1DsOJYY.cjs');
4
+ const blockchain = require('../shared/blockchain.BUnmkBag.cjs');
5
+ const address = require('../shared/blockchain.BVya3Mud.cjs');
8
6
  const cloudflare_workers = require('cloudflare:workers');
9
7
  const d1 = require('drizzle-orm/d1');
10
- require('../shared/blockchain.ByoXNMWP.cjs');
8
+ require('../shared/blockchain.DR86eH-9.cjs');
11
9
  require('drizzle-orm/sqlite-core');
12
10
  require('drizzle-orm');
13
11
  require('viem');
@@ -34,7 +32,7 @@ let BlockchainServiceBase = class extends backendSdk.develitWorker(
34
32
  async syncAddress(input) {
35
33
  return this.handleAction(
36
34
  { data: input, schema: address.syncAddressInputSchema },
37
- { successMessage: "Address sync workflow started" },
35
+ { successMessage: "Address sync workflow started." },
38
36
  async ({ addressId }) => {
39
37
  const instance = await this.env.SYNC_ADDRESS_TRANSACTIONS_WORKFLOW.create({
40
38
  id: addressId,
@@ -64,6 +62,24 @@ let BlockchainServiceBase = class extends backendSdk.develitWorker(
64
62
  }
65
63
  );
66
64
  }
65
+ async getDecimals(input) {
66
+ return this.handleAction(
67
+ { data: input, schema: address.getDecimalsInputSchema },
68
+ { successMessage: "Decimals retrieved successfully." },
69
+ async ({ chain, contractAddress }) => {
70
+ const connector = await blockchain.initiateConnector({
71
+ chain,
72
+ env: this.env,
73
+ tokens: [],
74
+ connectedAddresses: []
75
+ });
76
+ const decimals = await connector.getDecimals(
77
+ contractAddress
78
+ );
79
+ return { decimals };
80
+ }
81
+ );
82
+ }
67
83
  async getBlock(input) {
68
84
  return this.handleAction(
69
85
  { data: input, schema: address.getBlockInputSchema },
@@ -90,6 +106,9 @@ __decorateClass([
90
106
  __decorateClass([
91
107
  backendSdk.action("get-transaction")
92
108
  ], BlockchainServiceBase.prototype, "getTransaction", 1);
109
+ __decorateClass([
110
+ backendSdk.action("get-decimals")
111
+ ], BlockchainServiceBase.prototype, "getDecimals", 1);
93
112
  __decorateClass([
94
113
  backendSdk.action("get-block")
95
114
  ], BlockchainServiceBase.prototype, "getBlock", 1);
@@ -104,7 +123,4 @@ function defineBlockchainService() {
104
123
  };
105
124
  }
106
125
 
107
- const BlockchainService = defineBlockchainService();
108
-
109
- exports.default = BlockchainService;
110
126
  exports.defineBlockchainService = defineBlockchainService;
@@ -1,6 +1,6 @@
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.CQMtSOse.cjs';
3
+ import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetDecimalsInput, d as GetDecimalsOutput, e as GetBlockInput, f as GetBlockOutput } from '../shared/blockchain.Dzf9Wl8D.cjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
@@ -13,12 +13,9 @@ declare class BlockchainServiceBase extends BlockchainServiceBase_base {
13
13
  constructor(ctx: ExecutionContext, env: BlockchainEnv);
14
14
  syncAddress(input: SyncAddressInput): Promise<IRPCResponse<SyncAddressOutput>>;
15
15
  getTransaction(input: GetTransactionInput): Promise<IRPCResponse<GetTransactionOutput>>;
16
+ getDecimals(input: GetDecimalsInput): Promise<IRPCResponse<GetDecimalsOutput>>;
16
17
  getBlock(input: GetBlockInput): Promise<IRPCResponse<GetBlockOutput>>;
17
18
  }
18
- declare function defineBlockchainService(): new (ctx: ExecutionContext, env: BlockchainEnv) => BlockchainServiceBase;
19
+ declare function defineBlockchainService(): typeof BlockchainServiceBase;
19
20
 
20
- declare const _default: new (ctx: ExecutionContext, env: BlockchainEnv) => WorkerEntrypoint<BlockchainEnv>;
21
-
22
- // @ts-ignore
23
- export = _default;
24
21
  export { defineBlockchainService };
@@ -1,6 +1,6 @@
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.BJwCN-zk.mjs';
3
+ import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetDecimalsInput, d as GetDecimalsOutput, e as GetBlockInput, f as GetBlockOutput } from '../shared/blockchain.BQ6UGj4I.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
@@ -13,10 +13,9 @@ declare class BlockchainServiceBase extends BlockchainServiceBase_base {
13
13
  constructor(ctx: ExecutionContext, env: BlockchainEnv);
14
14
  syncAddress(input: SyncAddressInput): Promise<IRPCResponse<SyncAddressOutput>>;
15
15
  getTransaction(input: GetTransactionInput): Promise<IRPCResponse<GetTransactionOutput>>;
16
+ getDecimals(input: GetDecimalsInput): Promise<IRPCResponse<GetDecimalsOutput>>;
16
17
  getBlock(input: GetBlockInput): Promise<IRPCResponse<GetBlockOutput>>;
17
18
  }
18
- declare function defineBlockchainService(): new (ctx: ExecutionContext, env: BlockchainEnv) => BlockchainServiceBase;
19
+ declare function defineBlockchainService(): typeof BlockchainServiceBase;
19
20
 
20
- declare const _default: new (ctx: ExecutionContext, env: BlockchainEnv) => WorkerEntrypoint<BlockchainEnv>;
21
-
22
- export { _default as default, defineBlockchainService };
21
+ export { defineBlockchainService };
@@ -1,6 +1,6 @@
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.jMmU_icc.js';
3
+ import { t as tables, S as SyncAddressInput, a as SyncAddressOutput, G as GetTransactionInput, b as GetTransactionOutput, c as GetDecimalsInput, d as GetDecimalsOutput, e as GetBlockInput, f as GetBlockOutput } from '../shared/blockchain.HRS0o16z.js';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { DrizzleD1Database } from 'drizzle-orm/d1';
6
6
  import 'zod';
@@ -13,12 +13,9 @@ declare class BlockchainServiceBase extends BlockchainServiceBase_base {
13
13
  constructor(ctx: ExecutionContext, env: BlockchainEnv);
14
14
  syncAddress(input: SyncAddressInput): Promise<IRPCResponse<SyncAddressOutput>>;
15
15
  getTransaction(input: GetTransactionInput): Promise<IRPCResponse<GetTransactionOutput>>;
16
+ getDecimals(input: GetDecimalsInput): Promise<IRPCResponse<GetDecimalsOutput>>;
16
17
  getBlock(input: GetBlockInput): Promise<IRPCResponse<GetBlockOutput>>;
17
18
  }
18
- declare function defineBlockchainService(): new (ctx: ExecutionContext, env: BlockchainEnv) => BlockchainServiceBase;
19
+ declare function defineBlockchainService(): typeof BlockchainServiceBase;
19
20
 
20
- declare const _default: new (ctx: ExecutionContext, env: BlockchainEnv) => WorkerEntrypoint<BlockchainEnv>;
21
-
22
- // @ts-ignore
23
- export = _default;
24
21
  export { defineBlockchainService };
@@ -1,9 +1,9 @@
1
1
  import { develitWorker, action, service } from '@develit-io/backend-sdk';
2
- import { t as tables, i as initiateConnector } from '../shared/blockchain.Djm2P0EG.mjs';
3
- import { s as syncAddressInputSchema, d as getTransactionInputSchema, g as getBlockInputSchema } from '../shared/blockchain.CBJdSboV.mjs';
2
+ import { t as tables, i as initiateConnector } from '../shared/blockchain.BbPuQECZ.mjs';
3
+ import { s as syncAddressInputSchema, f as getTransactionInputSchema, d as getDecimalsInputSchema, g as getBlockInputSchema } from '../shared/blockchain.BsFFrNF0.mjs';
4
4
  import { WorkerEntrypoint } from 'cloudflare:workers';
5
5
  import { drizzle } from 'drizzle-orm/d1';
6
- import '../shared/blockchain.C1YDFhjP.mjs';
6
+ import '../shared/blockchain.ChUyJIdK.mjs';
7
7
  import 'drizzle-orm/sqlite-core';
8
8
  import 'drizzle-orm';
9
9
  import 'viem';
@@ -30,7 +30,7 @@ let BlockchainServiceBase = class extends develitWorker(
30
30
  async syncAddress(input) {
31
31
  return this.handleAction(
32
32
  { data: input, schema: syncAddressInputSchema },
33
- { successMessage: "Address sync workflow started" },
33
+ { successMessage: "Address sync workflow started." },
34
34
  async ({ addressId }) => {
35
35
  const instance = await this.env.SYNC_ADDRESS_TRANSACTIONS_WORKFLOW.create({
36
36
  id: addressId,
@@ -60,6 +60,24 @@ let BlockchainServiceBase = class extends develitWorker(
60
60
  }
61
61
  );
62
62
  }
63
+ async getDecimals(input) {
64
+ return this.handleAction(
65
+ { data: input, schema: getDecimalsInputSchema },
66
+ { successMessage: "Decimals retrieved successfully." },
67
+ async ({ chain, contractAddress }) => {
68
+ const connector = await initiateConnector({
69
+ chain,
70
+ env: this.env,
71
+ tokens: [],
72
+ connectedAddresses: []
73
+ });
74
+ const decimals = await connector.getDecimals(
75
+ contractAddress
76
+ );
77
+ return { decimals };
78
+ }
79
+ );
80
+ }
63
81
  async getBlock(input) {
64
82
  return this.handleAction(
65
83
  { data: input, schema: getBlockInputSchema },
@@ -86,6 +104,9 @@ __decorateClass([
86
104
  __decorateClass([
87
105
  action("get-transaction")
88
106
  ], BlockchainServiceBase.prototype, "getTransaction", 1);
107
+ __decorateClass([
108
+ action("get-decimals")
109
+ ], BlockchainServiceBase.prototype, "getDecimals", 1);
89
110
  __decorateClass([
90
111
  action("get-block")
91
112
  ], BlockchainServiceBase.prototype, "getBlock", 1);
@@ -100,6 +121,4 @@ function defineBlockchainService() {
100
121
  };
101
122
  }
102
123
 
103
- const BlockchainService = defineBlockchainService();
104
-
105
- export { BlockchainService as default, defineBlockchainService };
124
+ export { defineBlockchainService };
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
- const blockchain = require('../shared/blockchain.CPHf4-ak.cjs');
4
+ const blockchain = require('../shared/blockchain.BUnmkBag.cjs');
5
5
  const drizzleOrm = require('drizzle-orm');
6
6
  const cloudflare_workers = require('cloudflare:workers');
7
7
  const cloudflare_workflows = require('cloudflare:workflows');
8
8
  const d1 = require('drizzle-orm/d1');
9
- require('../shared/blockchain.ByoXNMWP.cjs');
9
+ require('../shared/blockchain.DR86eH-9.cjs');
10
10
  require('drizzle-orm/sqlite-core');
11
- require('../shared/blockchain.B1DsOJYY.cjs');
11
+ require('../shared/blockchain.BVya3Mud.cjs');
12
12
  require('zod');
13
13
  require('viem');
14
14
  require('viem/accounts');
@@ -157,7 +157,7 @@ class BlockchainSyncAddressTxs extends cloudflare_workers.WorkflowEntrypoint {
157
157
  metadata: {
158
158
  correlationId: backendSdk.uuidv4(),
159
159
  entityId: backendSdk.uuidv4(),
160
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
160
+ timestamp: /* @__PURE__ */ new Date()
161
161
  }
162
162
  }));
163
163
  const lastSyncMetadata = {
@@ -1,12 +1,12 @@
1
1
  import { uuidv4, asNonEmpty } from '@develit-io/backend-sdk';
2
- import { t as tables, i as initiateConnector } from '../shared/blockchain.Djm2P0EG.mjs';
2
+ import { t as tables, i as initiateConnector } from '../shared/blockchain.BbPuQECZ.mjs';
3
3
  import { eq } from 'drizzle-orm';
4
4
  import { WorkflowEntrypoint } from 'cloudflare:workers';
5
5
  import { NonRetryableError } from 'cloudflare:workflows';
6
6
  import { drizzle } from 'drizzle-orm/d1';
7
- import '../shared/blockchain.C1YDFhjP.mjs';
7
+ import '../shared/blockchain.ChUyJIdK.mjs';
8
8
  import 'drizzle-orm/sqlite-core';
9
- import '../shared/blockchain.CBJdSboV.mjs';
9
+ import '../shared/blockchain.BsFFrNF0.mjs';
10
10
  import 'zod';
11
11
  import 'viem';
12
12
  import 'viem/accounts';
@@ -155,7 +155,7 @@ class BlockchainSyncAddressTxs extends WorkflowEntrypoint {
155
155
  metadata: {
156
156
  correlationId: uuidv4(),
157
157
  entityId: uuidv4(),
158
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
158
+ timestamp: /* @__PURE__ */ new Date()
159
159
  }
160
160
  }));
161
161
  const lastSyncMetadata = {
@@ -64,6 +64,30 @@ interface GetBlockInput extends z.infer<typeof getBlockInputSchema> {
64
64
  }
65
65
  type GetBlockOutput = z.infer<typeof getBlockOutputSchema>;
66
66
 
67
+ declare const getDecimalsInputSchema: z.ZodObject<{
68
+ chain: z.ZodEnum<{
69
+ ARBITRUM: "ARBITRUM";
70
+ AVALANCHE: "AVALANCHE";
71
+ BASE: "BASE";
72
+ ETHEREUM: "ETHEREUM";
73
+ GNOSIS: "GNOSIS";
74
+ OPTIMISM: "OPTIMISM";
75
+ ARBITRUM_SEPOLIA: "ARBITRUM_SEPOLIA";
76
+ BASE_SEPOLIA: "BASE_SEPOLIA";
77
+ CHIADO: "CHIADO";
78
+ FUJI: "FUJI";
79
+ OPTIMISM_SEPOLIA: "OPTIMISM_SEPOLIA";
80
+ SEPOLIA: "SEPOLIA";
81
+ }>;
82
+ contractAddress: z.ZodString;
83
+ }, z.core.$strip>;
84
+ declare const getDecimalsOutputSchema: z.ZodObject<{
85
+ decimals: z.ZodNumber;
86
+ }, z.core.$strip>;
87
+ interface GetDecimalsInput extends z.infer<typeof getDecimalsInputSchema> {
88
+ }
89
+ type GetDecimalsOutput = z.infer<typeof getDecimalsOutputSchema>;
90
+
67
91
  declare const MAINNET_CHAIN_TYPE: readonly ["ARBITRUM", "AVALANCHE", "BASE", "ETHEREUM", "GNOSIS", "OPTIMISM"];
68
92
  declare const TESTNET_CHAIN_TYPE: readonly ["ARBITRUM_SEPOLIA", "BASE_SEPOLIA", "CHIADO", "FUJI", "OPTIMISM_SEPOLIA", "SEPOLIA"];
69
93
  declare const chainSchema: z.ZodEnum<{
@@ -151,5 +175,5 @@ type SyncAddressOutput = z.infer<typeof syncAddressOutputSchema>;
151
175
 
152
176
  declare const tables: typeof schema;
153
177
 
154
- export { MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, chainSchema as e, getBlockOutputSchema as f, getBlockInputSchema as g, getTransactionInputSchema as h, getTransactionOutputSchema as i, syncAddressOutputSchema as j, syncAddressInputSchema as s, tables as t };
155
- export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b, GetBlockInput as c, GetBlockOutput as d };
178
+ export { MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, chainSchema as g, getBlockInputSchema as h, getBlockOutputSchema as i, getDecimalsInputSchema as j, getDecimalsOutputSchema as k, getTransactionInputSchema as l, getTransactionOutputSchema as m, syncAddressOutputSchema as n, syncAddressInputSchema as s, tables as t };
179
+ export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b, GetDecimalsInput as c, GetDecimalsOutput as d, GetBlockInput as e, GetBlockOutput as f };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('./blockchain.ByoXNMWP.cjs');
3
+ const database_schema = require('./blockchain.DR86eH-9.cjs');
4
4
  require('drizzle-orm');
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
6
  const viem = require('viem');
@@ -22,6 +22,15 @@ const TRANSFER_EVENT_ABI = [
22
22
  ]
23
23
  }
24
24
  ];
25
+ const ERC20_DECIMALS_ABI = [
26
+ {
27
+ type: "function",
28
+ name: "decimals",
29
+ inputs: [],
30
+ outputs: [{ name: "", type: "uint8" }],
31
+ stateMutability: "view"
32
+ }
33
+ ];
25
34
  const ERC20_TRANSFER_ABI = [
26
35
  {
27
36
  type: "function",
@@ -119,6 +128,20 @@ class EvmConnector extends IBlockchainConnector {
119
128
  }
120
129
  return block;
121
130
  }
131
+ async getDecimals(contractAddress) {
132
+ const client = this.createClient();
133
+ const [decimals, error] = await backendSdk.useResult(
134
+ client.readContract({
135
+ abi: ERC20_DECIMALS_ABI,
136
+ address: contractAddress,
137
+ functionName: "decimals"
138
+ })
139
+ );
140
+ if (error || !decimals) {
141
+ throw error;
142
+ }
143
+ return decimals;
144
+ }
122
145
  async getAllAddressTransactions({
123
146
  address,
124
147
  filter
@@ -89,6 +89,14 @@ const getBlockOutputSchema = zod.z.object({
89
89
  withdrawalsRoot: Hex.optional()
90
90
  });
91
91
 
92
+ const getDecimalsInputSchema = zod.z.object({
93
+ chain: chainSchema,
94
+ contractAddress: zod.z.string()
95
+ });
96
+ const getDecimalsOutputSchema = zod.z.object({
97
+ decimals: zod.z.number()
98
+ });
99
+
92
100
  const syncAddressInputSchema = zod.z.object({
93
101
  addressId: zod.z.string()
94
102
  });
@@ -110,6 +118,8 @@ exports.TESTNET_CHAIN_TYPE = TESTNET_CHAIN_TYPE;
110
118
  exports.chainSchema = chainSchema;
111
119
  exports.getBlockInputSchema = getBlockInputSchema;
112
120
  exports.getBlockOutputSchema = getBlockOutputSchema;
121
+ exports.getDecimalsInputSchema = getDecimalsInputSchema;
122
+ exports.getDecimalsOutputSchema = getDecimalsOutputSchema;
113
123
  exports.getTransactionInputSchema = getTransactionInputSchema;
114
124
  exports.getTransactionOutputSchema = getTransactionOutputSchema;
115
125
  exports.syncAddressInputSchema = syncAddressInputSchema;
@@ -1,4 +1,4 @@
1
- import { s as schema } from './blockchain.C1YDFhjP.mjs';
1
+ import { s as schema } from './blockchain.ChUyJIdK.mjs';
2
2
  import 'drizzle-orm';
3
3
  import { useResult, createInternalError } from '@develit-io/backend-sdk';
4
4
  import { createPublicClient, http, createWalletClient, encodeFunctionData, parseUnits } from 'viem';
@@ -20,6 +20,15 @@ const TRANSFER_EVENT_ABI = [
20
20
  ]
21
21
  }
22
22
  ];
23
+ const ERC20_DECIMALS_ABI = [
24
+ {
25
+ type: "function",
26
+ name: "decimals",
27
+ inputs: [],
28
+ outputs: [{ name: "", type: "uint8" }],
29
+ stateMutability: "view"
30
+ }
31
+ ];
23
32
  const ERC20_TRANSFER_ABI = [
24
33
  {
25
34
  type: "function",
@@ -117,6 +126,20 @@ class EvmConnector extends IBlockchainConnector {
117
126
  }
118
127
  return block;
119
128
  }
129
+ async getDecimals(contractAddress) {
130
+ const client = this.createClient();
131
+ const [decimals, error] = await useResult(
132
+ client.readContract({
133
+ abi: ERC20_DECIMALS_ABI,
134
+ address: contractAddress,
135
+ functionName: "decimals"
136
+ })
137
+ );
138
+ if (error || !decimals) {
139
+ throw error;
140
+ }
141
+ return decimals;
142
+ }
120
143
  async getAllAddressTransactions({
121
144
  address,
122
145
  filter
@@ -87,6 +87,14 @@ const getBlockOutputSchema = z.object({
87
87
  withdrawalsRoot: Hex.optional()
88
88
  });
89
89
 
90
+ const getDecimalsInputSchema = z.object({
91
+ chain: chainSchema,
92
+ contractAddress: z.string()
93
+ });
94
+ const getDecimalsOutputSchema = z.object({
95
+ decimals: z.number()
96
+ });
97
+
90
98
  const syncAddressInputSchema = z.object({
91
99
  addressId: z.string()
92
100
  });
@@ -101,4 +109,4 @@ const CHAIN_KEYS = [
101
109
  ];
102
110
  const CREDENTIALS_TYPES = ["PRIVATE_KEY"];
103
111
 
104
- export { CHAIN_KEYS as C, MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, 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 };
112
+ export { CHAIN_KEYS as C, MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, CREDENTIALS_TYPES as a, getBlockOutputSchema as b, chainSchema as c, getDecimalsInputSchema as d, getDecimalsOutputSchema as e, getTransactionInputSchema as f, getBlockInputSchema as g, getTransactionOutputSchema as h, syncAddressOutputSchema as i, syncAddressInputSchema as s };
@@ -1,6 +1,6 @@
1
1
  import { base } from '@develit-io/backend-sdk';
2
2
  import { sqliteTable, text, integer, blob, uniqueIndex } from 'drizzle-orm/sqlite-core';
3
- import { a as CREDENTIALS_TYPES, C as CHAIN_KEYS } from './blockchain.CBJdSboV.mjs';
3
+ import { a as CREDENTIALS_TYPES, C as CHAIN_KEYS } from './blockchain.BsFFrNF0.mjs';
4
4
 
5
5
  const address = sqliteTable("address", {
6
6
  ...base,
@@ -2,7 +2,7 @@
2
2
 
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const sqliteCore = require('drizzle-orm/sqlite-core');
5
- const address$1 = require('./blockchain.B1DsOJYY.cjs');
5
+ const address$1 = require('./blockchain.BVya3Mud.cjs');
6
6
 
7
7
  const address = sqliteCore.sqliteTable("address", {
8
8
  ...backendSdk.base,
@@ -64,6 +64,30 @@ interface GetBlockInput extends z.infer<typeof getBlockInputSchema> {
64
64
  }
65
65
  type GetBlockOutput = z.infer<typeof getBlockOutputSchema>;
66
66
 
67
+ declare const getDecimalsInputSchema: z.ZodObject<{
68
+ chain: z.ZodEnum<{
69
+ ARBITRUM: "ARBITRUM";
70
+ AVALANCHE: "AVALANCHE";
71
+ BASE: "BASE";
72
+ ETHEREUM: "ETHEREUM";
73
+ GNOSIS: "GNOSIS";
74
+ OPTIMISM: "OPTIMISM";
75
+ ARBITRUM_SEPOLIA: "ARBITRUM_SEPOLIA";
76
+ BASE_SEPOLIA: "BASE_SEPOLIA";
77
+ CHIADO: "CHIADO";
78
+ FUJI: "FUJI";
79
+ OPTIMISM_SEPOLIA: "OPTIMISM_SEPOLIA";
80
+ SEPOLIA: "SEPOLIA";
81
+ }>;
82
+ contractAddress: z.ZodString;
83
+ }, z.core.$strip>;
84
+ declare const getDecimalsOutputSchema: z.ZodObject<{
85
+ decimals: z.ZodNumber;
86
+ }, z.core.$strip>;
87
+ interface GetDecimalsInput extends z.infer<typeof getDecimalsInputSchema> {
88
+ }
89
+ type GetDecimalsOutput = z.infer<typeof getDecimalsOutputSchema>;
90
+
67
91
  declare const MAINNET_CHAIN_TYPE: readonly ["ARBITRUM", "AVALANCHE", "BASE", "ETHEREUM", "GNOSIS", "OPTIMISM"];
68
92
  declare const TESTNET_CHAIN_TYPE: readonly ["ARBITRUM_SEPOLIA", "BASE_SEPOLIA", "CHIADO", "FUJI", "OPTIMISM_SEPOLIA", "SEPOLIA"];
69
93
  declare const chainSchema: z.ZodEnum<{
@@ -151,5 +175,5 @@ type SyncAddressOutput = z.infer<typeof syncAddressOutputSchema>;
151
175
 
152
176
  declare const tables: typeof schema;
153
177
 
154
- export { MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, chainSchema as e, getBlockOutputSchema as f, getBlockInputSchema as g, getTransactionInputSchema as h, getTransactionOutputSchema as i, syncAddressOutputSchema as j, syncAddressInputSchema as s, tables as t };
155
- export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b, GetBlockInput as c, GetBlockOutput as d };
178
+ export { MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, chainSchema as g, getBlockInputSchema as h, getBlockOutputSchema as i, getDecimalsInputSchema as j, getDecimalsOutputSchema as k, getTransactionInputSchema as l, getTransactionOutputSchema as m, syncAddressOutputSchema as n, syncAddressInputSchema as s, tables as t };
179
+ export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b, GetDecimalsInput as c, GetDecimalsOutput as d, GetBlockInput as e, GetBlockOutput as f };
@@ -64,6 +64,30 @@ interface GetBlockInput extends z.infer<typeof getBlockInputSchema> {
64
64
  }
65
65
  type GetBlockOutput = z.infer<typeof getBlockOutputSchema>;
66
66
 
67
+ declare const getDecimalsInputSchema: z.ZodObject<{
68
+ chain: z.ZodEnum<{
69
+ ARBITRUM: "ARBITRUM";
70
+ AVALANCHE: "AVALANCHE";
71
+ BASE: "BASE";
72
+ ETHEREUM: "ETHEREUM";
73
+ GNOSIS: "GNOSIS";
74
+ OPTIMISM: "OPTIMISM";
75
+ ARBITRUM_SEPOLIA: "ARBITRUM_SEPOLIA";
76
+ BASE_SEPOLIA: "BASE_SEPOLIA";
77
+ CHIADO: "CHIADO";
78
+ FUJI: "FUJI";
79
+ OPTIMISM_SEPOLIA: "OPTIMISM_SEPOLIA";
80
+ SEPOLIA: "SEPOLIA";
81
+ }>;
82
+ contractAddress: z.ZodString;
83
+ }, z.core.$strip>;
84
+ declare const getDecimalsOutputSchema: z.ZodObject<{
85
+ decimals: z.ZodNumber;
86
+ }, z.core.$strip>;
87
+ interface GetDecimalsInput extends z.infer<typeof getDecimalsInputSchema> {
88
+ }
89
+ type GetDecimalsOutput = z.infer<typeof getDecimalsOutputSchema>;
90
+
67
91
  declare const MAINNET_CHAIN_TYPE: readonly ["ARBITRUM", "AVALANCHE", "BASE", "ETHEREUM", "GNOSIS", "OPTIMISM"];
68
92
  declare const TESTNET_CHAIN_TYPE: readonly ["ARBITRUM_SEPOLIA", "BASE_SEPOLIA", "CHIADO", "FUJI", "OPTIMISM_SEPOLIA", "SEPOLIA"];
69
93
  declare const chainSchema: z.ZodEnum<{
@@ -151,5 +175,5 @@ type SyncAddressOutput = z.infer<typeof syncAddressOutputSchema>;
151
175
 
152
176
  declare const tables: typeof schema;
153
177
 
154
- export { MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, chainSchema as e, getBlockOutputSchema as f, getBlockInputSchema as g, getTransactionInputSchema as h, getTransactionOutputSchema as i, syncAddressOutputSchema as j, syncAddressInputSchema as s, tables as t };
155
- export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b, GetBlockInput as c, GetBlockOutput as d };
178
+ export { MAINNET_CHAIN_TYPE as M, TESTNET_CHAIN_TYPE as T, chainSchema as g, getBlockInputSchema as h, getBlockOutputSchema as i, getDecimalsInputSchema as j, getDecimalsOutputSchema as k, getTransactionInputSchema as l, getTransactionOutputSchema as m, syncAddressOutputSchema as n, syncAddressInputSchema as s, tables as t };
179
+ export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b, GetDecimalsInput as c, GetDecimalsOutput as d, GetBlockInput as e, GetBlockOutput as f };
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const address = require('./shared/blockchain.B1DsOJYY.cjs');
3
+ const address = require('./shared/blockchain.BVya3Mud.cjs');
4
4
  require('zod');
5
5
  require('@develit-io/backend-sdk');
6
6
 
@@ -13,6 +13,8 @@ exports.TESTNET_CHAIN_TYPE = address.TESTNET_CHAIN_TYPE;
13
13
  exports.chainSchema = address.chainSchema;
14
14
  exports.getBlockInputSchema = address.getBlockInputSchema;
15
15
  exports.getBlockOutputSchema = address.getBlockOutputSchema;
16
+ exports.getDecimalsInputSchema = address.getDecimalsInputSchema;
17
+ exports.getDecimalsOutputSchema = address.getDecimalsOutputSchema;
16
18
  exports.getTransactionInputSchema = address.getTransactionInputSchema;
17
19
  exports.getTransactionOutputSchema = address.getTransactionOutputSchema;
18
20
  exports.syncAddressInputSchema = address.syncAddressInputSchema;
package/dist/types.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, b as CredentialsType, L as LastSyncMetadata } from './shared/blockchain.BioJdfy8.cjs';
2
2
  import { BaseEvent } from '@develit-io/backend-sdk';
3
- import { t as tables } from './shared/blockchain.CQMtSOse.cjs';
4
- export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, M as MAINNET_CHAIN_TYPE, S as SyncAddressInput, a as SyncAddressOutput, T as TESTNET_CHAIN_TYPE, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.CQMtSOse.cjs';
3
+ import { t as tables } from './shared/blockchain.Dzf9Wl8D.cjs';
4
+ export { C as Chain, e as GetBlockInput, f as GetBlockOutput, c as GetDecimalsInput, d as GetDecimalsOutput, G as GetTransactionInput, b as GetTransactionOutput, M as MAINNET_CHAIN_TYPE, S as SyncAddressInput, a as SyncAddressOutput, T as TESTNET_CHAIN_TYPE, g as chainSchema, h as getBlockInputSchema, i as getBlockOutputSchema, j as getDecimalsInputSchema, k as getDecimalsOutputSchema, l as getTransactionInputSchema, m as getTransactionOutputSchema, s as syncAddressInputSchema, n as syncAddressOutputSchema } from './shared/blockchain.Dzf9Wl8D.cjs';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
6
  export { a as BlockchainServiceEnv, b as BlockchainServiceEnvironmentConfig, B as BlockchainServiceWranglerConfig } from './shared/blockchain.CVKUvfyj.cjs';
7
7
  import 'drizzle-orm/sqlite-core';
package/dist/types.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, b as CredentialsType, L as LastSyncMetadata } from './shared/blockchain.BioJdfy8.mjs';
2
2
  import { BaseEvent } from '@develit-io/backend-sdk';
3
- import { t as tables } from './shared/blockchain.BJwCN-zk.mjs';
4
- export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, M as MAINNET_CHAIN_TYPE, S as SyncAddressInput, a as SyncAddressOutput, T as TESTNET_CHAIN_TYPE, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.BJwCN-zk.mjs';
3
+ import { t as tables } from './shared/blockchain.BQ6UGj4I.mjs';
4
+ export { C as Chain, e as GetBlockInput, f as GetBlockOutput, c as GetDecimalsInput, d as GetDecimalsOutput, G as GetTransactionInput, b as GetTransactionOutput, M as MAINNET_CHAIN_TYPE, S as SyncAddressInput, a as SyncAddressOutput, T as TESTNET_CHAIN_TYPE, g as chainSchema, h as getBlockInputSchema, i as getBlockOutputSchema, j as getDecimalsInputSchema, k as getDecimalsOutputSchema, l as getTransactionInputSchema, m as getTransactionOutputSchema, s as syncAddressInputSchema, n as syncAddressOutputSchema } from './shared/blockchain.BQ6UGj4I.mjs';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
6
  export { a as BlockchainServiceEnv, b as BlockchainServiceEnvironmentConfig, B as BlockchainServiceWranglerConfig } from './shared/blockchain.CVKUvfyj.mjs';
7
7
  import 'drizzle-orm/sqlite-core';
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, b as CredentialsType, L as LastSyncMetadata } from './shared/blockchain.BioJdfy8.js';
2
2
  import { BaseEvent } from '@develit-io/backend-sdk';
3
- import { t as tables } from './shared/blockchain.jMmU_icc.js';
4
- export { C as Chain, c as GetBlockInput, d as GetBlockOutput, G as GetTransactionInput, b as GetTransactionOutput, M as MAINNET_CHAIN_TYPE, S as SyncAddressInput, a as SyncAddressOutput, T as TESTNET_CHAIN_TYPE, e as chainSchema, g as getBlockInputSchema, f as getBlockOutputSchema, h as getTransactionInputSchema, i as getTransactionOutputSchema, s as syncAddressInputSchema, j as syncAddressOutputSchema } from './shared/blockchain.jMmU_icc.js';
3
+ import { t as tables } from './shared/blockchain.HRS0o16z.js';
4
+ export { C as Chain, e as GetBlockInput, f as GetBlockOutput, c as GetDecimalsInput, d as GetDecimalsOutput, G as GetTransactionInput, b as GetTransactionOutput, M as MAINNET_CHAIN_TYPE, S as SyncAddressInput, a as SyncAddressOutput, T as TESTNET_CHAIN_TYPE, g as chainSchema, h as getBlockInputSchema, i as getBlockOutputSchema, j as getDecimalsInputSchema, k as getDecimalsOutputSchema, l as getTransactionInputSchema, m as getTransactionOutputSchema, s as syncAddressInputSchema, n as syncAddressOutputSchema } from './shared/blockchain.HRS0o16z.js';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
6
  export { a as BlockchainServiceEnv, b as BlockchainServiceEnvironmentConfig, B as BlockchainServiceWranglerConfig } from './shared/blockchain.CVKUvfyj.js';
7
7
  import 'drizzle-orm/sqlite-core';
package/dist/types.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, M as MAINNET_CHAIN_TYPE, T as TESTNET_CHAIN_TYPE, c as chainSchema, g as getBlockInputSchema, b as getBlockOutputSchema, d as getTransactionInputSchema, e as getTransactionOutputSchema, s as syncAddressInputSchema, f as syncAddressOutputSchema } from './shared/blockchain.CBJdSboV.mjs';
1
+ export { C as CHAIN_KEYS, a as CREDENTIALS_TYPES, M as MAINNET_CHAIN_TYPE, T as TESTNET_CHAIN_TYPE, c as chainSchema, g as getBlockInputSchema, b as getBlockOutputSchema, d as getDecimalsInputSchema, e as getDecimalsOutputSchema, f as getTransactionInputSchema, h as getTransactionOutputSchema, s as syncAddressInputSchema, i as syncAddressOutputSchema } from './shared/blockchain.BsFFrNF0.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.11.1",
3
+ "version": "1.0.0",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,9 +36,9 @@
36
36
  ],
37
37
  "scripts": {
38
38
  "db:init": "wrangler d1 execute develit-blockchain --local --persist-to ../../.wrangler/state --command=\"SELECT 'Creating database...' AS status;\"",
39
- "db:generate": "NODE_OPTIONS='--import tsx' drizzle-kit generate",
40
- "db:migrate": "NODE_OPTIONS='--import tsx' drizzle-kit migrate",
41
- "db:explore": "NODE_OPTIONS='--import tsx' drizzle-kit studio",
39
+ "db:generate": "drizzle-kit generate",
40
+ "db:migrate": "drizzle-kit migrate",
41
+ "db:explore": "drizzle-kit studio",
42
42
  "dev": "wrangler dev --port 9231 --persist-to ../../.wrangler/state -c ./wrangler.jsonc -c ../../apps/secrets-store/wrangler.jsonc",
43
43
  "wrangler:generate": "bunx develit wrangler:generate --types",
44
44
  "types": "bash typegen.sh",