@gnolang/tm2-js-client 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.
Files changed (77) hide show
  1. package/LICENSE.md +201 -0
  2. package/README.md +78 -0
  3. package/bin/index.d.ts +4 -0
  4. package/bin/index.js +20 -0
  5. package/bin/proto/google/protobuf/any.d.ts +151 -0
  6. package/bin/proto/google/protobuf/any.js +124 -0
  7. package/bin/proto/index.d.ts +2 -0
  8. package/bin/proto/index.js +20 -0
  9. package/bin/proto/tm2/tx.d.ts +540 -0
  10. package/bin/proto/tm2/tx.js +365 -0
  11. package/bin/provider/endpoints.d.ts +28 -0
  12. package/bin/provider/endpoints.js +36 -0
  13. package/bin/provider/index.d.ts +6 -0
  14. package/bin/provider/index.js +22 -0
  15. package/bin/provider/jsonrpc/index.d.ts +1 -0
  16. package/bin/provider/jsonrpc/index.js +17 -0
  17. package/bin/provider/jsonrpc/jsonrpc.d.ts +27 -0
  18. package/bin/provider/jsonrpc/jsonrpc.js +219 -0
  19. package/bin/provider/jsonrpc/jsonrpc.test.d.ts +1 -0
  20. package/bin/provider/jsonrpc/jsonrpc.test.js +374 -0
  21. package/bin/provider/provider.d.ts +86 -0
  22. package/bin/provider/provider.js +2 -0
  23. package/bin/provider/types/abci.d.ts +39 -0
  24. package/bin/provider/types/abci.js +4 -0
  25. package/bin/provider/types/common.d.ts +154 -0
  26. package/bin/provider/types/common.js +2 -0
  27. package/bin/provider/types/index.d.ts +3 -0
  28. package/bin/provider/types/index.js +19 -0
  29. package/bin/provider/types/jsonrpc.d.ts +26 -0
  30. package/bin/provider/types/jsonrpc.js +2 -0
  31. package/bin/provider/utility/index.d.ts +2 -0
  32. package/bin/provider/utility/index.js +18 -0
  33. package/bin/provider/utility/provider.utility.d.ts +28 -0
  34. package/bin/provider/utility/provider.utility.js +194 -0
  35. package/bin/provider/utility/requests.utility.d.ts +33 -0
  36. package/bin/provider/utility/requests.utility.js +74 -0
  37. package/bin/provider/websocket/index.d.ts +1 -0
  38. package/bin/provider/websocket/index.js +17 -0
  39. package/bin/provider/websocket/ws.d.ts +55 -0
  40. package/bin/provider/websocket/ws.js +303 -0
  41. package/bin/provider/websocket/ws.test.d.ts +1 -0
  42. package/bin/provider/websocket/ws.test.js +535 -0
  43. package/bin/services/index.d.ts +2 -0
  44. package/bin/services/index.js +18 -0
  45. package/bin/services/rest/restService.d.ts +4 -0
  46. package/bin/services/rest/restService.js +72 -0
  47. package/bin/services/rest/restService.types.d.ts +6 -0
  48. package/bin/services/rest/restService.types.js +2 -0
  49. package/bin/wallet/index.d.ts +5 -0
  50. package/bin/wallet/index.js +21 -0
  51. package/bin/wallet/key/index.d.ts +1 -0
  52. package/bin/wallet/key/index.js +17 -0
  53. package/bin/wallet/key/key.d.ts +21 -0
  54. package/bin/wallet/key/key.js +102 -0
  55. package/bin/wallet/key/key.test.d.ts +1 -0
  56. package/bin/wallet/key/key.test.js +121 -0
  57. package/bin/wallet/ledger/index.d.ts +1 -0
  58. package/bin/wallet/ledger/index.js +17 -0
  59. package/bin/wallet/ledger/ledger.d.ts +22 -0
  60. package/bin/wallet/ledger/ledger.js +109 -0
  61. package/bin/wallet/signer.d.ts +29 -0
  62. package/bin/wallet/signer.js +2 -0
  63. package/bin/wallet/types/index.d.ts +2 -0
  64. package/bin/wallet/types/index.js +18 -0
  65. package/bin/wallet/types/sign.d.ts +17 -0
  66. package/bin/wallet/types/sign.js +4 -0
  67. package/bin/wallet/types/wallet.d.ts +5 -0
  68. package/bin/wallet/types/wallet.js +2 -0
  69. package/bin/wallet/utility/index.d.ts +1 -0
  70. package/bin/wallet/utility/index.js +17 -0
  71. package/bin/wallet/utility/utility.d.ts +30 -0
  72. package/bin/wallet/utility/utility.js +105 -0
  73. package/bin/wallet/wallet.d.ts +94 -0
  74. package/bin/wallet/wallet.js +340 -0
  75. package/bin/wallet/wallet.test.d.ts +1 -0
  76. package/bin/wallet/wallet.test.js +345 -0
  77. package/package.json +64 -0
