@taquito/taquito 24.2.0 → 24.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/lib/batch/rpc-batch-provider.js +91 -83
- package/dist/lib/context.js +22 -26
- package/dist/lib/contract/big-map.js +16 -29
- package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
- package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
- package/dist/lib/contract/contract.js +21 -32
- package/dist/lib/contract/errors.js +9 -9
- package/dist/lib/contract/prepare.js +36 -45
- package/dist/lib/contract/rpc-contract-provider.js +426 -475
- package/dist/lib/contract/sapling-state-abstraction.js +3 -14
- package/dist/lib/contract/semantic.js +2 -2
- package/dist/lib/errors.js +3 -3
- package/dist/lib/estimate/errors.js +1 -1
- package/dist/lib/estimate/estimate.js +66 -20
- package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
- package/dist/lib/forger/composite-forger.js +16 -27
- package/dist/lib/forger/errors.js +2 -2
- package/dist/lib/forger/taquito-local-forger.js +9 -22
- package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
- package/dist/lib/global-constants/errors.js +2 -2
- package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
- package/dist/lib/import-key.js +23 -34
- package/dist/lib/injector/rpc-injector.js +13 -24
- package/dist/lib/operations/ballot-operation.js +2 -3
- package/dist/lib/operations/delegate-operation.js +5 -8
- package/dist/lib/operations/drain-delegate-operation.js +1 -1
- package/dist/lib/operations/errors.js +9 -6
- package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
- package/dist/lib/operations/operations.js +100 -30
- package/dist/lib/operations/origination-operation.js +16 -27
- package/dist/lib/operations/proposals-operation.js +2 -3
- package/dist/lib/operations/register-global-constant-operation.js +4 -7
- package/dist/lib/operations/reveal-operation.js +1 -1
- package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
- package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
- package/dist/lib/operations/transaction-operation.js +2 -2
- package/dist/lib/operations/transfer-ticket-operation.js +4 -6
- package/dist/lib/operations/types.js +17 -19
- package/dist/lib/operations/update-companion-key-operation.js +4 -7
- package/dist/lib/operations/update-consensus-key-operation.js +4 -7
- package/dist/lib/packer/michel-codec-packer.js +3 -14
- package/dist/lib/packer/rpc-packer.js +2 -13
- package/dist/lib/parser/michel-codec-parser.js +82 -107
- package/dist/lib/parser/noop-parser.js +2 -13
- package/dist/lib/prepare/prepare-provider.js +780 -744
- package/dist/lib/provider.js +322 -128
- package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
- package/dist/lib/signer/errors.js +1 -1
- package/dist/lib/signer/noop.js +9 -26
- package/dist/lib/subscribe/errors.js +2 -2
- package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
- package/dist/lib/taquito.js +33 -33
- package/dist/lib/tz/rpc-tz-provider.js +27 -44
- package/dist/lib/version.js +2 -2
- package/dist/lib/wallet/batch-operation.js +32 -45
- package/dist/lib/wallet/delegation-operation.js +25 -40
- package/dist/lib/wallet/errors.js +15 -3
- package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
- package/dist/lib/wallet/legacy.js +28 -63
- package/dist/lib/wallet/operation-factory.js +27 -56
- package/dist/lib/wallet/operation.js +123 -59
- package/dist/lib/wallet/origination-operation.js +34 -46
- package/dist/lib/wallet/register-global-constant-operation.js +26 -43
- package/dist/lib/wallet/transaction-operation.js +21 -36
- package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
- package/dist/lib/wallet/wallet.js +187 -184
- package/dist/taquito.es6.js +3424 -3197
- package/dist/taquito.es6.js.map +1 -1
- package/dist/taquito.min.js +1 -1
- package/dist/taquito.umd.js +7930 -7701
- package/dist/taquito.umd.js.map +1 -1
- package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
- package/dist/types/context.d.ts +4 -4
- package/dist/types/contract/big-map.d.ts +3 -3
- package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
- package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
- package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
- package/dist/types/contract/contract.d.ts +6 -6
- package/dist/types/contract/errors.d.ts +11 -11
- package/dist/types/contract/interface.d.ts +42 -42
- package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
- package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
- package/dist/types/contract/semantic.d.ts +2 -2
- package/dist/types/errors.d.ts +5 -5
- package/dist/types/estimate/errors.d.ts +1 -1
- package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
- package/dist/types/estimate/estimate.d.ts +28 -11
- package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
- package/dist/types/forger/errors.d.ts +2 -2
- package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
- package/dist/types/global-constants/errors.d.ts +2 -2
- package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
- package/dist/types/import-key.d.ts +2 -2
- package/dist/types/operations/ballot-operation.d.ts +1 -1
- package/dist/types/operations/delegate-operation.d.ts +2 -2
- package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
- package/dist/types/operations/errors.d.ts +5 -5
- package/dist/types/operations/failing-noop-operation.d.ts +1 -1
- package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
- package/dist/types/operations/operations.d.ts +2 -2
- package/dist/types/operations/origination-operation.d.ts +5 -5
- package/dist/types/operations/proposals-operation.d.ts +1 -1
- package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
- package/dist/types/operations/reveal-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
- package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
- package/dist/types/operations/transaction-operation.d.ts +2 -2
- package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
- package/dist/types/operations/types.d.ts +387 -25
- package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
- package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
- package/dist/types/prepare/interface.d.ts +32 -33
- package/dist/types/prepare/prepare-provider.d.ts +34 -60
- package/dist/types/provider.d.ts +7 -1
- package/dist/types/read-provider/interface.d.ts +21 -21
- package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
- package/dist/types/signer/errors.d.ts +1 -1
- package/dist/types/signer/noop.d.ts +1 -1
- package/dist/types/subscribe/errors.d.ts +2 -2
- package/dist/types/taquito.d.ts +33 -33
- package/dist/types/wallet/errors.d.ts +10 -2
- package/dist/types/wallet/interface.d.ts +13 -13
- package/dist/types/wallet/operation.d.ts +4 -3
- package/dist/types/wallet/wallet.d.ts +36 -35
- package/package.json +27 -15
- package/LICENSE +0 -202
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SaplingStateAbstraction = void 0;
|
|
13
4
|
class SaplingStateAbstraction {
|
|
@@ -17,16 +8,14 @@ class SaplingStateAbstraction {
|
|
|
17
8
|
}
|
|
18
9
|
/**
|
|
19
10
|
*
|
|
20
|
-
*
|
|
11
|
+
* Fetch the sapling state
|
|
21
12
|
*
|
|
22
13
|
* @param block optional block level to fetch the values from (head will be use by default)
|
|
23
14
|
* @returns Return a json object of the sapling_state
|
|
24
15
|
*
|
|
25
16
|
*/
|
|
26
|
-
getSaplingDiff(block) {
|
|
27
|
-
return
|
|
28
|
-
return this.provider.getSaplingDiffByID(this.id.toString(), block);
|
|
29
|
-
});
|
|
17
|
+
async getSaplingDiff(block) {
|
|
18
|
+
return this.provider.getSaplingDiffByID(this.id.toString(), block);
|
|
30
19
|
}
|
|
31
20
|
getId() {
|
|
32
21
|
return this.id.toString();
|
|
@@ -6,8 +6,8 @@ const big_map_1 = require("./big-map");
|
|
|
6
6
|
const bignumber_js_1 = require("bignumber.js");
|
|
7
7
|
const sapling_state_abstraction_1 = require("./sapling-state-abstraction");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
9
|
+
* Override the default michelson encoder semantic to provide richer abstraction over storage properties
|
|
10
|
+
* @param p ContractProvider (contract API)
|
|
11
11
|
*/
|
|
12
12
|
// Override the default michelson encoder semantic to provide richer abstraction over storage properties
|
|
13
13
|
const smartContractAbstractionSemantic = (provider) => ({
|
package/dist/lib/errors.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.RPCResponseError = exports.ConfirmationTimeoutError = exports.InvalidCon
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates invalid confirmation count has been passed or configured
|
|
8
8
|
*/
|
|
9
9
|
class InvalidConfirmationCountError extends core_1.ParameterValidationError {
|
|
10
10
|
constructor(invalidConfirmations) {
|
|
@@ -17,7 +17,7 @@ class InvalidConfirmationCountError extends core_1.ParameterValidationError {
|
|
|
17
17
|
exports.InvalidConfirmationCountError = InvalidConfirmationCountError;
|
|
18
18
|
/**
|
|
19
19
|
* @category Error
|
|
20
|
-
*
|
|
20
|
+
* Error that indicates that confirmation polling timed out
|
|
21
21
|
*/
|
|
22
22
|
class ConfirmationTimeoutError extends core_1.NetworkError {
|
|
23
23
|
constructor(message) {
|
|
@@ -29,7 +29,7 @@ class ConfirmationTimeoutError extends core_1.NetworkError {
|
|
|
29
29
|
exports.ConfirmationTimeoutError = ConfirmationTimeoutError;
|
|
30
30
|
/**
|
|
31
31
|
* @category Error
|
|
32
|
-
*
|
|
32
|
+
* Error that indicates an error being returned from the RPC response
|
|
33
33
|
*/
|
|
34
34
|
class RPCResponseError extends core_1.RpcError {
|
|
35
35
|
constructor(message, cause) {
|
|
@@ -4,7 +4,7 @@ exports.RevealEstimateError = void 0;
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates unable to get public key to estimate reveal operation in Wallet API
|
|
8
8
|
*/
|
|
9
9
|
class RevealEstimateError extends core_1.TaquitoError {
|
|
10
10
|
constructor() {
|
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Estimate = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exports.Estimate = exports.feeParamsFromMempoolFilter = exports.DEFAULT_FEE_PARAMS = void 0;
|
|
4
|
+
exports.DEFAULT_FEE_PARAMS = {
|
|
5
|
+
minimalFeeMutez: 100,
|
|
6
|
+
feePerGasMutez: 0.1,
|
|
7
|
+
feePerByteMutez: 1,
|
|
8
|
+
};
|
|
9
|
+
const parseRatio = (value) => {
|
|
10
|
+
if (!Array.isArray(value) || value.length < 2) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const numerator = Number(value[0]);
|
|
14
|
+
const denominator = Number(value[1]);
|
|
15
|
+
if (!Number.isFinite(numerator) || !Number.isFinite(denominator) || denominator === 0) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
return numerator / denominator;
|
|
19
|
+
};
|
|
20
|
+
const feeParamsFromMempoolFilter = (response) => {
|
|
21
|
+
// L1 historically behaves like Taquito's long-standing defaults. Tezos X keeps the
|
|
22
|
+
// same fee formula shape, but these mempool values become material and may change
|
|
23
|
+
// over time, so estimation must read them from RPC instead of hardcoding them.
|
|
24
|
+
const minimalFeeMutez = Number(response?.minimal_fees);
|
|
25
|
+
const feePerGasNanotez = parseRatio(response?.minimal_nanotez_per_gas_unit);
|
|
26
|
+
const feePerByteNanotez = parseRatio(response?.minimal_nanotez_per_byte);
|
|
27
|
+
return {
|
|
28
|
+
minimalFeeMutez: Number.isFinite(minimalFeeMutez)
|
|
29
|
+
? minimalFeeMutez
|
|
30
|
+
: exports.DEFAULT_FEE_PARAMS.minimalFeeMutez,
|
|
31
|
+
feePerGasMutez:
|
|
32
|
+
// `mempool/filter` returns nanotez ratios, while `Estimate` works in mutez.
|
|
33
|
+
typeof feePerGasNanotez === 'number'
|
|
34
|
+
? feePerGasNanotez / 1000
|
|
35
|
+
: exports.DEFAULT_FEE_PARAMS.feePerGasMutez,
|
|
36
|
+
feePerByteMutez: typeof feePerByteNanotez === 'number'
|
|
37
|
+
? feePerByteNanotez / 1000
|
|
38
|
+
: exports.DEFAULT_FEE_PARAMS.feePerByteMutez,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.feeParamsFromMempoolFilter = feeParamsFromMempoolFilter;
|
|
7
42
|
/**
|
|
8
43
|
* Examples of use :
|
|
9
44
|
*
|
|
@@ -38,69 +73,79 @@ const MINIMAL_FEE_PER_GAS_MUTEZ = 0.1;
|
|
|
38
73
|
* est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez)
|
|
39
74
|
*
|
|
40
75
|
* ```
|
|
76
|
+
*
|
|
77
|
+
* Fee estimation keeps the same overall formula shape on Tezos L1 and on Tezos X / Tezlink:
|
|
78
|
+
* a fixed minimal fee plus byte and gas-price components. The important difference is that on
|
|
79
|
+
* Tezos X the byte fee and gas-price terms exposed by `mempool/filter` are material and may
|
|
80
|
+
* change over time, while on L1 they have historically been close to Taquito's long-standing
|
|
81
|
+
* defaults. `Estimate` therefore accepts fee parameters computed by the estimator instead of
|
|
82
|
+
* assuming L1 values internally.
|
|
41
83
|
*/
|
|
42
84
|
class Estimate {
|
|
43
85
|
constructor(_milligasLimit, _storageLimit, opSize, minimalFeePerStorageByteMutez,
|
|
44
86
|
/**
|
|
45
|
-
*
|
|
87
|
+
* Base fee in mutez (1 mutez = 1e10−6 tez)
|
|
46
88
|
*/
|
|
47
|
-
baseFeeMutez =
|
|
89
|
+
baseFeeMutez = exports.DEFAULT_FEE_PARAMS.minimalFeeMutez, feeParams = exports.DEFAULT_FEE_PARAMS) {
|
|
48
90
|
this._milligasLimit = _milligasLimit;
|
|
49
91
|
this._storageLimit = _storageLimit;
|
|
50
92
|
this.opSize = opSize;
|
|
51
93
|
this.minimalFeePerStorageByteMutez = minimalFeePerStorageByteMutez;
|
|
52
94
|
this.baseFeeMutez = baseFeeMutez;
|
|
95
|
+
this.feeParams = feeParams;
|
|
53
96
|
}
|
|
54
97
|
/**
|
|
55
|
-
*
|
|
98
|
+
* The number of Mutez that will be burned for the storage of the [operation](https://tezos.gitlab.io/user/glossary.html#operations). (Storage + Allocation fees)
|
|
56
99
|
*/
|
|
57
100
|
get burnFeeMutez() {
|
|
58
101
|
return this.roundUp(Number(this.storageLimit) * Number(this.minimalFeePerStorageByteMutez));
|
|
59
102
|
}
|
|
60
103
|
/**
|
|
61
|
-
*
|
|
104
|
+
* The limit on the amount of storage an [operation](https://tezos.gitlab.io/user/glossary.html#operations) can use with 20 buffer.
|
|
62
105
|
*/
|
|
63
106
|
get storageLimit() {
|
|
64
107
|
return Math.max(Number(this._storageLimit), 0);
|
|
65
108
|
}
|
|
66
109
|
/**
|
|
67
|
-
*
|
|
110
|
+
* The limit on the amount of [gas](https://tezos.gitlab.io/user/glossary.html#gas) a given operation can consume with 100 buffer depends on the operation.
|
|
68
111
|
*/
|
|
69
112
|
get gasLimit() {
|
|
70
113
|
return this.roundUp(Number(this._milligasLimit) / 1000);
|
|
71
114
|
}
|
|
72
115
|
get operationFeeMutez() {
|
|
73
|
-
return (this.gasLimit *
|
|
116
|
+
return (this.gasLimit * this.feeParams.feePerGasMutez +
|
|
117
|
+
Number(this.opSize) * this.feeParams.feePerByteMutez);
|
|
74
118
|
}
|
|
75
119
|
roundUp(nanotez) {
|
|
76
120
|
return Math.ceil(Number(nanotez));
|
|
77
121
|
}
|
|
78
122
|
/**
|
|
79
|
-
*
|
|
123
|
+
* Minimum fees for the [operation](https://tezos.gitlab.io/user/glossary.html#operations) according to [baker](https://tezos.gitlab.io/user/glossary.html#baker) defaults.
|
|
80
124
|
*/
|
|
81
125
|
get minimalFeeMutez() {
|
|
82
|
-
return this.roundUp(this.operationFeeMutez +
|
|
126
|
+
return this.roundUp(this.operationFeeMutez + this.feeParams.minimalFeeMutez);
|
|
83
127
|
}
|
|
84
128
|
/**
|
|
85
|
-
*
|
|
129
|
+
* The suggested fee for the operation which includes minimal fees and a small buffer.
|
|
86
130
|
*/
|
|
87
131
|
get suggestedFeeMutez() {
|
|
88
|
-
return this.roundUp(this.operationFeeMutez +
|
|
132
|
+
return this.roundUp(this.operationFeeMutez + this.feeParams.minimalFeeMutez * 1.2);
|
|
89
133
|
}
|
|
90
134
|
/**
|
|
91
|
-
*
|
|
135
|
+
* Fees according to your specified base fee will ensure that at least minimum fees are used.
|
|
92
136
|
*/
|
|
93
137
|
get usingBaseFeeMutez() {
|
|
94
|
-
return (Math.max(Number(this.baseFeeMutez),
|
|
138
|
+
return (Math.max(Number(this.baseFeeMutez), this.feeParams.minimalFeeMutez) +
|
|
139
|
+
this.roundUp(this.operationFeeMutez));
|
|
95
140
|
}
|
|
96
141
|
/**
|
|
97
|
-
*
|
|
142
|
+
* The sum of `minimalFeeMutez` + `burnFeeMutez`.
|
|
98
143
|
*/
|
|
99
144
|
get totalCost() {
|
|
100
145
|
return this.minimalFeeMutez + this.burnFeeMutez;
|
|
101
146
|
}
|
|
102
147
|
/**
|
|
103
|
-
*
|
|
148
|
+
* Since Delphinet, consumed gas is provided in milligas for more precision.
|
|
104
149
|
* This function returns an estimation of the gas that operation will consume in milligas.
|
|
105
150
|
*/
|
|
106
151
|
get consumedMilligas() {
|
|
@@ -112,6 +157,7 @@ class Estimate {
|
|
|
112
157
|
let opSize = 0;
|
|
113
158
|
let minimalFeePerStorageByteMutez = 0;
|
|
114
159
|
let baseFeeMutez;
|
|
160
|
+
const feeParams = estimateProperties[0]?.feeParams;
|
|
115
161
|
estimateProperties.forEach((estimate) => {
|
|
116
162
|
milligasLimit += estimate.milligasLimit;
|
|
117
163
|
storageLimit += estimate.storageLimit;
|
|
@@ -121,10 +167,10 @@ class Estimate {
|
|
|
121
167
|
baseFeeMutez = baseFeeMutez ? baseFeeMutez + estimate.baseFeeMutez : estimate.baseFeeMutez;
|
|
122
168
|
}
|
|
123
169
|
});
|
|
124
|
-
return new Estimate(milligasLimit, storageLimit, opSize, minimalFeePerStorageByteMutez, baseFeeMutez);
|
|
170
|
+
return new Estimate(milligasLimit, storageLimit, opSize, minimalFeePerStorageByteMutez, baseFeeMutez, feeParams);
|
|
125
171
|
}
|
|
126
172
|
static createArrayEstimateInstancesFromProperties(estimateProperties) {
|
|
127
|
-
return estimateProperties.map((x) => new Estimate(x.milligasLimit, x.storageLimit, x.opSize, x.minimalFeePerStorageByteMutez, x.baseFeeMutez));
|
|
173
|
+
return estimateProperties.map((x) => new Estimate(x.milligasLimit, x.storageLimit, x.opSize, x.minimalFeePerStorageByteMutez, x.baseFeeMutez, x.feeParams));
|
|
128
174
|
}
|
|
129
175
|
}
|
|
130
176
|
exports.Estimate = Estimate;
|