@taquito/taquito 24.3.0-beta.2 → 24.3.0-beta.4

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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/contract/big-map.js +6 -3
  3. package/dist/lib/contract/contract.js +8 -3
  4. package/dist/lib/contract/not-found-retry.js +29 -0
  5. package/dist/lib/contract/rpc-contract-provider.js +28 -18
  6. package/dist/lib/contract/sapling-state-abstraction.js +5 -2
  7. package/dist/lib/contract/semantic.js +4 -4
  8. package/dist/lib/estimate/rpc-estimate-provider.js +2 -0
  9. package/dist/lib/operations/batch-operation.js +3 -2
  10. package/dist/lib/operations/delegate-operation.js +3 -2
  11. package/dist/lib/operations/operations.js +12 -2
  12. package/dist/lib/operations/origination-operation.js +9 -3
  13. package/dist/lib/operations/register-global-constant-operation.js +3 -2
  14. package/dist/lib/operations/reveal-operation.js +3 -2
  15. package/dist/lib/operations/transaction-operation.js +4 -3
  16. package/dist/lib/operations/transfer-ticket-operation.js +3 -2
  17. package/dist/lib/prepare/prepare-provider.js +6 -5
  18. package/dist/lib/provider.js +82 -10
  19. package/dist/lib/read-provider/interface.js +8 -0
  20. package/dist/lib/read-provider/rpc-read-adapter.js +2 -0
  21. package/dist/lib/tz/interface.js +2 -0
  22. package/dist/lib/tz/rpc-tz-provider.js +2 -0
  23. package/dist/lib/version.js +2 -2
  24. package/dist/lib/wallet/origination-operation.js +5 -1
  25. package/dist/lib/wallet/receipt.js +9 -8
  26. package/dist/lib/wallet/wallet.js +18 -7
  27. package/dist/taquito.es6.js +333 -181
  28. package/dist/taquito.es6.js.map +1 -1
  29. package/dist/taquito.min.js +1 -1
  30. package/dist/taquito.umd.js +332 -180
  31. package/dist/taquito.umd.js.map +1 -1
  32. package/dist/types/contract/big-map.d.ts +10 -5
  33. package/dist/types/contract/contract.d.ts +3 -2
  34. package/dist/types/contract/interface.d.ts +5 -4
  35. package/dist/types/contract/not-found-retry.d.ts +3 -0
  36. package/dist/types/contract/rpc-contract-provider.d.ts +5 -4
  37. package/dist/types/contract/sapling-state-abstraction.d.ts +9 -4
  38. package/dist/types/contract/semantic.d.ts +4 -3
  39. package/dist/types/operations/operations.d.ts +4 -1
  40. package/dist/types/operations/transaction-operation.d.ts +2 -2
  41. package/dist/types/provider.d.ts +4 -1
  42. package/dist/types/read-provider/interface.d.ts +5 -1
  43. package/dist/types/read-provider/rpc-read-adapter.d.ts +4 -1
  44. package/dist/types/tz/interface.d.ts +4 -1
  45. package/dist/types/tz/rpc-tz-provider.d.ts +4 -1
  46. package/dist/types/wallet/receipt.d.ts +4 -1
  47. package/dist/types/wallet/wallet.d.ts +1 -0
  48. package/package.json +15 -17
  49. package/signature.json +0 -866
package/README.md CHANGED
@@ -7,7 +7,7 @@ The `@taquito/taquito` package contains higher-level functionality that builds u
7
7
  ## CDN Bundle
8
8
 
9
9
  ```html
10
- <script src="https://unpkg.com/@taquito/taquito@24.3.0-beta.2/dist/taquito.min.js"
10
+ <script src="https://unpkg.com/@taquito/taquito@24.3.0-beta.4/dist/taquito.min.js"
11
11
  crossorigin="anonymous" integrity="sha384-IxvP0ECHi5oqLyz94wF85pU9+ktcsL1HHtA42MITxZsGbsUMEu/g+0Vkjj5vqiMR"></script>
12
12
  ```
13
13
 
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BigMapAbstraction = void 0;
4
+ const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.default;
4
6
  const http_utils_1 = require("@taquito/http-utils");
