@gnolang/tm2-js-client 1.2.7 → 1.3.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/bin/proto/google/protobuf/any.d.ts +1 -1
- package/bin/proto/google/protobuf/any.js +10 -8
- package/bin/proto/tm2/abci.d.ts +3 -3
- package/bin/proto/tm2/abci.js +32 -28
- package/bin/proto/tm2/tx.d.ts +3 -3
- package/bin/proto/tm2/tx.js +28 -28
- package/bin/provider/jsonrpc/jsonrpc.js +1 -1
- package/bin/provider/websocket/ws.js +2 -2
- package/bin/wallet/wallet.js +4 -4
- package/bin/wallet/wallet.test.js +6 -6
- package/package.json +1 -1
|
@@ -119,7 +119,7 @@ export interface Any {
|
|
|
119
119
|
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
120
120
|
* used with implementation specific semantics.
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
type_url: string;
|
|
123
123
|
/** Must be a valid serialized protocol buffer of the above specified type. */
|
|
124
124
|
value: Uint8Array;
|
|
125
125
|
}
|
|
@@ -10,13 +10,13 @@ exports.Any = exports.protobufPackage = void 0;
|
|
|
10
10
|
var wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
11
|
exports.protobufPackage = 'google.protobuf';
|
|
12
12
|
function createBaseAny() {
|
|
13
|
-
return {
|
|
13
|
+
return { type_url: '', value: new Uint8Array(0) };
|
|
14
14
|
}
|
|
15
15
|
exports.Any = {
|
|
16
16
|
encode: function (message, writer) {
|
|
17
17
|
if (writer === void 0) { writer = new wire_1.BinaryWriter(); }
|
|
18
|
-
if (message.
|
|
19
|
-
writer.uint32(10).string(message.
|
|
18
|
+
if (message.type_url !== '') {
|
|
19
|
+
writer.uint32(10).string(message.type_url);
|
|
20
20
|
}
|
|
21
21
|
if (message.value.length !== 0) {
|
|
22
22
|
writer.uint32(18).bytes(message.value);
|
|
@@ -34,7 +34,7 @@ exports.Any = {
|
|
|
34
34
|
if (tag !== 10) {
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
message.
|
|
37
|
+
message.type_url = reader.string();
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
case 2: {
|
|
@@ -54,7 +54,9 @@ exports.Any = {
|
|
|
54
54
|
},
|
|
55
55
|
fromJSON: function (object) {
|
|
56
56
|
return {
|
|
57
|
-
|
|
57
|
+
type_url: isSet(object.type_url)
|
|
58
|
+
? globalThis.String(object.type_url)
|
|
59
|
+
: '',
|
|
58
60
|
value: isSet(object.value)
|
|
59
61
|
? bytesFromBase64(object.value)
|
|
60
62
|
: new Uint8Array(0),
|
|
@@ -62,8 +64,8 @@ exports.Any = {
|
|
|
62
64
|
},
|
|
63
65
|
toJSON: function (message) {
|
|
64
66
|
var obj = {};
|
|
65
|
-
if (message.
|
|
66
|
-
obj.
|
|
67
|
+
if (message.type_url !== undefined) {
|
|
68
|
+
obj.type_url = message.type_url;
|
|
67
69
|
}
|
|
68
70
|
if (message.value !== undefined) {
|
|
69
71
|
obj.value = base64FromBytes(message.value);
|
|
@@ -76,7 +78,7 @@ exports.Any = {
|
|
|
76
78
|
fromPartial: function (object) {
|
|
77
79
|
var _a, _b;
|
|
78
80
|
var message = createBaseAny();
|
|
79
|
-
message.
|
|
81
|
+
message.type_url = (_a = object.type_url) !== null && _a !== void 0 ? _a : '';
|
|
80
82
|
message.value = (_b = object.value) !== null && _b !== void 0 ? _b : new Uint8Array(0);
|
|
81
83
|
return message;
|
|
82
84
|
},
|
package/bin/proto/tm2/abci.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import Long from 'long';
|
|
|
3
3
|
import { Any } from '../google/protobuf/any';
|
|
4
4
|
export declare const protobufPackage = "tm2.abci";
|
|
5
5
|
export interface ResponseDeliverTx {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
response_base?: ResponseBase | undefined;
|
|
7
|
+
gas_wanted: Long;
|
|
8
|
+
gas_used: Long;
|
|
9
9
|
}
|
|
10
10
|
export interface ResponseBase {
|
|
11
11
|
error?: Any | undefined;
|
package/bin/proto/tm2/abci.js
CHANGED
|
@@ -15,19 +15,23 @@ var long_1 = __importDefault(require("long"));
|
|
|
15
15
|
var any_1 = require("../google/protobuf/any");
|
|
16
16
|
exports.protobufPackage = 'tm2.abci';
|
|
17
17
|
function createBaseResponseDeliverTx() {
|
|
18
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
response_base: undefined,
|
|
20
|
+
gas_wanted: long_1.default.ZERO,
|
|
21
|
+
gas_used: long_1.default.ZERO,
|
|
22
|
+
};
|
|
19
23
|
}
|
|
20
24
|
exports.ResponseDeliverTx = {
|
|
21
25
|
encode: function (message, writer) {
|
|
22
26
|
if (writer === void 0) { writer = new wire_1.BinaryWriter(); }
|
|
23
|
-
if (message.
|
|
24
|
-
exports.ResponseBase.encode(message.
|
|
27
|
+
if (message.response_base !== undefined) {
|
|
28
|
+
exports.ResponseBase.encode(message.response_base, writer.uint32(10).fork()).join();
|
|
25
29
|
}
|
|
26
|
-
if (!message.
|
|
27
|
-
writer.uint32(16).sint64(message.
|
|
30
|
+
if (!message.gas_wanted.equals(long_1.default.ZERO)) {
|
|
31
|
+
writer.uint32(16).sint64(message.gas_wanted.toString());
|
|
28
32
|
}
|
|
29
|
-
if (!message.
|
|
30
|
-
writer.uint32(24).sint64(message.
|
|
33
|
+
if (!message.gas_used.equals(long_1.default.ZERO)) {
|
|
34
|
+
writer.uint32(24).sint64(message.gas_used.toString());
|
|
31
35
|
}
|
|
32
36
|
return writer;
|
|
33
37
|
},
|
|
@@ -42,21 +46,21 @@ exports.ResponseDeliverTx = {
|
|
|
42
46
|
if (tag !== 10) {
|
|
43
47
|
break;
|
|
44
48
|
}
|
|
45
|
-
message.
|
|
49
|
+
message.response_base = exports.ResponseBase.decode(reader, reader.uint32());
|
|
46
50
|
continue;
|
|
47
51
|
}
|
|
48
52
|
case 2: {
|
|
49
53
|
if (tag !== 16) {
|
|
50
54
|
break;
|
|
51
55
|
}
|
|
52
|
-
message.
|
|
56
|
+
message.gas_wanted = long_1.default.fromString(reader.sint64().toString());
|
|
53
57
|
continue;
|
|
54
58
|
}
|
|
55
59
|
case 3: {
|
|
56
60
|
if (tag !== 24) {
|
|
57
61
|
break;
|
|
58
62
|
}
|
|
59
|
-
message.
|
|
63
|
+
message.gas_used = long_1.default.fromString(reader.sint64().toString());
|
|
60
64
|
continue;
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -69,27 +73,27 @@ exports.ResponseDeliverTx = {
|
|
|
69
73
|
},
|
|
70
74
|
fromJSON: function (object) {
|
|
71
75
|
return {
|
|
72
|
-
|
|
76
|
+
response_base: isSet(object.ResponseBase)
|
|
73
77
|
? exports.ResponseBase.fromJSON(object.ResponseBase)
|
|
74
78
|
: undefined,
|
|
75
|
-
|
|
79
|
+
gas_wanted: isSet(object.GasWanted)
|
|
76
80
|
? long_1.default.fromValue(object.GasWanted)
|
|
77
81
|
: long_1.default.ZERO,
|
|
78
|
-
|
|
82
|
+
gas_used: isSet(object.GasUsed)
|
|
79
83
|
? long_1.default.fromValue(object.GasUsed)
|
|
80
84
|
: long_1.default.ZERO,
|
|
81
85
|
};
|
|
82
86
|
},
|
|
83
87
|
toJSON: function (message) {
|
|
84
88
|
var obj = {};
|
|
85
|
-
if (message.
|
|
86
|
-
obj.ResponseBase = exports.ResponseBase.toJSON(message.
|
|
89
|
+
if (message.response_base !== undefined) {
|
|
90
|
+
obj.ResponseBase = exports.ResponseBase.toJSON(message.response_base);
|
|
87
91
|
}
|
|
88
|
-
if (message.
|
|
89
|
-
obj.GasWanted = (message.
|
|
92
|
+
if (message.gas_wanted !== undefined) {
|
|
93
|
+
obj.GasWanted = (message.gas_wanted || long_1.default.ZERO).toString();
|
|
90
94
|
}
|
|
91
|
-
if (message.
|
|
92
|
-
obj.GasUsed = (message.
|
|
95
|
+
if (message.gas_used !== undefined) {
|
|
96
|
+
obj.GasUsed = (message.gas_used || long_1.default.ZERO).toString();
|
|
93
97
|
}
|
|
94
98
|
return obj;
|
|
95
99
|
},
|
|
@@ -98,17 +102,17 @@ exports.ResponseDeliverTx = {
|
|
|
98
102
|
},
|
|
99
103
|
fromPartial: function (object) {
|
|
100
104
|
var message = createBaseResponseDeliverTx();
|
|
101
|
-
message.
|
|
102
|
-
object.
|
|
103
|
-
? exports.ResponseBase.fromPartial(object.
|
|
105
|
+
message.response_base =
|
|
106
|
+
object.response_base !== undefined && object.response_base !== null
|
|
107
|
+
? exports.ResponseBase.fromPartial(object.response_base)
|
|
104
108
|
: undefined;
|
|
105
|
-
message.
|
|
106
|
-
object.
|
|
107
|
-
? long_1.default.fromValue(object.
|
|
109
|
+
message.gas_wanted =
|
|
110
|
+
object.gas_wanted !== undefined && object.gas_wanted !== null
|
|
111
|
+
? long_1.default.fromValue(object.gas_wanted)
|
|
108
112
|
: long_1.default.ZERO;
|
|
109
|
-
message.
|
|
110
|
-
object.
|
|
111
|
-
? long_1.default.fromValue(object.
|
|
113
|
+
message.gas_used =
|
|
114
|
+
object.gas_used !== undefined && object.gas_used !== null
|
|
115
|
+
? long_1.default.fromValue(object.gas_used)
|
|
112
116
|
: long_1.default.ZERO;
|
|
113
117
|
return message;
|
|
114
118
|
},
|
package/bin/proto/tm2/tx.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ export interface Tx {
|
|
|
14
14
|
}
|
|
15
15
|
export interface TxFee {
|
|
16
16
|
/** gas limit */
|
|
17
|
-
|
|
17
|
+
gas_wanted: Long;
|
|
18
18
|
/** gas fee details (<value><denomination>) */
|
|
19
|
-
|
|
19
|
+
gas_fee: string;
|
|
20
20
|
}
|
|
21
21
|
export interface TxSignature {
|
|
22
22
|
/** public key associated with the signature */
|
|
23
|
-
|
|
23
|
+
pub_key?: Any | undefined;
|
|
24
24
|
/** the signature */
|
|
25
25
|
signature: Uint8Array;
|
|
26
26
|
}
|
package/bin/proto/tm2/tx.js
CHANGED
|
@@ -126,16 +126,16 @@ exports.Tx = {
|
|
|
126
126
|
},
|
|
127
127
|
};
|
|
128
128
|
function createBaseTxFee() {
|
|
129
|
-
return {
|
|
129
|
+
return { gas_wanted: long_1.default.ZERO, gas_fee: '' };
|
|
130
130
|
}
|
|
131
131
|
exports.TxFee = {
|
|
132
132
|
encode: function (message, writer) {
|
|
133
133
|
if (writer === void 0) { writer = new wire_1.BinaryWriter(); }
|
|
134
|
-
if (!message.
|
|
135
|
-
writer.uint32(8).sint64(message.
|
|
134
|
+
if (!message.gas_wanted.equals(long_1.default.ZERO)) {
|
|
135
|
+
writer.uint32(8).sint64(message.gas_wanted.toString());
|
|
136
136
|
}
|
|
137
|
-
if (message.
|
|
138
|
-
writer.uint32(18).string(message.
|
|
137
|
+
if (message.gas_fee !== '') {
|
|
138
|
+
writer.uint32(18).string(message.gas_fee);
|
|
139
139
|
}
|
|
140
140
|
return writer;
|
|
141
141
|
},
|
|
@@ -150,14 +150,14 @@ exports.TxFee = {
|
|
|
150
150
|
if (tag !== 8) {
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
|
-
message.
|
|
153
|
+
message.gas_wanted = long_1.default.fromString(reader.sint64().toString());
|
|
154
154
|
continue;
|
|
155
155
|
}
|
|
156
156
|
case 2: {
|
|
157
157
|
if (tag !== 18) {
|
|
158
158
|
break;
|
|
159
159
|
}
|
|
160
|
-
message.
|
|
160
|
+
message.gas_fee = reader.string();
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -170,19 +170,19 @@ exports.TxFee = {
|
|
|
170
170
|
},
|
|
171
171
|
fromJSON: function (object) {
|
|
172
172
|
return {
|
|
173
|
-
|
|
174
|
-
? long_1.default.fromValue(object.
|
|
173
|
+
gas_wanted: isSet(object.gas_wanted)
|
|
174
|
+
? long_1.default.fromValue(object.gas_wanted)
|
|
175
175
|
: long_1.default.ZERO,
|
|
176
|
-
|
|
176
|
+
gas_fee: isSet(object.gas_fee) ? globalThis.String(object.gas_fee) : '',
|
|
177
177
|
};
|
|
178
178
|
},
|
|
179
179
|
toJSON: function (message) {
|
|
180
180
|
var obj = {};
|
|
181
|
-
if (message.
|
|
182
|
-
obj.
|
|
181
|
+
if (message.gas_wanted !== undefined) {
|
|
182
|
+
obj.gas_wanted = (message.gas_wanted || long_1.default.ZERO).toString();
|
|
183
183
|
}
|
|
184
|
-
if (message.
|
|
185
|
-
obj.
|
|
184
|
+
if (message.gas_fee !== undefined) {
|
|
185
|
+
obj.gas_fee = message.gas_fee;
|
|
186
186
|
}
|
|
187
187
|
return obj;
|
|
188
188
|
},
|
|
@@ -192,22 +192,22 @@ exports.TxFee = {
|
|
|
192
192
|
fromPartial: function (object) {
|
|
193
193
|
var _a;
|
|
194
194
|
var message = createBaseTxFee();
|
|
195
|
-
message.
|
|
196
|
-
object.
|
|
197
|
-
? long_1.default.fromValue(object.
|
|
195
|
+
message.gas_wanted =
|
|
196
|
+
object.gas_wanted !== undefined && object.gas_wanted !== null
|
|
197
|
+
? long_1.default.fromValue(object.gas_wanted)
|
|
198
198
|
: long_1.default.ZERO;
|
|
199
|
-
message.
|
|
199
|
+
message.gas_fee = (_a = object.gas_fee) !== null && _a !== void 0 ? _a : '';
|
|
200
200
|
return message;
|
|
201
201
|
},
|
|
202
202
|
};
|
|
203
203
|
function createBaseTxSignature() {
|
|
204
|
-
return {
|
|
204
|
+
return { pub_key: undefined, signature: new Uint8Array(0) };
|
|
205
205
|
}
|
|
206
206
|
exports.TxSignature = {
|
|
207
207
|
encode: function (message, writer) {
|
|
208
208
|
if (writer === void 0) { writer = new wire_1.BinaryWriter(); }
|
|
209
|
-
if (message.
|
|
210
|
-
any_1.Any.encode(message.
|
|
209
|
+
if (message.pub_key !== undefined) {
|
|
210
|
+
any_1.Any.encode(message.pub_key, writer.uint32(10).fork()).join();
|
|
211
211
|
}
|
|
212
212
|
if (message.signature.length !== 0) {
|
|
213
213
|
writer.uint32(18).bytes(message.signature);
|
|
@@ -225,7 +225,7 @@ exports.TxSignature = {
|
|
|
225
225
|
if (tag !== 10) {
|
|
226
226
|
break;
|
|
227
227
|
}
|
|
228
|
-
message.
|
|
228
|
+
message.pub_key = any_1.Any.decode(reader, reader.uint32());
|
|
229
229
|
continue;
|
|
230
230
|
}
|
|
231
231
|
case 2: {
|
|
@@ -245,7 +245,7 @@ exports.TxSignature = {
|
|
|
245
245
|
},
|
|
246
246
|
fromJSON: function (object) {
|
|
247
247
|
return {
|
|
248
|
-
|
|
248
|
+
pub_key: isSet(object.pub_key) ? any_1.Any.fromJSON(object.pub_key) : undefined,
|
|
249
249
|
signature: isSet(object.signature)
|
|
250
250
|
? bytesFromBase64(object.signature)
|
|
251
251
|
: new Uint8Array(0),
|
|
@@ -253,8 +253,8 @@ exports.TxSignature = {
|
|
|
253
253
|
},
|
|
254
254
|
toJSON: function (message) {
|
|
255
255
|
var obj = {};
|
|
256
|
-
if (message.
|
|
257
|
-
obj.
|
|
256
|
+
if (message.pub_key !== undefined) {
|
|
257
|
+
obj.pub_key = any_1.Any.toJSON(message.pub_key);
|
|
258
258
|
}
|
|
259
259
|
if (message.signature !== undefined) {
|
|
260
260
|
obj.signature = base64FromBytes(message.signature);
|
|
@@ -267,9 +267,9 @@ exports.TxSignature = {
|
|
|
267
267
|
fromPartial: function (object) {
|
|
268
268
|
var _a;
|
|
269
269
|
var message = createBaseTxSignature();
|
|
270
|
-
message.
|
|
271
|
-
object.
|
|
272
|
-
? any_1.Any.fromPartial(object.
|
|
270
|
+
message.pub_key =
|
|
271
|
+
object.pub_key !== undefined && object.pub_key !== null
|
|
272
|
+
? any_1.Any.fromPartial(object.pub_key)
|
|
273
273
|
: undefined;
|
|
274
274
|
message.signature = (_a = object.signature) !== null && _a !== void 0 ? _a : new Uint8Array(0);
|
|
275
275
|
return message;
|
|
@@ -72,7 +72,7 @@ var JSONRPCProvider = /** @class */ (function () {
|
|
|
72
72
|
case 1:
|
|
73
73
|
abciResponse = _a.sent();
|
|
74
74
|
simulateResult = (0, utility_1.extractSimulateFromResponse)(abciResponse);
|
|
75
|
-
return [2 /*return*/, simulateResult.
|
|
75
|
+
return [2 /*return*/, simulateResult.gas_used.toInt()];
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
});
|
|
@@ -162,11 +162,11 @@ var WSProvider = /** @class */ (function () {
|
|
|
162
162
|
response = _c.sent();
|
|
163
163
|
abciResponse = this.parseResponse(response);
|
|
164
164
|
simulateResult = (0, utility_1.extractSimulateFromResponse)(abciResponse);
|
|
165
|
-
resultErrorKey = (_b = (_a = simulateResult.
|
|
165
|
+
resultErrorKey = (_b = (_a = simulateResult.response_base) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.type_url;
|
|
166
166
|
if (resultErrorKey) {
|
|
167
167
|
throw (0, errors_utility_1.constructRequestError)(resultErrorKey);
|
|
168
168
|
}
|
|
169
|
-
return [2 /*return*/, simulateResult.
|
|
169
|
+
return [2 /*return*/, simulateResult.gas_used.toInt()];
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
});
|
package/bin/wallet/wallet.js
CHANGED
|
@@ -216,8 +216,8 @@ var Wallet = /** @class */ (function () {
|
|
|
216
216
|
account_number: accountNumber.toString(10),
|
|
217
217
|
sequence: accountSequence.toString(10),
|
|
218
218
|
fee: {
|
|
219
|
-
gas_fee: tx.fee.
|
|
220
|
-
gas_wanted: tx.fee.
|
|
219
|
+
gas_fee: tx.fee.gas_fee,
|
|
220
|
+
gas_wanted: tx.fee.gas_wanted.toString(10),
|
|
221
221
|
},
|
|
222
222
|
msgs: decodeTxMessages(tx.messages), // unrolled message objects
|
|
223
223
|
memo: tx.memo,
|
|
@@ -227,8 +227,8 @@ var Wallet = /** @class */ (function () {
|
|
|
227
227
|
key: publicKey,
|
|
228
228
|
};
|
|
229
229
|
_b = {
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
pub_key: {
|
|
231
|
+
type_url: types_1.Secp256k1PubKeyType,
|
|
232
232
|
value: proto_1.PubKeySecp256k1.encode(wrappedKey).finish(),
|
|
233
233
|
}
|
|
234
234
|
};
|
|
@@ -254,8 +254,8 @@ describe('Wallet', function () {
|
|
|
254
254
|
mockTx = (0, jest_mock_extended_1.mock)();
|
|
255
255
|
mockTx.signatures = [];
|
|
256
256
|
mockTx.fee = {
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
gas_fee: '10',
|
|
258
|
+
gas_wanted: new long_1.default(10),
|
|
259
259
|
};
|
|
260
260
|
mockTx.messages = [];
|
|
261
261
|
mockStatus = (0, jest_mock_extended_1.mock)();
|
|
@@ -291,8 +291,8 @@ describe('Wallet', function () {
|
|
|
291
291
|
expect(mockProvider.getAccountSequence).toHaveBeenCalled();
|
|
292
292
|
expect(signedTx.signatures).toHaveLength(1);
|
|
293
293
|
sig = signedTx.signatures[0];
|
|
294
|
-
expect((_a = sig.
|
|
295
|
-
expect((_b = sig.
|
|
294
|
+
expect((_a = sig.pub_key) === null || _a === void 0 ? void 0 : _a.type_url).toBe(types_1.Secp256k1PubKeyType);
|
|
295
|
+
expect((_b = sig.pub_key) === null || _b === void 0 ? void 0 : _b.value).not.toBeNull();
|
|
296
296
|
expect(sig.signature).not.toBeNull();
|
|
297
297
|
return [2 /*return*/];
|
|
298
298
|
}
|
|
@@ -306,8 +306,8 @@ describe('Wallet', function () {
|
|
|
306
306
|
mockTx = (0, jest_mock_extended_1.mock)();
|
|
307
307
|
mockTx.signatures = [];
|
|
308
308
|
mockTx.fee = {
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
gas_fee: '10',
|
|
310
|
+
gas_wanted: new long_1.default(10),
|
|
311
311
|
};
|
|
312
312
|
mockTx.messages = [];
|
|
313
313
|
mockTx.memo = '';
|