@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.
Files changed (129) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/batch/rpc-batch-provider.js +91 -83
  3. package/dist/lib/context.js +22 -26
  4. package/dist/lib/contract/big-map.js +16 -29
  5. package/dist/lib/contract/contract-methods/contract-method-object-param.js +7 -7
  6. package/dist/lib/contract/contract-methods/contract-on-chain-view.js +31 -44
  7. package/dist/lib/contract/contract.js +21 -32
  8. package/dist/lib/contract/errors.js +9 -9
  9. package/dist/lib/contract/prepare.js +36 -45
  10. package/dist/lib/contract/rpc-contract-provider.js +426 -475
  11. package/dist/lib/contract/sapling-state-abstraction.js +3 -14
  12. package/dist/lib/contract/semantic.js +2 -2
  13. package/dist/lib/errors.js +3 -3
  14. package/dist/lib/estimate/errors.js +1 -1
  15. package/dist/lib/estimate/estimate.js +66 -20
  16. package/dist/lib/estimate/rpc-estimate-provider.js +427 -460
  17. package/dist/lib/forger/composite-forger.js +16 -27
  18. package/dist/lib/forger/errors.js +2 -2
  19. package/dist/lib/forger/taquito-local-forger.js +9 -22
  20. package/dist/lib/global-constants/default-global-constants-provider.js +8 -19
  21. package/dist/lib/global-constants/errors.js +2 -2
  22. package/dist/lib/global-constants/noop-global-constants-provider.js +2 -13
  23. package/dist/lib/import-key.js +23 -34
  24. package/dist/lib/injector/rpc-injector.js +13 -24
  25. package/dist/lib/operations/ballot-operation.js +2 -3
  26. package/dist/lib/operations/delegate-operation.js +5 -8
  27. package/dist/lib/operations/drain-delegate-operation.js +1 -1
  28. package/dist/lib/operations/errors.js +9 -6
  29. package/dist/lib/operations/increase-paid-storage-operation.js +4 -7
  30. package/dist/lib/operations/operations.js +100 -30
  31. package/dist/lib/operations/origination-operation.js +16 -27
  32. package/dist/lib/operations/proposals-operation.js +2 -3
  33. package/dist/lib/operations/register-global-constant-operation.js +4 -7
  34. package/dist/lib/operations/reveal-operation.js +1 -1
  35. package/dist/lib/operations/smart-rollup-add-messages-operation.js +4 -7
  36. package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +4 -7
  37. package/dist/lib/operations/smart-rollup-originate-operation.js +4 -7
  38. package/dist/lib/operations/transaction-operation.js +2 -2
  39. package/dist/lib/operations/transfer-ticket-operation.js +4 -6
  40. package/dist/lib/operations/types.js +17 -19
  41. package/dist/lib/operations/update-companion-key-operation.js +4 -7
  42. package/dist/lib/operations/update-consensus-key-operation.js +4 -7
  43. package/dist/lib/packer/michel-codec-packer.js +3 -14
  44. package/dist/lib/packer/rpc-packer.js +2 -13
  45. package/dist/lib/parser/michel-codec-parser.js +82 -107
  46. package/dist/lib/parser/noop-parser.js +2 -13
  47. package/dist/lib/prepare/prepare-provider.js +780 -744
  48. package/dist/lib/provider.js +322 -128
  49. package/dist/lib/read-provider/rpc-read-adapter.js +76 -121
  50. package/dist/lib/signer/errors.js +1 -1
  51. package/dist/lib/signer/noop.js +9 -26
  52. package/dist/lib/subscribe/errors.js +2 -2
  53. package/dist/lib/subscribe/polling-subcribe-provider.js +35 -38
  54. package/dist/lib/taquito.js +33 -33
  55. package/dist/lib/tz/rpc-tz-provider.js +27 -44
  56. package/dist/lib/version.js +2 -2
  57. package/dist/lib/wallet/batch-operation.js +32 -45
  58. package/dist/lib/wallet/delegation-operation.js +25 -40
  59. package/dist/lib/wallet/errors.js +15 -3
  60. package/dist/lib/wallet/increase-paid-storage-operation.js +25 -40
  61. package/dist/lib/wallet/legacy.js +28 -63
  62. package/dist/lib/wallet/operation-factory.js +27 -56
  63. package/dist/lib/wallet/operation.js +123 -59
  64. package/dist/lib/wallet/origination-operation.js +34 -46
  65. package/dist/lib/wallet/register-global-constant-operation.js +26 -43
  66. package/dist/lib/wallet/transaction-operation.js +21 -36
  67. package/dist/lib/wallet/transfer-ticket-operation.js +21 -36
  68. package/dist/lib/wallet/wallet.js +187 -184
  69. package/dist/taquito.es6.js +3424 -3197
  70. package/dist/taquito.es6.js.map +1 -1
  71. package/dist/taquito.min.js +1 -1
  72. package/dist/taquito.umd.js +7930 -7701
  73. package/dist/taquito.umd.js.map +1 -1
  74. package/dist/types/batch/rpc-batch-provider.d.ts +18 -18
  75. package/dist/types/context.d.ts +4 -4
  76. package/dist/types/contract/big-map.d.ts +3 -3
  77. package/dist/types/contract/contract-methods/contract-method-interface.d.ts +4 -4
  78. package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +6 -6
  79. package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +3 -3
  80. package/dist/types/contract/contract.d.ts +6 -6
  81. package/dist/types/contract/errors.d.ts +11 -11
  82. package/dist/types/contract/interface.d.ts +42 -42
  83. package/dist/types/contract/rpc-contract-provider.d.ts +44 -43
  84. package/dist/types/contract/sapling-state-abstraction.d.ts +1 -1
  85. package/dist/types/contract/semantic.d.ts +2 -2
  86. package/dist/types/errors.d.ts +5 -5
  87. package/dist/types/estimate/errors.d.ts +1 -1
  88. package/dist/types/estimate/estimate-provider-interface.d.ts +81 -84
  89. package/dist/types/estimate/estimate.d.ts +28 -11
  90. package/dist/types/estimate/rpc-estimate-provider.d.ts +34 -30
  91. package/dist/types/forger/errors.d.ts +2 -2
  92. package/dist/types/global-constants/default-global-constants-provider.d.ts +2 -2
  93. package/dist/types/global-constants/errors.d.ts +2 -2
  94. package/dist/types/global-constants/interface-global-constants-provider.d.ts +1 -1
  95. package/dist/types/import-key.d.ts +2 -2
  96. package/dist/types/operations/ballot-operation.d.ts +1 -1
  97. package/dist/types/operations/delegate-operation.d.ts +2 -2
  98. package/dist/types/operations/drain-delegate-operation.d.ts +1 -1
  99. package/dist/types/operations/errors.d.ts +5 -5
  100. package/dist/types/operations/failing-noop-operation.d.ts +1 -1
  101. package/dist/types/operations/increase-paid-storage-operation.d.ts +1 -1
  102. package/dist/types/operations/operations.d.ts +2 -2
  103. package/dist/types/operations/origination-operation.d.ts +5 -5
  104. package/dist/types/operations/proposals-operation.d.ts +1 -1
  105. package/dist/types/operations/register-global-constant-operation.d.ts +2 -2
  106. package/dist/types/operations/reveal-operation.d.ts +1 -1
  107. package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +1 -1
  108. package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +1 -1
  109. package/dist/types/operations/smart-rollup-originate-operation.d.ts +1 -1
  110. package/dist/types/operations/transaction-operation.d.ts +2 -2
  111. package/dist/types/operations/transfer-ticket-operation.d.ts +2 -2
  112. package/dist/types/operations/types.d.ts +387 -25
  113. package/dist/types/operations/update-companion-key-operation.d.ts +1 -1
  114. package/dist/types/operations/update-consensus-key-operation.d.ts +1 -1
  115. package/dist/types/prepare/interface.d.ts +32 -33
  116. package/dist/types/prepare/prepare-provider.d.ts +34 -60
  117. package/dist/types/provider.d.ts +7 -1
  118. package/dist/types/read-provider/interface.d.ts +21 -21
  119. package/dist/types/read-provider/rpc-read-adapter.d.ts +22 -22
  120. package/dist/types/signer/errors.d.ts +1 -1
  121. package/dist/types/signer/noop.d.ts +1 -1
  122. package/dist/types/subscribe/errors.d.ts +2 -2
  123. package/dist/types/taquito.d.ts +33 -33
  124. package/dist/types/wallet/errors.d.ts +10 -2
  125. package/dist/types/wallet/interface.d.ts +13 -13
  126. package/dist/types/wallet/operation.d.ts +4 -3
  127. package/dist/types/wallet/wallet.d.ts +36 -35
  128. package/package.json +27 -15
  129. 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.OnChainView = void 0;
