@ohmpathorn/block-node-client 0.1.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/README.md +322 -0
- package/dist/client.d.ts +81 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +251 -0
- package/dist/client.js.map +1 -0
- package/dist/decoder.d.ts +27 -0
- package/dist/decoder.d.ts.map +1 -0
- package/dist/decoder.js +606 -0
- package/dist/decoder.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/proto-manager.d.ts +22 -0
- package/dist/proto-manager.d.ts.map +1 -0
- package/dist/proto-manager.js +207 -0
- package/dist/proto-manager.js.map +1 -0
- package/dist/types.d.ts +192 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9F,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ProtoReader = exports.decodeBlockItem = exports.STATE_IDS = exports.RESPONSE_CODES = exports.TX_TYPES = exports.BlockNodeClient = void 0;
|
|
18
|
+
var client_1 = require("./client");
|
|
19
|
+
Object.defineProperty(exports, "BlockNodeClient", { enumerable: true, get: function () { return client_1.BlockNodeClient; } });
|
|
20
|
+
var decoder_1 = require("./decoder");
|
|
21
|
+
Object.defineProperty(exports, "TX_TYPES", { enumerable: true, get: function () { return decoder_1.TX_TYPES; } });
|
|
22
|
+
Object.defineProperty(exports, "RESPONSE_CODES", { enumerable: true, get: function () { return decoder_1.RESPONSE_CODES; } });
|
|
23
|
+
Object.defineProperty(exports, "STATE_IDS", { enumerable: true, get: function () { return decoder_1.STATE_IDS; } });
|
|
24
|
+
Object.defineProperty(exports, "decodeBlockItem", { enumerable: true, get: function () { return decoder_1.decodeBlockItem; } });
|
|
25
|
+
Object.defineProperty(exports, "ProtoReader", { enumerable: true, get: function () { return decoder_1.ProtoReader; } });
|
|
26
|
+
__exportStar(require("./types"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,qCAA8F;AAArF,mGAAA,QAAQ,OAAA;AAAE,yGAAA,cAAc,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,0GAAA,eAAe,OAAA;AAAE,sGAAA,WAAW,OAAA;AAC1E,0CAAwB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as grpc from "@grpc/grpc-js";
|
|
2
|
+
/**
|
|
3
|
+
* Manages inline proto definitions and loaded gRPC clients.
|
|
4
|
+
* Protos are written to a temp directory at construction and cleaned up on close().
|
|
5
|
+
*/
|
|
6
|
+
export declare class ProtoManager {
|
|
7
|
+
private readonly endpoint;
|
|
8
|
+
private readonly tls;
|
|
9
|
+
private protoDir;
|
|
10
|
+
private _nodeClient;
|
|
11
|
+
private _blockClient;
|
|
12
|
+
private _streamClient;
|
|
13
|
+
constructor(endpoint: string, tls: "tls" | "insecure");
|
|
14
|
+
get nodeClient(): grpc.Client;
|
|
15
|
+
get blockClient(): grpc.Client;
|
|
16
|
+
get streamClient(): grpc.Client;
|
|
17
|
+
cleanup(): void;
|
|
18
|
+
private write;
|
|
19
|
+
private writeProtos;
|
|
20
|
+
private loadClients;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=proto-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proto-manager.d.ts","sourceRoot":"","sources":["../src/proto-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AAGtC;;;GAGG;AACH,qBAAa,YAAY;IAMX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAU,OAAO,CAAC,QAAQ,CAAC,GAAG;IALnE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,aAAa,CAA4B;gBAEpB,QAAQ,EAAE,MAAM,EAAmB,GAAG,EAAE,KAAK,GAAG,UAAU;IAMvF,IAAI,UAAU,IAAI,IAAI,CAAC,MAAM,CAE5B;IACD,IAAI,WAAW,IAAI,IAAI,CAAC,MAAM,CAE7B;IACD,IAAI,YAAY,IAAI,IAAI,CAAC,MAAM,CAE9B;IAED,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,WAAW;IA8GnB,OAAO,CAAC,WAAW;CA4BpB"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ProtoManager = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const os = __importStar(require("os"));
|
|
40
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
41
|
+
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
42
|
+
/**
|
|
43
|
+
* Manages inline proto definitions and loaded gRPC clients.
|
|
44
|
+
* Protos are written to a temp directory at construction and cleaned up on close().
|
|
45
|
+
*/
|
|
46
|
+
class ProtoManager {
|
|
47
|
+
constructor(endpoint, tls) {
|
|
48
|
+
this.endpoint = endpoint;
|
|
49
|
+
this.tls = tls;
|
|
50
|
+
this._nodeClient = null;
|
|
51
|
+
this._blockClient = null;
|
|
52
|
+
this._streamClient = null;
|
|
53
|
+
this.protoDir = fs.mkdtempSync(path.join(os.tmpdir(), "bnproto-"));
|
|
54
|
+
this.writeProtos();
|
|
55
|
+
this.loadClients();
|
|
56
|
+
}
|
|
57
|
+
get nodeClient() {
|
|
58
|
+
return this._nodeClient;
|
|
59
|
+
}
|
|
60
|
+
get blockClient() {
|
|
61
|
+
return this._blockClient;
|
|
62
|
+
}
|
|
63
|
+
get streamClient() {
|
|
64
|
+
return this._streamClient;
|
|
65
|
+
}
|
|
66
|
+
cleanup() {
|
|
67
|
+
try {
|
|
68
|
+
fs.rmSync(this.protoDir, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
catch (_) { }
|
|
71
|
+
}
|
|
72
|
+
write(rel, content) {
|
|
73
|
+
const full = path.join(this.protoDir, rel);
|
|
74
|
+
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
75
|
+
fs.writeFileSync(full, content);
|
|
76
|
+
}
|
|
77
|
+
writeProtos() {
|
|
78
|
+
// ── Shared stubs ────────────────────────────────────────────────────────
|
|
79
|
+
this.write("services/basic_types.proto", `
|
|
80
|
+
syntax = "proto3"; package proto;
|
|
81
|
+
message Timestamp { int64 seconds = 1; int32 nanos = 2; }
|
|
82
|
+
message AccountID { uint64 shardNum = 1; uint64 realmNum = 2; oneof account { uint64 accountNum = 3; bytes alias = 4; } }
|
|
83
|
+
message SemanticVersion { uint32 major = 1; uint32 minor = 2; uint32 patch = 3; }
|
|
84
|
+
message TransferList { repeated AccountAmount accountAmounts = 1; }
|
|
85
|
+
message AccountAmount { proto.AccountID accountID = 1; int64 amount = 2; bool is_approval = 3; }
|
|
86
|
+
message NodeAddressBook { repeated NodeAddress nodeAddress = 1; }
|
|
87
|
+
message NodeAddress { bytes RSA_PubKey = 1; int64 nodeId = 2; }
|
|
88
|
+
`);
|
|
89
|
+
// ── BlockItemSet (repeated bytes so inner decoding is handled manually) ──
|
|
90
|
+
this.write("block-node/api/shared_message_types.proto", `
|
|
91
|
+
syntax = "proto3"; package org.hiero.block.api;
|
|
92
|
+
message BlockItemSet { repeated bytes block_items = 1; }
|
|
93
|
+
message BlockEnd { uint64 block_number = 1; }
|
|
94
|
+
`);
|
|
95
|
+
// ── Block (for getBlock response) — repeated bytes inner items ───────────
|
|
96
|
+
this.write("block/stream/block.proto", `
|
|
97
|
+
syntax = "proto3"; package com.hedera.hapi.block.stream;
|
|
98
|
+
message Block { repeated bytes items = 1; }
|
|
99
|
+
`);
|
|
100
|
+
// ── NodeService ──────────────────────────────────────────────────────────
|
|
101
|
+
this.write("block-node/api/node_service.proto", `
|
|
102
|
+
syntax = "proto3"; package org.hiero.block.api;
|
|
103
|
+
import "services/basic_types.proto";
|
|
104
|
+
|
|
105
|
+
message ServerStatusRequest {}
|
|
106
|
+
message ServerStatusResponse {
|
|
107
|
+
uint64 first_available_block = 1;
|
|
108
|
+
uint64 last_available_block = 2;
|
|
109
|
+
bool only_latest_state = 3;
|
|
110
|
+
uint64 next_expected_block = 4;
|
|
111
|
+
}
|
|
112
|
+
message BlockRange { uint64 range_start = 1; uint64 range_end = 2; }
|
|
113
|
+
message PluginVersion {
|
|
114
|
+
string plugin_id = 1;
|
|
115
|
+
proto.SemanticVersion plugin_software_version = 2;
|
|
116
|
+
repeated string plugin_feature_names = 3;
|
|
117
|
+
}
|
|
118
|
+
message BlockNodeVersions {
|
|
119
|
+
proto.SemanticVersion stream_proto_version = 1;
|
|
120
|
+
proto.SemanticVersion block_node_version = 2;
|
|
121
|
+
repeated PluginVersion installed_plugin_versions = 3;
|
|
122
|
+
}
|
|
123
|
+
message ServerStatusDetailResponse {
|
|
124
|
+
BlockNodeVersions version_information = 1;
|
|
125
|
+
repeated BlockRange available_ranges = 2;
|
|
126
|
+
bytes tss_data = 3;
|
|
127
|
+
proto.NodeAddressBook node_address_book = 4;
|
|
128
|
+
repeated BlockRange stored_ranges = 5;
|
|
129
|
+
}
|
|
130
|
+
service BlockNodeService {
|
|
131
|
+
rpc serverStatus (ServerStatusRequest) returns (ServerStatusResponse);
|
|
132
|
+
rpc serverStatusDetail (ServerStatusRequest) returns (ServerStatusDetailResponse);
|
|
133
|
+
}
|
|
134
|
+
`);
|
|
135
|
+
// ── BlockAccessService ───────────────────────────────────────────────────
|
|
136
|
+
this.write("block-node/api/block_access_service.proto", `
|
|
137
|
+
syntax = "proto3"; package org.hiero.block.api;
|
|
138
|
+
import "block/stream/block.proto";
|
|
139
|
+
message BlockRequest {
|
|
140
|
+
oneof block_specifier {
|
|
141
|
+
uint64 block_number = 1;
|
|
142
|
+
bool retrieve_latest = 2;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
message BlockResponse {
|
|
146
|
+
enum Code {
|
|
147
|
+
UNKNOWN = 0; SUCCESS = 1; INVALID_REQUEST = 2;
|
|
148
|
+
ERROR = 3; NOT_FOUND = 4; NOT_AVAILABLE = 5;
|
|
149
|
+
}
|
|
150
|
+
Code status = 1;
|
|
151
|
+
com.hedera.hapi.block.stream.Block block = 2;
|
|
152
|
+
}
|
|
153
|
+
service BlockAccessService {
|
|
154
|
+
rpc getBlock (BlockRequest) returns (BlockResponse);
|
|
155
|
+
}
|
|
156
|
+
`);
|
|
157
|
+
// ── BlockStreamSubscribeService ──────────────────────────────────────────
|
|
158
|
+
this.write("block-node/api/block_stream_subscribe_service.proto", `
|
|
159
|
+
syntax = "proto3"; package org.hiero.block.api;
|
|
160
|
+
import "block-node/api/shared_message_types.proto";
|
|
161
|
+
message SubscribeStreamRequest {
|
|
162
|
+
uint64 start_block_number = 1;
|
|
163
|
+
uint64 end_block_number = 2;
|
|
164
|
+
}
|
|
165
|
+
message SubscribeStreamResponse {
|
|
166
|
+
enum Code {
|
|
167
|
+
UNKNOWN = 0; SUCCESS = 1; INVALID_REQUEST = 2; ERROR = 3;
|
|
168
|
+
INVALID_START_BLOCK_NUMBER = 4; INVALID_END_BLOCK_NUMBER = 5; NOT_AVAILABLE = 6;
|
|
169
|
+
}
|
|
170
|
+
oneof response {
|
|
171
|
+
Code status = 1;
|
|
172
|
+
org.hiero.block.api.BlockItemSet block_items = 2;
|
|
173
|
+
org.hiero.block.api.BlockEnd end_of_block = 3;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
service BlockStreamSubscribeService {
|
|
177
|
+
rpc subscribeBlockStream (SubscribeStreamRequest) returns (stream SubscribeStreamResponse);
|
|
178
|
+
}
|
|
179
|
+
`);
|
|
180
|
+
}
|
|
181
|
+
loadClients() {
|
|
182
|
+
const opts = {
|
|
183
|
+
keepCase: true,
|
|
184
|
+
longs: String,
|
|
185
|
+
enums: String,
|
|
186
|
+
defaults: true,
|
|
187
|
+
oneofs: true,
|
|
188
|
+
includeDirs: [this.protoDir],
|
|
189
|
+
};
|
|
190
|
+
const creds = this.tls === "insecure"
|
|
191
|
+
? grpc.credentials.createInsecure()
|
|
192
|
+
: grpc.credentials.createSsl(null, null, null, {
|
|
193
|
+
checkServerIdentity: () => undefined,
|
|
194
|
+
});
|
|
195
|
+
const nodeDef = protoLoader.loadSync(path.join(this.protoDir, "block-node/api/node_service.proto"), opts);
|
|
196
|
+
const blockDef = protoLoader.loadSync(path.join(this.protoDir, "block-node/api/block_access_service.proto"), opts);
|
|
197
|
+
const streamDef = protoLoader.loadSync(path.join(this.protoDir, "block-node/api/block_stream_subscribe_service.proto"), opts);
|
|
198
|
+
const nodePkg = grpc.loadPackageDefinition(nodeDef)["org"]["hiero"]["block"]["api"];
|
|
199
|
+
const blockPkg = grpc.loadPackageDefinition(blockDef)["org"]["hiero"]["block"]["api"];
|
|
200
|
+
const streamPkg = grpc.loadPackageDefinition(streamDef)["org"]["hiero"]["block"]["api"];
|
|
201
|
+
this._nodeClient = new nodePkg.BlockNodeService(this.endpoint, creds);
|
|
202
|
+
this._blockClient = new blockPkg.BlockAccessService(this.endpoint, creds);
|
|
203
|
+
this._streamClient = new streamPkg.BlockStreamSubscribeService(this.endpoint, creds);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
exports.ProtoManager = ProtoManager;
|
|
207
|
+
//# sourceMappingURL=proto-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proto-manager.js","sourceRoot":"","sources":["../src/proto-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,oDAAsC;AACtC,gEAAkD;AAElD;;;GAGG;AACH,MAAa,YAAY;IAMvB,YAA6B,QAAgB,EAAmB,GAAuB;QAA1D,aAAQ,GAAR,QAAQ,CAAQ;QAAmB,QAAG,GAAH,GAAG,CAAoB;QAJ/E,gBAAW,GAAuB,IAAI,CAAC;QACvC,iBAAY,GAAuB,IAAI,CAAC;QACxC,kBAAa,GAAuB,IAAI,CAAC;QAG/C,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;QACnE,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,UAAU;QACZ,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CAAC,KAAK,CAAC,CAAC;QACjG,MAAM,SAAS,GAAI,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;QAEjG,IAAI,CAAC,WAAW,GAAK,IAAI,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACxE,IAAI,CAAC,YAAY,GAAI,IAAI,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,GAAG,IAAI,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvF,CAAC;CACF;AA5KD,oCA4KC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export interface BlockNodeClientOptions {
|
|
2
|
+
/** gRPC endpoint, e.g. "s01.test.blk.ams.lat.ope.eng.hashgraph.io:40840" */
|
|
3
|
+
endpoint: string;
|
|
4
|
+
/**
|
|
5
|
+
* TLS mode.
|
|
6
|
+
* "tls" – TLS with self-signed cert tolerance (default)
|
|
7
|
+
* "insecure" – plaintext (USE_INSECURE=1 equivalent)
|
|
8
|
+
*/
|
|
9
|
+
tls?: "tls" | "insecure";
|
|
10
|
+
/** Timeout in ms for unary calls (serverStatus, getBlock). Default: 10000 */
|
|
11
|
+
timeout?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ServerStatusResponse {
|
|
14
|
+
firstAvailableBlock: bigint;
|
|
15
|
+
lastAvailableBlock: bigint;
|
|
16
|
+
nextExpectedBlock: bigint;
|
|
17
|
+
onlyLatestState: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SemanticVersion {
|
|
20
|
+
major: number;
|
|
21
|
+
minor: number;
|
|
22
|
+
patch: number;
|
|
23
|
+
}
|
|
24
|
+
export interface BlockRange {
|
|
25
|
+
rangeStart: bigint;
|
|
26
|
+
rangeEnd: bigint;
|
|
27
|
+
}
|
|
28
|
+
export interface PluginVersion {
|
|
29
|
+
pluginId: string;
|
|
30
|
+
pluginSoftwareVersion?: SemanticVersion;
|
|
31
|
+
pluginFeatureNames: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface BlockNodeVersions {
|
|
34
|
+
streamProtoVersion?: SemanticVersion;
|
|
35
|
+
blockNodeVersion?: SemanticVersion;
|
|
36
|
+
installedPluginVersions: PluginVersion[];
|
|
37
|
+
}
|
|
38
|
+
export interface ServerStatusDetailResponse {
|
|
39
|
+
versionInformation?: BlockNodeVersions;
|
|
40
|
+
availableRanges: BlockRange[];
|
|
41
|
+
storedRanges: BlockRange[];
|
|
42
|
+
nodeAddressBook?: unknown;
|
|
43
|
+
tssData?: unknown;
|
|
44
|
+
}
|
|
45
|
+
export type BlockRequestSpecifier = {
|
|
46
|
+
blockNumber: bigint;
|
|
47
|
+
} | {
|
|
48
|
+
retrieveLatest: true;
|
|
49
|
+
};
|
|
50
|
+
export declare enum BlockResponseCode {
|
|
51
|
+
UNKNOWN = 0,
|
|
52
|
+
SUCCESS = 1,
|
|
53
|
+
INVALID_REQUEST = 2,
|
|
54
|
+
ERROR = 3,
|
|
55
|
+
NOT_FOUND = 4,
|
|
56
|
+
NOT_AVAILABLE = 5
|
|
57
|
+
}
|
|
58
|
+
export interface AddressBookProof {
|
|
59
|
+
previousAddressBookHash: Buffer;
|
|
60
|
+
currentAddressBookHash: Buffer;
|
|
61
|
+
ledgerHash: Buffer;
|
|
62
|
+
}
|
|
63
|
+
/** A single decoded BlockItem from the stream or getBlock response */
|
|
64
|
+
export interface BlockItem {
|
|
65
|
+
/** The discriminator name of the oneof field that was set */
|
|
66
|
+
kind: BlockItemKind;
|
|
67
|
+
/** Raw bytes of the inner message (before kind-specific decoding) */
|
|
68
|
+
raw: Buffer;
|
|
69
|
+
/** Decoded payload — shape depends on `kind` */
|
|
70
|
+
payload: BlockHeader | EventHeader | RoundHeader | EventTransaction | TransactionResult | StateChanges | FilteredItemHash | BlockProof | RecordFile | AddressBookProof | Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
export type BlockItemKind = "block_header" | "event_header" | "round_header" | "event_transaction" | "transaction_result" | "transaction_output" | "state_changes" | "filtered_item_hash" | "block_proof" | "record_file" | "address_book_proof" | "unknown";
|
|
73
|
+
export interface BlockHeader {
|
|
74
|
+
number: bigint;
|
|
75
|
+
hapiProtoVersion?: SemanticVersion;
|
|
76
|
+
softwareVersion?: SemanticVersion;
|
|
77
|
+
previousBlockHash: Buffer;
|
|
78
|
+
firstTransactionConsensusTime?: Timestamp;
|
|
79
|
+
hashAlgorithm: number;
|
|
80
|
+
}
|
|
81
|
+
export interface EventHeader {
|
|
82
|
+
birthRound: bigint;
|
|
83
|
+
generation: bigint;
|
|
84
|
+
creatorNodeId: Buffer;
|
|
85
|
+
}
|
|
86
|
+
export interface RoundHeader {
|
|
87
|
+
roundNumber: bigint;
|
|
88
|
+
}
|
|
89
|
+
export interface TransactionId {
|
|
90
|
+
accountId?: AccountId;
|
|
91
|
+
transactionValidStart?: Timestamp;
|
|
92
|
+
scheduled: boolean;
|
|
93
|
+
nonce: number;
|
|
94
|
+
/** Canonical format: "0.0.X@seconds.nanos" */
|
|
95
|
+
toString(): string;
|
|
96
|
+
}
|
|
97
|
+
export interface AccountId {
|
|
98
|
+
shardNum: bigint;
|
|
99
|
+
realmNum: bigint;
|
|
100
|
+
accountNum: bigint;
|
|
101
|
+
}
|
|
102
|
+
export interface Timestamp {
|
|
103
|
+
seconds: bigint;
|
|
104
|
+
nanos: number;
|
|
105
|
+
toDate(): Date;
|
|
106
|
+
}
|
|
107
|
+
export interface EventTransaction {
|
|
108
|
+
kind: "application" | "system";
|
|
109
|
+
transactionId?: TransactionId;
|
|
110
|
+
type?: string;
|
|
111
|
+
memo?: string;
|
|
112
|
+
raw: Buffer;
|
|
113
|
+
}
|
|
114
|
+
export interface TransactionResult {
|
|
115
|
+
status: number;
|
|
116
|
+
statusName: string;
|
|
117
|
+
consensusTimestamp?: Timestamp;
|
|
118
|
+
transactionFee: bigint;
|
|
119
|
+
payerAccountId?: AccountId;
|
|
120
|
+
transactionHash: Buffer;
|
|
121
|
+
transfers: Transfer[];
|
|
122
|
+
}
|
|
123
|
+
export interface Transfer {
|
|
124
|
+
accountId?: AccountId;
|
|
125
|
+
amount: bigint;
|
|
126
|
+
}
|
|
127
|
+
export interface StateChange {
|
|
128
|
+
stateId: number;
|
|
129
|
+
stateName: string;
|
|
130
|
+
}
|
|
131
|
+
export interface StateChanges {
|
|
132
|
+
consensusTimestamp?: Timestamp;
|
|
133
|
+
changes: StateChange[];
|
|
134
|
+
}
|
|
135
|
+
export interface FilteredItemHash {
|
|
136
|
+
itemHash: Buffer;
|
|
137
|
+
filteredPath: bigint;
|
|
138
|
+
}
|
|
139
|
+
export interface BlockProof {
|
|
140
|
+
block: bigint;
|
|
141
|
+
previousBlockRootHash: Buffer;
|
|
142
|
+
startOfBlockStateRootHash: Buffer;
|
|
143
|
+
blockSignature: Buffer;
|
|
144
|
+
siblingHashes: Buffer[];
|
|
145
|
+
}
|
|
146
|
+
export interface RecordFile {
|
|
147
|
+
creationTime?: Timestamp;
|
|
148
|
+
number: bigint;
|
|
149
|
+
transactions: DecodedTransaction[];
|
|
150
|
+
}
|
|
151
|
+
export interface DecodedTransaction {
|
|
152
|
+
transactionId?: TransactionId;
|
|
153
|
+
type?: string;
|
|
154
|
+
memo?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface GetBlockResponse {
|
|
157
|
+
status: BlockResponseCode;
|
|
158
|
+
statusName: string;
|
|
159
|
+
block?: BlockItem[];
|
|
160
|
+
}
|
|
161
|
+
export declare enum SubscribeStreamCode {
|
|
162
|
+
UNKNOWN = 0,
|
|
163
|
+
SUCCESS = 1,
|
|
164
|
+
INVALID_REQUEST = 2,
|
|
165
|
+
ERROR = 3,
|
|
166
|
+
INVALID_START_BLOCK_NUMBER = 4,
|
|
167
|
+
INVALID_END_BLOCK_NUMBER = 5,
|
|
168
|
+
NOT_AVAILABLE = 6
|
|
169
|
+
}
|
|
170
|
+
export interface BlockStreamOptions {
|
|
171
|
+
startBlockNumber: bigint | number;
|
|
172
|
+
/**
|
|
173
|
+
* End block. Omit or pass 0n for a live open-ended stream.
|
|
174
|
+
* The SDK automatically converts 0 to uint64_max for you.
|
|
175
|
+
*/
|
|
176
|
+
endBlockNumber?: bigint | number;
|
|
177
|
+
}
|
|
178
|
+
export interface BlockStreamCallbacks {
|
|
179
|
+
/** Called once after the stream is opened — SUCCESS means items will follow */
|
|
180
|
+
onStatus?: (code: SubscribeStreamCode, name: string) => void;
|
|
181
|
+
/** Called once per complete block (after end_of_block is received) */
|
|
182
|
+
onBlock?: (blockNumber: bigint, items: BlockItem[]) => void;
|
|
183
|
+
/** Called on stream error */
|
|
184
|
+
onError?: (err: Error) => void;
|
|
185
|
+
/** Called when the stream ends (either bounded range finished or cancelled) */
|
|
186
|
+
onEnd?: () => void;
|
|
187
|
+
}
|
|
188
|
+
export interface StreamHandle {
|
|
189
|
+
/** Cancel the stream */
|
|
190
|
+
cancel(): void;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC;IACzB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,oBAAoB;IACnC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;CAC1B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jC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB;AAID,oBAAY,mBAAmB;IAC7B,OAAO,IAAI;IACX,OAAO,IAAI;IACX,eAAe,IAAI;IACnB,KAAK,IAAI;IACT,0BAA0B,IAAI;IAC9B,wBAAwB,IAAI;IAC5B,aAAa,IAAI;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,wBAAwB;IACxB,MAAM,IAAI,IAAI,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─── Public types ─────────────────────────────────────────────────────────────
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SubscribeStreamCode = exports.BlockResponseCode = void 0;
|
|
5
|
+
var BlockResponseCode;
|
|
6
|
+
(function (BlockResponseCode) {
|
|
7
|
+
BlockResponseCode[BlockResponseCode["UNKNOWN"] = 0] = "UNKNOWN";
|
|
8
|
+
BlockResponseCode[BlockResponseCode["SUCCESS"] = 1] = "SUCCESS";
|
|
9
|
+
BlockResponseCode[BlockResponseCode["INVALID_REQUEST"] = 2] = "INVALID_REQUEST";
|
|
10
|
+
BlockResponseCode[BlockResponseCode["ERROR"] = 3] = "ERROR";
|
|
11
|
+
BlockResponseCode[BlockResponseCode["NOT_FOUND"] = 4] = "NOT_FOUND";
|
|
12
|
+
BlockResponseCode[BlockResponseCode["NOT_AVAILABLE"] = 5] = "NOT_AVAILABLE";
|
|
13
|
+
})(BlockResponseCode || (exports.BlockResponseCode = BlockResponseCode = {}));
|
|
14
|
+
// ── Subscribe ─────────────────────────────────────────────────────────────────
|
|
15
|
+
var SubscribeStreamCode;
|
|
16
|
+
(function (SubscribeStreamCode) {
|
|
17
|
+
SubscribeStreamCode[SubscribeStreamCode["UNKNOWN"] = 0] = "UNKNOWN";
|
|
18
|
+
SubscribeStreamCode[SubscribeStreamCode["SUCCESS"] = 1] = "SUCCESS";
|
|
19
|
+
SubscribeStreamCode[SubscribeStreamCode["INVALID_REQUEST"] = 2] = "INVALID_REQUEST";
|
|
20
|
+
SubscribeStreamCode[SubscribeStreamCode["ERROR"] = 3] = "ERROR";
|
|
21
|
+
SubscribeStreamCode[SubscribeStreamCode["INVALID_START_BLOCK_NUMBER"] = 4] = "INVALID_START_BLOCK_NUMBER";
|
|
22
|
+
SubscribeStreamCode[SubscribeStreamCode["INVALID_END_BLOCK_NUMBER"] = 5] = "INVALID_END_BLOCK_NUMBER";
|
|
23
|
+
SubscribeStreamCode[SubscribeStreamCode["NOT_AVAILABLE"] = 6] = "NOT_AVAILABLE";
|
|
24
|
+
})(SubscribeStreamCode || (exports.SubscribeStreamCode = SubscribeStreamCode = {}));
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iFAAiF;;;AA+DjF,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,+DAAW,CAAA;IACX,+EAAmB,CAAA;IACnB,2DAAS,CAAA;IACT,mEAAa,CAAA;IACb,2EAAiB,CAAA;AACnB,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;AA0ID,iFAAiF;AAEjF,IAAY,mBAQX;AARD,WAAY,mBAAmB;IAC7B,mEAAW,CAAA;IACX,mEAAW,CAAA;IACX,mFAAmB,CAAA;IACnB,+DAAS,CAAA;IACT,yGAA8B,CAAA;IAC9B,qGAA4B,CAAA;IAC5B,+EAAiB,CAAA;AACnB,CAAC,EARW,mBAAmB,mCAAnB,mBAAmB,QAQ9B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ohmpathorn/block-node-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "JavaScript SDK for the Hedera Block Node gRPC API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npx tsc",
|
|
13
|
+
"test": "node examples/basic.js",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"hedera",
|
|
18
|
+
"hiero",
|
|
19
|
+
"block-node",
|
|
20
|
+
"grpc",
|
|
21
|
+
"blockchain"
|
|
22
|
+
],
|
|
23
|
+
"author": "Hedera | Hiero",
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@grpc/grpc-js": "^1.10.0",
|
|
27
|
+
"@grpc/proto-loader": "^0.7.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^5.0.0",
|
|
31
|
+
"@types/node": "^20.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16.0.0"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/hiero-ledger/hiero-block-node-sdk.git"
|
|
39
|
+
}
|
|
40
|
+
}
|