@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
|
@@ -41,6 +41,7 @@ const core_1 = require("@taquito/core");
|
|
|
41
41
|
const contract_1 = require("../contract");
|
|
42
42
|
const provider_1 = require("../provider");
|
|
43
43
|
const bignumber_js_1 = require("bignumber.js");
|
|
44
|
+
const utils_1 = require("@taquito/utils");
|
|
44
45
|
const mergeLimits = (userDefinedLimit, defaultLimits) => {
|
|
45
46
|
var _a, _b, _c;
|
|
46
47
|
return {
|
|
@@ -114,10 +115,14 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
114
115
|
if (!publicKey) {
|
|
115
116
|
throw new core_1.PublicKeyNotFoundError(pkh);
|
|
116
117
|
}
|
|
118
|
+
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(pkh, utils_1.publicKeyHashPrefixes);
|
|
117
119
|
ops.unshift(yield (0, contract_1.createRevealOperation)({
|
|
118
120
|
fee: (0, constants_1.getRevealFee)(pkh),
|
|
119
121
|
storageLimit: constants_1.REVEAL_STORAGE_LIMIT,
|
|
120
122
|
gasLimit: (0, constants_1.getRevealGasLimit)(pkh),
|
|
123
|
+
proof: pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash
|
|
124
|
+
? (yield this.signer.provePossession()).prefixSig
|
|
125
|
+
: undefined,
|
|
121
126
|
}, publicKeyHash, publicKey));
|
|
122
127
|
return ops;
|
|
123
128
|
}
|
|
@@ -163,6 +168,7 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
163
168
|
case rpc_1.OpKind.DELEGATION:
|
|
164
169
|
case rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT:
|
|
165
170
|
case rpc_1.OpKind.UPDATE_CONSENSUS_KEY:
|
|
171
|
+
case rpc_1.OpKind.UPDATE_COMPANION_KEY:
|
|
166
172
|
case rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES:
|
|
167
173
|
case rpc_1.OpKind.SMART_ROLLUP_ORIGINATE:
|
|
168
174
|
case rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:
|
|
@@ -223,11 +229,26 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
223
229
|
* @returns a PreparedOperation object
|
|
224
230
|
*/
|
|
225
231
|
reveal(_a) {
|
|
226
|
-
return __awaiter(this, arguments, void 0, function* ({ fee, gasLimit, storageLimit }) {
|
|
232
|
+
return __awaiter(this, arguments, void 0, function* ({ fee, gasLimit, storageLimit, proof }) {
|
|
227
233
|
const { pkh, publicKey } = yield this.getKeys();
|
|
228
234
|
if (!publicKey) {
|
|
229
235
|
throw new core_1.PublicKeyNotFoundError(pkh);
|
|
230
236
|
}
|
|
237
|
+
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(pkh, utils_1.publicKeyHashPrefixes);
|
|
238
|
+
if (pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash) {
|
|
239
|
+
if (proof) {
|
|
240
|
+
(0, utils_1.b58DecodeAndCheckPrefix)(proof, [utils_1.PrefixV2.BLS12_381Signature]); // validate proof to be a bls signature
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const { prefixSig } = yield this.signer.provePossession();
|
|
244
|
+
proof = prefixSig;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
if (proof) {
|
|
249
|
+
throw new core_1.ProhibitedActionError('Proof field is only allowed to reveal a bls account ');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
231
252
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
232
253
|
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
233
254
|
const mergedEstimates = mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS);
|
|
@@ -235,6 +256,7 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
235
256
|
fee: mergedEstimates.fee,
|
|
236
257
|
gasLimit: mergedEstimates.gasLimit,
|
|
237
258
|
storageLimit: mergedEstimates.storageLimit,
|
|
259
|
+
proof,
|
|
238
260
|
}, pkh, publicKey);
|
|
239
261
|
const ops = this.convertIntoArray(op);
|
|
240
262
|
const hash = yield this.getBlockHash();
|
|
@@ -393,11 +415,11 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
393
415
|
*/
|
|
394
416
|
finalizeUnstake(_a) {
|
|
395
417
|
return __awaiter(this, void 0, void 0, function* () {
|
|
396
|
-
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
418
|
+
var { fee, storageLimit, gasLimit, to } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit", "to"]);
|
|
397
419
|
const { pkh } = yield this.getKeys();
|
|
398
420
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
399
421
|
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
400
|
-
const op = yield (0, contract_1.createTransferOperation)(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: pkh, amount: 0 }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
|
|
422
|
+
const op = yield (0, contract_1.createTransferOperation)(Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { to: to ? to : pkh, amount: 0 }), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)), { parameter: {
|
|
401
423
|
entrypoint: 'finalize_unstake',
|
|
402
424
|
value: { prim: 'Unit' },
|
|
403
425
|
} }));
|
|
@@ -526,6 +548,17 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
526
548
|
return __awaiter(this, void 0, void 0, function* () {
|
|
527
549
|
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
528
550
|
const { pkh } = yield this.getKeys();
|
|
551
|
+
const [, pkPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(rest.pk, utils_1.publicKeyPrefixes);
|
|
552
|
+
if (pkPrefix === utils_1.PrefixV2.BLS12_381PublicKey) {
|
|
553
|
+
if (!rest.proof) {
|
|
554
|
+
throw new core_1.InvalidProofError('Proof is required to set a bls account as consensus key ');
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
if (rest.proof) {
|
|
559
|
+
throw new core_1.ProhibitedActionError('Proof field is only allowed for a bls account as consensus key');
|
|
560
|
+
}
|
|
561
|
+
}
|
|
529
562
|
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
530
563
|
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
531
564
|
const op = yield (0, contract_1.createUpdateConsensusKeyOperation)(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)));
|
|
@@ -546,6 +579,44 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
546
579
|
};
|
|
547
580
|
});
|
|
548
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
*
|
|
584
|
+
* @description Method to prepare an update_companion_key operation
|
|
585
|
+
* @param operation RPCOperation object or RPCOperation array
|
|
586
|
+
* @param source string or undefined source pkh
|
|
587
|
+
* @returns a PreparedOperation object
|
|
588
|
+
*/
|
|
589
|
+
updateCompanionKey(_a, source) {
|
|
590
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
591
|
+
var { fee, storageLimit, gasLimit } = _a, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]);
|
|
592
|
+
const { pkh } = yield this.getKeys();
|
|
593
|
+
const [, pkPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(rest.pk, utils_1.publicKeyPrefixes);
|
|
594
|
+
if (pkPrefix !== utils_1.PrefixV2.BLS12_381PublicKey) {
|
|
595
|
+
throw new core_1.ProhibitedActionError('companion key must be a bls account');
|
|
596
|
+
}
|
|
597
|
+
if (!rest.proof) {
|
|
598
|
+
throw new core_1.InvalidProofError('Proof is required to set a bls account as companion key ');
|
|
599
|
+
}
|
|
600
|
+
const protocolConstants = yield this.context.readProvider.getProtocolConstants('head');
|
|
601
|
+
const DEFAULT_PARAMS = yield this.getOperationLimits(protocolConstants);
|
|
602
|
+
const op = yield (0, contract_1.createUpdateCompanionKeyOperation)(Object.assign(Object.assign({}, rest), mergeLimits({ fee, storageLimit, gasLimit }, DEFAULT_PARAMS)));
|
|
603
|
+
const operation = yield this.addRevealOperationIfNeeded(op, pkh);
|
|
604
|
+
const ops = this.convertIntoArray(operation);
|
|
605
|
+
const hash = yield this.getBlockHash();
|
|
606
|
+
const protocol = yield this.getProtocolHash();
|
|
607
|
+
__classPrivateFieldSet(this, _PrepareProvider_counters, {}, "f");
|
|
608
|
+
const headCounter = parseInt(yield this.getHeadCounter(pkh), 10);
|
|
609
|
+
const contents = this.constructOpContents(ops, headCounter, pkh, source);
|
|
610
|
+
return {
|
|
611
|
+
opOb: {
|
|
612
|
+
branch: hash,
|
|
613
|
+
contents,
|
|
614
|
+
protocol,
|
|
615
|
+
},
|
|
616
|
+
counter: headCounter,
|
|
617
|
+
};
|
|
618
|
+
});
|
|
619
|
+
}
|
|
549
620
|
/**
|
|
550
621
|
*
|
|
551
622
|
* @description Method to prepare an increase_paid_storage operation
|
|
@@ -836,10 +907,14 @@ class PrepareProvider extends provider_1.Provider {
|
|
|
836
907
|
if (!publicKey) {
|
|
837
908
|
throw new core_1.PublicKeyNotFoundError(pkh);
|
|
838
909
|
}
|
|
910
|
+
const [, pkhPrefix] = (0, utils_1.b58DecodeAndCheckPrefix)(pkh, utils_1.publicKeyHashPrefixes);
|
|
839
911
|
ops.unshift(yield (0, contract_1.createRevealOperation)({
|
|
840
912
|
fee: (0, constants_1.getRevealFee)(pkh),
|
|
841
913
|
storageLimit: constants_1.REVEAL_STORAGE_LIMIT,
|
|
842
914
|
gasLimit: (0, constants_1.getRevealGasLimit)(pkh),
|
|
915
|
+
proof: pkhPrefix === utils_1.PrefixV2.BLS12_381PublicKeyHash
|
|
916
|
+
? (yield this.signer.provePossession()).prefixSig
|
|
917
|
+
: undefined,
|
|
843
918
|
}, pkh, publicKey));
|
|
844
919
|
}
|
|
845
920
|
const hash = yield this.getBlockHash();
|
package/dist/lib/provider.js
CHANGED
|
@@ -91,6 +91,10 @@ class Provider {
|
|
|
91
91
|
return (0, prepare_1.createRegisterGlobalConstantOperation)(Object.assign({}, param));
|
|
92
92
|
case rpc_1.OpKind.INCREASE_PAID_STORAGE:
|
|
93
93
|
return (0, prepare_1.createIncreasePaidStorageOperation)(Object.assign({}, param));
|
|
94
|
+
case rpc_1.OpKind.UPDATE_CONSENSUS_KEY:
|
|
95
|
+
return (0, prepare_1.createUpdateConsensusKeyOperation)(Object.assign({}, param));
|
|
96
|
+
case rpc_1.OpKind.UPDATE_COMPANION_KEY:
|
|
97
|
+
return (0, prepare_1.createUpdateCompanionKeyOperation)(Object.assign({}, param));
|
|
94
98
|
case rpc_1.OpKind.TRANSFER_TICKET:
|
|
95
99
|
return (0, prepare_1.createTransferTicketOperation)(Object.assign({}, param));
|
|
96
100
|
case rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES:
|
|
@@ -60,7 +60,7 @@ class PollingSubscribeProvider {
|
|
|
60
60
|
constructor(context, config = {}) {
|
|
61
61
|
this.context = context;
|
|
62
62
|
this._config$ = new rxjs_1.BehaviorSubject(Object.assign(Object.assign({}, exports.defaultConfigStreamer), config));
|
|
63
|
-
this.timer$ = this._config$.pipe((0, operators_1.
|
|
63
|
+
this.timer$ = this._config$.pipe((0, operators_1.map)((x) => x === null || x === void 0 ? void 0 : x.pollingIntervalMilliseconds), (0, operators_1.switchMap)((pollingIntervalMilliseconds) => {
|
|
64
64
|
if (!pollingIntervalMilliseconds) {
|
|
65
65
|
return (0, rxjs_1.from)(this.getConfirmationPollingInterval()).pipe((0, operators_1.switchMap)((interval) => {
|
|
66
66
|
return (0, rxjs_1.timer)(0, interval);
|
|
@@ -70,7 +70,11 @@ class PollingSubscribeProvider {
|
|
|
70
70
|
return (0, rxjs_1.timer)(0, pollingIntervalMilliseconds);
|
|
71
71
|
}
|
|
72
72
|
}));
|
|
73
|
-
this.newBlock$ = this.timer$.pipe((0, operators_1.switchMap)(() => getLastBlock(this.context)), (0, operators_1.distinctUntilKeyChanged)('hash'), (0, operators_1.
|
|
73
|
+
this.newBlock$ = this.timer$.pipe((0, operators_1.switchMap)(() => getLastBlock(this.context)), (0, operators_1.distinctUntilKeyChanged)('hash'), (0, operators_1.share)({
|
|
74
|
+
resetOnError: false,
|
|
75
|
+
resetOnComplete: false,
|
|
76
|
+
resetOnRefCountZero: true,
|
|
77
|
+
}));
|
|
74
78
|
}
|
|
75
79
|
get config() {
|
|
76
80
|
return this._config$.getValue();
|
|
@@ -102,7 +106,7 @@ class PollingSubscribeProvider {
|
|
|
102
106
|
return new observable_subscription_1.ObservableSubscription(this.newBlock$, this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
103
107
|
}
|
|
104
108
|
subscribe(_filter) {
|
|
105
|
-
return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe((0, operators_1.
|
|
109
|
+
return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe((0, operators_1.map)((x) => x === null || x === void 0 ? void 0 : x.hash)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
106
110
|
}
|
|
107
111
|
subscribeOperation(filter) {
|
|
108
112
|
return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
|
|
@@ -24,7 +24,7 @@ class RpcTzProvider extends provider_1.Provider {
|
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
const addressValidation = (0, utils_1.validateAddress)(address);
|
|
26
26
|
if (addressValidation !== utils_1.ValidationResult.VALID) {
|
|
27
|
-
throw new core_1.InvalidAddressError(address,
|
|
27
|
+
throw new core_1.InvalidAddressError(address, addressValidation);
|
|
28
28
|
}
|
|
29
29
|
return this.context.readProvider.getBalance(address, 'head');
|
|
30
30
|
});
|
|
@@ -33,7 +33,7 @@ class RpcTzProvider extends provider_1.Provider {
|
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
const addressValidation = (0, utils_1.validateAddress)(address);
|
|
35
35
|
if (addressValidation !== utils_1.ValidationResult.VALID) {
|
|
36
|
-
throw new core_1.InvalidAddressError(address,
|
|
36
|
+
throw new core_1.InvalidAddressError(address, addressValidation);
|
|
37
37
|
}
|
|
38
38
|
return this.context.readProvider.getSpendable(address, 'head');
|
|
39
39
|
});
|
|
@@ -42,7 +42,7 @@ class RpcTzProvider extends provider_1.Provider {
|
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
const addressValidation = (0, utils_1.validateAddress)(address);
|
|
44
44
|
if (addressValidation !== utils_1.ValidationResult.VALID) {
|
|
45
|
-
throw new core_1.InvalidAddressError(address,
|
|
45
|
+
throw new core_1.InvalidAddressError(address, addressValidation);
|
|
46
46
|
}
|
|
47
47
|
return this.context.readProvider.getDelegate(address, 'head');
|
|
48
48
|
});
|
|
@@ -51,7 +51,7 @@ class RpcTzProvider extends provider_1.Provider {
|
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
const pkhValidation = (0, utils_1.validateKeyHash)(pkh);
|
|
53
53
|
if (pkhValidation !== utils_1.ValidationResult.VALID) {
|
|
54
|
-
throw new utils_1.InvalidKeyHashError(pkh,
|
|
54
|
+
throw new utils_1.InvalidKeyHashError(pkh, pkhValidation);
|
|
55
55
|
}
|
|
56
56
|
const prepared = yield this.prepare.activate({ pkh, secret });
|
|
57
57
|
const forgedBytes = yield this.forge(prepared);
|
package/dist/lib/version.js
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
5
5
|
exports.VERSION = {
|
|
6
|
-
"commitHash": "
|
|
7
|
-
"version": "
|
|
6
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
7
|
+
"version": "23.0.0-beta.1"
|
|
8
8
|
};
|
|
@@ -35,7 +35,7 @@ const createNewPollingBasedHeadObservable = (sharedHeadOb, context, _scheduler)
|
|
|
35
35
|
connector: () => new rxjs_1.ReplaySubject(1),
|
|
36
36
|
resetOnError: false,
|
|
37
37
|
resetOnComplete: false,
|
|
38
|
-
resetOnRefCountZero:
|
|
38
|
+
resetOnRefCountZero: true,
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
41
|
exports.createNewPollingBasedHeadObservable = createNewPollingBasedHeadObservable;
|
|
@@ -62,7 +62,7 @@ class WalletOperation {
|
|
|
62
62
|
connector: () => new rxjs_1.ReplaySubject(1),
|
|
63
63
|
resetOnError: false,
|
|
64
64
|
resetOnComplete: false,
|
|
65
|
-
resetOnRefCountZero:
|
|
65
|
+
resetOnRefCountZero: true,
|
|
66
66
|
}));
|
|
67
67
|
// Observable that emit once operation is seen in a block
|
|
68
68
|
this.confirmed$ = this.newHead$.pipe((0, operators_1.map)((head) => {
|
|
@@ -83,7 +83,7 @@ class WalletOperation {
|
|
|
83
83
|
connector: () => new rxjs_1.ReplaySubject(1),
|
|
84
84
|
resetOnError: false,
|
|
85
85
|
resetOnComplete: false,
|
|
86
|
-
resetOnRefCountZero:
|
|
86
|
+
resetOnRefCountZero: true,
|
|
87
87
|
}));
|
|
88
88
|
if ((0, utils_1.validateOperation)(this.opHash) !== utils_1.ValidationResult.VALID) {
|
|
89
89
|
throw new core_1.InvalidOperationHashError(this.opHash);
|
|
@@ -27,7 +27,7 @@ class WalletOperationBatch {
|
|
|
27
27
|
withTransfer(params) {
|
|
28
28
|
const toValidation = (0, utils_1.validateAddress)(params.to);
|
|
29
29
|
if (toValidation !== utils_1.ValidationResult.VALID) {
|
|
30
|
-
throw new core_1.InvalidAddressError(params.to,
|
|
30
|
+
throw new core_1.InvalidAddressError(params.to, toValidation);
|
|
31
31
|
}
|
|
32
32
|
this.operations.push(Object.assign({ kind: types_1.OpKind.TRANSACTION }, params));
|
|
33
33
|
return this;
|
|
@@ -48,7 +48,7 @@ class WalletOperationBatch {
|
|
|
48
48
|
var _a;
|
|
49
49
|
const delegateValidation = (0, utils_1.validateAddress)((_a = params.delegate) !== null && _a !== void 0 ? _a : '');
|
|
50
50
|
if (params.delegate && delegateValidation !== utils_1.ValidationResult.VALID) {
|
|
51
|
-
throw new core_1.InvalidAddressError(params.delegate,
|
|
51
|
+
throw new core_1.InvalidAddressError(params.delegate, delegateValidation);
|
|
52
52
|
}
|
|
53
53
|
this.operations.push(Object.assign({ kind: types_1.OpKind.DELEGATION }, params));
|
|
54
54
|
return this;
|
|
@@ -68,7 +68,7 @@ class WalletOperationBatch {
|
|
|
68
68
|
withIncreasePaidStorage(params) {
|
|
69
69
|
const destinationValidation = (0, utils_1.validateAddress)(params.destination);
|
|
70
70
|
if (destinationValidation !== utils_1.ValidationResult.VALID) {
|
|
71
|
-
throw new core_1.InvalidAddressError(params.destination,
|
|
71
|
+
throw new core_1.InvalidAddressError(params.destination, destinationValidation);
|
|
72
72
|
}
|
|
73
73
|
this.operations.push(Object.assign({ kind: types_1.OpKind.INCREASE_PAID_STORAGE }, params));
|
|
74
74
|
return this;
|
|
@@ -80,7 +80,7 @@ class WalletOperationBatch {
|
|
|
80
80
|
withTransferTicket(params) {
|
|
81
81
|
const destinationValidation = (0, utils_1.validateAddress)(params.destination);
|
|
82
82
|
if (destinationValidation !== utils_1.ValidationResult.VALID) {
|
|
83
|
-
throw new core_1.InvalidAddressError(params.destination,
|
|
83
|
+
throw new core_1.InvalidAddressError(params.destination, destinationValidation);
|
|
84
84
|
}
|
|
85
85
|
this.operations.push(Object.assign({ kind: types_1.OpKind.TRANSFER_TICKET }, params));
|
|
86
86
|
return this;
|
|
@@ -203,7 +203,7 @@ class Wallet {
|
|
|
203
203
|
var _a;
|
|
204
204
|
const delegateValidation = (0, utils_1.validateAddress)((_a = params.delegate) !== null && _a !== void 0 ? _a : '');
|
|
205
205
|
if (params.delegate && delegateValidation !== utils_1.ValidationResult.VALID) {
|
|
206
|
-
throw new core_1.InvalidAddressError(params.delegate,
|
|
206
|
+
throw new core_1.InvalidAddressError(params.delegate, delegateValidation);
|
|
207
207
|
}
|
|
208
208
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
209
209
|
const mappedParams = yield this.walletProvider.mapDelegateParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -265,7 +265,7 @@ class Wallet {
|
|
|
265
265
|
transfer(params) {
|
|
266
266
|
const toValidation = (0, utils_1.validateAddress)(params.to);
|
|
267
267
|
if (toValidation !== utils_1.ValidationResult.VALID) {
|
|
268
|
-
throw new core_1.InvalidAddressError(params.to,
|
|
268
|
+
throw new core_1.InvalidAddressError(params.to, toValidation);
|
|
269
269
|
}
|
|
270
270
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
271
271
|
const mappedParams = yield this.walletProvider.mapTransferParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -281,7 +281,7 @@ class Wallet {
|
|
|
281
281
|
transferTicket(params) {
|
|
282
282
|
const toValidation = (0, utils_1.validateAddress)(params.destination);
|
|
283
283
|
if (toValidation !== utils_1.ValidationResult.VALID) {
|
|
284
|
-
throw new core_1.InvalidAddressError(params.destination,
|
|
284
|
+
throw new core_1.InvalidAddressError(params.destination, toValidation);
|
|
285
285
|
}
|
|
286
286
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
287
287
|
const mappedParams = yield this.walletProvider.mapTransferTicketParamsToWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -347,9 +347,6 @@ class Wallet {
|
|
|
347
347
|
if (!params.to) {
|
|
348
348
|
params.to = source;
|
|
349
349
|
}
|
|
350
|
-
if (params.to !== source) {
|
|
351
|
-
throw new core_1.InvalidStakingAddressError(params.to);
|
|
352
|
-
}
|
|
353
350
|
if (!params.amount) {
|
|
354
351
|
params.amount = 0;
|
|
355
352
|
}
|
|
@@ -371,7 +368,7 @@ class Wallet {
|
|
|
371
368
|
increasePaidStorage(params) {
|
|
372
369
|
const destinationValidation = (0, utils_1.validateAddress)(params.destination);
|
|
373
370
|
if (destinationValidation !== utils_1.ValidationResult.VALID) {
|
|
374
|
-
throw new core_1.InvalidAddressError(params.destination,
|
|
371
|
+
throw new core_1.InvalidAddressError(params.destination, destinationValidation);
|
|
375
372
|
}
|
|
376
373
|
return this.walletCommand(() => __awaiter(this, void 0, void 0, function* () {
|
|
377
374
|
const mappedParams = yield this.walletProvider.mapIncreasePaidStorageWalletParams(() => __awaiter(this, void 0, void 0, function* () { return params; }));
|
|
@@ -401,7 +398,7 @@ class Wallet {
|
|
|
401
398
|
return __awaiter(this, arguments, void 0, function* (address, contractAbstractionComposer = (x) => x) {
|
|
402
399
|
const addressValidation = (0, utils_1.validateContractAddress)(address);
|
|
403
400
|
if (addressValidation !== utils_1.ValidationResult.VALID) {
|
|
404
|
-
throw new core_1.InvalidContractAddressError(address,
|
|
401
|
+
throw new core_1.InvalidContractAddressError(address, addressValidation);
|
|
405
402
|
}
|
|
406
403
|
const rpc = this.context.withExtensions().rpc;
|
|
407
404
|
const readProvider = this.context.withExtensions().readProvider;
|