13
4
  const utils_1 = require("@taquito/utils");
@@ -23,7 +14,7 @@ class OnChainView {
23
14
  this._args = _args;
24
15
  }
25
16
  /**
26
- * @description Get the signature of the smart contract view
17
+ * Get the signature of the smart contract view
27
18
  */
28
19
  getSignature() {
29
20
  return {
@@ -32,27 +23,25 @@ class OnChainView {
32
23
  };
33
24
  }
34
25
  /**
35
- * @description Get the result of the view simulation
26
+ * Get the result of the view simulation
36
27
  * @param executionContext.source the public key hash of the account who initialized this view execution.
37
28
  * @param executionContext.viewCaller the contract address which is the caller of view.
38
29
  */
39
- executeView(executionContext) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- this.verifyContextExecution(executionContext);
42
- const chainId = yield this._readProvider.getChainId();
43
- const viewArgs = this.transformArgsToMichelson();
44
- const scriptView = {
45
- contract: this._contractAddress,
46
- view: this._smartContractViewSchema.viewName,
47
- input: viewArgs,
48
- chain_id: chainId,
49
- source: executionContext.viewCaller,
50
- };
51
- if (executionContext.source) {
52
- scriptView.payer = executionContext.source;
53
- }
54
- return this.executeViewAndDecodeResult(scriptView);
55
- });
30
+ async executeView(executionContext) {
31
+ this.verifyContextExecution(executionContext);
32
+ const chainId = await this._readProvider.getChainId();
33
+ const viewArgs = this.transformArgsToMichelson();
34
+ const scriptView = {
35
+ contract: this._contractAddress,
36
+ view: this._smartContractViewSchema.viewName,
37
+ input: viewArgs,
38
+ chain_id: chainId,
39
+ source: executionContext.viewCaller,
40
+ };
41
+ if (executionContext.source) {
42
+ scriptView.payer = executionContext.source;
43
+ }
44
+ return this.executeViewAndDecodeResult(scriptView);
56
45
  }
