@taquito/rpc 10.2.1 → 11.0.1
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/lib/opkind.js +1 -0
- package/dist/lib/opkind.js.map +1 -1
- package/dist/lib/rpc-client-interface.js.map +1 -1
- package/dist/lib/rpc-client-modules/rpc-cache.js +57 -7
- package/dist/lib/rpc-client-modules/rpc-cache.js.map +1 -1
- package/dist/lib/taquito-rpc.js +35 -3
- package/dist/lib/taquito-rpc.js.map +1 -1
- package/dist/lib/utils/utils.js +2 -2
- package/dist/lib/version.js +2 -2
- package/dist/taquito-rpc.es5.js +96 -14
- package/dist/taquito-rpc.es5.js.map +1 -1
- package/dist/taquito-rpc.umd.js +96 -14
- package/dist/taquito-rpc.umd.js.map +1 -1
- package/dist/types/opkind.d.ts +2 -1
- package/dist/types/rpc-client-interface.d.ts +2 -1
- package/dist/types/rpc-client-modules/rpc-cache.d.ts +19 -7
- package/dist/types/taquito-rpc.d.ts +19 -2
- package/dist/types/types.d.ts +68 -7
- package/package.json +7 -6
- package/signature.json +1 -1
package/dist/taquito-rpc.umd.js
CHANGED
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
var defaultChain = 'main';
|
|
88
88
|
var defaultRPCOptions = { block: 'head' };
|
|
89
89
|
|
|
90
|
-
var getByPath = require('lodash
|
|
91
|
-
var setByPath = require('lodash
|
|
90
|
+
var getByPath = require('lodash.get');
|
|
91
|
+
var setByPath = require('lodash.set');
|
|
92
92
|
/**
|
|
93
93
|
* Casts object/array items to BigNumber
|
|
94
94
|
* keys support lodash path notation
|
|
@@ -152,11 +152,16 @@
|
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
RpcClientCache.prototype.formatCacheKey = function (rpcUrl, rpcMethodName, rpcMethodParams, rpcMethodData) {
|
|
155
|
-
var paramsToString =
|
|
155
|
+
var paramsToString = '';
|
|
156
156
|
rpcMethodParams.forEach(function (param) {
|
|
157
|
-
paramsToString =
|
|
157
|
+
paramsToString =
|
|
158
|
+
typeof param === 'object'
|
|
159
|
+
? paramsToString + JSON.stringify(param) + '/'
|
|
160
|
+
: paramsToString + param + '/';
|
|
158
161
|
});
|
|
159
|
-
return rpcMethodData
|
|
162
|
+
return rpcMethodData
|
|
163
|
+
? rpcUrl + "/" + rpcMethodName + "/" + paramsToString + "/" + JSON.stringify(rpcMethodData)
|
|
164
|
+
: rpcUrl + "/" + rpcMethodName + "/" + paramsToString;
|
|
160
165
|
};
|
|
161
166
|
RpcClientCache.prototype.has = function (key) {
|
|
162
167
|
return key in this._cache;
|
|
@@ -305,6 +310,37 @@
|
|
|
305
310
|
});
|
|
306
311
|
});
|
|
307
312
|
};
|
|
313
|
+
/**
|
|
314
|
+
*
|
|
315
|
+
* @param address contract address from which we want to retrieve the script
|
|
316
|
+
* @param unparsingMode default is { unparsing_mode: "Readable" }
|
|
317
|
+
* @param options contains generic configuration for rpc calls
|
|
318
|
+
*
|
|
319
|
+
* @description Access the script of the contract and normalize it using the requested unparsing mode.
|
|
320
|
+
*
|
|
321
|
+
*/
|
|
322
|
+
RpcClientCache.prototype.getNormalizedScript = function (address, unparsingMode, _a) {
|
|
323
|
+
if (unparsingMode === void 0) { unparsingMode = { unparsing_mode: 'Readable' }; }
|
|
324
|
+
var _b = _a === void 0 ? defaultRPCOptions : _a, block = _b.block;
|
|
325
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
326
|
+
var key, response;
|
|
327
|
+
return __generator(this, function (_c) {
|
|
328
|
+
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getNormalizedScript', [
|
|
329
|
+
block,
|
|
330
|
+
address,
|
|
331
|
+
unparsingMode,
|
|
332
|
+
]);
|
|
333
|
+
if (this.has(key)) {
|
|
334
|
+
return [2 /*return*/, this.get(key)];
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
response = this.rpcClient.getNormalizedScript(address, unparsingMode, { block: block });
|
|
338
|
+
this.put(key, response);
|
|
339
|
+
return [2 /*return*/, response];
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
};
|
|
308
344
|
/**
|
|
309
345
|
*
|
|
310
346
|
* @param address contract address from which we want to retrieve
|
|
@@ -399,7 +435,11 @@
|
|
|
399
435
|
return __awaiter(this, void 0, void 0, function () {
|
|
400
436
|
var keyUrl, response;
|
|
401
437
|
return __generator(this, function (_c) {
|
|
402
|
-
keyUrl = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBigMapKey', [
|
|
438
|
+
keyUrl = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getBigMapKey', [
|
|
439
|
+
block,
|
|
440
|
+
address,
|
|
441
|
+
key,
|
|
442
|
+
]);
|
|
403
443
|
if (this.has(keyUrl)) {
|
|
404
444
|
return [2 /*return*/, this.get(keyUrl)];
|
|
405
445
|
}
|
|
@@ -609,7 +649,10 @@
|
|
|
609
649
|
return __awaiter(this, void 0, void 0, function () {
|
|
610
650
|
var key, response;
|
|
611
651
|
return __generator(this, function (_c) {
|
|
612
|
-
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEndorsingRights', [
|
|
652
|
+
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEndorsingRights', [
|
|
653
|
+
block,
|
|
654
|
+
args,
|
|
655
|
+
]);
|
|
613
656
|
if (this.has(key)) {
|
|
614
657
|
return [2 /*return*/, this.get(key)];
|
|
615
658
|
}
|
|
@@ -861,7 +904,10 @@
|
|
|
861
904
|
return __awaiter(this, void 0, void 0, function () {
|
|
862
905
|
var key, response;
|
|
863
906
|
return __generator(this, function (_c) {
|
|
864
|
-
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEntrypoints', [
|
|
907
|
+
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getEntrypoints', [
|
|
908
|
+
block,
|
|
909
|
+
contract,
|
|
910
|
+
]);
|
|
865
911
|
if (this.has(key)) {
|
|
866
912
|
return [2 /*return*/, this.get(key)];
|
|
867
913
|
}
|
|
@@ -1050,7 +1096,10 @@
|
|
|
1050
1096
|
return __awaiter(this, void 0, void 0, function () {
|
|
1051
1097
|
var key, response;
|
|
1052
1098
|
return __generator(this, function (_c) {
|
|
1053
|
-
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSaplingDiffByContract', [
|
|
1099
|
+
key = this.formatCacheKey(this.rpcClient.getRpcUrl(), 'getSaplingDiffByContract', [
|
|
1100
|
+
block,
|
|
1101
|
+
contract,
|
|
1102
|
+
]);
|
|
1054
1103
|
if (this.has(key)) {
|
|
1055
1104
|
return [2 /*return*/, this.get(key)];
|
|
1056
1105
|
}
|
|
@@ -1080,13 +1129,14 @@
|
|
|
1080
1129
|
OpKind["PROPOSALS"] = "proposals";
|
|
1081
1130
|
OpKind["BALLOT"] = "ballot";
|
|
1082
1131
|
OpKind["FAILING_NOOP"] = "failing_noop";
|
|
1132
|
+
OpKind["REGISTER_GLOBAL_CONSTANT"] = "register_global_constant";
|
|
1083
1133
|
})(exports.OpKind || (exports.OpKind = {}));
|
|
1084
1134
|
|
|
1085
1135
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
1086
1136
|
/* tslint:disable */
|
|
1087
1137
|
var VERSION = {
|
|
1088
|
-
"commitHash": "
|
|
1089
|
-
"version": "
|
|
1138
|
+
"commitHash": "8d7ecc86ce608bff9ee8c6cf0cd7d795263b8bda",
|
|
1139
|
+
"version": "11.0.1"
|
|
1090
1140
|
};
|
|
1091
1141
|
/* tslint:enable */
|
|
1092
1142
|
|
|
@@ -1230,6 +1280,27 @@
|
|
|
1230
1280
|
});
|
|
1231
1281
|
});
|
|
1232
1282
|
};
|
|
1283
|
+
/**
|
|
1284
|
+
*
|
|
1285
|
+
* @param address contract address from which we want to retrieve the script
|
|
1286
|
+
* @param unparsingMode default is { unparsing_mode: "Readable" }
|
|
1287
|
+
* @param options contains generic configuration for rpc calls
|
|
1288
|
+
*
|
|
1289
|
+
* @description Access the script of the contract and normalize it using the requested unparsing mode.
|
|
1290
|
+
*
|
|
1291
|
+
*/
|
|
1292
|
+
RpcClient.prototype.getNormalizedScript = function (address, unparsingMode, _a) {
|
|
1293
|
+
if (unparsingMode === void 0) { unparsingMode = { unparsing_mode: 'Readable' }; }
|
|
1294
|
+
var _b = _a === void 0 ? defaultRPCOptions : _a, block = _b.block;
|
|
1295
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1296
|
+
return __generator(this, function (_c) {
|
|
1297
|
+
return [2 /*return*/, this.httpBackend.createRequest({
|
|
1298
|
+
url: this.createURL("/chains/" + this.chain + "/blocks/" + block + "/context/contracts/" + address + "/script/normalized"),
|
|
1299
|
+
method: 'POST',
|
|
1300
|
+
}, unparsingMode)];
|
|
1301
|
+
});
|
|
1302
|
+
});
|
|
1303
|
+
};
|
|
1233
1304
|
/**
|
|
1234
1305
|
*
|
|
1235
1306
|
* @param address contract address from which we want to retrieve
|
|
@@ -1388,7 +1459,7 @@
|
|
|
1388
1459
|
'deposit',
|
|
1389
1460
|
'deposits',
|
|
1390
1461
|
'fees',
|
|
1391
|
-
'rewards'
|
|
1462
|
+
'rewards',
|
|
1392
1463
|
]);
|
|
1393
1464
|
return __assign(__assign({}, rest), { deposit: castedToBigNumber.deposit, deposits: castedToBigNumber.deposits, fees: castedToBigNumber.fees, rewards: castedToBigNumber.rewards });
|
|
1394
1465
|
}),
|
|
@@ -1396,7 +1467,7 @@
|
|
|
1396
1467
|
delegated_contracts: response.delegated_contracts,
|
|
1397
1468
|
delegated_balance: new BigNumber__default['default'](response.delegated_balance),
|
|
1398
1469
|
grace_period: response.grace_period,
|
|
1399
|
-
voting_power: response.voting_power
|
|
1470
|
+
voting_power: response.voting_power,
|
|
1400
1471
|
}];
|
|
1401
1472
|
}
|
|
1402
1473
|
});
|
|
@@ -1439,7 +1510,13 @@
|
|
|
1439
1510
|
'baking_reward_per_endorsement',
|
|
1440
1511
|
'delay_per_missing_endorsement',
|
|
1441
1512
|
'minimal_block_delay',
|
|
1442
|
-
'liquidity_baking_subsidy'
|
|
1513
|
+
'liquidity_baking_subsidy',
|
|
1514
|
+
'cache_layout',
|
|
1515
|
+
'baking_reward_fixed_portion',
|
|
1516
|
+
'baking_reward_bonus_per_slot',
|
|
1517
|
+
'endorsing_reward_per_slot',
|
|
1518
|
+
'round_durations',
|
|
1519
|
+
'double_baking_punishment'
|
|
1443
1520
|
]);
|
|
1444
1521
|
return [2 /*return*/, __assign(__assign({}, response), castedResponse)];
|
|
1445
1522
|
}
|
|
@@ -1913,9 +1990,14 @@
|
|
|
1913
1990
|
* @param options contains generic configuration for rpc calls
|
|
1914
1991
|
*
|
|
1915
1992
|
* @description Computes the serialized version of a data expression using the same algorithm as script instruction PACK
|
|
1993
|
+
* Note: You should always verify the packed bytes before signing or requesting that they be signed when using the the RPC to pack.
|
|
1994
|
+
* This precaution helps protect you and your applications users from RPC nodes that have been compromised.
|
|
1995
|
+
* A node that is operated by a bad actor, or compromised by a bad actor could return a fully formed operation that does not correspond to the input provided to the RPC endpoint.
|
|
1996
|
+
* A safer solution to pack and sign data would be to use the `packDataBytes` function available in the `@taquito/michel-codec` package.
|
|
1916
1997
|
*
|
|
1917
1998
|
* @example packData({ data: { string: "test" }, type: { prim: "string" } })
|
|
1918
1999
|
*
|
|
2000
|
+
*
|
|
1919
2001
|
* @see https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-scripts-pack-data
|
|
1920
2002
|
*/
|
|
1921
2003
|
RpcClient.prototype.packData = function (data, _a) {
|