@taquito/taquito 22.0.0 → 23.0.0-beta.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/README.md +1 -1
- package/dist/400.taquito.min.js +1 -0
- package/dist/993.taquito.min.js +1 -0
- package/dist/lib/batch/rpc-batch-provider.js +47 -5
- package/dist/lib/constants.js +18 -16
- package/dist/lib/contract/contract.js +1 -1
- package/dist/lib/contract/prepare.js +17 -3
- package/dist/lib/contract/rpc-contract-provider.js +69 -22
- package/dist/lib/estimate/rpc-estimate-provider.js +133 -31
- package/dist/lib/operations/index.js +3 -1
- package/dist/lib/operations/reveal-operation.js +9 -0
- package/dist/lib/operations/types.js +5 -1
- package/dist/lib/operations/update-companion-key-operation.js +58 -0
- package/dist/lib/operations/update-consensus-key-operation.js +9 -0
- package/dist/lib/prepare/prepare-provider.js +78 -3
- package/dist/lib/provider.js +4 -0
- package/dist/lib/subscribe/polling-subcribe-provider.js +7 -3
- package/dist/lib/tz/rpc-tz-provider.js +4 -4
- package/dist/lib/version.js +2 -2
- package/dist/lib/wallet/operation-factory.js +1 -1
- package/dist/lib/wallet/operation.js +2 -2
- package/dist/lib/wallet/wallet.js +9 -12
- package/dist/taquito.es6.js +466 -109
- package/dist/taquito.es6.js.map +1 -1
- package/dist/taquito.min.js +1 -1
- package/dist/taquito.min.js.LICENSE.txt +2 -0
- package/dist/taquito.umd.js +464 -105
- package/dist/taquito.umd.js.map +1 -1
- package/dist/types/batch/rpc-batch-provider.d.ts +16 -2
- package/dist/types/constants.d.ts +4 -1
- package/dist/types/contract/interface.d.ts +10 -3
- package/dist/types/contract/prepare.d.ts +4 -3
- package/dist/types/contract/rpc-contract-provider.d.ts +12 -5
- package/dist/types/estimate/estimate-provider-interface.d.ts +9 -3
- package/dist/types/estimate/rpc-estimate-provider.d.ts +10 -5
- package/dist/types/operations/index.d.ts +1 -0
- package/dist/types/operations/reveal-operation.d.ts +1 -0
- package/dist/types/operations/types.d.ts +26 -5
- package/dist/types/operations/update-companion-key-operation.d.ts +23 -0
- package/dist/types/operations/update-consensus-key-operation.d.ts +1 -0
- package/dist/types/prepare/interface.d.ts +8 -1
- package/dist/types/prepare/prepare-provider.d.ts +11 -3
- package/dist/types/provider.d.ts +1 -1
- package/dist/types/signer/interface.d.ts +18 -8
- package/package.json +9 -9
package/dist/taquito.es6.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { OpKind, RpcClient } from '@taquito/rpc';
|
|
2
2
|
export { OpKind } from '@taquito/rpc';
|
|
3
3
|
import { HttpResponseError, STATUS_CODE } from '@taquito/http-utils';
|
|
4
|
-
import { TezosToolkitConfigError, ParameterValidationError, RpcError, TaquitoError, NetworkError, InvalidOperationHashError, InvalidAddressError, InvalidOperationKindError as InvalidOperationKindError$1, InvalidStakingAddressError, InvalidFinalizeUnstakeAmountError, InvalidContractAddressError, InvalidViewParameterError, DeprecationError, InvalidChainIdError, PublicKeyNotFoundError, InvalidAmountError, InvalidKeyHashError } from '@taquito/core';
|
|
4
|
+
import { TezosToolkitConfigError, ParameterValidationError, RpcError, TaquitoError, NetworkError, InvalidOperationHashError, InvalidAddressError, InvalidOperationKindError as InvalidOperationKindError$1, InvalidStakingAddressError, InvalidFinalizeUnstakeAmountError, InvalidContractAddressError, InvalidViewParameterError, DeprecationError, InvalidChainIdError, PublicKeyNotFoundError, ProhibitedActionError, InvalidProofError, InvalidAmountError, InvalidKeyHashError } from '@taquito/core';
|
|
5
5
|
import { Observable, ReplaySubject, BehaviorSubject, throwError, defer, range, of, EMPTY, combineLatest, from, concat, Subject, NEVER, timer } from 'rxjs';
|
|
6
|
-
import { switchMap, timeout, concatMap, endWith, tap, shareReplay, map, filter, first, catchError, share, distinctUntilChanged, takeWhile, startWith, mergeMap, takeUntil, retry,
|
|
6
|
+
import { switchMap, timeout, concatMap, endWith, tap, shareReplay, map, filter, first, catchError, share, distinctUntilChanged, takeWhile, startWith, mergeMap, takeUntil, retry, distinctUntilKeyChanged } from 'rxjs/operators';
|
|
7
7
|
import { Schema, ParameterSchema, ViewSchema, EventSchema, MichelsonMap, Token } from '@taquito/michelson-encoder';
|
|
8
8
|
export { MichelsonMap, Token, UnitValue } from '@taquito/michelson-encoder';
|
|
9
|
-
import { format, validateOperation, ValidationResult, InvalidOperationKindError, validateAddress,
|
|
9
|
+
import { format, validateOperation, ValidationResult, InvalidOperationKindError, validateAddress, validateContractAddress, validateChain, b58DecodeAndCheckPrefix, publicKeyHashPrefixes, PrefixV2, publicKeyPrefixes, validateKeyHash, InvalidKeyHashError as InvalidKeyHashError$1, payloadLength, encodeExpr } from '@taquito/utils';
|
|
10
10
|
import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
|
|
11
11
|
import { Parser, packDataBytes } from '@taquito/michel-codec';
|
|
12
12
|
import { LocalForger } from '@taquito/local-forging';
|
|
@@ -194,25 +194,25 @@ const DEFAULT_STORAGE_LIMIT = {
|
|
|
194
194
|
TRANSFER: 257,
|
|
195
195
|
REVEAL: 0,
|
|
196
196
|
};
|
|
197
|
-
// value is based on octez-client reveal operation gasLimit of each address type in
|
|
197
|
+
// value is based on octez-client reveal operation gasLimit of each address type in Seoul Protocol
|
|
198
198
|
const REVEAL_GAS_LIMIT = {
|
|
199
|
-
TZ1:
|
|
200
|
-
TZ2:
|
|
201
|
-
TZ3:
|
|
202
|
-
TZ4:
|
|
199
|
+
TZ1: 171,
|
|
200
|
+
TZ2: 157,
|
|
201
|
+
TZ3: 447,
|
|
202
|
+
TZ4: 3252,
|
|
203
203
|
};
|
|
204
|
-
// value is based on octez-client reveal operation fee of each address type in
|
|
204
|
+
// value is based on octez-client reveal operation fee of each address type in Seoul Protocol
|
|
205
205
|
const REVEAL_FEE = {
|
|
206
|
-
TZ1:
|
|
207
|
-
TZ2:
|
|
208
|
-
TZ3:
|
|
209
|
-
TZ4:
|
|
206
|
+
TZ1: 278,
|
|
207
|
+
TZ2: 277,
|
|
208
|
+
TZ3: 306,
|
|
209
|
+
TZ4: 736,
|
|
210
210
|
};
|
|
211
|
-
// value is based on octez-client reveal operation storageLimit of all address type in
|
|
211
|
+
// value is based on octez-client reveal operation storageLimit of all address type in Seoul Protocol
|
|
212
212
|
const REVEAL_STORAGE_LIMIT = 0;
|
|
213
|
-
// protocol constants in
|
|
213
|
+
// protocol constants in Seoul Protocol
|
|
214
214
|
const ORIGINATION_SIZE = 257;
|
|
215
|
-
// protocol constants in
|
|
215
|
+
// protocol constants in Seoul Protocol
|
|
216
216
|
const COST_PER_BYTE = 250;
|
|
217
217
|
var Protocols;
|
|
218
218
|
(function (Protocols) {
|
|
@@ -238,6 +238,7 @@ var Protocols;
|
|
|
238
238
|
Protocols["PsParisCZ"] = "PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi";
|
|
239
239
|
Protocols["PsQuebecn"] = "PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg";
|
|
240
240
|
Protocols["PsRiotuma"] = "PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7";
|
|
241
|
+
Protocols["PtSeouLou"] = "PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh";
|
|
241
242
|
Protocols["ProtoALpha"] = "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK";
|
|
242
243
|
})(Protocols || (Protocols = {}));
|
|
243
244
|
const protocols = {
|
|
@@ -259,7 +260,8 @@ const protocols = {
|
|
|
259
260
|
'020': [Protocols.PtParisBx, Protocols.PsParisCZ],
|
|
260
261
|
'021': [Protocols.PsQuebecn],
|
|
261
262
|
'022': [Protocols.PsRiotuma],
|
|
262
|
-
'023': [Protocols.
|
|
263
|
+
'023': [Protocols.PtSeouLou],
|
|
264
|
+
'024': [Protocols.ProtoALpha],
|
|
263
265
|
};
|
|
264
266
|
var ChainIds;
|
|
265
267
|
(function (ChainIds) {
|
|
@@ -283,8 +285,8 @@ var ChainIds;
|
|
|
283
285
|
ChainIds["PARISCNET"] = "NetXXWAHLEvre9b";
|
|
284
286
|
ChainIds["QUEBECNET"] = "NetXuTeGinLEqxp";
|
|
285
287
|
ChainIds["RIONET"] = "NetXPdgaoabtBth";
|
|
288
|
+
ChainIds["SEOULNET"] = "NetXd56aBs1aeW3";
|
|
286
289
|
})(ChainIds || (ChainIds = {}));
|
|
287
|
-
// A fixed fee reveal operation gasLimit accepted by both simulate and injection endpoint is between 1.2-5 times of actual gas consumption (3.5 fails occasionally with gas exhausted; 4 fails occasionally with fee too low)
|
|
288
290
|
const getRevealGasLimit = (address) => Math.round((getRevealGasLimitInternal(address) * 37) / 10);
|
|
289
291
|
const getRevealGasLimitInternal = (address) => {
|
|
290
292
|
switch (address.substring(0, 3)) {
|
|
@@ -310,7 +312,7 @@ const getRevealFeeInternal = (address) => {
|
|
|
310
312
|
case 'tz3':
|
|
311
313
|
return REVEAL_FEE.TZ3;
|
|
312
314
|
case 'tz4':
|
|
313
|
-
return REVEAL_FEE.TZ4;
|
|
315
|
+
return REVEAL_FEE.TZ4 * 1.7;
|
|
314
316
|
default:
|
|
315
317
|
throw new Error(`Cannot estimate reveal fee for ${address}`);
|
|
316
318
|
}
|
|
@@ -523,7 +525,7 @@ const createRegisterDelegateOperation = (_a, source_1) => __awaiter(void 0, [_a,
|
|
|
523
525
|
delegate: source,
|
|
524
526
|
};
|
|
525
527
|
});
|
|
526
|
-
const createRevealOperation = (_a, source_1, publicKey_1) => __awaiter(void 0, [_a, source_1, publicKey_1], void 0, function* ({ fee, gasLimit, storageLimit }, source, publicKey) {
|
|
528
|
+
const createRevealOperation = (_a, source_1, publicKey_1) => __awaiter(void 0, [_a, source_1, publicKey_1], void 0, function* ({ fee, gasLimit, storageLimit, proof }, source, publicKey) {
|
|
527
529
|
return {
|
|
528
530
|
kind: OpKind.REVEAL,
|
|
529
531
|
fee,
|
|
@@ -531,6 +533,7 @@ const createRevealOperation = (_a, source_1, publicKey_1) => __awaiter(void 0, [
|
|
|
531
533
|
source,
|
|
532
534
|
gas_limit: gasLimit !== null && gasLimit !== void 0 ? gasLimit : getRevealGasLimit(source),
|
|
533
535
|
storage_limit: storageLimit,
|
|
536
|
+
proof,
|
|
534
537
|
};
|
|
535
538
|
});
|
|
536
539
|
const createRegisterGlobalConstantOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ value, source, fee, gasLimit, storageLimit, }) {
|
|
@@ -592,7 +595,7 @@ const createProposalsOperation = (_a) => __awaiter(void 0, [_a], void 0, functio
|
|
|
592
595
|
proposals,
|
|
593
596
|
};
|
|
594
597
|
});
|
|
595
|
-
const createUpdateConsensusKeyOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, pk, }) {
|
|
598
|
+
const createUpdateConsensusKeyOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, pk, proof, }) {
|
|
596
599
|
return {
|
|
597
600
|
kind: OpKind.UPDATE_CONSENSUS_KEY,
|
|
598
601
|
source,
|
|
@@ -600,6 +603,18 @@ const createUpdateConsensusKeyOperation = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
600
603
|
gas_limit: gasLimit,
|
|
601
604
|
storage_limit: storageLimit,
|
|
602
605
|
pk,
|
|
606
|
+
proof,
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
const createUpdateCompanionKeyOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, pk, proof, }) {
|
|
610
|
+
return {
|
|
611
|
+
kind: OpKind.UPDATE_COMPANION_KEY,
|
|
612
|
+
source,
|
|
613
|
+
fee,
|
|
614
|
+
gas_limit: gasLimit,
|
|
615
|
+
storage_limit: storageLimit,
|
|
616
|
+
pk,
|
|
617
|
+
proof,
|
|
603
618
|
};
|
|
604
619
|
});
|
|
605
620
|
const createSmartRollupAddMessagesOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, message, }) {
|
|
@@ -652,7 +667,8 @@ const isKind = (op, kind) => {
|
|
|
652
667
|
return op.kind === kind;
|
|
653
668
|
};
|
|
654
669
|
const isOpWithGasBuffer = (op) => {
|
|
655
|
-
|
|
670
|
+
var _a;
|
|
671
|
+
if (op.kind === OpKind.TRANSACTION && ((_a = op.destination) === null || _a === void 0 ? void 0 : _a.startsWith('KT1'))) {
|
|
656
672
|
return true;
|
|
657
673
|
}
|
|
658
674
|
else {
|
|
@@ -661,6 +677,7 @@ const isOpWithGasBuffer = (op) => {
|
|
|
661
677
|
'register_global_constant',
|
|
662
678
|
'transfer_ticket',
|
|
663
679
|
'update_consensus_key',
|
|
680
|
+
'update_companion_key',
|
|
664
681
|
'smart_rollup_add_messages',
|
|
665
682
|
'smart_rollup_originate',
|
|
666
683
|
].indexOf(op.kind) !== -1);
|
|
@@ -676,6 +693,7 @@ const isOpWithFee = (op) => {
|
|
|
676
693
|
'increase_paid_storage',
|
|
677
694
|
'transfer_ticket',
|
|
678
695
|
'update_consensus_key',
|
|
696
|
+
'update_companion_key',
|
|
679
697
|
'smart_rollup_add_messages',
|
|
680
698
|
'smart_rollup_originate',
|
|
681
699
|
'smart_rollup_execute_outbox_message',
|
|
@@ -690,6 +708,7 @@ const isOpRequireReveal = (op) => {
|
|
|
690
708
|
'increase_paid_storage',
|
|
691
709
|
'transfer_ticket',
|
|
692
710
|
'update_consensus_key',
|
|
711
|
+
'update_companion_key',
|
|
693
712
|
'smart_rollup_add_messages',
|
|
694
713
|
'smart_rollup_originate',
|
|
695
714
|
'smart_rollup_execute_outbox_message',
|
|
@@ -1091,6 +1110,10 @@ class Provider {
|
|
|
1091
1110
|
return createRegisterGlobalConstantOperation(Object.assign({}, param));
|
|
1092
1111
|
case OpKind.INCREASE_PAID_STORAGE:
|
|
1093
1112
|
return createIncreasePaidStorageOperation(Object.assign({}, param));
|
|
1113
|
+
case OpKind.UPDATE_CONSENSUS_KEY:
|
|
1114
|
+
return createUpdateConsensusKeyOperation(Object.assign({}, param));
|
|
1115
|
+
case OpKind.UPDATE_COMPANION_KEY:
|
|
1116
|
+
return createUpdateCompanionKeyOperation(Object.assign({}, param));
|
|
1094
1117
|
case OpKind.TRANSFER_TICKET:
|
|
1095
1118
|
return createTransferTicketOperation(Object.assign({}, param));
|
|
1096
1119
|
case OpKind.SMART_ROLLUP_ADD_MESSAGES:
|
|
@@ -1185,7 +1208,7 @@ class WalletOperationBatch {
|
|
|
1185
1208
|
withTransfer(params) {
|
|
1186
1209
|
const toValidation = validateAddress(params.to);
|
|
1187
1210
|
if (toValidation !== ValidationResult.VALID) {
|
|
1188
|
-
throw new InvalidAddressError(params.to,
|
|
1211
|
+
throw new InvalidAddressError(params.to, toValidation);
|
|
1189
1212
|
}
|
|
1190
1213
|
this.operations.push(Object.assign({ kind: OpKind.TRANSACTION }, params));
|
|
1191
1214
|
return this;
|
|
@@ -1206,7 +1229,7 @@ class WalletOperationBatch {
|
|
|
1206
1229
|
var _a;
|
|
1207
1230
|
const delegateValidation = validateAddress((_a = params.delegate) !== null && _a !== void 0 ? _a : '');
|
|
1208
1231
|
if (params.delegate && delegateValidation !== ValidationResult.VALID) {
|
|
1209
|
-
throw new InvalidAddressError(params.delegate,
|
|
1232
|
+
throw new InvalidAddressError(params.delegate, delegateValidation);
|
|
1210
1233
|
}
|
|
1211
1234
|
this.operations.push(Object.assign({ kind: OpKind.DELEGATION }, params));
|
|
1212
1235
|
return this;
|
|
@@ -1226,7 +1249,7 @@ class WalletOperationBatch {
|
|
|
1226
1249
|
withIncreasePaidStorage(params) {
|
|
1227
1250
|
const destinationValidation = validateAddress(params.destination);
|
|
1228
1251
|
if (destinationValidation !== ValidationResult.VALID) {
|
|
1229
|
-
throw new InvalidAddressError(params.destination,
|
|
1252
|
+
throw new InvalidAddressError(params.destination, destinationValidation);
|
|
1230
1253
|
}
|
|
1231
1254
|
this.operations.push(Object.assign({ kind: OpKind.INCREASE_PAID_STORAGE }, params));
|
|
1232
1255
|
return this;
|
|
@@ -1238,7 +1261,7 @@ class WalletOperationBatch {
|
|
|
1238
1261
|
withTransferTicket(params) {
|
|
1239
1262
|
const destinationValidation = validateAddress(params.destination);
|
|
1240
1263
|
if (destinationValidation !== ValidationResult.VALID) {
|
|
1241
|
-
throw new InvalidAddressError(params.destination,
|
|
1264
|
+
throw new InvalidAddressError(params.destination, destinationValidation);
|
|
1242
1265
|
}
|
|
1243
1266
|
this.operations.push(Object.assign({ kind: OpKind.TRANSFER_TICKET }, params));
|
|
1244
1267
|
return this;
|
|
@@ -1360,7 +1383,7 @@ class Wallet {
|
|
|
1360
1383
|
var _a;
|
|
1361
1384
|
const delegateValidation = validateAddress((_a = params.delegate) !== null && _a !== void 0 ? _a : '');
|
|
1362
1385
|
if (params.delegate && delegateValidation !== ValidationResult.VALID) {
|
|
1363
|
-
throw new InvalidAddressError(params.delegate,
|
|
1386
|
+
throw new InvalidAddressError(params.delegate, delegateValidation);
|
|
1364
1387
|
}
|
|
1365
1388
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
1366
1389
|
const mappedParams = yield this.walletProvider.mapDelegateParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -1422,7 +1445,7 @@ class Wallet {
|
|
|
1422
1445
|
transfer(params) {
|
|
1423
1446
|
const toValidation = validateAddress(params.to);
|
|
1424
1447
|
if (toValidation !== ValidationResult.VALID) {
|
|
1425
|
-
throw new InvalidAddressError(params.to,
|
|
1448
|
+
throw new InvalidAddressError(params.to, toValidation);
|
|
1426
1449
|
}
|
|
1427
1450
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
1428
1451
|
const mappedParams = yield this.walletProvider.mapTransferParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -1438,7 +1461,7 @@ class Wallet {
|
|
|
1438
1461
|
transferTicket(params) {
|
|
1439
1462
|
const toValidation = validateAddress(params.destination);
|
|
1440
1463
|
if (toValidation !== ValidationResult.VALID) {
|
|
1441
|
-
throw new InvalidAddressError(params.destination,
|
|
1464
|
+
throw new InvalidAddressError(params.destination, toValidation);
|
|
1442
1465
|
}
|
|
1443
1466
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
1444
1467
|
const mappedParams = yield this.walletProvider.mapTransferTicketParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -1504,9 +1527,6 @@ class Wallet {
|
|
|
1504
1527
|
if (!params.to) {
|
|
1505
1528
|
params.to = source;
|
|
1506
1529
|
}
|
|
1507
|
-
if (params.to !== source) {
|
|
1508
|
-
throw new InvalidStakingAddressError(params.to);
|
|
1509
|
-
}
|
|
1510
1530
|
if (!params.amount) {
|
|
1511
1531
|
params.amount = 0;
|
|
1512
1532
|
}
|
|
@@ -1528,7 +1548,7 @@ class Wallet {
|
|
|
1528
1548
|
increasePaidStorage(params) {
|
|
1529
1549
|
const destinationValidation = validateAddress(params.destination);
|
|
1530
1550
|
if (destinationValidation !== ValidationResult.VALID) {
|
|
1531
|
-
throw new InvalidAddressError(params.destination,
|
|
1551
|
+
throw new InvalidAddressError(params.destination, destinationValidation);
|
|
1532
1552
|
}
|
|
1533
1553
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
1534
1554
|
const mappedParams = yield this.walletProvider.mapIncreasePaidStorageWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -1558,7 +1578,7 @@ class Wallet {
|
|
|
1558
1578
|
return __awaiter(this, arguments, void 0, function* (address, contractAbstractionComposer = (x) => x) {
|
|
1559
1579
|
const addressValidation = validateContractAddress(address);
|
|
1560
1580
|
if (addressValidation !== ValidationResult.VALID) {
|
|
1561
|
-
throw new InvalidContractAddressError(address,
|
|
1581
|
+
throw new InvalidContractAddressError(address, addressValidation);
|
|
1562
1582
|
}
|
|
1563
1583
|
const rpc = this.context.withExtensions().rpc;
|
|
1564
1584
|
const readProvider = this.context.withExtensions().readProvider;
|
|
@@ -1684,7 +1704,7 @@ class WalletOperation {
|
|
|
1684
1704
|
connector: () => new ReplaySubject(1),
|
|
1685
1705
|
resetOnError: false,
|
|
1686
1706
|
resetOnComplete: false,
|
|
1687
|
-
resetOnRefCountZero:
|
|
1707
|
+
resetOnRefCountZero: true,
|
|
1688
1708
|
}));
|
|
1689
1709
|
// Observable that emit once operation is seen in a block
|
|
1690
1710
|
this.confirmed$ = this.newHead$.pipe(map((head) => {
|
|
@@ -1705,7 +1725,7 @@ class WalletOperation {
|
|
|
1705
1725
|
connector: () => new ReplaySubject(1),
|
|
1706
1726
|
resetOnError: false,
|
|
1707
1727
|
resetOnComplete: false,
|
|
1708
|
-
resetOnRefCountZero:
|
|
1728
|
+
resetOnRefCountZero: true,
|
|
1709
1729
|
}));
|
|
1710
1730
|
if (validateOperation(this.opHash) !== ValidationResult.VALID) {
|
|
1711
1731
|
throw new InvalidOperationHashError(this.opHash);
|
|
@@ -2306,7 +2326,7 @@ class ContractView {
|
|
|
2306
2326
|
throw new DeprecationError(`Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.`);
|
|
2307
2327
|
}
|
|
2308
2328
|
else if (chainId && chainIdValidation !== ValidationResult.VALID) {
|
|
2309
|
-
throw new InvalidChainIdError(chainId,
|
|
2329
|
+
throw new InvalidChainIdError(chainId, chainIdValidation);
|
|
2310
2330
|
}
|
|
2311
2331
|
const arg = this.parameterSchema.Encode(...this.args);
|
|
2312
2332
|
const result = yield this.rpc.runView({
|
|
@@ -2744,10 +2764,14 @@ class PrepareProvider extends Provider {
|
|
|
2744
2764
|
if (!publicKey) {
|
|
2745
2765
|
throw new PublicKeyNotFoundError(pkh);
|
|
2746
2766
|
}
|
|
2767
|
+
const [, pkhPrefix] = b58DecodeAndCheckPrefix(pkh, publicKeyHashPrefixes);
|
|
2747
2768
|
ops.unshift(yield createRevealOperation({
|
|
2748
2769
|
fee: getRevealFee(pkh),
|
|
2749
2770
|
storageLimit: REVEAL_STORAGE_LIMIT,
|
|
2750
2771
|
gasLimit: getRevealGasLimit(pkh),
|
|
2772
|
+
proof: pkhPrefix === PrefixV2.BLS12_381PublicKeyHash
|
|
2773
|
+
? (yield this.signer.provePossession()).prefixSig
|
|
2774
|
+
: undefined,
|
|
2751
2775
|
}, publicKeyHash, publicKey));
|
|
2752
2776
|
return ops;
|
|
2753
2777
|
}
|
|
@@ -2793,6 +2817,7 @@ class PrepareProvider extends Provider {
|
|
|
2793
2817
|
case OpKind.DELEGATION:
|
|
2794
2818
|
case OpKind.REGISTER_GLOBAL_CONSTANT:
|
|
2795
2819
|
case OpKind.UPDATE_CONSENSUS_KEY:
|
|
2820
|
+
case OpKind.UPDATE_COMPANION_KEY:
|
|
2796
2821
|
case OpKind.SMART_ROLLUP_ADD_MESSAGES:
|
|
2797
2822
|
case OpKind.SMART_ROLLUP_ORIGINATE:
|
|
2798
2823
|
case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:
|
|
@@ -2853,11 +2878,26 @@ class PrepareProvider extends Provider {
|
|
|
2853
2878
|
* @returns a PreparedOperation object
|
|
2854
2879
|
*/
|
|
2855
2880
|
reveal(_a) {
|
|
2856
|
-
return __awaiter(this, arguments, void 0, function* ({ fee, gasLimit, storageLimit }) {
|
|
2881
|
+
return __awaiter(this, arguments, void 0, function* ({ fee, gasLimit, storageLimit, proof }) {
|
|
2857
2882
|
const { pkh, publicKey } = yield this.getKeys();
|
|
2858
2883
|
if (!publicKey) {
|
|
2859
2884
|
throw new PublicKeyNotFoundError(pkh);
|
|
2860
2885
|
}
|
|
2886
|
+
const [, pkhPrefix] = b58DecodeAndCheckPrefix(pkh, publicKeyHashPrefixes);
|
|
2887
|
+
if (pkhPrefix === PrefixV2.BLS12_381PublicKeyHash) {
|
|
2888
|
+
if (proof) {
|
|
2889
|
+
b58DecodeAndCheckPrefix(proof, [PrefixV2.BLS12_381Signature]); // validate proof to be a bls signature
|
|
2890
|
+
}
|
|
2891
|
+
else {
|
|
2892
|
+
const { prefixSig } = yield this.signer.provePossession();
|
|
2893
|
+
proof = prefixSig;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
else {
|
|
2897
|
+
if (proof) {
|
|
2898
|
+
throw new ProhibitedActionError('Proof field is only allowed to reveal a bls account ');
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2861
2901
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
2862
2902
|
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
2863
2903
|
const mergedEstimates = mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS);
|
|
@@ -2865,6 +2905,7 @@ class PrepareProvider extends Provider {
|
|
|
2865
2905
|
fee: mergedEstimates.fee,
|
|
2866
2906
|
gasLimit: mergedEstimates.gasLimit,
|
|
2867
2907
|
storageLimit: mergedEstimates.storageLimit,
|
|
2908
|
+
proof,
|
|
2868
2909
|
}, pkh, publicKey);
|
|
2869
2910
|
const ops = this.convertIntoArray(op);
|
|
2870
2911
|
const hash = yield this.getBlockHash();
|
|
@@ -3023,11 +3064,11 @@ class PrepareProvider extends Provider {
|
|
|
3023
3064
|
*/
|
|
3024
3065
|
finalizeUnstake(_a) {
|
|
3025
3066
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3026
|
-
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
3067
|
+
var { fee, storageLimit, gasLimit, to } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit", "to"]);
|
|
3027
3068
|
const { pkh } = yield this.getKeys();
|
|
3028
3069
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
3029
3070
|
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
3030
|
-
const op = yield createTransferOperation(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: pkh, amount: 0 }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
|
|
3071
|
+
const op = yield createTransferOperation(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: to ? to : pkh, amount: 0 }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
|
|
3031
3072
|
entrypoint: 'finalize_unstake',
|
|
3032
3073
|
value: { prim: 'Unit' },
|
|
3033
3074
|
} }));
|
|
@@ -3156,6 +3197,17 @@ class PrepareProvider extends Provider {
|
|
|
3156
3197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3157
3198
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
3158
3199
|
const { pkh } = yield this.getKeys();
|
|
3200
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(rest.pk, publicKeyPrefixes);
|
|
3201
|
+
if (pkPrefix === PrefixV2.BLS12_381PublicKey) {
|
|
3202
|
+
if (!rest.proof) {
|
|
3203
|
+
throw new InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
else {
|
|
3207
|
+
if (rest.proof) {
|
|
3208
|
+
throw new ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3159
3211
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
3160
3212
|
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
3161
3213
|
const op = yield createUpdateConsensusKeyOperation(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)));
|
|
@@ -3176,6 +3228,44 @@ class PrepareProvider extends Provider {
|
|
|
3176
3228
|
};
|
|
3177
3229
|
});
|
|
3178
3230
|
}
|
|
3231
|
+
/**
|
|
3232
|
+
*
|
|
3233
|
+
* @description Method to prepare an update_companion_key operation
|
|
3234
|
+
* @param operation RPCOperation object or RPCOperation array
|
|
3235
|
+
* @param source string or undefined source pkh
|
|
3236
|
+
* @returns a PreparedOperation object
|
|
3237
|
+
*/
|
|
3238
|
+
updateCompanionKey(_a, source) {
|
|
3239
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3240
|
+
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
3241
|
+
const { pkh } = yield this.getKeys();
|
|
3242
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(rest.pk, publicKeyPrefixes);
|
|
3243
|
+
if (pkPrefix !== PrefixV2.BLS12_381PublicKey) {
|
|
3244
|
+
throw new ProhibitedActionError('companion key must be a bls account');
|
|
3245
|
+
}
|
|
3246
|
+
if (!rest.proof) {
|
|
3247
|
+
throw new InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
3248
|
+
}
|
|
3249
|
+
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
3250
|
+
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
3251
|
+
const op = yield createUpdateCompanionKeyOperation(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)));
|
|
3252
|
+
const operation = yield this.addRevealOperationIfNeeded(op, pkh);
|
|
3253
|
+
const ops = this.convertIntoArray(operation);
|
|
3254
|
+
const hash = yield this.getBlockHash();
|
|
3255
|
+
const protocol = yield this.getProtocolHash();
|
|
3256
|
+
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
3257
|
+
const headCounter = parseInt(yield this.getHeadCounter(pkh), 10);
|
|
3258
|
+
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
3259
|
+
return {
|
|
3260
|
+
opOb: {
|
|
3261
|
+
branch: hash,
|
|
3262
|
+
contents,
|
|
3263
|
+
protocol,
|
|
3264
|
+
},
|
|
3265
|
+
counter: headCounter,
|
|
3266
|
+
};
|
|
3267
|
+
});
|
|
3268
|
+
}
|
|
3179
3269
|
/**
|
|
3180
3270
|
*
|
|
3181
3271
|
* @description Method to prepare an increase_paid_storage operation
|
|
@@ -3466,10 +3556,14 @@ class PrepareProvider extends Provider {
|
|
|
3466
3556
|
if (!publicKey) {
|
|
3467
3557
|
throw new PublicKeyNotFoundError(pkh);
|
|
3468
3558
|
}
|
|
3559
|
+
const [, pkhPrefix] = b58DecodeAndCheckPrefix(pkh, publicKeyHashPrefixes);
|
|
3469
3560
|
ops.unshift(yield createRevealOperation({
|
|
3470
3561
|
fee: getRevealFee(pkh),
|
|
3471
3562
|
storageLimit: REVEAL_STORAGE_LIMIT,
|
|
3472
3563
|
gasLimit: getRevealGasLimit(pkh),
|
|
3564
|
+
proof: pkhPrefix === PrefixV2.BLS12_381PublicKeyHash
|
|
3565
|
+
? (yield this.signer.provePossession()).prefixSig
|
|
3566
|
+
: undefined,
|
|
3473
3567
|
}, pkh, publicKey));
|
|
3474
3568
|
}
|
|
3475
3569
|
const hash = yield this.getBlockHash();
|
|
@@ -3586,7 +3680,7 @@ class OperationBatch extends Provider {
|
|
|
3586
3680
|
throw new InvalidAmountError(params.amount.toString());
|
|
3587
3681
|
}
|
|
3588
3682
|
if (toValidation !== ValidationResult.VALID) {
|
|
3589
|
-
throw new InvalidAddressError(params.to,
|
|
3683
|
+
throw new InvalidAddressError(params.to, toValidation);
|
|
3590
3684
|
}
|
|
3591
3685
|
this.operations.push(Object.assign({ kind: OpKind.TRANSACTION }, params));
|
|
3592
3686
|
return this;
|
|
@@ -3600,7 +3694,7 @@ class OperationBatch extends Provider {
|
|
|
3600
3694
|
withTransferTicket(params) {
|
|
3601
3695
|
const destinationValidation = validateAddress(params.destination);
|
|
3602
3696
|
if (destinationValidation !== ValidationResult.VALID) {
|
|
3603
|
-
throw new InvalidAddressError(params.destination,
|
|
3697
|
+
throw new InvalidAddressError(params.destination, destinationValidation);
|
|
3604
3698
|
}
|
|
3605
3699
|
this.operations.push(Object.assign({ kind: OpKind.TRANSFER_TICKET }, params));
|
|
3606
3700
|
return this;
|
|
@@ -3625,11 +3719,11 @@ class OperationBatch extends Provider {
|
|
|
3625
3719
|
var _a;
|
|
3626
3720
|
const sourceValidation = validateAddress(params.source);
|
|
3627
3721
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
3628
|
-
throw new InvalidAddressError(params.source,
|
|
3722
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
3629
3723
|
}
|
|
3630
3724
|
const delegateValidation = validateAddress((_a = params.delegate) !== null && _a !== void 0 ? _a : '');
|
|
3631
3725
|
if (params.delegate && delegateValidation !== ValidationResult.VALID) {
|
|
3632
|
-
throw new InvalidAddressError(params.delegate,
|
|
3726
|
+
throw new InvalidAddressError(params.delegate, delegateValidation);
|
|
3633
3727
|
}
|
|
3634
3728
|
this.operations.push(Object.assign({ kind: OpKind.DELEGATION }, params));
|
|
3635
3729
|
return this;
|
|
@@ -3644,7 +3738,7 @@ class OperationBatch extends Provider {
|
|
|
3644
3738
|
withActivation({ pkh, secret }) {
|
|
3645
3739
|
const pkhValidation = validateKeyHash(pkh);
|
|
3646
3740
|
if (pkhValidation !== ValidationResult.VALID) {
|
|
3647
|
-
throw new InvalidKeyHashError(pkh,
|
|
3741
|
+
throw new InvalidKeyHashError(pkh, pkhValidation);
|
|
3648
3742
|
}
|
|
3649
3743
|
this.operations.push({ kind: OpKind.ACTIVATION, pkh, secret });
|
|
3650
3744
|
return this;
|
|
@@ -3679,6 +3773,44 @@ class OperationBatch extends Provider {
|
|
|
3679
3773
|
this.operations.push(Object.assign({ kind: OpKind.INCREASE_PAID_STORAGE }, params));
|
|
3680
3774
|
return this;
|
|
3681
3775
|
}
|
|
3776
|
+
/**
|
|
3777
|
+
*
|
|
3778
|
+
* @description Add a update consensus key operation to the batch
|
|
3779
|
+
*
|
|
3780
|
+
* @param params UpdateConsensusKey operation parameter
|
|
3781
|
+
*/
|
|
3782
|
+
withUpdateConsensusKey(params) {
|
|
3783
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(params.pk, publicKeyPrefixes);
|
|
3784
|
+
if (pkPrefix === PrefixV2.BLS12_381PublicKey) {
|
|
3785
|
+
if (!params.proof) {
|
|
3786
|
+
throw new InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
else {
|
|
3790
|
+
if (params.proof) {
|
|
3791
|
+
throw new ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
this.operations.push(Object.assign({ kind: OpKind.UPDATE_CONSENSUS_KEY }, params));
|
|
3795
|
+
return this;
|
|
3796
|
+
}
|
|
3797
|
+
/**
|
|
3798
|
+
*
|
|
3799
|
+
* @description Add a update companion key operation to the batch
|
|
3800
|
+
*
|
|
3801
|
+
* @param params UpdateCompanionKey operation parameter
|
|
3802
|
+
*/
|
|
3803
|
+
withUpdateCompanionKey(params) {
|
|
3804
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(params.pk, publicKeyPrefixes);
|
|
3805
|
+
if (pkPrefix !== PrefixV2.BLS12_381PublicKey) {
|
|
3806
|
+
throw new ProhibitedActionError('companion key must be a bls account');
|
|
3807
|
+
}
|
|
3808
|
+
if (!params.proof) {
|
|
3809
|
+
throw new InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
3810
|
+
}
|
|
3811
|
+
this.operations.push(Object.assign({ kind: OpKind.UPDATE_COMPANION_KEY }, params));
|
|
3812
|
+
return this;
|
|
3813
|
+
}
|
|
3682
3814
|
/**
|
|
3683
3815
|
*
|
|
3684
3816
|
* @description Add a smart rollup add messages operation to the batch
|
|
@@ -3722,6 +3854,10 @@ class OperationBatch extends Provider {
|
|
|
3722
3854
|
return createRegisterGlobalConstantOperation(Object.assign({}, param));
|
|
3723
3855
|
case OpKind.INCREASE_PAID_STORAGE:
|
|
3724
3856
|
return createIncreasePaidStorageOperation(Object.assign({}, param));
|
|
3857
|
+
case OpKind.UPDATE_CONSENSUS_KEY:
|
|
3858
|
+
return createUpdateConsensusKeyOperation(Object.assign({}, param));
|
|
3859
|
+
case OpKind.UPDATE_COMPANION_KEY:
|
|
3860
|
+
return createUpdateCompanionKeyOperation(Object.assign({}, param));
|
|
3725
3861
|
case OpKind.TRANSFER_TICKET:
|
|
3726
3862
|
return createTransferTicketOperation(Object.assign({}, param));
|
|
3727
3863
|
case OpKind.SMART_ROLLUP_ADD_MESSAGES:
|
|
@@ -3936,7 +4072,7 @@ const createNewPollingBasedHeadObservable = (sharedHeadOb, context, _scheduler)
|
|
|
3936
4072
|
connector: () => new ReplaySubject(1),
|
|
3937
4073
|
resetOnError: false,
|
|
3938
4074
|
resetOnComplete: false,
|
|
3939
|
-
resetOnRefCountZero:
|
|
4075
|
+
resetOnRefCountZero: true,
|
|
3940
4076
|
}));
|
|
3941
4077
|
};
|
|
3942
4078
|
class OperationFactory {
|
|
@@ -4018,7 +4154,7 @@ class RpcTzProvider extends Provider {
|
|
|
4018
4154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4019
4155
|
const addressValidation = validateAddress(address);
|
|
4020
4156
|
if (addressValidation !== ValidationResult.VALID) {
|
|
4021
|
-
throw new InvalidAddressError(address,
|
|
4157
|
+
throw new InvalidAddressError(address, addressValidation);
|
|
4022
4158
|
}
|
|
4023
4159
|
return this.context.readProvider.getBalance(address, 'head');
|
|
4024
4160
|
});
|
|
@@ -4027,7 +4163,7 @@ class RpcTzProvider extends Provider {
|
|
|
4027
4163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4028
4164
|
const addressValidation = validateAddress(address);
|
|
4029
4165
|
if (addressValidation !== ValidationResult.VALID) {
|
|
4030
|
-
throw new InvalidAddressError(address,
|
|
4166
|
+
throw new InvalidAddressError(address, addressValidation);
|
|
4031
4167
|
}
|
|
4032
4168
|
return this.context.readProvider.getSpendable(address, 'head');
|
|
4033
4169
|
});
|
|
@@ -4036,7 +4172,7 @@ class RpcTzProvider extends Provider {
|
|
|
4036
4172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4037
4173
|
const addressValidation = validateAddress(address);
|
|
4038
4174
|
if (addressValidation !== ValidationResult.VALID) {
|
|
4039
|
-
throw new InvalidAddressError(address,
|
|
4175
|
+
throw new InvalidAddressError(address, addressValidation);
|
|
4040
4176
|
}
|
|
4041
4177
|
return this.context.readProvider.getDelegate(address, 'head');
|
|
4042
4178
|
});
|
|
@@ -4045,7 +4181,7 @@ class RpcTzProvider extends Provider {
|
|
|
4045
4181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4046
4182
|
const pkhValidation = validateKeyHash(pkh);
|
|
4047
4183
|
if (pkhValidation !== ValidationResult.VALID) {
|
|
4048
|
-
throw new InvalidKeyHashError$1(pkh,
|
|
4184
|
+
throw new InvalidKeyHashError$1(pkh, pkhValidation);
|
|
4049
4185
|
}
|
|
4050
4186
|
const prepared = yield this.prepare.activate({ pkh, secret });
|
|
4051
4187
|
const forgedBytes = yield this.forge(prepared);
|
|
@@ -4199,7 +4335,8 @@ const STUB_SIGNATURE = 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfL
|
|
|
4199
4335
|
class RPCEstimateProvider extends Provider {
|
|
4200
4336
|
constructor() {
|
|
4201
4337
|
super(...arguments);
|
|
4202
|
-
this.
|
|
4338
|
+
this.REVEAL_LENGTH = 324; // injecting size tz1=320, tz2=322, tz3=322
|
|
4339
|
+
this.REVEAL_LENGTH_TZ4 = 622; // injecting size tz4=620
|
|
4203
4340
|
this.MILLIGAS_BUFFER = 100 * 1000; // 100 buffer depends on operation kind
|
|
4204
4341
|
this.STORAGE_BUFFER = 20; // according to octez-client
|
|
4205
4342
|
this.prepare = new PrepareProvider(this.context);
|
|
@@ -4281,9 +4418,20 @@ class RPCEstimateProvider extends Provider {
|
|
|
4281
4418
|
: op.opOb.contents.length;
|
|
4282
4419
|
}
|
|
4283
4420
|
return opResponse.contents.map((x) => {
|
|
4421
|
+
const content = x;
|
|
4422
|
+
content.source = content.source || '';
|
|
4423
|
+
let revealSize, eachOpSize;
|
|
4424
|
+
if (content.source.startsWith(PrefixV2.BLS12_381PublicKeyHash)) {
|
|
4425
|
+
revealSize = this.REVEAL_LENGTH_TZ4 / 2;
|
|
4426
|
+
eachOpSize = (opbytes.length / 2 + payloadLength[PrefixV2.BLS12_381Signature]) / numberOfOps;
|
|
4427
|
+
}
|
|
4428
|
+
else {
|
|
4429
|
+
revealSize = this.REVEAL_LENGTH / 2;
|
|
4430
|
+
eachOpSize = (opbytes.length / 2 + payloadLength[PrefixV2.Ed25519Signature]) / numberOfOps;
|
|
4431
|
+
}
|
|
4284
4432
|
return this.getEstimationPropertiesFromOperationContent(x,
|
|
4285
4433
|
// diff between estimated and injecting OP_SIZE is 124-126, we added buffer to use 130
|
|
4286
|
-
x.kind === 'reveal' ?
|
|
4434
|
+
x.kind === 'reveal' ? revealSize : eachOpSize, cost_per_byte, origination_size !== null && origination_size !== void 0 ? origination_size : 257 // protocol constants
|
|
4287
4435
|
);
|
|
4288
4436
|
});
|
|
4289
4437
|
});
|
|
@@ -4302,8 +4450,11 @@ class RPCEstimateProvider extends Provider {
|
|
|
4302
4450
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
4303
4451
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4304
4452
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4453
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4454
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4455
|
+
: this.REVEAL_LENGTH / 2;
|
|
4305
4456
|
estimateProperties.shift();
|
|
4306
|
-
estimateProperties[0].opSize -=
|
|
4457
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4307
4458
|
}
|
|
4308
4459
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4309
4460
|
});
|
|
@@ -4322,11 +4473,11 @@ class RPCEstimateProvider extends Provider {
|
|
|
4322
4473
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
4323
4474
|
const toValidation = validateAddress(rest.to);
|
|
4324
4475
|
if (toValidation !== ValidationResult.VALID) {
|
|
4325
|
-
throw new InvalidAddressError(rest.to,
|
|
4476
|
+
throw new InvalidAddressError(rest.to, toValidation);
|
|
4326
4477
|
}
|
|
4327
4478
|
const sourceValidation = validateAddress((_b = rest.source) !== null && _b !== void 0 ? _b : '');
|
|
4328
4479
|
if (rest.source && sourceValidation !== ValidationResult.VALID) {
|
|
4329
|
-
throw new InvalidAddressError(rest.source,
|
|
4480
|
+
throw new InvalidAddressError(rest.source, sourceValidation);
|
|
4330
4481
|
}
|
|
4331
4482
|
if (rest.amount < 0) {
|
|
4332
4483
|
throw new InvalidAmountError(rest.amount.toString());
|
|
@@ -4337,8 +4488,11 @@ class RPCEstimateProvider extends Provider {
|
|
|
4337
4488
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
4338
4489
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4339
4490
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4491
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4492
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4493
|
+
: this.REVEAL_LENGTH / 2;
|
|
4340
4494
|
estimateProperties.shift();
|
|
4341
|
-
estimateProperties[0].opSize -=
|
|
4495
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4342
4496
|
}
|
|
4343
4497
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4344
4498
|
});
|
|
@@ -4357,7 +4511,7 @@ class RPCEstimateProvider extends Provider {
|
|
|
4357
4511
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
4358
4512
|
const sourceValidation = validateAddress((_b = rest.source) !== null && _b !== void 0 ? _b : '');
|
|
4359
4513
|
if (rest.source && sourceValidation !== ValidationResult.VALID) {
|
|
4360
|
-
throw new InvalidAddressError(rest.source,
|
|
4514
|
+
throw new InvalidAddressError(rest.source, sourceValidation);
|
|
4361
4515
|
}
|
|
4362
4516
|
if (!rest.to) {
|
|
4363
4517
|
rest.to = rest.source;
|
|
@@ -4375,7 +4529,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4375
4529
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4376
4530
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4377
4531
|
estimateProperties.shift();
|
|
4378
|
-
|
|
4532
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4533
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4534
|
+
: this.REVEAL_LENGTH / 2;
|
|
4535
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4379
4536
|
}
|
|
4380
4537
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4381
4538
|
});
|
|
@@ -4394,7 +4551,7 @@ class RPCEstimateProvider extends Provider {
|
|
|
4394
4551
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
4395
4552
|
const sourceValidation = validateAddress((_b = rest.source) !== null && _b !== void 0 ? _b : '');
|
|
4396
4553
|
if (rest.source && sourceValidation !== ValidationResult.VALID) {
|
|
4397
|
-
throw new InvalidAddressError(rest.source,
|
|
4554
|
+
throw new InvalidAddressError(rest.source, sourceValidation);
|
|
4398
4555
|
}
|
|
4399
4556
|
if (!rest.to) {
|
|
4400
4557
|
rest.to = rest.source;
|
|
@@ -4412,7 +4569,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4412
4569
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4413
4570
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4414
4571
|
estimateProperties.shift();
|
|
4415
|
-
|
|
4572
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4573
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4574
|
+
: this.REVEAL_LENGTH / 2;
|
|
4575
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4416
4576
|
}
|
|
4417
4577
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4418
4578
|
});
|
|
@@ -4431,14 +4591,11 @@ class RPCEstimateProvider extends Provider {
|
|
|
4431
4591
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
4432
4592
|
const sourceValidation = validateAddress((_b = rest.source) !== null && _b !== void 0 ? _b : '');
|
|
4433
4593
|
if (rest.source && sourceValidation !== ValidationResult.VALID) {
|
|
4434
|
-
throw new InvalidAddressError(rest.source,
|
|
4594
|
+
throw new InvalidAddressError(rest.source, sourceValidation);
|
|
4435
4595
|
}
|
|
4436
4596
|
if (!rest.to) {
|
|
4437
4597
|
rest.to = rest.source;
|
|
4438
4598
|
}
|
|
4439
|
-
if (rest.to && rest.to !== rest.source) {
|
|
4440
|
-
throw new InvalidStakingAddressError(rest.to);
|
|
4441
|
-
}
|
|
4442
4599
|
if (!rest.amount) {
|
|
4443
4600
|
rest.amount = 0;
|
|
4444
4601
|
}
|
|
@@ -4452,7 +4609,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4452
4609
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4453
4610
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4454
4611
|
estimateProperties.shift();
|
|
4455
|
-
|
|
4612
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4613
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4614
|
+
: this.REVEAL_LENGTH / 2;
|
|
4615
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4456
4616
|
}
|
|
4457
4617
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4458
4618
|
});
|
|
@@ -4471,11 +4631,11 @@ class RPCEstimateProvider extends Provider {
|
|
|
4471
4631
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
4472
4632
|
const destinationValidation = validateAddress(rest.destination);
|
|
4473
4633
|
if (destinationValidation !== ValidationResult.VALID) {
|
|
4474
|
-
throw new InvalidAddressError(rest.destination,
|
|
4634
|
+
throw new InvalidAddressError(rest.destination, destinationValidation);
|
|
4475
4635
|
}
|
|
4476
4636
|
const sourceValidation = validateAddress((_b = rest.source) !== null && _b !== void 0 ? _b : '');
|
|
4477
4637
|
if (rest.source && sourceValidation !== ValidationResult.VALID) {
|
|
4478
|
-
throw new InvalidAddressError(rest.source,
|
|
4638
|
+
throw new InvalidAddressError(rest.source, sourceValidation);
|
|
4479
4639
|
}
|
|
4480
4640
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
4481
4641
|
const preparedOperation = yield this.prepare.transferTicket(Object.assign({ fee,
|
|
@@ -4484,7 +4644,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4484
4644
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4485
4645
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4486
4646
|
estimateProperties.shift();
|
|
4487
|
-
|
|
4647
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4648
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4649
|
+
: this.REVEAL_LENGTH / 2;
|
|
4650
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4488
4651
|
}
|
|
4489
4652
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4490
4653
|
});
|
|
@@ -4503,11 +4666,11 @@ class RPCEstimateProvider extends Provider {
|
|
|
4503
4666
|
var { fee, gasLimit, storageLimit } = _a, rest = __rest(_a, ["fee", "gasLimit", "storageLimit"]);
|
|
4504
4667
|
const sourceValidation = validateAddress(rest.source);
|
|
4505
4668
|
if (rest.source && sourceValidation !== ValidationResult.VALID) {
|
|
4506
|
-
throw new InvalidAddressError(rest.source,
|
|
4669
|
+
throw new InvalidAddressError(rest.source, sourceValidation);
|
|
4507
4670
|
}
|
|
4508
4671
|
const delegateValidation = validateAddress((_b = rest.delegate) !== null && _b !== void 0 ? _b : '');
|
|
4509
4672
|
if (rest.delegate && delegateValidation !== ValidationResult.VALID) {
|
|
4510
|
-
throw new InvalidAddressError(rest.delegate,
|
|
4673
|
+
throw new InvalidAddressError(rest.delegate, delegateValidation);
|
|
4511
4674
|
}
|
|
4512
4675
|
const preparedOperation = yield this.prepare.delegation(Object.assign({ fee,
|
|
4513
4676
|
storageLimit,
|
|
@@ -4516,7 +4679,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4516
4679
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4517
4680
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4518
4681
|
estimateProperties.shift();
|
|
4519
|
-
|
|
4682
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4683
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4684
|
+
: this.REVEAL_LENGTH / 2;
|
|
4685
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4520
4686
|
}
|
|
4521
4687
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4522
4688
|
});
|
|
@@ -4553,7 +4719,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4553
4719
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4554
4720
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4555
4721
|
estimateProperties.shift();
|
|
4556
|
-
|
|
4722
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4723
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4724
|
+
: this.REVEAL_LENGTH / 2;
|
|
4725
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4557
4726
|
}
|
|
4558
4727
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4559
4728
|
});
|
|
@@ -4561,7 +4730,6 @@ class RPCEstimateProvider extends Provider {
|
|
|
4561
4730
|
/**
|
|
4562
4731
|
*
|
|
4563
4732
|
* @description Estimate gasLimit, storageLimit and fees to reveal the current account
|
|
4564
|
-
*
|
|
4565
4733
|
* @returns An estimation of gasLimit, storageLimit and fees for the operation or undefined if the account is already revealed
|
|
4566
4734
|
*
|
|
4567
4735
|
* @param Estimate
|
|
@@ -4573,6 +4741,21 @@ class RPCEstimateProvider extends Provider {
|
|
|
4573
4741
|
throw new RevealEstimateError();
|
|
4574
4742
|
}
|
|
4575
4743
|
if (yield this.isAccountRevealRequired(publicKeyHash)) {
|
|
4744
|
+
const [, pkhPrefix] = b58DecodeAndCheckPrefix(publicKeyHash, publicKeyHashPrefixes);
|
|
4745
|
+
if (pkhPrefix === PrefixV2.BLS12_381PublicKeyHash) {
|
|
4746
|
+
if (params && params.proof) {
|
|
4747
|
+
b58DecodeAndCheckPrefix(params.proof, [PrefixV2.BLS12_381Signature]); // validate proof to be a bls signature
|
|
4748
|
+
}
|
|
4749
|
+
else {
|
|
4750
|
+
const { prefixSig } = yield this.signer.provePossession();
|
|
4751
|
+
params = Object.assign(Object.assign({}, params), { proof: prefixSig });
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
else {
|
|
4755
|
+
if (params && params.proof) {
|
|
4756
|
+
throw new ProhibitedActionError('Proof field is only allowed to reveal a bls account ');
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4576
4759
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
4577
4760
|
const preparedOperation = params
|
|
4578
4761
|
? yield this.prepare.reveal(params)
|
|
@@ -4600,7 +4783,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4600
4783
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4601
4784
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4602
4785
|
estimateProperties.shift();
|
|
4603
|
-
|
|
4786
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4787
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4788
|
+
: this.REVEAL_LENGTH / 2;
|
|
4789
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4604
4790
|
}
|
|
4605
4791
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4606
4792
|
});
|
|
@@ -4626,7 +4812,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4626
4812
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4627
4813
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4628
4814
|
estimateProperties.shift();
|
|
4629
|
-
|
|
4815
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4816
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4817
|
+
: this.REVEAL_LENGTH / 2;
|
|
4818
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4630
4819
|
}
|
|
4631
4820
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4632
4821
|
});
|
|
@@ -4634,19 +4823,59 @@ class RPCEstimateProvider extends Provider {
|
|
|
4634
4823
|
/**
|
|
4635
4824
|
*
|
|
4636
4825
|
* @description Estimate gasLimit, storageLimit and fees for an Update Consensus Key operation
|
|
4637
|
-
*
|
|
4638
4826
|
* @returns An estimation of gasLimit, storageLimit and fees for the operation
|
|
4639
|
-
*
|
|
4640
4827
|
* @param Estimate
|
|
4641
4828
|
*/
|
|
4642
4829
|
updateConsensusKey(params) {
|
|
4643
4830
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4831
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(params.pk, publicKeyPrefixes);
|
|
4832
|
+
if (pkPrefix === PrefixV2.BLS12_381PublicKey) {
|
|
4833
|
+
if (!params.proof) {
|
|
4834
|
+
throw new InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
4835
|
+
}
|
|
4836
|
+
}
|
|
4837
|
+
else {
|
|
4838
|
+
if (params.proof) {
|
|
4839
|
+
throw new ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4644
4842
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
4645
4843
|
const preparedOperation = yield this.prepare.updateConsensusKey(params);
|
|
4646
4844
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4647
4845
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4648
4846
|
estimateProperties.shift();
|
|
4649
|
-
|
|
4847
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4848
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4849
|
+
: this.REVEAL_LENGTH / 2;
|
|
4850
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4851
|
+
}
|
|
4852
|
+
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4853
|
+
});
|
|
4854
|
+
}
|
|
4855
|
+
/**
|
|
4856
|
+
*
|
|
4857
|
+
* @description Estimate gasLimit, storageLimit and fees for an Update Companion Key operation
|
|
4858
|
+
* @returns An estimation of gasLimit, storageLimit and fees for the operation
|
|
4859
|
+
* @param Estimate
|
|
4860
|
+
*/
|
|
4861
|
+
updateCompanionKey(params) {
|
|
4862
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4863
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(params.pk, publicKeyPrefixes);
|
|
4864
|
+
if (pkPrefix !== PrefixV2.BLS12_381PublicKey) {
|
|
4865
|
+
throw new ProhibitedActionError('companion key must be a bls account');
|
|
4866
|
+
}
|
|
4867
|
+
if (!params.proof) {
|
|
4868
|
+
throw new InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
4869
|
+
}
|
|
4870
|
+
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
4871
|
+
const preparedOperation = yield this.prepare.updateCompanionKey(params);
|
|
4872
|
+
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4873
|
+
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4874
|
+
estimateProperties.shift();
|
|
4875
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4876
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4877
|
+
: this.REVEAL_LENGTH / 2;
|
|
4878
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4650
4879
|
}
|
|
4651
4880
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4652
4881
|
});
|
|
@@ -4666,7 +4895,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4666
4895
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4667
4896
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4668
4897
|
estimateProperties.shift();
|
|
4669
|
-
|
|
4898
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4899
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4900
|
+
: this.REVEAL_LENGTH / 2;
|
|
4901
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4670
4902
|
}
|
|
4671
4903
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4672
4904
|
});
|
|
@@ -4686,7 +4918,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4686
4918
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4687
4919
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4688
4920
|
estimateProperties.shift();
|
|
4689
|
-
|
|
4921
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4922
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4923
|
+
: this.REVEAL_LENGTH / 2;
|
|
4924
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4690
4925
|
}
|
|
4691
4926
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4692
4927
|
});
|
|
@@ -4725,7 +4960,10 @@ class RPCEstimateProvider extends Provider {
|
|
|
4725
4960
|
const estimateProperties = yield this.calculateEstimates(preparedOperation, protocolConstants);
|
|
4726
4961
|
if (preparedOperation.opOb.contents[0].kind === 'reveal') {
|
|
4727
4962
|
estimateProperties.shift();
|
|
4728
|
-
|
|
4963
|
+
const revealSize = preparedOperation.opOb.contents[0].source.startsWith(PrefixV2.BLS12_381PublicKeyHash)
|
|
4964
|
+
? this.REVEAL_LENGTH_TZ4 / 2
|
|
4965
|
+
: this.REVEAL_LENGTH / 2;
|
|
4966
|
+
estimateProperties[0].opSize -= revealSize;
|
|
4729
4967
|
}
|
|
4730
4968
|
return Estimate.createEstimateInstanceFromProperties(estimateProperties);
|
|
4731
4969
|
});
|
|
@@ -4943,6 +5181,14 @@ class RevealOperation extends Operation {
|
|
|
4943
5181
|
get publicKey() {
|
|
4944
5182
|
return this.params.public_key;
|
|
4945
5183
|
}
|
|
5184
|
+
get proof() {
|
|
5185
|
+
if (this.params.proof) {
|
|
5186
|
+
return this.params.proof;
|
|
5187
|
+
}
|
|
5188
|
+
else {
|
|
5189
|
+
throw new ProhibitedActionError('Only BLS key has proof');
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
4946
5192
|
sumProp(arr, prop) {
|
|
4947
5193
|
return arr.reduce((prev, current) => {
|
|
4948
5194
|
return prop in current ? Number(current[prop]) + prev : prev;
|
|
@@ -5113,6 +5359,67 @@ class UpdateConsensusKeyOperation extends Operation {
|
|
|
5113
5359
|
get pk() {
|
|
5114
5360
|
return this.params.pk;
|
|
5115
5361
|
}
|
|
5362
|
+
get proof() {
|
|
5363
|
+
if (this.params.proof) {
|
|
5364
|
+
return this.params.proof;
|
|
5365
|
+
}
|
|
5366
|
+
else {
|
|
5367
|
+
throw new ProhibitedActionError('Only updating consensus key to a BLS account has proof');
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
get consumedMilliGas() {
|
|
5371
|
+
var _a;
|
|
5372
|
+
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
5373
|
+
}
|
|
5374
|
+
get errors() {
|
|
5375
|
+
var _a;
|
|
5376
|
+
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.errors;
|
|
5377
|
+
}
|
|
5378
|
+
}
|
|
5379
|
+
|
|
5380
|
+
/**
|
|
5381
|
+
*
|
|
5382
|
+
* @description UpdateCompanionKeyOperation provides utility to fetch properties for Operation of kind UpdateCompanionKey
|
|
5383
|
+
*
|
|
5384
|
+
*/
|
|
5385
|
+
class UpdateCompanionKeyOperation extends Operation {
|
|
5386
|
+
constructor(hash, params, source, raw, results, context) {
|
|
5387
|
+
super(hash, raw, results, context);
|
|
5388
|
+
this.params = params;
|
|
5389
|
+
this.source = source;
|
|
5390
|
+
}
|
|
5391
|
+
get operationResults() {
|
|
5392
|
+
const updateCompanionKeyOp = Array.isArray(this.results) &&
|
|
5393
|
+
this.results.find((op) => op.kind === 'update_companion_key');
|
|
5394
|
+
const result = updateCompanionKeyOp &&
|
|
5395
|
+
updateCompanionKeyOp.metadata &&
|
|
5396
|
+
updateCompanionKeyOp.metadata.operation_result;
|
|
5397
|
+
return result ? result : undefined;
|
|
5398
|
+
}
|
|
5399
|
+
get status() {
|
|
5400
|
+
var _a, _b;
|
|
5401
|
+
return (_b = (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'unknown';
|
|
5402
|
+
}
|
|
5403
|
+
get fee() {
|
|
5404
|
+
return Number(this.params.fee);
|
|
5405
|
+
}
|
|
5406
|
+
get gasLimit() {
|
|
5407
|
+
return Number(this.params.gas_limit);
|
|
5408
|
+
}
|
|
5409
|
+
get storageLimit() {
|
|
5410
|
+
return Number(this.params.storage_limit);
|
|
5411
|
+
}
|
|
5412
|
+
get pk() {
|
|
5413
|
+
return this.params.pk;
|
|
5414
|
+
}
|
|
5415
|
+
get proof() {
|
|
5416
|
+
if (this.params.proof) {
|
|
5417
|
+
return this.params.proof;
|
|
5418
|
+
}
|
|
5419
|
+
else {
|
|
5420
|
+
throw new ProhibitedActionError('Only updating companion key to a BLS account has proof');
|
|
5421
|
+
}
|
|
5422
|
+
}
|
|
5116
5423
|
get consumedMilliGas() {
|
|
5117
5424
|
var _a;
|
|
5118
5425
|
return (_a = this.operationResults) === null || _a === void 0 ? void 0 : _a.consumed_milligas;
|
|
@@ -5410,7 +5717,7 @@ class RpcContractProvider extends Provider {
|
|
|
5410
5717
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5411
5718
|
const contractValidation = validateContractAddress(contract);
|
|
5412
5719
|
if (contractValidation !== ValidationResult.VALID) {
|
|
5413
|
-
throw new InvalidContractAddressError(contract,
|
|
5720
|
+
throw new InvalidContractAddressError(contract, contractValidation);
|
|
5414
5721
|
}
|
|
5415
5722
|
const script = yield this.context.readProvider.getScript(contract, 'head');
|
|
5416
5723
|
if (!schema) {
|
|
@@ -5442,7 +5749,7 @@ class RpcContractProvider extends Provider {
|
|
|
5442
5749
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5443
5750
|
const contractValidation = validateContractAddress(contract);
|
|
5444
5751
|
if (contractValidation !== ValidationResult.VALID) {
|
|
5445
|
-
throw new InvalidContractAddressError(contract,
|
|
5752
|
+
throw new InvalidContractAddressError(contract, contractValidation);
|
|
5446
5753
|
}
|
|
5447
5754
|
if (!schema) {
|
|
5448
5755
|
schema = (yield this.rpc.getContract(contract)).script;
|
|
@@ -5586,14 +5893,14 @@ class RpcContractProvider extends Provider {
|
|
|
5586
5893
|
var _a;
|
|
5587
5894
|
const sourceValidation = validateAddress(params.source);
|
|
5588
5895
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5589
|
-
throw new InvalidAddressError(params.source,
|
|
5896
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5590
5897
|
}
|
|
5591
5898
|
const delegateValidation = validateAddress((_a = params.delegate) !== null && _a !== void 0 ? _a : '');
|
|
5592
5899
|
if (params.delegate && delegateValidation !== ValidationResult.VALID) {
|
|
5593
|
-
throw new InvalidAddressError(params.delegate,
|
|
5900
|
+
throw new InvalidAddressError(params.delegate, delegateValidation);
|
|
5594
5901
|
}
|
|
5595
5902
|
// Since babylon delegation source cannot smart contract
|
|
5596
|
-
if (
|
|
5903
|
+
if (/^kt1/i.test(params.source)) {
|
|
5597
5904
|
throw new InvalidDelegationSource(params.source);
|
|
5598
5905
|
}
|
|
5599
5906
|
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
@@ -5638,11 +5945,11 @@ class RpcContractProvider extends Provider {
|
|
|
5638
5945
|
var _a;
|
|
5639
5946
|
const toValidation = validateAddress(params.to);
|
|
5640
5947
|
if (toValidation !== ValidationResult.VALID) {
|
|
5641
|
-
throw new InvalidAddressError(params.to,
|
|
5948
|
+
throw new InvalidAddressError(params.to, toValidation);
|
|
5642
5949
|
}
|
|
5643
5950
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5644
5951
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5645
|
-
throw new InvalidAddressError(params.source,
|
|
5952
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5646
5953
|
}
|
|
5647
5954
|
if (params.amount < 0) {
|
|
5648
5955
|
throw new InvalidAmountError(params.amount.toString());
|
|
@@ -5670,7 +5977,7 @@ class RpcContractProvider extends Provider {
|
|
|
5670
5977
|
var _a;
|
|
5671
5978
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5672
5979
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5673
|
-
throw new InvalidAddressError(params.source,
|
|
5980
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5674
5981
|
}
|
|
5675
5982
|
if (!params.to) {
|
|
5676
5983
|
params.to = params.source;
|
|
@@ -5706,7 +6013,7 @@ class RpcContractProvider extends Provider {
|
|
|
5706
6013
|
var _a;
|
|
5707
6014
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5708
6015
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5709
|
-
throw new InvalidAddressError(params.source,
|
|
6016
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5710
6017
|
}
|
|
5711
6018
|
if (!params.to) {
|
|
5712
6019
|
params.to = params.source;
|
|
@@ -5739,14 +6046,11 @@ class RpcContractProvider extends Provider {
|
|
|
5739
6046
|
var _a;
|
|
5740
6047
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5741
6048
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5742
|
-
throw new InvalidAddressError(params.source,
|
|
6049
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5743
6050
|
}
|
|
5744
6051
|
if (!params.to) {
|
|
5745
6052
|
params.to = params.source;
|
|
5746
6053
|
}
|
|
5747
|
-
if (params.to && params.to !== params.source) {
|
|
5748
|
-
throw new InvalidStakingAddressError(params.to);
|
|
5749
|
-
}
|
|
5750
6054
|
if (!params.amount) {
|
|
5751
6055
|
params.amount = 0;
|
|
5752
6056
|
}
|
|
@@ -5776,11 +6080,11 @@ class RpcContractProvider extends Provider {
|
|
|
5776
6080
|
var _a, _b;
|
|
5777
6081
|
const destinationValidation = validateAddress(params.destination);
|
|
5778
6082
|
if (destinationValidation !== ValidationResult.VALID) {
|
|
5779
|
-
throw new InvalidAddressError(params.destination,
|
|
6083
|
+
throw new InvalidAddressError(params.destination, destinationValidation);
|
|
5780
6084
|
}
|
|
5781
6085
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5782
6086
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5783
|
-
throw new InvalidAddressError(params.source,
|
|
6087
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5784
6088
|
}
|
|
5785
6089
|
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
5786
6090
|
const source = (_b = params.source) !== null && _b !== void 0 ? _b : publicKeyHash;
|
|
@@ -5794,8 +6098,7 @@ class RpcContractProvider extends Provider {
|
|
|
5794
6098
|
}
|
|
5795
6099
|
/**
|
|
5796
6100
|
*
|
|
5797
|
-
* @description Reveal the current address. Will throw an error if the address is already revealed.
|
|
5798
|
-
*
|
|
6101
|
+
* @description Reveal the public key of the current address. Will throw an error if the address is already revealed.
|
|
5799
6102
|
* @returns An operation handle with the result from the rpc node
|
|
5800
6103
|
*
|
|
5801
6104
|
* @param RevealParams operation parameter
|
|
@@ -5803,6 +6106,21 @@ class RpcContractProvider extends Provider {
|
|
|
5803
6106
|
reveal(params) {
|
|
5804
6107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5805
6108
|
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
6109
|
+
const [, pkhPrefix] = b58DecodeAndCheckPrefix(publicKeyHash, publicKeyHashPrefixes);
|
|
6110
|
+
if (pkhPrefix === PrefixV2.BLS12_381PublicKeyHash) {
|
|
6111
|
+
if (params.proof) {
|
|
6112
|
+
b58DecodeAndCheckPrefix(params.proof, [PrefixV2.BLS12_381Signature]); // validate proof to be a bls signature
|
|
6113
|
+
}
|
|
6114
|
+
else {
|
|
6115
|
+
const { prefixSig } = yield this.signer.provePossession();
|
|
6116
|
+
params.proof = prefixSig;
|
|
6117
|
+
}
|
|
6118
|
+
}
|
|
6119
|
+
else {
|
|
6120
|
+
if (params.proof) {
|
|
6121
|
+
throw new ProhibitedActionError('Proof field is only allowed to reveal a bls account ');
|
|
6122
|
+
}
|
|
6123
|
+
}
|
|
5806
6124
|
const estimateReveal = yield this.estimator.reveal(params);
|
|
5807
6125
|
if (estimateReveal) {
|
|
5808
6126
|
const estimated = yield this.estimate(params, () => __awaiter(this, void 0, void 0, function* () { return estimateReveal; }));
|
|
@@ -5889,7 +6207,7 @@ class RpcContractProvider extends Provider {
|
|
|
5889
6207
|
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
5890
6208
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5891
6209
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5892
|
-
throw new InvalidAddressError(params.source,
|
|
6210
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5893
6211
|
}
|
|
5894
6212
|
const source = (_b = params.source) !== null && _b !== void 0 ? _b : publicKeyHash;
|
|
5895
6213
|
const prepared = yield this.prepare.ballot(Object.assign(Object.assign({}, params), { source }));
|
|
@@ -5913,7 +6231,7 @@ class RpcContractProvider extends Provider {
|
|
|
5913
6231
|
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
5914
6232
|
const sourceValidation = validateAddress((_a = params.source) !== null && _a !== void 0 ? _a : '');
|
|
5915
6233
|
if (params.source && sourceValidation !== ValidationResult.VALID) {
|
|
5916
|
-
throw new InvalidAddressError(params.source,
|
|
6234
|
+
throw new InvalidAddressError(params.source, sourceValidation);
|
|
5917
6235
|
}
|
|
5918
6236
|
const source = (_b = params.source) !== null && _b !== void 0 ? _b : publicKeyHash;
|
|
5919
6237
|
const prepared = yield this.prepare.proposals(Object.assign(Object.assign({}, params), { source }));
|
|
@@ -5925,8 +6243,7 @@ class RpcContractProvider extends Provider {
|
|
|
5925
6243
|
}
|
|
5926
6244
|
/**
|
|
5927
6245
|
*
|
|
5928
|
-
* @description
|
|
5929
|
-
*
|
|
6246
|
+
* @description Update the consensus key of a delegate starting from the current cycle plus CONSENSUS_RIGHTS_DELAY + 1
|
|
5930
6247
|
* @returns An operation handle with the result from the rpc node
|
|
5931
6248
|
*
|
|
5932
6249
|
* @param UpdateConsensusKeyParams
|
|
@@ -5934,6 +6251,17 @@ class RpcContractProvider extends Provider {
|
|
|
5934
6251
|
updateConsensusKey(params) {
|
|
5935
6252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5936
6253
|
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
6254
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(params.pk, publicKeyPrefixes);
|
|
6255
|
+
if (pkPrefix === PrefixV2.BLS12_381PublicKey) {
|
|
6256
|
+
if (!params.proof) {
|
|
6257
|
+
throw new InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
6258
|
+
}
|
|
6259
|
+
}
|
|
6260
|
+
else {
|
|
6261
|
+
if (params.proof) {
|
|
6262
|
+
throw new ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
6263
|
+
}
|
|
6264
|
+
}
|
|
5937
6265
|
const estimate = yield this.estimate(params, this.estimator.updateConsensusKey.bind(this.estimator));
|
|
5938
6266
|
const prepared = yield this.prepare.updateConsensusKey(Object.assign(Object.assign({}, params), estimate));
|
|
5939
6267
|
const content = prepared.opOb.contents.find((op) => op.kind === OpKind.UPDATE_CONSENSUS_KEY);
|
|
@@ -5942,6 +6270,31 @@ class RpcContractProvider extends Provider {
|
|
|
5942
6270
|
return new UpdateConsensusKeyOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
5943
6271
|
});
|
|
5944
6272
|
}
|
|
6273
|
+
/**
|
|
6274
|
+
*
|
|
6275
|
+
* @description Updates the companion key of the delegate starting from the current cycle plus CONSENSUS_KEY_ACTIVATION_DELAY + 1
|
|
6276
|
+
* @returns An operation handle with the result from the rpc node
|
|
6277
|
+
*
|
|
6278
|
+
* @param UpdateCompanionKeyParams
|
|
6279
|
+
*/
|
|
6280
|
+
updateCompanionKey(params) {
|
|
6281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6282
|
+
const publicKeyHash = yield this.signer.publicKeyHash();
|
|
6283
|
+
const [, pkPrefix] = b58DecodeAndCheckPrefix(params.pk, publicKeyPrefixes);
|
|
6284
|
+
if (pkPrefix !== PrefixV2.BLS12_381PublicKey) {
|
|
6285
|
+
throw new ProhibitedActionError('Proof field is only allowed for a bls account as companion key');
|
|
6286
|
+
}
|
|
6287
|
+
if (!params.proof) {
|
|
6288
|
+
throw new InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
6289
|
+
}
|
|
6290
|
+
const estimate = yield this.estimate(params, this.estimator.updateCompanionKey.bind(this.estimator));
|
|
6291
|
+
const prepared = yield this.prepare.updateCompanionKey(Object.assign(Object.assign({}, params), estimate));
|
|
6292
|
+
const content = prepared.opOb.contents.find((op) => op.kind === OpKind.UPDATE_COMPANION_KEY);
|
|
6293
|
+
const opBytes = yield this.forge(prepared);
|
|
6294
|
+
const { hash, context, forgedBytes, opResponse } = yield this.signAndInject(opBytes);
|
|
6295
|
+
return new UpdateCompanionKeyOperation(hash, content, publicKeyHash, forgedBytes, opResponse, context);
|
|
6296
|
+
});
|
|
6297
|
+
}
|
|
5945
6298
|
/**
|
|
5946
6299
|
* @description Adds messages to the rollup inbox that can be executed/claimed after it gets cemented
|
|
5947
6300
|
* @param SmartRollupAddMessagesParams
|
|
@@ -6036,7 +6389,7 @@ class RpcContractProvider extends Provider {
|
|
|
6036
6389
|
return __awaiter(this, arguments, void 0, function* (address, contractAbstractionComposer = (x) => x) {
|
|
6037
6390
|
const addressValidation = validateContractAddress(address);
|
|
6038
6391
|
if (addressValidation !== ValidationResult.VALID) {
|
|
6039
|
-
throw new InvalidContractAddressError(address,
|
|
6392
|
+
throw new InvalidContractAddressError(address, addressValidation);
|
|
6040
6393
|
}
|
|
6041
6394
|
const rpc = this.context.withExtensions().rpc;
|
|
6042
6395
|
const readProvider = this.context.withExtensions().readProvider;
|
|
@@ -6673,7 +7026,7 @@ class PollingSubscribeProvider {
|
|
|
6673
7026
|
constructor(context, config = {}) {
|
|
6674
7027
|
this.context = context;
|
|
6675
7028
|
this._config$ = new BehaviorSubject(Object.assign(Object.assign({}, defaultConfigStreamer), config));
|
|
6676
|
-
this.timer$ = this._config$.pipe(
|
|
7029
|
+
this.timer$ = this._config$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.pollingIntervalMilliseconds), switchMap((pollingIntervalMilliseconds) => {
|
|
6677
7030
|
if (!pollingIntervalMilliseconds) {
|
|
6678
7031
|
return from(this.getConfirmationPollingInterval()).pipe(switchMap((interval) => {
|
|
6679
7032
|
return timer(0, interval);
|
|
@@ -6683,7 +7036,11 @@ class PollingSubscribeProvider {
|
|
|
6683
7036
|
return timer(0, pollingIntervalMilliseconds);
|
|
6684
7037
|
}
|
|
6685
7038
|
}));
|
|
6686
|
-
this.newBlock$ = this.timer$.pipe(switchMap(() => getLastBlock(this.context)), distinctUntilKeyChanged('hash'),
|
|
7039
|
+
this.newBlock$ = this.timer$.pipe(switchMap(() => getLastBlock(this.context)), distinctUntilKeyChanged('hash'), share({
|
|
7040
|
+
resetOnError: false,
|
|
7041
|
+
resetOnComplete: false,
|
|
7042
|
+
resetOnRefCountZero: true,
|
|
7043
|
+
}));
|
|
6687
7044
|
}
|
|
6688
7045
|
get config() {
|
|
6689
7046
|
return this._config$.getValue();
|
|
@@ -6715,7 +7072,7 @@ class PollingSubscribeProvider {
|
|
|
6715
7072
|
return new ObservableSubscription(this.newBlock$, this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
6716
7073
|
}
|
|
6717
7074
|
subscribe(_filter) {
|
|
6718
|
-
return new ObservableSubscription(this.newBlock$.pipe(
|
|
7075
|
+
return new ObservableSubscription(this.newBlock$.pipe(map((x) => x === null || x === void 0 ? void 0 : x.hash)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
6719
7076
|
}
|
|
6720
7077
|
subscribeOperation(filter) {
|
|
6721
7078
|
return new ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
@@ -6901,8 +7258,8 @@ class Context {
|
|
|
6901
7258
|
|
|
6902
7259
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
6903
7260
|
const VERSION = {
|
|
6904
|
-
"commitHash": "
|
|
6905
|
-
"version": "
|
|
7261
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
7262
|
+
"version": "23.0.0-beta.1"
|
|
6906
7263
|
};
|
|
6907
7264
|
|
|
6908
7265
|
/**
|
|
@@ -7350,5 +7707,5 @@ class TezosToolkit {
|
|
|
7350
7707
|
}
|
|
7351
7708
|
}
|
|
7352
7709
|
|
|
7353
|
-
export { BallotOperation, BatchOperation, BigMapAbstraction, COST_PER_BYTE, ChainIds, CompositeForger, Context, ContractAbstraction, ContractMethod, ContractMethodObject, ContractView, DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_SMART_CONTRACT_METHOD_NAME, DEFAULT_STORAGE_LIMIT, DefaultGlobalConstantsProvider, DelegateOperation, DelegationWalletOperation, DrainDelegateOperation, Estimate, GlobalConstantNotFound, IncreasePaidStorageOperation, InvalidBalanceError, InvalidCodeParameter, InvalidDelegationSource, InvalidEstimateValueError, InvalidInitParameter, InvalidParameterError, InvalidViewSimulationContext, LegacyWalletProvider, MANAGER_LAMBDA, MichelCodecPacker, MichelCodecParser, NoopParser, ORIGINATION_SIZE, ObservableSubscription, Operation, OperationBatch, OriginationOperation, OriginationParameterError, OriginationWalletOperation, PollingSubscribeProvider, PrepareProvider, ProposalsOperation, Protocols, REVEAL_STORAGE_LIMIT, RPCEstimateProvider, RegisterGlobalConstantOperation, RevealEstimateError, RevealOperation, RevealOperationError, RpcForger, RpcInjector, RpcPacker, RpcReadAdapter, SaplingStateAbstraction, SmartRollupAddMessagesOperation, SmartRollupOriginateOperation, TaquitoLocalForger, TezosOperationError, TezosPreapplyFailureError, TezosToolkit, TransactionOperation, TransactionWalletOperation, TransferTicketOperation, TransferTicketWalletOperation, UnconfiguredGlobalConstantsProviderError, UpdateConsensusKeyOperation, VIEW_LAMBDA, ViewSimulationError, Wallet, WalletOperation, WalletOperationBatch, attachKind, compose, createActivationOperation, createBallotOperation, createDrainDelegateOperation, createIncreasePaidStorageOperation, createOriginationOperation, createProposalsOperation, createRegisterDelegateOperation, createRegisterGlobalConstantOperation, createRevealOperation, createSetDelegateOperation, createSmartRollupAddMessagesOperation, createSmartRollupExecuteOutboxMessageOperation, createSmartRollupOriginateOperation, createTransferOperation, createTransferTicketOperation, createUpdateConsensusKeyOperation, defaultConfigConfirmation, findWithKind, getRevealFee, getRevealFeeInternal, getRevealGasLimit, hasMetadata, hasMetadataWithInternalOperationResult, hasMetadataWithResult, isKind, isOpRequireReveal, isOpWithFee, isOpWithGasBuffer, isSourceOp, protocols, smartContractAbstractionSemantic, validateAndExtractFailwith };
|
|
7710
|
+
export { BallotOperation, BatchOperation, BigMapAbstraction, COST_PER_BYTE, ChainIds, CompositeForger, Context, ContractAbstraction, ContractMethod, ContractMethodObject, ContractView, DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_SMART_CONTRACT_METHOD_NAME, DEFAULT_STORAGE_LIMIT, DefaultGlobalConstantsProvider, DelegateOperation, DelegationWalletOperation, DrainDelegateOperation, Estimate, GlobalConstantNotFound, IncreasePaidStorageOperation, InvalidBalanceError, InvalidCodeParameter, InvalidDelegationSource, InvalidEstimateValueError, InvalidInitParameter, InvalidParameterError, InvalidViewSimulationContext, LegacyWalletProvider, MANAGER_LAMBDA, MichelCodecPacker, MichelCodecParser, NoopParser, ORIGINATION_SIZE, ObservableSubscription, Operation, OperationBatch, OriginationOperation, OriginationParameterError, OriginationWalletOperation, PollingSubscribeProvider, PrepareProvider, ProposalsOperation, Protocols, REVEAL_STORAGE_LIMIT, RPCEstimateProvider, RegisterGlobalConstantOperation, RevealEstimateError, RevealOperation, RevealOperationError, RpcForger, RpcInjector, RpcPacker, RpcReadAdapter, SaplingStateAbstraction, SmartRollupAddMessagesOperation, SmartRollupOriginateOperation, TaquitoLocalForger, TezosOperationError, TezosPreapplyFailureError, TezosToolkit, TransactionOperation, TransactionWalletOperation, TransferTicketOperation, TransferTicketWalletOperation, UnconfiguredGlobalConstantsProviderError, UpdateCompanionKeyOperation, UpdateConsensusKeyOperation, VIEW_LAMBDA, ViewSimulationError, Wallet, WalletOperation, WalletOperationBatch, attachKind, compose, createActivationOperation, createBallotOperation, createDrainDelegateOperation, createIncreasePaidStorageOperation, createOriginationOperation, createProposalsOperation, createRegisterDelegateOperation, createRegisterGlobalConstantOperation, createRevealOperation, createSetDelegateOperation, createSmartRollupAddMessagesOperation, createSmartRollupExecuteOutboxMessageOperation, createSmartRollupOriginateOperation, createTransferOperation, createTransferTicketOperation, createUpdateCompanionKeyOperation, createUpdateConsensusKeyOperation, defaultConfigConfirmation, findWithKind, getRevealFee, getRevealFeeInternal, getRevealGasLimit, hasMetadata, hasMetadataWithInternalOperationResult, hasMetadataWithResult, isKind, isOpRequireReveal, isOpWithFee, isOpWithGasBuffer, isSourceOp, protocols, smartContractAbstractionSemantic, validateAndExtractFailwith };
|
|
7354
7711
|
//# sourceMappingURL=taquito.es6.js.map
|