57
46
  verifyContextExecution(executionContext) {
58
47
  if (executionContext.source &&
@@ -73,7 +62,7 @@ class OnChainView {
73
62
  }
74
63
  }
75
64
  /**
76
- * @description Loops through the view's instructions and replace BALANCE, SENDER, SELF_ADDRESS and AMOUNT with Michelson expressions that match the current context, if applicable.
65
+ * Loops through the view's instructions and replace BALANCE, SENDER, SELF_ADDRESS and AMOUNT with Michelson expressions that match the current context, if applicable.
77
66
  *
78
67
  * Certain specific instructions have different semantics in view:
79
68
  * BALANCE represents the current amount of mutez held by the contract where view is;
@@ -104,21 +93,19 @@ class OnChainView {
104
93
  });
105
94
  return instructions;
106
95
  }
107
- executeViewAndDecodeResult(viewScript) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- let storage;
110
- try {
111
- storage = (yield this._rpc.runScriptView(viewScript))
112
- .data;
113
- }
114
- catch (error) {
115
- const failWith = (0, errors_1.validateAndExtractFailwith)(error);
116
- throw failWith
117
- ? new errors_1.ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(failWith)}`, this._smartContractViewSchema.viewName, failWith, error)
118
- : error;
119
- }
120
- return this._smartContractViewSchema.decodeViewResult(storage);
121
- });
96
+ async executeViewAndDecodeResult(viewScript) {
97
+ let storage;
98
+ try {
99
+ storage = (await this._rpc.runScriptView(viewScript))
100
+ .data;
101
+ }
102
+ catch (error) {
103
+ const failWith = (0, errors_1.validateAndExtractFailwith)(error);
104
+ throw failWith
105
+ ? new errors_1.ViewSimulationError(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(failWith)}`, this._smartContractViewSchema.viewName, failWith, error)
106
+ : error;
107
+ }
108
+ return this._smartContractViewSchema.decodeViewResult(storage);
122
109
  }
123
110
  }
124
111
  exports.OnChainView = OnChainView;
@@ -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.ContractAbstraction = exports.ContractView = exports.DEFAULT_SMART_CONTRACT_METHOD_NAME = void 0;
13
4
  const michelson_encoder_1 = require("@taquito/michelson-encoder");
@@ -18,7 +9,7 @@ const core_1 = require("@taquito/core");
18
9
  const constants_1 = require("./constants");
19
10
  Object.defineProperty(exports, "DEFAULT_SMART_CONTRACT_METHOD_NAME", { enumerable: true, get: function () { return constants_1.DEFAULT_SMART_CONTRACT_METHOD_NAME; } });
20
11
  /**
21
- * @description Utility class to retrieve data from a smart contract's storage without incurring fees via a contract's view method
12
+ * Utility class to retrieve data from a smart contract's storage without incurring fees via a contract's view method
22
13
  */
23
14
  class ContractView {
24
15
  constructor(currentContract, name, callbackParametersSchema, parameterSchema, args, rpc, readProvider) {
@@ -30,24 +21,22 @@ class ContractView {
30
21
  this.rpc = rpc;
31
22
  this.readProvider = readProvider;
32
23
  }
33
- read(chainId) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const chainIdValidation = (0, utils_1.validateChain)(chainId !== null && chainId !== void 0 ? chainId : '');
36
- if ((0, utils_1.validateContractAddress)(chainId !== null && chainId !== void 0 ? chainId : '') == utils_1.ValidationResult.VALID) {
37
- throw new core_1.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.`);
38
- }
39
- else if (chainId && chainIdValidation !== utils_1.ValidationResult.VALID) {
40
- throw new core_1.InvalidChainIdError(chainId, chainIdValidation);
41
- }
42
- const arg = this.parameterSchema.Encode(...this.args);
43
- const result = yield this.rpc.runView({
44
- contract: this.currentContract.address,
45
- entrypoint: this.name,
46
- input: arg,
47
- chain_id: chainId ? chainId : yield this.readProvider.getChainId(),
48
- });
49
- return this.callbackParametersSchema.Execute(result.data);
24
+ async read(chainId) {
25
+ const chainIdValidation = (0, utils_1.validateChain)(chainId ?? '');
26
+ if ((0, utils_1.validateContractAddress)(chainId ?? '') == utils_1.ValidationResult.VALID) {
27
+ throw new core_1.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.`);
28
+ }
29
+ else if (chainId && chainIdValidation !== utils_1.ValidationResult.VALID) {
30
+ throw new core_1.InvalidChainIdError(chainId, chainIdValidation);
31
+ }
32
+ const arg = this.parameterSchema.Encode(...this.args);
33
+ const result = await this.rpc.runView({
34
+ contract: this.currentContract.address,
35
+ entrypoint: this.name,
36
+ input: arg,
37
+ chain_id: chainId ? chainId : await this.readProvider.getChainId(),
50
38
  });
39
+ return this.callbackParametersSchema.Execute(result.data);
51
40
  }
52
41
  }