@@ -0,0 +1,365 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PubKeySecp256k1 = exports.TxSignature = exports.TxFee = exports.Tx = exports.protobufPackage = void 0;
7
+ /* eslint-disable */
8
+ var long_1 = __importDefault(require("long"));
9
+ var minimal_1 = __importDefault(require("protobufjs/minimal"));
10
+ var any_1 = require("../google/protobuf/any");
11
+ exports.protobufPackage = 'tm2.tx';
12
+ function createBaseTx() {
13
+ return { messages: [], fee: undefined, signatures: [], memo: '' };
14
+ }
15
+ exports.Tx = {
16
+ encode: function (message, writer) {
17
+ if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
18
+ for (var _i = 0, _a = message.messages; _i < _a.length; _i++) {
19
+ var v = _a[_i];
20
+ any_1.Any.encode(v, writer.uint32(10).fork()).ldelim();
21
+ }
22
+ if (message.fee !== undefined) {
23
+ exports.TxFee.encode(message.fee, writer.uint32(18).fork()).ldelim();
24
+ }
25
+ for (var _b = 0, _c = message.signatures; _b < _c.length; _b++) {
26
+ var v = _c[_b];
27
+ exports.TxSignature.encode(v, writer.uint32(26).fork()).ldelim();
28
+ }
29
+ if (message.memo !== '') {
30
+ writer.uint32(34).string(message.memo);
31
+ }
32
+ return writer;
33
+ },
34
+ decode: function (input, length) {
35
+ var reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
36
+ var end = length === undefined ? reader.len : reader.pos + length;
37
+ var message = createBaseTx();
38
+ while (reader.pos < end) {
39
+ var tag = reader.uint32();
40
+ switch (tag >>> 3) {
41
+ case 1:
42
+ if (tag != 10) {
43
+ break;
44
+ }
45
+ message.messages.push(any_1.Any.decode(reader, reader.uint32()));
46
+ continue;
47
+ case 2:
48
+ if (tag != 18) {
49
+ break;
50
+ }
51
+ message.fee = exports.TxFee.decode(reader, reader.uint32());
52
+ continue;
53
+ case 3:
54
+ if (tag != 26) {
55
+ break;
56
+ }
57
+ message.signatures.push(exports.TxSignature.decode(reader, reader.uint32()));
58
+ continue;
59
+ case 4:
60
+ if (tag != 34) {
61
+ break;
62
+ }
63
+ message.memo = reader.string();
64
+ continue;
65
+ }
66
+ if ((tag & 7) == 4 || tag == 0) {
67
+ break;
68
+ }
69
+ reader.skipType(tag & 7);
70
+ }
71
+ return message;
72
+ },
73
+ fromJSON: function (object) {
74
+ return {
75
+ messages: Array.isArray(object === null || object === void 0 ? void 0 : object.messages)
76
+ ? object.messages.map(function (e) { return any_1.Any.fromJSON(e); })
77
+ : [],
78
+ fee: isSet(object.fee) ? exports.TxFee.fromJSON(object.fee) : undefined,
79
+ signatures: Array.isArray(object === null || object === void 0 ? void 0 : object.signatures)
80
+ ? object.signatures.map(function (e) { return exports.TxSignature.fromJSON(e); })
81
+ : [],
82
+ memo: isSet(object.memo) ? String(object.memo) : '',
83
+ };
84
+ },
85
+ toJSON: function (message) {
86
+ var obj = {};
87
+ if (message.messages) {
88
+ obj.messages = message.messages.map(function (e) {
89
+ return e ? any_1.Any.toJSON(e) : undefined;
90
+ });
91
+ }
92
+ else {
93
+ obj.messages = [];
94
+ }
95
+ message.fee !== undefined &&
96
+ (obj.fee = message.fee ? exports.TxFee.toJSON(message.fee) : undefined);
97
+ if (message.signatures) {
98
+ obj.signatures = message.signatures.map(function (e) {
99
+ return e ? exports.TxSignature.toJSON(e) : undefined;
100
+ });
101
+ }
102
+ else {
103
+ obj.signatures = [];
104
+ }
105
+ message.memo !== undefined && (obj.memo = message.memo);
106
+ return obj;
107
+ },
108
+ create: function (base) {
109
+ return exports.Tx.fromPartial(base !== null && base !== void 0 ? base : {});
110
+ },
111
+ fromPartial: function (object) {
112
+ var _a, _b, _c;
113
+ var message = createBaseTx();
114
+ message.messages = ((_a = object.messages) === null || _a === void 0 ? void 0 : _a.map(function (e) { return any_1.Any.fromPartial(e); })) || [];
115
+ message.fee =
116
+ object.fee !== undefined && object.fee !== null
117
+ ? exports.TxFee.fromPartial(object.fee)
118
+ : undefined;
119
+ message.signatures =
120
+ ((_b = object.signatures) === null || _b === void 0 ? void 0 : _b.map(function (e) { return exports.TxSignature.fromPartial(e); })) || [];
121
+ message.memo = (_c = object.memo) !== null && _c !== void 0 ? _c : '';
122
+ return message;
123
+ },
124
+ };
125
+ function createBaseTxFee() {
126
+ return { gasWanted: long_1.default.ZERO, gasFee: '' };
127
+ }
128
+ exports.TxFee = {
129
+ encode: function (message, writer) {
130
+ if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
131
+ if (!message.gasWanted.isZero()) {
132
+ writer.uint32(8).sint64(message.gasWanted);
133
+ }
134
+ if (message.gasFee !== '') {
135
+ writer.uint32(18).string(message.gasFee);
136
+ }
137
+ return writer;
138
+ },
139
+ decode: function (input, length) {
140
+ var reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
141
+ var end = length === undefined ? reader.len : reader.pos + length;
142
+ var message = createBaseTxFee();
143
+ while (reader.pos < end) {
144
+ var tag = reader.uint32();
145
+ switch (tag >>> 3) {
146
+ case 1:
147
+ if (tag != 8) {
148
+ break;
149
+ }
150
+ message.gasWanted = reader.sint64();
151
+ continue;
152
+ case 2:
153
+ if (tag != 18) {
154
+ break;
155
+ }
156
+ message.gasFee = reader.string();
157
+ continue;
158
+ }
159
+ if ((tag & 7) == 4 || tag == 0) {
160
+ break;
161
+ }
162
+ reader.skipType(tag & 7);
163
+ }
164
+ return message;
165
+ },
166
+ fromJSON: function (object) {
167
+ return {
168
+ gasWanted: isSet(object.gasWanted)
169
+ ? long_1.default.fromValue(object.gasWanted)
170
+ : long_1.default.ZERO,
171
+ gasFee: isSet(object.gasFee) ? String(object.gasFee) : '',
172
+ };
173
+ },
174
+ toJSON: function (message) {
175
+ var obj = {};
176
+ message.gasWanted !== undefined &&
177
+ (obj.gasWanted = (message.gasWanted || long_1.default.ZERO).toString());
178
+ message.gasFee !== undefined && (obj.gasFee = message.gasFee);
179
+ return obj;
180
+ },
181
+ create: function (base) {
182
+ return exports.TxFee.fromPartial(base !== null && base !== void 0 ? base : {});
183
+ },
184
+ fromPartial: function (object) {
185
+ var _a;
186
+ var message = createBaseTxFee();
187
+ message.gasWanted =
188
+ object.gasWanted !== undefined && object.gasWanted !== null
189
+ ? long_1.default.fromValue(object.gasWanted)
190
+ : long_1.default.ZERO;
191
+ message.gasFee = (_a = object.gasFee) !== null && _a !== void 0 ? _a : '';
192
+ return message;
193
+ },
194
+ };
195
+ function createBaseTxSignature() {
196
+ return { pubKey: undefined, signature: new Uint8Array() };
197
+ }
198
+ exports.TxSignature = {
199
+ encode: function (message, writer) {
200
+ if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
201
+ if (message.pubKey !== undefined) {
202
+ any_1.Any.encode(message.pubKey, writer.uint32(10).fork()).ldelim();
203
+ }
204
+ if (message.signature.length !== 0) {
205
+ writer.uint32(18).bytes(message.signature);
206
+ }
207
+ return writer;
208
+ },
209
+ decode: function (input, length) {
210
+ var reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
211
+ var end = length === undefined ? reader.len : reader.pos + length;
212
+ var message = createBaseTxSignature();
213
+ while (reader.pos < end) {
214
+ var tag = reader.uint32();
215
+ switch (tag >>> 3) {
216
+ case 1:
217
+ if (tag != 10) {
218
+ break;
219
+ }
220
+ message.pubKey = any_1.Any.decode(reader, reader.uint32());
221
+ continue;
222
+ case 2:
223
+ if (tag != 18) {
224
+ break;
225
+ }
226
+ message.signature = reader.bytes();
227
+ continue;
228
+ }
229
+ if ((tag & 7) == 4 || tag == 0) {
230
+ break;
231
+ }
232
+ reader.skipType(tag & 7);
233
+ }
234
+ return message;
235
+ },
236
+ fromJSON: function (object) {
237
+ return {
238
+ pubKey: isSet(object.pubKey) ? any_1.Any.fromJSON(object.pubKey) : undefined,
239
+ signature: isSet(object.signature)
240
+ ? bytesFromBase64(object.signature)
241
+ : new Uint8Array(),
242
+ };
243
+ },
244
+ toJSON: function (message) {
245
+ var obj = {};
246
+ message.pubKey !== undefined &&
247
+ (obj.pubKey = message.pubKey ? any_1.Any.toJSON(message.pubKey) : undefined);
248
+ message.signature !== undefined &&
249
+ (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array()));
250
+ return obj;
251
+ },
252
+ create: function (base) {
253
+ return exports.TxSignature.fromPartial(base !== null && base !== void 0 ? base : {});
254
+ },
255
+ fromPartial: function (object) {
256
+ var _a;
257
+ var message = createBaseTxSignature();
258
+ message.pubKey =
259
+ object.pubKey !== undefined && object.pubKey !== null
260
+ ? any_1.Any.fromPartial(object.pubKey)
261
+ : undefined;
262
+ message.signature = (_a = object.signature) !== null && _a !== void 0 ? _a : new Uint8Array();
263
+ return message;
264
+ },
265
+ };
266
+ function createBasePubKeySecp256k1() {
267
+ return { key: new Uint8Array() };
268
+ }
269
+ exports.PubKeySecp256k1 = {
270
+ encode: function (message, writer) {
271
+ if (writer === void 0) { writer = minimal_1.default.Writer.create(); }
272
+ if (message.key.length !== 0) {
273
+ writer.uint32(10).bytes(message.key);
274
+ }
275
+ return writer;
276
+ },
277
+ decode: function (input, length) {
278
+ var reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
279
+ var end = length === undefined ? reader.len : reader.pos + length;
280
+ var message = createBasePubKeySecp256k1();
281
+ while (reader.pos < end) {
282
+ var tag = reader.uint32();
283
+ switch (tag >>> 3) {
284
+ case 1:
285
+ if (tag != 10) {
286
+ break;
287
+ }
288
+ message.key = reader.bytes();
289
+ continue;
290
+ }
291
+ if ((tag & 7) == 4 || tag == 0) {
292
+ break;
293
+ }
294
+ reader.skipType(tag & 7);
295
+ }
296
+ return message;
297
+ },
298
+ fromJSON: function (object) {
299
+ return {
300
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(),
301
+ };
302
+ },
303
+ toJSON: function (message) {
304
+ var obj = {};
305
+ message.key !== undefined &&
306
+ (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
307
+ return obj;
308
+ },
309
+ create: function (base) {
310
+ return exports.PubKeySecp256k1.fromPartial(base !== null && base !== void 0 ? base : {});
311
+ },
312
+ fromPartial: function (object) {
313
+ var _a;
314
+ var message = createBasePubKeySecp256k1();
315
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : new Uint8Array();
316
+ return message;
317
+ },
318
+ };
319
+ var tsProtoGlobalThis = (function () {
320
+ if (typeof globalThis !== 'undefined') {
321
+ return globalThis;
322
+ }
323
+ if (typeof self !== 'undefined') {
324
+ return self;
325
+ }
326
+ if (typeof window !== 'undefined') {
327
+ return window;
328
+ }
329
+ if (typeof global !== 'undefined') {
330
+ return global;
331
+ }
332
+ throw 'Unable to locate global object';
333
+ })();
334
+ function bytesFromBase64(b64) {
335
+ if (tsProtoGlobalThis.Buffer) {
336
+ return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, 'base64'));
337
+ }
338
+ else {
339
+ var bin = tsProtoGlobalThis.atob(b64);
340
+ var arr = new Uint8Array(bin.length);
341
+ for (var i = 0; i < bin.length; ++i) {
342
+ arr[i] = bin.charCodeAt(i);
343
+ }
344
+ return arr;
345
+ }
346
+ }
347
+ function base64FromBytes(arr) {
348
+ if (tsProtoGlobalThis.Buffer) {
349
+ return tsProtoGlobalThis.Buffer.from(arr).toString('base64');
350
+ }
351
+ else {
352
+ var bin_1 = [];
353
+ arr.forEach(function (byte) {
354
+ bin_1.push(String.fromCharCode(byte));
355
+ });
356
+ return tsProtoGlobalThis.btoa(bin_1.join(''));
357
+ }
358
+ }
359
+ if (minimal_1.default.util.Long !== long_1.default) {
360
+ minimal_1.default.util.Long = long_1.default;
361
+ minimal_1.default.configure();
362
+ }
363
+ function isSet(value) {
364
+ return value !== null && value !== undefined;
365
+ }
@@ -0,0 +1,28 @@
1
+ export declare enum CommonEndpoint {
2
+ HEALTH = "health",
3
+ STATUS = "status"
4
+ }
5
+ export declare enum ConsensusEndpoint {
6
+ NET_INFO = "net_info",
7
+ GENESIS = "genesis",
8
+ CONSENSUS_PARAMS = "consensus_params",
9
+ CONSENSUS_STATE = "consensus_state",
10
+ COMMIT = "commit",
11
+ VALIDATORS = "validators"
12
+ }
13
+ export declare enum BlockEndpoint {
14
+ BLOCK = "block",
15
+ BLOCK_RESULTS = "block_results",
16
+ BLOCKCHAIN = "blockchain"
17
+ }
18
+ export declare enum TransactionEndpoint {
19
+ NUM_UNCONFIRMED_TXS = "num_unconfirmed_txs",
20
+ UNCONFIRMED_TXS = "unconfirmed_txs",
21
+ BROADCAST_TX_ASYNC = "broadcast_tx_async",
22
+ BROADCAST_TX_SYNC = "broadcast_tx_sync",
23
+ BROADCAST_TX_COMMIT = "broadcast_tx_commit"
24
+ }
25
+ export declare enum ABCIEndpoint {
26
+ ABCI_INFO = "abci_info",
27
+ ABCI_QUERY = "abci_query"
28
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ABCIEndpoint = exports.TransactionEndpoint = exports.BlockEndpoint = exports.ConsensusEndpoint = exports.CommonEndpoint = void 0;
4
+ var CommonEndpoint;
5
+ (function (CommonEndpoint) {
6
+ CommonEndpoint["HEALTH"] = "health";
7
+ CommonEndpoint["STATUS"] = "status";
8
+ })(CommonEndpoint = exports.CommonEndpoint || (exports.CommonEndpoint = {}));
9
+ var ConsensusEndpoint;
10
+ (function (ConsensusEndpoint) {
11
+ ConsensusEndpoint["NET_INFO"] = "net_info";
12
+ ConsensusEndpoint["GENESIS"] = "genesis";
13
+ ConsensusEndpoint["CONSENSUS_PARAMS"] = "consensus_params";
14
+ ConsensusEndpoint["CONSENSUS_STATE"] = "consensus_state";
15
+ ConsensusEndpoint["COMMIT"] = "commit";
16
+ ConsensusEndpoint["VALIDATORS"] = "validators";
17
+ })(ConsensusEndpoint = exports.ConsensusEndpoint || (exports.ConsensusEndpoint = {}));
18
+ var BlockEndpoint;
19
+ (function (BlockEndpoint) {
20
+ BlockEndpoint["BLOCK"] = "block";
21
+ BlockEndpoint["BLOCK_RESULTS"] = "block_results";
22
+ BlockEndpoint["BLOCKCHAIN"] = "blockchain";
23
+ })(BlockEndpoint = exports.BlockEndpoint || (exports.BlockEndpoint = {}));
24
+ var TransactionEndpoint;
25
+ (function (TransactionEndpoint) {
26
+ TransactionEndpoint["NUM_UNCONFIRMED_TXS"] = "num_unconfirmed_txs";
27
+ TransactionEndpoint["UNCONFIRMED_TXS"] = "unconfirmed_txs";
28
+ TransactionEndpoint["BROADCAST_TX_ASYNC"] = "broadcast_tx_async";
29
+ TransactionEndpoint["BROADCAST_TX_SYNC"] = "broadcast_tx_sync";
30
+ TransactionEndpoint["BROADCAST_TX_COMMIT"] = "broadcast_tx_commit";
31
+ })(TransactionEndpoint = exports.TransactionEndpoint || (exports.TransactionEndpoint = {}));
32
+ var ABCIEndpoint;
33
+ (function (ABCIEndpoint) {
34
+ ABCIEndpoint["ABCI_INFO"] = "abci_info";
35
+ ABCIEndpoint["ABCI_QUERY"] = "abci_query";
36
+ })(ABCIEndpoint = exports.ABCIEndpoint || (exports.ABCIEndpoint = {}));
@@ -0,0 +1,6 @@
1
+ export * from './jsonrpc';
2
+ export * from './types';
3
+ export * from './utility';
4
+ export * from './websocket';
5
+ export * from './endpoints';
6
+ export * from './provider';
@@ -0,0 +1,22 @@
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
+ __exportStar(require("./jsonrpc"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ __exportStar(require("./utility"), exports);
20
+ __exportStar(require("./websocket"), exports);
21
+ __exportStar(require("./endpoints"), exports);
22
+ __exportStar(require("./provider"), exports);
@@ -0,0 +1 @@
1
+ export * from './jsonrpc';
@@ -0,0 +1,17 @@
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
+ __exportStar(require("./jsonrpc"), exports);
@@ -0,0 +1,27 @@
1
+ import { Provider } from '../provider';
2
+ import { BlockInfo, BlockResult, ConsensusParams, NetworkInfo, Status } from '../types';
3
+ import { Tx } from '../../proto';
4
+ /**
5
+ * Provider based on JSON-RPC HTTP requests
6
+ */
7
+ export declare class JSONRPCProvider implements Provider {
8
+ protected readonly baseURL: string;
9
+ /**
10
+ * Creates a new instance of the JSON-RPC Provider
11
+ * @param {string} baseURL the JSON-RPC URL of the node
12
+ */
13
+ constructor(baseURL: string);
14
+ estimateGas(tx: Tx): Promise<number>;
15
+ getBalance(address: string, denomination?: string, height?: number): Promise<number>;
16
+ getBlock(height: number): Promise<BlockInfo>;
17
+ getBlockResult(height: number): Promise<BlockResult>;
18
+ getBlockNumber(): Promise<number>;
19
+ getConsensusParams(height: number): Promise<ConsensusParams>;
20
+ getGasPrice(): Promise<number>;
21
+ getNetwork(): Promise<NetworkInfo>;
22
+ getAccountSequence(address: string, height?: number): Promise<number>;
23
+ getAccountNumber(address: string, height?: number): Promise<number>;
24
+ getStatus(): Promise<Status>;
25
+ sendTransaction(tx: string): Promise<string>;
26
+ waitForTransaction(hash: string, fromHeight?: number, timeout?: number): Promise<Tx>;
27
+ }