5
7
  class BigMapAbstraction {
6
- constructor(id, schema, provider) {
8
+ constructor(id, schema, provider, defaultBlock) {
7
9
  this.id = id;
8
10
  this.schema = schema;
9
11
  this.provider = provider;
12
+ this.defaultBlock = defaultBlock;
10
13
  }
11
14
  /**
12
15
  *
@@ -19,7 +22,7 @@ class BigMapAbstraction {
19
22
  */
20
23
  async get(keyToEncode, block) {
21
24
  try {
22
- const id = await this.provider.getBigMapKeyByID(this.id.toString(), keyToEncode, this.schema, block);
25
+ const id = await this.provider.getBigMapKeyByID(this.id.toString(), keyToEncode, this.schema, block ?? this.defaultBlock);
23
26
  return id;
24
27
  }
25
28
  catch (e) {
@@ -45,7 +48,7 @@ class BigMapAbstraction {
45
48
  *
46
49
  */
47
50
  async getMultipleValues(keysToEncode, block, batchSize = 5) {
48
- return this.provider.getBigMapKeysByID(this.id.toString(), keysToEncode, this.schema, block, batchSize);
51
+ return this.provider.getBigMapKeysByID(this.id.toString(), keysToEncode, this.schema, block ?? this.defaultBlock, batchSize);
49
52
  }
50
53
  toJSON() {
51
54
  return this.id.toString();
@@ -8,6 +8,7 @@ const errors_1 = require("./errors");
8
8
  const core_1 = require("@taquito/core");
9
9
  const constants_1 = require("./constants");
10
10
  Object.defineProperty(exports, "DEFAULT_SMART_CONTRACT_METHOD_NAME", { enumerable: true, get: function () { return constants_1.DEFAULT_SMART_CONTRACT_METHOD_NAME; } });
11
+ const semantic_1 = require("./semantic");
11
12
  /**
12
13
  * Utility class to retrieve data from a smart contract's storage without incurring fees via a contract's view method
13
14
  */
@@ -61,13 +62,14 @@ const isView = (entrypoint) => {
61
62
  * Smart contract abstraction
62
63
  */
63
64
  class ContractAbstraction {
64
- constructor(address, script, provider, storageProvider, entrypoints, rpc, readProvider) {
65
+ constructor(address, script, provider, storageProvider, entrypoints, rpc, readProvider, readBlock = 'head') {
65
66
  this.address = address;
66
67
  this.script = script;
67
68
  this.storageProvider = storageProvider;
68
69
  this.entrypoints = entrypoints;
69
70
  this.rpc = rpc;
70
71
  this.readProvider = readProvider;
72
+ this.readBlock = readBlock;
71
73
  /**
72
74
  * Contains methods that are implemented by the target Tezos Smart Contract, and offers the user to call the Smart Contract methods as if they were native TS/JS methods.
73
75
  * `methodsObject` serves the exact same purpose as the `methods` member. The difference is that it allows passing the parameter in an object format when calling the smart contract method (instead of the flattened representation)
@@ -151,8 +153,11 @@ class ContractAbstraction {
151
153
  /**
152
154
  * Return a friendly representation of the smart contract storage
153
155
  */
154
- storage() {
155
- return this.storageProvider.getStorage(this.address, this.schema);
156
+ async storage() {
157
+ if (this.readBlock !== 'head') {
158
+ return this.schema.Execute(this.script.storage, (0, semantic_1.smartContractAbstractionSemantic)(this.storageProvider, this.readBlock));
159
+ }
160
+ return this.storageProvider.getStorage(this.address, this.schema, this.readBlock);
156
161
  }
157
162
  }
158
163
  exports.ContractAbstraction = ContractAbstraction;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.retryOnNotFound = exports.isNotFoundError = void 0;
4
+ const http_utils_1 = require("@taquito/http-utils");
5
+ const CONTRACT_READ_RETRY_DELAYS_MS = [0, 200, 400, 800];
6
+ const sleep = (durationMs) => new Promise((resolve) => {
7
+ setTimeout(resolve, durationMs);
8
+ });
9
+ const isNotFoundError = (error) => error instanceof http_utils_1.HttpResponseError && error.status === http_utils_1.STATUS_CODE.NOT_FOUND;
10
+ exports.isNotFoundError = isNotFoundError;
11
+ const retryOnNotFound = async (read, retryDelaysMs = CONTRACT_READ_RETRY_DELAYS_MS) => {
12
+ let lastError;
13
+ for (const delayMs of retryDelaysMs) {
14
+ if (delayMs > 0) {
15
+ await sleep(delayMs);
16
+ }
17
+ try {
18
+ return await read();
19
+ }
20
+ catch (error) {
21
+ if (!(0, exports.isNotFoundError)(error)) {
22
+ throw error;
23
+ }
24
+ lastError = error;
25
+ }
26
+ }
27
+ throw lastError;
28
+ };
29
+ exports.retryOnNotFound = retryOnNotFound;
@@ -27,6 +27,7 @@ const smart_rollup_originate_operation_1 = require("../operations/smart-rollup-o
27
27
  const smart_rollup_execute_outbox_message_operation_1 = require("../operations/smart-rollup-execute-outbox-message-operation");
28
28
  const provider_1 = require("../provider");
29
29
  const prepare_1 = require("../prepare");
30
+ const not_found_retry_1 = require("./not-found-retry");
30
31
  class RpcContractProvider extends provider_1.Provider {
31
32
  constructor(context, estimator) {
32
33
  super(context);
@@ -43,12 +44,14 @@ class RpcContractProvider extends provider_1.Provider {
43
44
  * @throws {@link InvalidContractAddressError}
44
45
  * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script
45
46
  */
46
- async getStorage(contract, schema) {
47
+ async getStorage(contract, schema, block = 'head') {
47
48
  const contractValidation = (0, utils_1.validateContractAddress)(contract);
48
49
  if (contractValidation !== utils_1.ValidationResult.VALID) {
49
50
  throw new core_1.InvalidContractAddressError(contract, contractValidation);
50
51
  }
51
- const script = await this.context.readProvider.getScript(contract, 'head');
52
+ const script = block === 'head'
53
+ ? await (0, not_found_retry_1.retryOnNotFound)(() => this.context.readProvider.getScript(contract, 'head'))
54
+ : await this.context.readProvider.getScript(contract, block);
52
55
  if (!schema) {
53
56
  schema = script;
54
57
  }
@@ -59,7 +62,7 @@ class RpcContractProvider extends provider_1.Provider {
59
62
  else {
60
63
  contractSchema = michelson_encoder_1.Schema.fromRPCResponse({ script: schema });
61
64
  }
62
- return contractSchema.Execute(script.storage, (0, semantic_1.smartContractAbstractionSemantic)(this)); // Cast into T because only the caller can know the true type of the storage
65
+ return contractSchema.Execute(script.storage, (0, semantic_1.smartContractAbstractionSemantic)(this, block)); // Cast into T because only the caller can know the true type of the storage
63
66
  }
64
67
  /**
65
68
  *
@@ -76,10 +79,9 @@ class RpcContractProvider extends provider_1.Provider {
76
79
  const { key, type } = schema.EncodeBigMapKey(keyToEncode);
77
80
  const { packed } = await this.context.packer.packData({ data: key, type });
78
81
  const encodedExpr = (0, utils_1.encodeExpr)(packed);
79
- const bigMapValue = block
80
- ? await this.context.readProvider.getBigMapValue({ id: id.toString(), expr: encodedExpr }, block)
81
- : await this.context.readProvider.getBigMapValue({ id: id.toString(), expr: encodedExpr }, 'head');
82
- return schema.ExecuteOnBigMapValue(bigMapValue, (0, semantic_1.smartContractAbstractionSemantic)(this));
82
+ const requestedBlock = block ?? 'head';
83
+ const bigMapValue = await this.context.readProvider.getBigMapValue({ id: id.toString(), expr: encodedExpr }, requestedBlock);
84
+ return schema.ExecuteOnBigMapValue(bigMapValue, (0, semantic_1.smartContractAbstractionSemantic)(this, requestedBlock));
83
85
  }
84
86
  /**
85
87
  *
@@ -139,11 +141,8 @@ class RpcContractProvider extends provider_1.Provider {
139
141
  * @param block optional block level to fetch the value from
140
142
  *
141
143
  */
142
- async getSaplingDiffByID(id, block) {
143
- const saplingState = block
144
- ? await this.context.readProvider.getSaplingDiffById({ id: id.toString() }, block)
145
- : await this.context.readProvider.getSaplingDiffById({ id: id.toString() }, 'head');
146
- return saplingState;
144
+ async getSaplingDiffByID(id, block = 'head') {
145
+ return this.context.readProvider.getSaplingDiffById({ id: id.toString() }, block);
147
146
  }
148
147
  /**
149
148
  *
@@ -643,17 +642,28 @@ class RpcContractProvider extends provider_1.Provider {
643
642
  catch (error) {
644
643
  // Shadownet's rolling nodes occasionally 404 a just-originated contract at the exact
645
644
  // inclusion level even after confirmation. Retry at head so the contract abstraction still
646
- // resolves once the node's contract index catches up.
647
- if (block !== 'head' &&
648
- error instanceof http_utils_1.HttpResponseError &&
649
- error.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
650
- contractState = await loadContractState('head');
645
+ // resolves once the node's contract index catches up. The head index can lag briefly too,
646
+ // so give it a few bounded retries before surfacing the 404.
647
+ if (block !== 'head' && (0, not_found_retry_1.isNotFoundError)(error)) {
648
+ contractState = await (0, not_found_retry_1.retryOnNotFound)(() => loadContractState('head'));
651
649
  }
652
650
  else {
653
651
  throw error;
654
652
  }
655
653
  }
656
- const abs = new contract_1.ContractAbstraction(address, contractState.script, this, this, contractState.entrypoints, rpc, readProvider);
654
+ const abs = new contract_1.ContractAbstraction(address, contractState.script, this, this, contractState.entrypoints, rpc, readProvider, 'head');
655
+ return contractAbstractionComposer(abs, this.context);
656
+ }
657
+ async atExactBlock(address, contractAbstractionComposer = (x) => x, block) {
658
+ const addressValidation = (0, utils_1.validateContractAddress)(address);
659
+ if (addressValidation !== utils_1.ValidationResult.VALID) {
660
+ throw new core_1.InvalidContractAddressError(address, addressValidation);
661
+ }
662
+ const rpc = this.context.withExtensions().rpc;
663
+ const readProvider = this.context.withExtensions().readProvider;
664
+ const script = await readProvider.getScript(address, block);
665
+ const entrypoints = await rpc.getEntrypoints(address, { block: String(block) });
666
+ const abs = new contract_1.ContractAbstraction(address, script, this, this, entrypoints, rpc, readProvider, block);
657
667
  return contractAbstractionComposer(abs, this.context);
658
668
  }
659
669
  /**
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SaplingStateAbstraction = void 0;
4
+ const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.default;
4
6
  class SaplingStateAbstraction {
5
- constructor(id, provider) {
7
+ constructor(id, provider, defaultBlock) {
6
8
  this.id = id;
7
9
  this.provider = provider;
10
+ this.defaultBlock = defaultBlock;
8
11
  }
9
12
  /**
10
13
  *
@@ -15,7 +18,7 @@ class SaplingStateAbstraction {
15
18
  *
16
19
  */
17
20
  async getSaplingDiff(block) {
18
- return this.provider.getSaplingDiffByID(this.id.toString(), block);
21
+ return this.provider.getSaplingDiffByID(this.id.toString(), block ?? this.defaultBlock);
19
22
  }
20
23
  getId() {
21
24
  return this.id.toString();
@@ -7,10 +7,10 @@ const bignumber_js_1 = require("bignumber.js");
7
7
  const sapling_state_abstraction_1 = require("./sapling-state-abstraction");
8
8
  /**
9
9
  * Override the default michelson encoder semantic to provide richer abstraction over storage properties
10
- * @param p ContractProvider (contract API)
10
+ * @param p StorageProvider (contract API)
11
11
  */
12
12
  // Override the default michelson encoder semantic to provide richer abstraction over storage properties
13
- const smartContractAbstractionSemantic = (provider) => ({
13
+ const smartContractAbstractionSemantic = (provider, block) => ({
14
14
  // Provide a specific abstraction for BigMaps
15
15
  big_map: (val, code) => {
16
16
  if (!val || !('int' in val) || val.int === undefined) {
@@ -19,7 +19,7 @@ const smartContractAbstractionSemantic = (provider) => ({
19
19
  }
20
20
  else {
21
21
  const schema = new michelson_encoder_1.Schema(code);
22
- return new big_map_1.BigMapAbstraction(new bignumber_js_1.default(val.int), schema, provider);
22
+ return new big_map_1.BigMapAbstraction(new bignumber_js_1.default(val.int), schema, provider, block);
23
23
  }
24
24
  },
25
25
  sapling_state: (val) => {
@@ -28,7 +28,7 @@ const smartContractAbstractionSemantic = (provider) => ({
28
28
  return {};
29
29
  }
30
30
  else {
31
- return new sapling_state_abstraction_1.SaplingStateAbstraction(new bignumber_js_1.default(val.int), provider);
31
+ return new sapling_state_abstraction_1.SaplingStateAbstraction(new bignumber_js_1.default(val.int), provider, block);
32
32
  }
33
33
  },
34
34
  /*
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RPCEstimateProvider = void 0;
4
+ const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.default;
4
6
  const errors_1 = require("../operations/errors");
5
7
  const types_1 = require("../operations/types");
6
8
  const estimate_1 = require("./estimate");
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BatchOperation = void 0;
4
4
  const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.default;
5
6
  const constants_1 = require("../batch/constants");
6
7
  const errors_1 = require("./errors");
7
8
  const operations_1 = require("./operations");
@@ -50,8 +51,8 @@ class BatchOperation extends operations_1.Operation {
50
51
  return this.sumProp(this.params, 'storage_limit');
51
52
  }
52
53
  get consumedGas() {
53
- bignumber_js_1.default.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.default.ROUND_UP });
54
- return new bignumber_js_1.default(this.consumedMilliGas).dividedBy(1000).toString();
54
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
55
+ return new BigNumber(this.consumedMilliGas).dividedBy(1000).toString();
55
56
  }
56
57
  get consumedMilliGas() {
57
58
  return String(this.sumProp((0, errors_1.flattenOperationResult)({ contents: this.results }), 'consumed_milligas'));
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DelegateOperation = void 0;
4
4
  const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.BigNumber;
5
6
  const operations_1 = require("./operations");
6
7
  /**
7
8
  * Delegation operation provide utility function to fetch newly issued delegation
@@ -39,9 +40,9 @@ class DelegateOperation extends operations_1.Operation {
39
40
  return Number(this.params.storage_limit);
40
41
  }
41
42
  get consumedGas() {
42
- bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
43
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
43
44
  return this.consumedMilliGas
44
- ? new bignumber_js_1.BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
45
+ ? new BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
45
46
  : undefined;
46
47
  }
47
48
  get consumedMilliGas() {
@@ -67,6 +67,13 @@ class Operation {
67
67
  get includedInBlock() {
68
68
  return this._foundAt;
69
69
  }
70
+ async getInclusionBlock() {
71
+ const inclusionBlock = await this._includedInBlock.pipe((0, operators_1.first)()).toPromise();
72
+ if (!inclusionBlock) {
73
+ throw new Error('Inclusion block is undefined');
74
+ }
75
+ return inclusionBlock;
76
+ }
70
77
  /**
71
78
  *
72
79
  * @param hash Operation hash
@@ -80,6 +87,7 @@ class Operation {
80
87
  this.results = results;
81
88
  this.context = context;
82
89
  this._pollingConfig$ = new rxjs_1.ReplaySubject(1);
90
+ this._includedInBlock = new rxjs_1.ReplaySubject(1);
83
91
  this.currentHead$ = this._pollingConfig$.pipe((0, operators_1.switchMap)((config) => {
84
92
  return new rxjs_1.BehaviorSubject(config).pipe((0, operators_1.timeout)({
85
93
  each: config.timeout * 1000,
@@ -94,11 +102,13 @@ class Operation {
94
102
  // Observable that emit once operation is seen in a block
95
103
  this.confirmed$ = this.currentHead$.pipe((0, operators_1.map)((head) => {
96
104
  for (let i = 3; i >= 0; i--) {
97
- head.operations[i].forEach((op) => {
105
+ for (const op of head.operations[i]) {
98
106
  if (op.hash === this.hash) {
99
107
  this._foundAt = head.header.level;
108
+ this._includedInBlock.next(head);
109
+ return this._foundAt;
100
110
  }
101
- });
111
+ }
102
112
  }
103
113
  if (head.header.level - this._foundAt >= 0) {
104
114
  return this._foundAt;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OriginationOperation = void 0;
4
4
  const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.BigNumber;
6
+ const interface_1 = require("../read-provider/interface");
5
7
  const errors_1 = require("./errors");
6
8
  const operations_1 = require("./operations");
7
9
  const types_1 = require("./types");
@@ -41,9 +43,9 @@ class OriginationOperation extends operations_1.Operation {
41
43
  return Number(this.params.storage_limit);
42
44
  }
43
45
  get consumedGas() {
44
- bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
46
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
45
47
  return this.consumedMilliGas
46
- ? new bignumber_js_1.BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
48
+ ? new BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
47
49
  : undefined;
48
50
  }
49
51
  get consumedMilliGas() {
@@ -72,7 +74,11 @@ class OriginationOperation extends operations_1.Operation {
72
74
  if (!Number.isFinite(this.includedInBlock)) {
73
75
  throw new errors_1.OriginationOperationError('Confirmation completed but includedInBlock was not set');
74
76
  }
75
- return this.contractProvider.at(this.contractAddress, undefined, this.includedInBlock);
77
+ const inclusionBlock = await this.getInclusionBlock();
78
+ if (!(0, interface_1.isBlockHashIdentifier)(inclusionBlock.hash)) {
79
+ throw new errors_1.OriginationOperationError('Confirmation completed but includedInBlock was not set');
80
+ }
81
+ return this.contractProvider.at(this.contractAddress, undefined, inclusionBlock.hash);
76
82
  }
77
83
  }
78
84
  exports.OriginationOperation = OriginationOperation;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RegisterGlobalConstantOperation = void 0;
4
4
  const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.BigNumber;
5
6
  const operations_1 = require("./operations");
6
7
  /**
7
8
  * RegisterGlobalConstantOperation provides utility functions to fetch a newly issued operation of kind register_global_constant
@@ -40,9 +41,9 @@ class RegisterGlobalConstantOperation extends operations_1.Operation {
40
41
  return this.operationResults?.errors;
41
42
  }
42
43
  get consumedGas() {
43
- bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
44
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
44
45
  return this.consumedMilliGas
45
- ? new bignumber_js_1.BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
46
+ ? new BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
46
47
  : undefined;
47
48
  }
48
49
  get consumedMilliGas() {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RevealOperation = void 0;
4
4
  const core_1 = require("@taquito/core");
5
5
  const bignumber_js_1 = require("bignumber.js");
6
+ const BigNumber = bignumber_js_1.BigNumber;
6
7
  const errors_1 = require("./errors");
7
8
  const operations_1 = require("./operations");
8
9
  /**
@@ -55,8 +56,8 @@ class RevealOperation extends operations_1.Operation {
55
56
  }, 0);
56
57
  }
57
58
  get consumedGas() {
58
- bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
59
- return new bignumber_js_1.BigNumber(this.consumedMilliGas).dividedBy(1000).toString();
59
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
60
+ return new BigNumber(this.consumedMilliGas).dividedBy(1000).toString();
60
61
  }
61
62
  get consumedMilliGas() {
62
63
  return String(this.sumProp((0, errors_1.flattenOperationResult)({ contents: this.operationResults }), 'consumed_milligas'));
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TransactionOperation = void 0;
4
4
  const bignumber_js_1 = require("bignumber.js");
5
+ const BigNumber = bignumber_js_1.default;
5
6
  const errors_1 = require("./errors");
6
7
  const operations_1 = require("./operations");
7
8
  /**
@@ -31,7 +32,7 @@ class TransactionOperation extends operations_1.Operation {
31
32
  }
32
33
  }
33
34
  get amount() {
34
- return new bignumber_js_1.default(this.params.amount);
35
+ return new BigNumber(this.params.amount);
35
36
  }
36
37
  get destination() {
37
38
  return this.params.destination;
@@ -51,8 +52,8 @@ class TransactionOperation extends operations_1.Operation {
51
52
  }, 0);
52
53
  }
53
54
  get consumedGas() {
54
- bignumber_js_1.default.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.default.ROUND_UP });
55
- return new bignumber_js_1.default(this.consumedMilliGas).dividedBy(1000).toString();
55
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
56
+ return new BigNumber(this.consumedMilliGas).dividedBy(1000).toString();
56
57
  }
57
58
  get consumedMilliGas() {
58
59
  return String(this.sumProp((0, errors_1.flattenOperationResult)({ contents: this.operationResults }), 'consumed_milligas'));
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TransferTicketOperation = void 0;
4
4
  const rpc_1 = require("@taquito/rpc");
5
5
  const bignumber_js_1 = require("bignumber.js");
6
+ const BigNumber = bignumber_js_1.BigNumber;
6
7
  const operations_1 = require("./operations");
7
8
  /**
8
9
  *
@@ -35,9 +36,9 @@ class TransferTicketOperation extends operations_1.Operation {
35
36
  return Number(this.params.storage_limit);
36
37
  }
37
38
  get consumedGas() {
38
- bignumber_js_1.BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: bignumber_js_1.BigNumber.ROUND_UP });
39
+ BigNumber.config({ DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_UP });
39
40
  return this.consumedMilliGas
40
- ? new bignumber_js_1.BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
41
+ ? new BigNumber(this.consumedMilliGas).dividedBy(1000).toString()
41
42
  : undefined;
42
43
  }
43
44
  get consumedMilliGas() {
@@ -21,6 +21,7 @@ const core_1 = require("@taquito/core");
21
21
  const contract_1 = require("../contract");
22
22
  const provider_1 = require("../provider");
23
23
  const bignumber_js_1 = require("bignumber.js");
24
+ const BigNumber = bignumber_js_1.default;
24
25
  const utils_1 = require("@taquito/utils");
25
26
  const mergeLimits = (userDefinedLimit, defaultLimits) => {
26
27
  return {
@@ -48,15 +49,15 @@ class PrepareProvider extends provider_1.Provider {
48
49
  async getHeadCounter(pkh) {
49
50
  return this.context.readProvider.getCounter(pkh, 'head') ?? '0';
50
51
  }
51
- adjustGasForManagerOperations(gasLimitBlock, gaslimitOp, opsNeedingGasLimitPatch, explicitGasLimitTotal = new bignumber_js_1.default(0)) {
52
+ adjustGasForManagerOperations(gasLimitBlock, gaslimitOp, opsNeedingGasLimitPatch, explicitGasLimitTotal = new BigNumber(0)) {
52
53
  if (opsNeedingGasLimitPatch <= 0) {
53
54
  return gaslimitOp;
54
55
  }
55
56
  const remainingBlockGas = gasLimitBlock.minus(explicitGasLimitTotal);
56
57
  if (remainingBlockGas.lte(0)) {
57
- return new bignumber_js_1.default(0);
58
+ return new BigNumber(0);
58
59
  }
59
- return bignumber_js_1.default.min(gaslimitOp, remainingBlockGas.div(opsNeedingGasLimitPatch).integerValue(bignumber_js_1.default.ROUND_DOWN));
60
+ return BigNumber.min(gaslimitOp, remainingBlockGas.div(opsNeedingGasLimitPatch).integerValue(BigNumber.ROUND_DOWN));
60
61
  }
61
62
  getOperationLimits(constants, options = {}) {
62
63
  const { hard_gas_limit_per_operation, hard_gas_limit_per_block, hard_storage_limit_per_operation, } = constants;
@@ -71,7 +72,7 @@ class PrepareProvider extends provider_1.Provider {
71
72
  return this.getOperationLimits(constants, {
72
73
  opsNeedingGasLimitPatch: typeof gasLimit === 'undefined' ? 1 : 0,
73
74
  explicitGasLimitTotal: revealNeeded
74
- ? new bignumber_js_1.default((0, constants_1.getRevealGasLimit)(publicKeyHash))
75
+ ? new BigNumber((0, constants_1.getRevealGasLimit)(publicKeyHash))
75
76
  : undefined,
76
77
  });
77
78
  }
@@ -901,7 +902,7 @@ class PrepareProvider extends provider_1.Provider {
901
902
  const { pkh, publicKey } = await this.getKeys();
902
903
  const protocolConstants = await this.context.readProvider.getProtocolConstants('head');
903
904
  const revealNeeded = await this.isRevealOpNeeded(batchParams, pkh);
904
- const explicitGasLimitTotal = batchParams.reduce((acc, op) => (0, types_1.isOpWithFee)(op) && typeof op.gasLimit !== 'undefined' ? acc.plus(op.gasLimit) : acc, revealNeeded ? new bignumber_js_1.default((0, constants_1.getRevealGasLimit)(pkh)) : new bignumber_js_1.default(0));
905
+ const explicitGasLimitTotal = batchParams.reduce((acc, op) => (0, types_1.isOpWithFee)(op) && typeof op.gasLimit !== 'undefined' ? acc.plus(op.gasLimit) : acc, revealNeeded ? new BigNumber((0, constants_1.getRevealGasLimit)(pkh)) : new BigNumber(0));
905
906
  const DEFAULT_PARAMS = this.getOperationLimits(protocolConstants, {
906
907
  opsNeedingGasLimitPatch: batchParams.filter((op) => (0, types_1.isOpWithFee)(op) && typeof op.gasLimit === 'undefined').length,
907
908
  explicitGasLimitTotal,