@gnolang/tm2-js-client 1.1.3 → 1.1.5
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/bin/provider/jsonrpc/jsonrpc.js +3 -3
- package/bin/provider/jsonrpc/jsonrpc.test.js +5 -5
- package/bin/provider/utility/requests.utility.js +1 -1
- package/bin/provider/websocket/ws.js +3 -3
- package/bin/provider/websocket/ws.test.js +5 -5
- package/bin/wallet/key/key.js +1 -1
- package/bin/wallet/ledger/ledger.js +1 -1
- package/bin/wallet/wallet.js +1 -1
- package/package.json +5 -5
|
@@ -65,7 +65,7 @@ var JSONRPCProvider = /** @class */ (function () {
|
|
|
65
65
|
request: (0, utility_1.newRequest)(endpoints_1.ABCIEndpoint.ABCI_QUERY, [
|
|
66
66
|
"bank/balances/".concat(address),
|
|
67
67
|
'',
|
|
68
|
-
'0',
|
|
68
|
+
'0', // Height; not supported > 0 for now
|
|
69
69
|
false,
|
|
70
70
|
]),
|
|
71
71
|
})];
|
|
@@ -151,7 +151,7 @@ var JSONRPCProvider = /** @class */ (function () {
|
|
|
151
151
|
request: (0, utility_1.newRequest)(endpoints_1.ABCIEndpoint.ABCI_QUERY, [
|
|
152
152
|
"auth/accounts/".concat(address),
|
|
153
153
|
'',
|
|
154
|
-
'0',
|
|
154
|
+
'0', // Height; not supported > 0 for now
|
|
155
155
|
false,
|
|
156
156
|
]),
|
|
157
157
|
})];
|
|
@@ -171,7 +171,7 @@ var JSONRPCProvider = /** @class */ (function () {
|
|
|
171
171
|
request: (0, utility_1.newRequest)(endpoints_1.ABCIEndpoint.ABCI_QUERY, [
|
|
172
172
|
"auth/accounts/".concat(address),
|
|
173
173
|
'',
|
|
174
|
-
'0',
|
|
174
|
+
'0', // Height; not supported > 0 for now
|
|
175
175
|
false,
|
|
176
176
|
]),
|
|
177
177
|
})];
|
|
@@ -129,7 +129,7 @@ describe('JSON-RPC Provider', function () {
|
|
|
129
129
|
hash: '',
|
|
130
130
|
};
|
|
131
131
|
test.each([
|
|
132
|
-
[validResult, validResult.hash, '', ''],
|
|
132
|
+
[validResult, validResult.hash, '', ''], // no error
|
|
133
133
|
[invalidResult, invalidResult.hash, messages_1.UnauthorizedErrorMessage, mockLog], // error out
|
|
134
134
|
])('case %#', function (response, expectedHash, expectedErr, expectedLog) { return __awaiter(void 0, void 0, void 0, function () {
|
|
135
135
|
var provider, tx, e_1;
|
|
@@ -281,8 +281,8 @@ describe('JSON-RPC Provider', function () {
|
|
|
281
281
|
describe('getBalance', function () {
|
|
282
282
|
var denomination = 'atom';
|
|
283
283
|
test.each([
|
|
284
|
-
['"5gnot,100atom"', 100],
|
|
285
|
-
['"5universe"', 0],
|
|
284
|
+
['"5gnot,100atom"', 100], // balance found
|
|
285
|
+
['"5universe"', 0], // balance not found
|
|
286
286
|
['""', 0], // account doesn't exist
|
|
287
287
|
])('case %#', function (existing, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
288
288
|
var mockABCIResponse, provider, balance;
|
|
@@ -325,7 +325,7 @@ describe('JSON-RPC Provider', function () {
|
|
|
325
325
|
[
|
|
326
326
|
JSON.stringify(validAccount),
|
|
327
327
|
parseInt(validAccount.BaseAccount.sequence, 10),
|
|
328
|
-
],
|
|
328
|
+
], // account exists
|
|
329
329
|
['null', 0], // account doesn't exist
|
|
330
330
|
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
331
331
|
var mockABCIResponse, provider, sequence;
|
|
@@ -368,7 +368,7 @@ describe('JSON-RPC Provider', function () {
|
|
|
368
368
|
[
|
|
369
369
|
JSON.stringify(validAccount),
|
|
370
370
|
parseInt(validAccount.BaseAccount.account_number, 10),
|
|
371
|
-
],
|
|
371
|
+
], // account exists
|
|
372
372
|
['null', 0], // account doesn't exist
|
|
373
373
|
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
374
374
|
var mockABCIResponse, provider, accountNumber, e_2;
|
|
@@ -13,7 +13,7 @@ var newRequest = function (method, params) {
|
|
|
13
13
|
return {
|
|
14
14
|
// the ID of the request is not that relevant for this helper method;
|
|
15
15
|
// for finer ID control, instantiate the request object directly
|
|
16
|
-
id:
|
|
16
|
+
id: (0, uuid_1.v4)(),
|
|
17
17
|
jsonrpc: standardVersion,
|
|
18
18
|
method: method,
|
|
19
19
|
params: params,
|
|
@@ -154,7 +154,7 @@ var WSProvider = /** @class */ (function () {
|
|
|
154
154
|
case 0: return [4 /*yield*/, this.sendRequest((0, utility_1.newRequest)(endpoints_1.ABCIEndpoint.ABCI_QUERY, [
|
|
155
155
|
"bank/balances/".concat(address),
|
|
156
156
|
'',
|
|
157
|
-
'0',
|
|
157
|
+
'0', // Height; not supported > 0 for now
|
|
158
158
|
false,
|
|
159
159
|
]))];
|
|
160
160
|
case 1:
|
|
@@ -241,7 +241,7 @@ var WSProvider = /** @class */ (function () {
|
|
|
241
241
|
case 0: return [4 /*yield*/, this.sendRequest((0, utility_1.newRequest)(endpoints_1.ABCIEndpoint.ABCI_QUERY, [
|
|
242
242
|
"auth/accounts/".concat(address),
|
|
243
243
|
'',
|
|
244
|
-
'0',
|
|
244
|
+
'0', // Height; not supported > 0 for now
|
|
245
245
|
false,
|
|
246
246
|
]))];
|
|
247
247
|
case 1:
|
|
@@ -260,7 +260,7 @@ var WSProvider = /** @class */ (function () {
|
|
|
260
260
|
case 0: return [4 /*yield*/, this.sendRequest((0, utility_1.newRequest)(endpoints_1.ABCIEndpoint.ABCI_QUERY, [
|
|
261
261
|
"auth/accounts/".concat(address),
|
|
262
262
|
'',
|
|
263
|
-
'0',
|
|
263
|
+
'0', // Height; not supported > 0 for now
|
|
264
264
|
false,
|
|
265
265
|
]))];
|
|
266
266
|
case 1:
|
|
@@ -225,7 +225,7 @@ describe('WS Provider', function () {
|
|
|
225
225
|
[
|
|
226
226
|
JSON.stringify(validAccount),
|
|
227
227
|
parseInt(validAccount.BaseAccount.sequence, 10),
|
|
228
|
-
],
|
|
228
|
+
], // account exists
|
|
229
229
|
['null', 0], // account doesn't exist
|
|
230
230
|
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
231
|
var mockResponse, sequence;
|
|
@@ -261,7 +261,7 @@ describe('WS Provider', function () {
|
|
|
261
261
|
[
|
|
262
262
|
JSON.stringify(validAccount),
|
|
263
263
|
parseInt(validAccount.BaseAccount.account_number, 10),
|
|
264
|
-
],
|
|
264
|
+
], // account exists
|
|
265
265
|
['null', 0], // account doesn't exist
|
|
266
266
|
])('case %#', function (response, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
267
267
|
var mockResponse, accountNumber, e_1;
|
|
@@ -294,8 +294,8 @@ describe('WS Provider', function () {
|
|
|
294
294
|
describe('getBalance', function () {
|
|
295
295
|
var denomination = 'atom';
|
|
296
296
|
test.each([
|
|
297
|
-
['"5gnot,100atom"', 100],
|
|
298
|
-
['"5universe"', 0],
|
|
297
|
+
['"5gnot,100atom"', 100], // balance found
|
|
298
|
+
['"5universe"', 0], // balance not found
|
|
299
299
|
['""', 0], // account doesn't exist
|
|
300
300
|
])('case %#', function (existing, expected) { return __awaiter(void 0, void 0, void 0, function () {
|
|
301
301
|
var mockResponse, balance;
|
|
@@ -357,7 +357,7 @@ describe('WS Provider', function () {
|
|
|
357
357
|
hash: '',
|
|
358
358
|
};
|
|
359
359
|
test.each([
|
|
360
|
-
[validResult, validResult.hash, '', ''],
|
|
360
|
+
[validResult, validResult.hash, '', ''], // no error
|
|
361
361
|
[invalidResult, invalidResult.hash, messages_1.UnauthorizedErrorMessage, mockLog], // error out
|
|
362
362
|
])('case %#', function (response, expectedHash, expectedErr, expectedLog) { return __awaiter(void 0, void 0, void 0, function () {
|
|
363
363
|
var tx, e_2;
|
package/bin/wallet/key/key.js
CHANGED
|
@@ -60,8 +60,8 @@ var KeySigner = /** @class */ (function () {
|
|
|
60
60
|
* @param {string} addressPrefix the address prefix
|
|
61
61
|
*/
|
|
62
62
|
function KeySigner(privateKey, publicKey, addressPrefix) {
|
|
63
|
-
var _this = this;
|
|
64
63
|
if (addressPrefix === void 0) { addressPrefix = utility_1.defaultAddressPrefix; }
|
|
64
|
+
var _this = this;
|
|
65
65
|
this.getAddress = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
66
66
|
return __generator(this, function (_a) {
|
|
67
67
|
return [2 /*return*/, (0, amino_1.pubkeyToAddress)((0, amino_1.encodeSecp256k1Pubkey)(crypto_1.Secp256k1.compressPubkey(this.publicKey)), this.addressPrefix)];
|
|
@@ -51,8 +51,8 @@ var LedgerSigner = /** @class */ (function () {
|
|
|
51
51
|
* @param {string} addressPrefix the address prefix
|
|
52
52
|
*/
|
|
53
53
|
function LedgerSigner(connector, accountIndex, addressPrefix) {
|
|
54
|
-
var _this = this;
|
|
55
54
|
if (addressPrefix === void 0) { addressPrefix = utility_1.defaultAddressPrefix; }
|
|
55
|
+
var _this = this;
|
|
56
56
|
this.getAddress = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
57
57
|
var compressedPubKey;
|
|
58
58
|
return __generator(this, function (_a) {
|
package/bin/wallet/wallet.js
CHANGED
|
@@ -220,7 +220,7 @@ var Wallet = /** @class */ (function () {
|
|
|
220
220
|
gas_fee: tx.fee.gasFee,
|
|
221
221
|
gas_wanted: tx.fee.gasWanted.toString(10),
|
|
222
222
|
},
|
|
223
|
-
msgs: decodeTxMessages(tx.messages),
|
|
223
|
+
msgs: decodeTxMessages(tx.messages), // unrolled message objects
|
|
224
224
|
memo: tx.memo,
|
|
225
225
|
time: defaultSigTimestamp,
|
|
226
226
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnolang/tm2-js-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Tendermint2 JS / TS Client",
|
|
5
5
|
"main": "./bin/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"jest": "^29.5.0",
|
|
39
39
|
"jest-mock-extended": "^3.0.4",
|
|
40
40
|
"jest-websocket-mock": "^2.4.0",
|
|
41
|
-
"prettier": "^3.
|
|
41
|
+
"prettier": "^3.1.0",
|
|
42
42
|
"ts-jest": "^29.1.0",
|
|
43
43
|
"ts-proto": "^1.147.2",
|
|
44
44
|
"typescript": "^5.0.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@cosmjs/amino": "^0.
|
|
48
|
-
"@cosmjs/crypto": "^0.
|
|
49
|
-
"@cosmjs/ledger-amino": "^0.
|
|
47
|
+
"@cosmjs/amino": "^0.32.0",
|
|
48
|
+
"@cosmjs/crypto": "^0.32.0",
|
|
49
|
+
"@cosmjs/ledger-amino": "^0.32.0",
|
|
50
50
|
"@types/uuid": "^9.0.4",
|
|
51
51
|
"axios": "^1.4.0",
|
|
52
52
|
"long": "^5.2.3",
|