53
42
  exports.ContractView = ContractView;
@@ -69,7 +58,7 @@ const isView = (entrypoint) => {
69
58
  return isView;
70
59
  };
71
60
  /**
72
- * @description Smart contract abstraction
61
+ * Smart contract abstraction
73
62
  */
74
63
  class ContractAbstraction {
75
64
  constructor(address, script, provider, storageProvider, entrypoints, rpc, readProvider) {
@@ -80,19 +69,19 @@ class ContractAbstraction {
80
69
  this.rpc = rpc;
81
70
  this.readProvider = readProvider;
82
71
  /**
83
- * @description 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.
72
+ * 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.
84
73
  * `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)
85
74
  * NB: if the contract contains annotation it will include named properties; if not it will be indexed by a number.
86
75
  *
87
76
  */
88
77
  this.methodsObject = {};
89
78
  /**
90
- * @description Contains lamda views (tzip4) that are implemented by the target Tezos Smart Contract, and offers the user to call the lambda views as if they were native TS/JS methods.
79
+ * Contains lamda views (tzip4) that are implemented by the target Tezos Smart Contract, and offers the user to call the lambda views as if they were native TS/JS methods.
91
80
  * NB: These are the view defined in the tzip4 standard, not the views introduced by the Hangzhou protocol.
92
81
  */
93
82
  this.views = {};
94
83
  /**
95
- * @description Contains on-chain views that are defined by the target Tezos Smart Contract, and offers the user to simulate the views execution as if they were native TS/JS methods.
84
+ * Contains on-chain views that are defined by the target Tezos Smart Contract, and offers the user to simulate the views execution as if they were native TS/JS methods.
96
85
  * NB: the expected format for the parameter when calling a smart contract view is the object format (same format as for the storage) and not the flattened representation.
97
86
  *
98
87
  */
@@ -160,7 +149,7 @@ class ContractAbstraction {
160
149
  });
161
150
  }
162
151
  /**
163
- * @description Return a friendly representation of the smart contract storage
152
+ * Return a friendly representation of the smart contract storage
164
153
  */
165
154
  storage() {
166
155
  return this.storageProvider.getStorage(this.address, this.schema);
@@ -4,7 +4,7 @@ exports.InvalidBalanceError = exports.OriginationParameterError = exports.Reveal
4
4
  const core_1 = require("@taquito/core");
5
5
  /**
6
6
  * @category Error
7
- * @description Error that indicates invalid smart contract parameters being passed or used
7
+ * Error that indicates invalid smart contract parameters being passed or used
8
8
  */
9
9
  class InvalidParameterError extends core_1.ParameterValidationError {
10
10
  constructor(smartContractMethodName, sigs, invalidParams) {
@@ -19,7 +19,7 @@ class InvalidParameterError extends core_1.ParameterValidationError {
19
19
  exports.InvalidParameterError = InvalidParameterError;
20
20
  /**
21
21
  * @category Error
22
- * @description Error that indicates an invalid delegation source contract address being passed or used
22
+ * Error that indicates an invalid delegation source contract address being passed or used
23
23
  */
24
24
  class InvalidDelegationSource extends core_1.ParameterValidationError {
25
25
  constructor(source) {
@@ -32,7 +32,7 @@ class InvalidDelegationSource extends core_1.ParameterValidationError {
32
32
  exports.InvalidDelegationSource = InvalidDelegationSource;
33
33
  /**
34
34
  * @category Error
35
- * @description Error that indicates an invalid smart contract code parameter being passed or used
35
+ * Error that indicates an invalid smart contract code parameter being passed or used
36
36
  */
37
37
  class InvalidCodeParameter extends core_1.ParameterValidationError {
38
38
  constructor(message, data) {
@@ -45,7 +45,7 @@ class InvalidCodeParameter extends core_1.ParameterValidationError {
45
45
  exports.InvalidCodeParameter = InvalidCodeParameter;
46
46
  /**
47
47
  * @category Error
48
- * @description Error that indicates invalid smart contract init parameter being passed or used
48
+ * Error that indicates invalid smart contract init parameter being passed or used
49
49
  */
50
50
  class InvalidInitParameter extends core_1.ParameterValidationError {
51
51
  constructor(message, data) {
@@ -58,7 +58,7 @@ class InvalidInitParameter extends core_1.ParameterValidationError {
58
58
  exports.InvalidInitParameter = InvalidInitParameter;
59
59
  /**
60
60
  * @category Error
61
- * @description Error that indicates a failure when conducting a view simulation
61
+ * Error that indicates a failure when conducting a view simulation
62
62
  */
63
63
  class ViewSimulationError extends core_1.RpcError {
64
64
  constructor(message, viewName, failWith, cause) {
@@ -91,7 +91,7 @@ const isJsonString = (str) => {
91
91
  };
92
92
  /**
93
93
  * @category Error
94
- * @description Error that indicates invalid or unconfigured context when executing a view
94
+ * Error that indicates invalid or unconfigured context when executing a view
95
95
  */
96
96
  class InvalidViewSimulationContext extends core_1.ParameterValidationError {
97
97
  constructor(info) {
@@ -104,7 +104,7 @@ class InvalidViewSimulationContext extends core_1.ParameterValidationError {
104
104
  exports.InvalidViewSimulationContext = InvalidViewSimulationContext;
105
105
  /**
106
106
  * @category Error
107
- * @description Error that indicates a mistake happening during the reveal operation
107
+ * Error that indicates a mistake happening during the reveal operation
108
108
  */
109
109
  class RevealOperationError extends core_1.RpcError {
110
110
  constructor(message) {
@@ -116,7 +116,7 @@ class RevealOperationError extends core_1.RpcError {
116
116
  exports.RevealOperationError = RevealOperationError;
117
117
  /**
118
118
  * @category Error
119
- * @description Error that indicates a mistake in the parameters in the preparation of an Origination operation
119
+ * Error that indicates a mistake in the parameters in the preparation of an Origination operation
120
120
  */
121
121
  class OriginationParameterError extends core_1.ParameterValidationError {
122
122
  constructor(message) {
@@ -128,7 +128,7 @@ class OriginationParameterError extends core_1.ParameterValidationError {
128
128
  exports.OriginationParameterError = OriginationParameterError;
129
129
  /**
130
130
  * @category Error
131
- * @description Error that indicates an invalid balance being passed or used
131
+ * Error that indicates an invalid balance being passed or used
132
132
  */
133
133
  class InvalidBalanceError extends core_1.ParameterValidationError {
134
134
  constructor(message) {
@@ -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.createSmartRollupExecuteOutboxMessageOperation = exports.createSmartRollupOriginateOperation = exports.createSmartRollupAddMessagesOperation = exports.createUpdateCompanionKeyOperation = exports.createUpdateConsensusKeyOperation = exports.createProposalsOperation = exports.createBallotOperation = exports.createDrainDelegateOperation = exports.createIncreasePaidStorageOperation = exports.createTransferTicketOperation = exports.createRegisterGlobalConstantOperation = exports.createRevealOperation = exports.createRegisterDelegateOperation = exports.createSetDelegateOperation = exports.createTransferOperation = exports.createOriginationOperation = exports.createActivationOperation = void 0;
13
4
  const michelson_encoder_1 = require("@taquito/michelson-encoder");
@@ -15,15 +6,15 @@ const rpc_1 = require("@taquito/rpc");
15
6
  const constants_1 = require("../constants");
16
7
  const utils_1 = require("@taquito/utils");
17
8
  const errors_1 = require("./errors");
18
- const createActivationOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pkh, secret }) {
9
+ const createActivationOperation = async ({ pkh, secret }) => {
19
10
  return {
20
11
  kind: rpc_1.OpKind.ACTIVATION,
21
12
  pkh,
22
13
  secret,
23
14
  };
24
- });
15
+ };
25
16
  exports.createActivationOperation = createActivationOperation;
26
- const createOriginationOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ code, init, balance = '0', delegate, storage, fee, gasLimit, storageLimit, mutez = false, }) {
17
+ const createOriginationOperation = async ({ code, init, balance = '0', delegate, storage, fee, gasLimit, storageLimit, mutez = false, }) => {
27
18
  if (storage !== undefined && init !== undefined) {
28
19
  throw new errors_1.OriginationParameterError('Storage and Init cannot be set a the same time. Please either use storage or init but not both.');
29
20
  }
@@ -33,7 +24,7 @@ const createOriginationOperation = (_a) => __awaiter(void 0, [_a], void 0, funct
33
24
  let contractStorage;
34
25
  if (storage !== undefined) {
35
26
  const storageType = code.find((p) => 'prim' in p && p.prim === 'storage');
36
- if ((storageType === null || storageType === void 0 ? void 0 : storageType.args) === undefined) {
27
+ if (storageType?.args === undefined) {
37
28
  throw new errors_1.InvalidCodeParameter('The storage section is missing from the script', code);
38
29
  }
39
30
  const schema = new michelson_encoder_1.Schema(storageType.args[0]); // TODO
@@ -64,9 +55,9 @@ const createOriginationOperation = (_a) => __awaiter(void 0, [_a], void 0, funct
64
55
  operation.delegate = delegate;
65
56
  }
66
57
  return operation;
67
- });
58
+ };
68
59
  exports.createOriginationOperation = createOriginationOperation;
69
- const createTransferOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ to, amount, parameter, fee, gasLimit, storageLimit, mutez = false, }) {
60
+ const createTransferOperation = async ({ to, amount, parameter, fee, gasLimit, storageLimit, mutez = false, }) => {
70
61
  return {
71
62
  kind: rpc_1.OpKind.TRANSACTION,
72
63
  fee,
@@ -76,9 +67,9 @@ const createTransferOperation = (_a) => __awaiter(void 0, [_a], void 0, function
76
67
  destination: to,
77
68
  parameters: parameter,
78
69
  };
79
- });
70
+ };
80
71
  exports.createTransferOperation = createTransferOperation;
81
- const createSetDelegateOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ delegate, source, fee, gasLimit, storageLimit, }) {
72
+ const createSetDelegateOperation = async ({ delegate, source, fee, gasLimit, storageLimit, }) => {
82
73
  const operation = {
83
74
  kind: rpc_1.OpKind.DELEGATION,
84
75
  source,
@@ -88,9 +79,9 @@ const createSetDelegateOperation = (_a) => __awaiter(void 0, [_a], void 0, funct
88
79
  delegate,
89
80
  };
90
81
  return operation;
91
- });
82
+ };
92
83
  exports.createSetDelegateOperation = createSetDelegateOperation;
93
- const createRegisterDelegateOperation = (_a, source_1) => __awaiter(void 0, [_a, source_1], void 0, function* ({ fee, gasLimit, storageLimit }, source) {
84
+ const createRegisterDelegateOperation = async ({ fee, gasLimit, storageLimit }, source) => {
94
85
  return {
95
86
  kind: rpc_1.OpKind.DELEGATION,
96
87
  fee,
@@ -98,21 +89,21 @@ const createRegisterDelegateOperation = (_a, source_1) => __awaiter(void 0, [_a,
98
89
  storage_limit: storageLimit,
99
90
  delegate: source,
100
91
  };
101
- });
92
+ };
102
93
  exports.createRegisterDelegateOperation = createRegisterDelegateOperation;
103
- const createRevealOperation = (_a, source_1, publicKey_1) => __awaiter(void 0, [_a, source_1, publicKey_1], void 0, function* ({ fee, gasLimit, storageLimit, proof }, source, publicKey) {
94
+ const createRevealOperation = async ({ fee, gasLimit, storageLimit, proof }, source, publicKey) => {
104
95
  return {
105
96
  kind: rpc_1.OpKind.REVEAL,
106
97
  fee,
107
98
  public_key: publicKey,
108
99
  source,
109
- gas_limit: gasLimit !== null && gasLimit !== void 0 ? gasLimit : (0, constants_1.getRevealGasLimit)(source),
100
+ gas_limit: gasLimit ?? (0, constants_1.getRevealGasLimit)(source),
110
101
  storage_limit: storageLimit,
111
102
  proof,
112
103
  };
113
- });
104
+ };
114
105
  exports.createRevealOperation = createRevealOperation;
115
- const createRegisterGlobalConstantOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ value, source, fee, gasLimit, storageLimit, }) {
106
+ const createRegisterGlobalConstantOperation = async ({ value, source, fee, gasLimit, storageLimit, }) => {
116
107
  return {
117
108
  kind: rpc_1.OpKind.REGISTER_GLOBAL_CONSTANT,
118
109
  value,
@@ -121,9 +112,9 @@ const createRegisterGlobalConstantOperation = (_a) => __awaiter(void 0, [_a], vo
121
112
  storage_limit: storageLimit,
122
113
  source,
123
114
  };
124
- });
115
+ };
125
116
  exports.createRegisterGlobalConstantOperation = createRegisterGlobalConstantOperation;
126
- const createTransferTicketOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ ticketContents, ticketTy, ticketTicketer, ticketAmount, destination, entrypoint, source, fee, gasLimit, storageLimit, }) {
117
+ const createTransferTicketOperation = async ({ ticketContents, ticketTy, ticketTicketer, ticketAmount, destination, entrypoint, source, fee, gasLimit, storageLimit, }) => {
127
118
  return {
128
119
  kind: rpc_1.OpKind.TRANSFER_TICKET,
129
120
  fee,
@@ -137,9 +128,9 @@ const createTransferTicketOperation = (_a) => __awaiter(void 0, [_a], void 0, fu
137
128
  destination,
138
129
  entrypoint,
139
130
  };
140
- });
131
+ };
141
132
  exports.createTransferTicketOperation = createTransferTicketOperation;
142
- const createIncreasePaidStorageOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, amount, destination, }) {
133
+ const createIncreasePaidStorageOperation = async ({ source, fee, gasLimit, storageLimit, amount, destination, }) => {
143
134
  return {
144
135
  kind: rpc_1.OpKind.INCREASE_PAID_STORAGE,
145
136
  source,
@@ -149,35 +140,35 @@ const createIncreasePaidStorageOperation = (_a) => __awaiter(void 0, [_a], void
149
140
  amount,
150
141
  destination,
151
142
  };
152
- });
143
+ };
153
144
  exports.createIncreasePaidStorageOperation = createIncreasePaidStorageOperation;
154
- const createDrainDelegateOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ consensus_key, delegate, destination, }) {
145
+ const createDrainDelegateOperation = async ({ consensus_key, delegate, destination, }) => {
155
146
  return {
156
147
  kind: rpc_1.OpKind.DRAIN_DELEGATE,
157
148
  consensus_key,
158
149
  delegate,
159
150
  destination,
160
151
  };
161
- });
152
+ };
162
153
  exports.createDrainDelegateOperation = createDrainDelegateOperation;
163
- const createBallotOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, proposal, ballot }) {
154
+ const createBallotOperation = async ({ source, proposal, ballot }) => {
164
155
  return {
165
156
  kind: rpc_1.OpKind.BALLOT,
166
157
  source,
167
158
  proposal,
168
159
  ballot,
169
160
  };
170
- });
161
+ };
171
162
  exports.createBallotOperation = createBallotOperation;
172
- const createProposalsOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, proposals }) {
163
+ const createProposalsOperation = async ({ source, proposals }) => {
173
164
  return {
174
165
  kind: rpc_1.OpKind.PROPOSALS,
175
166
  source,
176
167
  proposals,
177
168
  };
178
- });
169
+ };
179
170
  exports.createProposalsOperation = createProposalsOperation;
180
- const createUpdateConsensusKeyOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, pk, proof, }) {
171
+ const createUpdateConsensusKeyOperation = async ({ source, fee, gasLimit, storageLimit, pk, proof, }) => {
181
172
  return {
182
173
  kind: rpc_1.OpKind.UPDATE_CONSENSUS_KEY,
183
174
  source,
@@ -187,9 +178,9 @@ const createUpdateConsensusKeyOperation = (_a) => __awaiter(void 0, [_a], void 0
187
178
  pk,
188
179
  proof,
189
180
  };
190
- });
181
+ };
191
182
  exports.createUpdateConsensusKeyOperation = createUpdateConsensusKeyOperation;
192
- const createUpdateCompanionKeyOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, pk, proof, }) {
183
+ const createUpdateCompanionKeyOperation = async ({ source, fee, gasLimit, storageLimit, pk, proof, }) => {
193
184
  return {
194
185
  kind: rpc_1.OpKind.UPDATE_COMPANION_KEY,
195
186
  source,
@@ -199,9 +190,9 @@ const createUpdateCompanionKeyOperation = (_a) => __awaiter(void 0, [_a], void 0
199
190
  pk,
200
191
  proof,
201
192
  };
202
- });
193
+ };
203
194
  exports.createUpdateCompanionKeyOperation = createUpdateCompanionKeyOperation;
204
- const createSmartRollupAddMessagesOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, message, }) {
195
+ const createSmartRollupAddMessagesOperation = async ({ source, fee, gasLimit, storageLimit, message, }) => {
205
196
  return {
206
197
  kind: rpc_1.OpKind.SMART_ROLLUP_ADD_MESSAGES,
207
198
  source,
@@ -210,9 +201,9 @@ const createSmartRollupAddMessagesOperation = (_a) => __awaiter(void 0, [_a], vo
210
201
  storage_limit: storageLimit,
211
202
  message,
212
203
  };
213
- });
204
+ };
214
205
  exports.createSmartRollupAddMessagesOperation = createSmartRollupAddMessagesOperation;
215
- const createSmartRollupOriginateOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, pvmKind, kernel, parametersType, }) {
206
+ const createSmartRollupOriginateOperation = async ({ source, fee, gasLimit, storageLimit, pvmKind, kernel, parametersType, }) => {
216
207
  return {
217
208
  kind: rpc_1.OpKind.SMART_ROLLUP_ORIGINATE,
218
209
  source,
@@ -223,9 +214,9 @@ const createSmartRollupOriginateOperation = (_a) => __awaiter(void 0, [_a], void
223
214
  kernel,
224
215
  parameters_ty: parametersType,
225
216
  };
226
- });
217
+ };
227
218
  exports.createSmartRollupOriginateOperation = createSmartRollupOriginateOperation;
228
- const createSmartRollupExecuteOutboxMessageOperation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, fee, gasLimit, storageLimit, rollup, cementedCommitment, outputProof, }) {
219
+ const createSmartRollupExecuteOutboxMessageOperation = async ({ source, fee, gasLimit, storageLimit, rollup, cementedCommitment, outputProof, }) => {
229
220
  return {
230
221
  kind: rpc_1.OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,
231
222
  source,
@@ -236,5 +227,5 @@ const createSmartRollupExecuteOutboxMessageOperation = (_a) => __awaiter(void 0,
236
227
  cemented_commitment: cementedCommitment,
237
228
  output_proof: outputProof,
238
229
  };
239
- });
230
+ };
240
231
  exports.createSmartRollupExecuteOutboxMessageOperation = createSmartRollupExecuteOutboxMessageOperation;