@develit-services/blockchain 0.11.1 → 0.12.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.
- package/dist/database/schema.cjs +2 -2
- package/dist/database/schema.mjs +2 -2
- package/dist/export/worker.cjs +25 -4
- package/dist/export/worker.d.cts +2 -1
- package/dist/export/worker.d.mts +2 -1
- package/dist/export/worker.d.ts +2 -1
- package/dist/export/worker.mjs +25 -4
- package/dist/export/workflows.cjs +3 -3
- package/dist/export/workflows.mjs +3 -3
- package/dist/shared/{blockchain.jMmU_icc.d.ts → blockchain.BL2AlFRD.d.ts} +28 -4
- package/dist/shared/{blockchain.CPHf4-ak.cjs → blockchain.BUnmkBag.cjs} +24 -1
- package/dist/shared/{blockchain.B1DsOJYY.cjs → blockchain.BVya3Mud.cjs} +10 -0
- package/dist/shared/{blockchain.Djm2P0EG.mjs → blockchain.BbPuQECZ.mjs} +24 -1
- package/dist/shared/{blockchain.CBJdSboV.mjs → blockchain.BsFFrNF0.mjs} +9 -1
- package/dist/shared/{blockchain.BJwCN-zk.d.mts → blockchain.C8acDQuh.d.mts} +28 -4
- package/dist/shared/{blockchain.C1YDFhjP.mjs → blockchain.ChUyJIdK.mjs} +1 -1
- package/dist/shared/{blockchain.ByoXNMWP.cjs → blockchain.DR86eH-9.cjs} +1 -1
- package/dist/shared/{blockchain.CQMtSOse.d.cts → blockchain.Z_R-J9qs.d.cts} +28 -4
- package/dist/types.cjs +3 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.mjs +1 -1
- package/package.json +1 -1
package/dist/database/schema.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const database_schema = require('../shared/blockchain.
|
|
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.
|
|
6
|
+
require('../shared/blockchain.BVya3Mud.cjs');
|
|
7
7
|
require('zod');
|
|
8
8
|
|
|
9
9
|
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as address, b as addressCredentials, t as tokens, c as transaction } from '../shared/blockchain.
|
|
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.
|
|
4
|
+
import '../shared/blockchain.BsFFrNF0.mjs';
|
|
5
5
|
import 'zod';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
|
-
const blockchain = require('../shared/blockchain.
|
|
7
|
-
const address = require('../shared/blockchain.
|
|
6
|
+
const blockchain = require('../shared/blockchain.BUnmkBag.cjs');
|
|
7
|
+
const address = require('../shared/blockchain.BVya3Mud.cjs');
|
|
8
8
|
const cloudflare_workers = require('cloudflare:workers');
|
|
9
9
|
const d1 = require('drizzle-orm/d1');
|
|
10
|
-
require('../shared/blockchain.
|
|
10
|
+
require('../shared/blockchain.DR86eH-9.cjs');
|
|
11
11
|
require('drizzle-orm/sqlite-core');
|
|
12
12
|
require('drizzle-orm');
|
|
13
13
|
require('viem');
|
|
@@ -34,7 +34,7 @@ let BlockchainServiceBase = class extends backendSdk.develitWorker(
|
|
|
34
34
|
async syncAddress(input) {
|
|
35
35
|
return this.handleAction(
|
|
36
36
|
{ data: input, schema: address.syncAddressInputSchema },
|
|
37
|
-
{ successMessage: "Address sync workflow started" },
|
|
37
|
+
{ successMessage: "Address sync workflow started." },
|
|
38
38
|
async ({ addressId }) => {
|
|
39
39
|
const instance = await this.env.SYNC_ADDRESS_TRANSACTIONS_WORKFLOW.create({
|
|
40
40
|
id: addressId,
|
|
@@ -64,6 +64,24 @@ let BlockchainServiceBase = class extends backendSdk.develitWorker(
|
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
+
async getDecimals(input) {
|
|
68
|
+
return this.handleAction(
|
|
69
|
+
{ data: input, schema: address.getDecimalsInputSchema },
|
|
70
|
+
{ successMessage: "Decimals retrieved successfully." },
|
|
71
|
+
async ({ chain, contractAddress }) => {
|
|
72
|
+
const connector = await blockchain.initiateConnector({
|
|
73
|
+
chain,
|
|
74
|
+
env: this.env,
|
|
75
|
+
tokens: [],
|
|
76
|
+
connectedAddresses: []
|
|
77
|
+
});
|
|
78
|
+
const decimals = await connector.getDecimals(
|
|
79
|
+
contractAddress
|
|
80
|
+
);
|
|
81
|
+
return { decimals };
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
67
85
|
async getBlock(input) {
|
|
68
86
|
return this.handleAction(
|
|
69
87
|
{ data: input, schema: address.getBlockInputSchema },
|
|
@@ -90,6 +108,9 @@ __decorateClass([
|
|
|
90
108
|
__decorateClass([
|
|
91
109
|
backendSdk.action("get-transaction")
|
|
92
110
|
], BlockchainServiceBase.prototype, "getTransaction", 1);
|
|
111
|
+
__decorateClass([
|
|
112
|
+
backendSdk.action("get-decimals")
|
|
113
|
+
], BlockchainServiceBase.prototype, "getDecimals", 1);
|
|
93
114
|
__decorateClass([
|
|
94
115
|
backendSdk.action("get-block")
|
|
95
116
|
], BlockchainServiceBase.prototype, "getBlock", 1);
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -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
|
|
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.Z_R-J9qs.cjs';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
6
|
import 'zod';
|
|
@@ -13,6 +13,7 @@ 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
19
|
declare function defineBlockchainService(): new (ctx: ExecutionContext, env: BlockchainEnv) => BlockchainServiceBase;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -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
|
|
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.C8acDQuh.mjs';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
6
|
import 'zod';
|
|
@@ -13,6 +13,7 @@ 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
19
|
declare function defineBlockchainService(): new (ctx: ExecutionContext, env: BlockchainEnv) => BlockchainServiceBase;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -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
|
|
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.BL2AlFRD.js';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
6
|
import 'zod';
|
|
@@ -13,6 +13,7 @@ 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
19
|
declare function defineBlockchainService(): new (ctx: ExecutionContext, env: BlockchainEnv) => BlockchainServiceBase;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -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.
|
|
3
|
-
import { s as syncAddressInputSchema,
|
|
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.
|
|
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);
|
|
@@ -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.
|
|
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.
|
|
9
|
+
require('../shared/blockchain.DR86eH-9.cjs');
|
|
10
10
|
require('drizzle-orm/sqlite-core');
|
|
11
|
-
require('../shared/blockchain.
|
|
11
|
+
require('../shared/blockchain.BVya3Mud.cjs');
|
|
12
12
|
require('zod');
|
|
13
13
|
require('viem');
|
|
14
14
|
require('viem/accounts');
|
|
@@ -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.
|
|
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.
|
|
7
|
+
import '../shared/blockchain.ChUyJIdK.mjs';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
|
-
import '../shared/blockchain.
|
|
9
|
+
import '../shared/blockchain.BsFFrNF0.mjs';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'viem';
|
|
12
12
|
import 'viem/accounts';
|
|
@@ -17,9 +17,9 @@ declare const getBlockInputSchema: z.ZodObject<{
|
|
|
17
17
|
SEPOLIA: "SEPOLIA";
|
|
18
18
|
}>;
|
|
19
19
|
blockTag: z.ZodOptional<z.ZodEnum<{
|
|
20
|
-
pending: "pending";
|
|
21
20
|
latest: "latest";
|
|
22
21
|
earliest: "earliest";
|
|
22
|
+
pending: "pending";
|
|
23
23
|
safe: "safe";
|
|
24
24
|
finalized: "finalized";
|
|
25
25
|
}>>;
|
|
@@ -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<{
|
|
@@ -110,9 +134,9 @@ declare const getTransactionOutputSchema: z.ZodObject<{
|
|
|
110
134
|
nonce: z.ZodNumber;
|
|
111
135
|
transactionIndex: z.ZodNullable<z.ZodNumber>;
|
|
112
136
|
status: z.ZodEnum<{
|
|
137
|
+
pending: "pending";
|
|
113
138
|
success: "success";
|
|
114
139
|
reverted: "reverted";
|
|
115
|
-
pending: "pending";
|
|
116
140
|
}>;
|
|
117
141
|
gasUsed: z.ZodNullable<z.ZodString>;
|
|
118
142
|
timestamp: z.ZodNullable<z.ZodNumber>;
|
|
@@ -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
|
|
155
|
-
export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b,
|
|
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.
|
|
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.
|
|
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,
|
|
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 };
|
|
@@ -17,9 +17,9 @@ declare const getBlockInputSchema: z.ZodObject<{
|
|
|
17
17
|
SEPOLIA: "SEPOLIA";
|
|
18
18
|
}>;
|
|
19
19
|
blockTag: z.ZodOptional<z.ZodEnum<{
|
|
20
|
-
pending: "pending";
|
|
21
20
|
latest: "latest";
|
|
22
21
|
earliest: "earliest";
|
|
22
|
+
pending: "pending";
|
|
23
23
|
safe: "safe";
|
|
24
24
|
finalized: "finalized";
|
|
25
25
|
}>>;
|
|
@@ -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<{
|
|
@@ -110,9 +134,9 @@ declare const getTransactionOutputSchema: z.ZodObject<{
|
|
|
110
134
|
nonce: z.ZodNumber;
|
|
111
135
|
transactionIndex: z.ZodNullable<z.ZodNumber>;
|
|
112
136
|
status: z.ZodEnum<{
|
|
137
|
+
pending: "pending";
|
|
113
138
|
success: "success";
|
|
114
139
|
reverted: "reverted";
|
|
115
|
-
pending: "pending";
|
|
116
140
|
}>;
|
|
117
141
|
gasUsed: z.ZodNullable<z.ZodString>;
|
|
118
142
|
timestamp: z.ZodNullable<z.ZodNumber>;
|
|
@@ -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
|
|
155
|
-
export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b,
|
|
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
|
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.
|
|
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.
|
|
5
|
+
const address$1 = require('./blockchain.BVya3Mud.cjs');
|
|
6
6
|
|
|
7
7
|
const address = sqliteCore.sqliteTable("address", {
|
|
8
8
|
...backendSdk.base,
|
|
@@ -17,9 +17,9 @@ declare const getBlockInputSchema: z.ZodObject<{
|
|
|
17
17
|
SEPOLIA: "SEPOLIA";
|
|
18
18
|
}>;
|
|
19
19
|
blockTag: z.ZodOptional<z.ZodEnum<{
|
|
20
|
-
pending: "pending";
|
|
21
20
|
latest: "latest";
|
|
22
21
|
earliest: "earliest";
|
|
22
|
+
pending: "pending";
|
|
23
23
|
safe: "safe";
|
|
24
24
|
finalized: "finalized";
|
|
25
25
|
}>>;
|
|
@@ -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<{
|
|
@@ -110,9 +134,9 @@ declare const getTransactionOutputSchema: z.ZodObject<{
|
|
|
110
134
|
nonce: z.ZodNumber;
|
|
111
135
|
transactionIndex: z.ZodNullable<z.ZodNumber>;
|
|
112
136
|
status: z.ZodEnum<{
|
|
137
|
+
pending: "pending";
|
|
113
138
|
success: "success";
|
|
114
139
|
reverted: "reverted";
|
|
115
|
-
pending: "pending";
|
|
116
140
|
}>;
|
|
117
141
|
gasUsed: z.ZodNullable<z.ZodString>;
|
|
118
142
|
timestamp: z.ZodNullable<z.ZodNumber>;
|
|
@@ -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
|
|
155
|
-
export type { Chain as C, GetTransactionInput as G, SyncAddressInput as S, SyncAddressOutput as a, GetTransactionOutput as b,
|
|
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.
|
|
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.
|
|
4
|
-
export { C as Chain,
|
|
3
|
+
import { t as tables } from './shared/blockchain.Z_R-J9qs.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.Z_R-J9qs.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.
|
|
4
|
-
export { C as Chain,
|
|
3
|
+
import { t as tables } from './shared/blockchain.C8acDQuh.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.C8acDQuh.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.
|
|
4
|
-
export { C as Chain,
|
|
3
|
+
import { t as tables } from './shared/blockchain.BL2AlFRD.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.BL2AlFRD.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
|
|
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';
|