@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,224 +1,179 @@
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.RpcReadAdapter = void 0;
13
4
  /**
14
- * @description Converts calls from TzReadProvider into calls to the wrapped RpcClient in a format it can understand.
5
+ * Converts calls from TzReadProvider into calls to the wrapped RpcClient in a format it can understand.
15
6
  */
16
7
  class RpcReadAdapter {
17
8
  constructor(rpc) {
18
9
  this.rpc = rpc;
19
10
  }
20
11
  /**
21
- * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
12
+ * The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'spendable' RPC.
22
13
  * @param address address from which we want to retrieve the spendable balance
23
14
  * @param block from which we want to retrieve the balance
24
15
  * @returns the balance in mutez
25
16
  */
26
- getBalance(address, block) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- return this.rpc.getBalance(address, { block: String(block) });
29
- });
17
+ async getBalance(address, block) {
18
+ return this.rpc.getBalance(address, { block: String(block) });
30
19
  }
31
20
  /**
32
- * @description The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
21
+ * The spendable balance of a contract (in mutez), also known as liquid balance. Corresponds to tez owned by the contract that are neither staked, nor in unstaked requests, nor in frozen bonds. Identical to the 'balance' RPC.
33
22
  * @param address address from which we want to retrieve the spendable balance
34
23
  * @param block from which we want to retrieve the balance
35
24
  * @returns the balance in mutez
36
25
  */
37
- getSpendable(address, block) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- return this.rpc.getSpendable(address, { block: String(block) });
40
- });
26
+ async getSpendable(address, block) {
27
+ return this.rpc.getSpendable(address, { block: String(block) });
41
28
  }
42
29
  /**
43
- * @description Access the delegate of a contract, if any.
30
+ * Access the delegate of a contract, if any.
44
31
  * @param address contract address from which we want to retrieve the delegate (baker)
45
32
  * @param block from which we want to retrieve the delegate
46
33
  * @returns the public key hash of the delegate or null if no delegate
47
34
  */
48
- getDelegate(address, block) {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- return this.rpc.getDelegate(address, { block: String(block) });
51
- });
35
+ async getDelegate(address, block) {
36
+ return this.rpc.getDelegate(address, { block: String(block) });
52
37
  }
53
38
  /**
54
- * @description Access the next protocol hash
39
+ * Access the next protocol hash
55
40
  * @param block from which we want to retrieve the next protocol hash
56
41
  */
57
- getNextProtocol(block) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const protocols = yield this.rpc.getProtocols({ block: String(block) });
60
- return protocols.next_protocol;
61
- });
42
+ async getNextProtocol(block) {
43
+ const protocols = await this.rpc.getProtocols({ block: String(block) });
44
+ return protocols.next_protocol;
62
45
  }
63
46
  /**
64
- * @description Access protocol constants used in Taquito
47
+ * Access protocol constants used in Taquito
65
48
  * @param block from which we want to retrieve the constants
66
49
  */
67
- getProtocolConstants(block) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- const { time_between_blocks, minimal_block_delay, hard_gas_limit_per_operation, hard_gas_limit_per_block, hard_storage_limit_per_operation, cost_per_byte, smart_rollup_origination_size, } = yield this.rpc.getConstants({ block: String(block) });
70
- return {
71
- time_between_blocks,
72
- minimal_block_delay,
73
- hard_gas_limit_per_operation,
74
- hard_gas_limit_per_block,
75
- hard_storage_limit_per_operation,
76
- cost_per_byte,
77
- smart_rollup_origination_size,
78
- };
79
- });
50
+ async getProtocolConstants(block) {
51
+ const { time_between_blocks, minimal_block_delay, hard_gas_limit_per_operation, hard_gas_limit_per_block, hard_storage_limit_per_operation, cost_per_byte, smart_rollup_origination_size, } = await this.rpc.getConstants({ block: String(block) });
52
+ return {
53
+ time_between_blocks,
54
+ minimal_block_delay,
55
+ hard_gas_limit_per_operation,
56
+ hard_gas_limit_per_block,
57
+ hard_storage_limit_per_operation,
58
+ cost_per_byte,
59
+ smart_rollup_origination_size,
60
+ };
80
61
  }
81
62
  /**
82
- * @description Access the script (code and storage) of a smart contract
63
+ * Access the script (code and storage) of a smart contract
83
64
  * @param contract contract address from which we want to retrieve the script
84
65
  * @param block from which we want to retrieve the storage value
85
66
  * @returns Note: The code must be in the JSON format and not contain global constant
86
67
  */
87
- getScript(contract, block) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- const { script } = yield this.rpc.getContract(contract, { block: String(block) });
90
- return script;
91
- });
68
+ async getScript(contract, block) {
69
+ const { script } = await this.rpc.getContract(contract, { block: String(block) });
70
+ return script;
92
71
  }
93
72
  /**
94
- * @description Access the storage value of a contract
73
+ * Access the storage value of a contract
95
74
  * @param contract contract address from which we want to retrieve the storage
96
75
  * @param block from which we want to retrieve the storage value
97
76
  */
98
- getStorage(contract, block) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- return this.rpc.getStorage(contract, { block: String(block) });
101
- });
77
+ async getStorage(contract, block) {
78
+ return this.rpc.getStorage(contract, { block: String(block) });
102
79
  }
103
80
  /**
104
- * @description Access the block hash
81
+ * Access the block hash
105
82
  */
106
- getBlockHash(block) {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- const { hash } = yield this.rpc.getBlockHeader({ block: String(block) });
109
- return hash;
110
- });
83
+ async getBlockHash(block) {
84
+ const { hash } = await this.rpc.getBlockHeader({ block: String(block) });
85
+ return hash;
111
86
  }
112
87
  /**
113
- * @description Access the block level
88
+ * Access the block level
114
89
  */
115
- getBlockLevel(block) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- const { level } = yield this.rpc.getBlockHeader({ block: String(block) });
118
- return level;
119
- });
90
+ async getBlockLevel(block) {
91
+ const { level } = await this.rpc.getBlockHeader({ block: String(block) });
92
+ return level;
120
93
  }
121
94
  /**
122
- * @description Access the counter of an address
95
+ * Access the counter of an address
123
96
  * @param pkh from which we want to retrieve the counter
124
97
  * @param block from which we want to retrieve the counter
125
98
  */
126
- getCounter(pkh, block) {
127
- return __awaiter(this, void 0, void 0, function* () {
128
- const { counter } = yield this.rpc.getContract(pkh, { block: String(block) });
129
- return counter || '0';
130
- });
99
+ async getCounter(pkh, block) {
100
+ const { counter } = await this.rpc.getContract(pkh, { block: String(block) });
101
+ return counter || '0';
131
102
  }
132
103
  /**
133
- * @description Access the timestamp of a block
104
+ * Access the timestamp of a block
134
105
  * @param block from which we want to retrieve the timestamp
135
106
  * @returns date ISO format zero UTC offset ("2022-01-19T22:37:07Z")
136
107
  */
137
- getBlockTimestamp(block) {
138
- return __awaiter(this, void 0, void 0, function* () {
139
- const { timestamp } = yield this.rpc.getBlockHeader({ block: String(block) });
140
- return timestamp;
141
- });
108
+ async getBlockTimestamp(block) {
109
+ const { timestamp } = await this.rpc.getBlockHeader({ block: String(block) });
110
+ return timestamp;
142
111
  }
143
112
  /**
144
- * @description Access the value associated with a key in a big map.
113
+ * Access the value associated with a key in a big map.
145
114
  * @param bigMapQuery Big Map ID and Expression hash to query (A b58check encoded Blake2b hash of the expression)
146
115
  * @param block from which we want to retrieve the big map value
147
116
  */
148
- getBigMapValue(bigMapQuery, block) {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- return this.rpc.getBigMapExpr(bigMapQuery.id, bigMapQuery.expr, {
151
- block: String(block),
152
- });
117
+ async getBigMapValue(bigMapQuery, block) {
118
+ return this.rpc.getBigMapExpr(bigMapQuery.id, bigMapQuery.expr, {
119
+ block: String(block),
153
120
  });
154
121
  }
155
122
  /**
156
- * @description Access the value associated with a sapling state ID.
157
- * @param id Sapling state ID
123
+ * Access the value associated with a sapling state ID.
124
+ * @param saplingStateQuery Sapling state ID query
158
125
  * @param block from which we want to retrieve the sapling state
159
126
  */
160
- getSaplingDiffById(saplingStateQuery, block) {
161
- return __awaiter(this, void 0, void 0, function* () {
162
- return this.rpc.getSaplingDiffById(saplingStateQuery.id, { block: String(block) });
163
- });
127
+ async getSaplingDiffById(saplingStateQuery, block) {
128
+ return this.rpc.getSaplingDiffById(saplingStateQuery.id, { block: String(block) });
164
129
  }
165
130
  /**
166
- * @description Access the sapling state of a smart contract.
131
+ * Access the sapling state of a smart contract.
167
132
  * @param contractAddress The address of the smart contract
168
133
  * @param block The block you want to retrieve the sapling state from
169
134
  */
170
- getSaplingDiffByContract(contractAddress, block) {
171
- return __awaiter(this, void 0, void 0, function* () {
172
- return this.rpc.getSaplingDiffByContract(contractAddress, { block: String(block) });
173
- });
135
+ async getSaplingDiffByContract(contractAddress, block) {
136
+ return this.rpc.getSaplingDiffByContract(contractAddress, { block: String(block) });
174
137
  }
175
138
  /**
176
- * @description Return the list of entrypoints of the contract
139
+ * Return the list of entrypoints of the contract
177
140
  * @param contract address of the contract we want to get the entrypoints of
178
141
  */
179
- getEntrypoints(contract) {
180
- return __awaiter(this, void 0, void 0, function* () {
181
- return this.rpc.getEntrypoints(contract);
182
- });
142
+ async getEntrypoints(contract) {
143
+ return this.rpc.getEntrypoints(contract);
183
144
  }
184
145
  /**
185
- * @description Access the chain id
146
+ * Access the chain id
186
147
  */
187
- getChainId() {
188
- return __awaiter(this, void 0, void 0, function* () {
189
- return this.rpc.getChainId();
190
- });
148
+ async getChainId() {
149
+ return this.rpc.getChainId();
191
150
  }
192
151
  /**
193
- * @description Indicate if an account is revealed
152
+ * Indicate if an account is revealed
194
153
  * @param publicKeyHash of the account
195
154
  * @param block from which we want to know if the account is revealed
196
155
  */
197
- isAccountRevealed(publicKeyHash, block) {
198
- return __awaiter(this, void 0, void 0, function* () {
199
- const manager = yield this.rpc.getManagerKey(publicKeyHash, { block: String(block) });
200
- const haveManager = manager && typeof manager === 'object' ? !!manager.key : !!manager;
201
- return haveManager;
202
- });
156
+ async isAccountRevealed(publicKeyHash, block) {
157
+ const manager = await this.rpc.getManagerKey(publicKeyHash, { block: String(block) });
158
+ const haveManager = manager && typeof manager === 'object' ? !!manager.key : !!manager;
159
+ return haveManager;
203
160
  }
204
161
  /**
205
- * @description Return all the information about a block
162
+ * Return all the information about a block
206
163
  * @param block from which we want to retrieve the information
207
164
  */
208
- getBlock(block) {
209
- return __awaiter(this, void 0, void 0, function* () {
210
- return this.rpc.getBlock({ block: String(block) });
211
- });
165
+ async getBlock(block) {
166
+ return this.rpc.getBlock({ block: String(block) });
212
167
  }
213
168
  /**
214
- * @description Return a list of the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
169
+ * Return a list of the ancestors of the given block which, if referred to as the branch in an operation header, are recent enough for that operation to be included in the current block.
215
170
  * @param block from which we want to retrieve the information
216
171
  */
217
172
  getLiveBlocks(block) {
218
173
  return this.rpc.getLiveBlocks({ block: String(block) });
219
174
  }
220
175
  /**
221
- * @description Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
176
+ * Returns the cycle at which the launch of the Adaptive Issuance feature is set to happen. A result of null means that the feature is not yet set to launch.
222
177
  * @param block from which we want to retrieve the information
223
178
  */
224
179
  getAdaptiveIssuanceLaunchCycle(block) {
@@ -4,7 +4,7 @@ exports.UnconfiguredSignerError = void 0;
4
4
  const core_1 = require("@taquito/core");
5
5
  /**
6
6
  * @category Error
7
- * @description Error that indicates no signer has been configured in the TezosToolkit instance
7
+ * Error that indicates no signer has been configured in the TezosToolkit instance
8
8
  */
9
9
  class UnconfiguredSignerError extends core_1.TezosToolkitConfigError {
10
10
  constructor() {
@@ -1,40 +1,23 @@
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.NoopSigner = void 0;
13
4
  const errors_1 = require("./errors");
14
5
  /**
15
- * @description Default signer implementation which does nothing and produce invalid signature
6
+ * Default signer implementation which does nothing and produce invalid signature
16
7
  * @throw {@link UnconfiguredSignerError}
17
8
  */
18
9
  class NoopSigner {
19
- publicKey() {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- throw new errors_1.UnconfiguredSignerError();
22
- });
10
+ async publicKey() {
11
+ throw new errors_1.UnconfiguredSignerError();
23
12
  }
24
- publicKeyHash() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- throw new errors_1.UnconfiguredSignerError();
27
- });
13
+ async publicKeyHash() {
14
+ throw new errors_1.UnconfiguredSignerError();
28
15
  }
29
- secretKey() {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- throw new errors_1.UnconfiguredSignerError();
32
- });
16
+ async secretKey() {
17
+ throw new errors_1.UnconfiguredSignerError();
33
18
  }
34
- sign(_bytes, _watermark) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- throw new errors_1.UnconfiguredSignerError();
37
- });
19
+ async sign(_bytes, _watermark) {
20
+ throw new errors_1.UnconfiguredSignerError();
38
21
  }
39
22
  }
40
23
  exports.NoopSigner = NoopSigner;
@@ -4,7 +4,7 @@ exports.InvalidFilterExpressionError = exports.UnsupportedEventError = void 0;
4
4
  const core_1 = require("@taquito/core");
5
5
  /**
6
6
  * @category Error
7
- * @description Error that indicates an unsupported event being passed or used
7
+ * Error that indicates an unsupported event being passed or used
8
8
  */
9
9
  class UnsupportedEventError extends core_1.ParameterValidationError {
10
10
  constructor(type) {
@@ -17,7 +17,7 @@ class UnsupportedEventError extends core_1.ParameterValidationError {
17
17
  exports.UnsupportedEventError = UnsupportedEventError;
18
18
  /**
19
19
  * @category Error
20
- * @description Error that indicates an invalid filter expression being passed or used
20
+ * Error that indicates an invalid filter expression being passed or used
21
21
  */
22
22
  class InvalidFilterExpressionError extends core_1.ParameterValidationError {
23
23
  constructor(invalidExpression) {
@@ -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.PollingSubscribeProvider = exports.defaultConfigStreamer = void 0;
13
4
  const rxjs_1 = require("rxjs");
@@ -27,8 +18,8 @@ const applyFilter = (filter) => (0, operators_1.concatMap)((block) => {
27
18
  for (const ops of block.operations) {
28
19
  for (const op of ops) {
29
20
  for (const content of op.contents) {
30
- if ((0, filters_1.evaluateFilter)(Object.assign({ hash: op.hash }, content), filter)) {
31
- sub.next(Object.assign({ hash: op.hash }, content));
21
+ if ((0, filters_1.evaluateFilter)({ hash: op.hash, ...content }, filter)) {
22
+ sub.next({ hash: op.hash, ...content });
32
23
  }
33
24
  }
34
25
  }
@@ -45,8 +36,13 @@ const applyEventFilter = (filter) => (0, operators_1.concatMap)((block) => {
45
36
  const internalOpResults = tx.metadata.internal_operation_results;
46
37
  if (internalOpResults) {
47
38
  for (const event of internalOpResults) {
48
- if ((0, filters_1.eventFilter)(event, filter === null || filter === void 0 ? void 0 : filter.address, filter === null || filter === void 0 ? void 0 : filter.tag, filter === null || filter === void 0 ? void 0 : filter.excludeFailedOperations)) {
49
- sub.next(Object.assign({ opHash: op.hash, blockHash: block.hash, level: block.header.level }, event));
39
+ if ((0, filters_1.eventFilter)(event, filter?.address, filter?.tag, filter?.excludeFailedOperations)) {
40
+ sub.next({
41
+ opHash: op.hash,
42
+ blockHash: block.hash,
43
+ level: block.header.level,
44
+ ...event,
45
+ });
50
46
  }
51
47
  }
52
48
  }
@@ -59,8 +55,11 @@ const applyEventFilter = (filter) => (0, operators_1.concatMap)((block) => {
59
55
  class PollingSubscribeProvider {
60
56
  constructor(context, config = {}) {
61
57
  this.context = context;
62
- this._config$ = new rxjs_1.BehaviorSubject(Object.assign(Object.assign({}, exports.defaultConfigStreamer), config));
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) => {
58
+ this._config$ = new rxjs_1.BehaviorSubject({
59
+ ...exports.defaultConfigStreamer,
60
+ ...config,
61
+ });
62
+ this.timer$ = this._config$.pipe((0, operators_1.map)((x) => x?.pollingIntervalMilliseconds), (0, operators_1.switchMap)((pollingIntervalMilliseconds) => {
64
63
  if (!pollingIntervalMilliseconds) {
65
64
  return (0, rxjs_1.from)(this.getConfirmationPollingInterval()).pipe((0, operators_1.switchMap)((interval) => {
66
65
  return (0, rxjs_1.timer)(0, interval);
@@ -70,7 +69,7 @@ class PollingSubscribeProvider {
70
69
  return (0, rxjs_1.timer)(0, pollingIntervalMilliseconds);
71
70
  }
72
71
  }));
73
- this.newBlock$ = this.timer$.pipe((0, operators_1.switchMap)(() => getLastBlock(this.context)), (0, operators_1.distinctUntilKeyChanged)('hash'), (0, operators_1.share)({
72
+ this.newBlock$ = this.timer$.pipe((0, operators_1.exhaustMap)(() => getLastBlock(this.context)), (0, operators_1.distinctUntilKeyChanged)('hash'), (0, operators_1.share)({
74
73
  resetOnError: false,
75
74
  resetOnComplete: false,
76
75
  resetOnRefCountZero: true,
@@ -79,34 +78,32 @@ class PollingSubscribeProvider {
79
78
  get config() {
80
79
  return this._config$.getValue();
81
80
  }
82
- getConfirmationPollingInterval() {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- if (!this.config.pollingIntervalMilliseconds) {
85
- const defaultIntervalTestnetsMainnet = 5000;
86
- const minimumPollingInterval = 700;
87
- try {
88
- const constants = yield this.context.readProvider.getProtocolConstants('head');
89
- const blockTime = constants.minimal_block_delay
90
- ? constants.minimal_block_delay.multipliedBy(1000)
91
- : new bignumber_js_1.default(defaultIntervalTestnetsMainnet);
92
- const confirmationPollingInterval = blockTime.dividedBy(3);
93
- this.config.pollingIntervalMilliseconds =
94
- confirmationPollingInterval.toNumber() === 0
95
- ? minimumPollingInterval
96
- : Math.max(confirmationPollingInterval.toNumber(), minimumPollingInterval);
97
- }
98
- catch (exception) {
99
- return defaultIntervalTestnetsMainnet;
100
- }
81
+ async getConfirmationPollingInterval() {
82
+ if (!this.config.pollingIntervalMilliseconds) {
83
+ const defaultIntervalTestnetsMainnet = 5000;
84
+ const minimumPollingInterval = 700;
85
+ try {
86
+ const constants = await this.context.readProvider.getProtocolConstants('head');
87
+ const blockTime = constants.minimal_block_delay
88
+ ? constants.minimal_block_delay.multipliedBy(1000)
89
+ : new bignumber_js_1.default(defaultIntervalTestnetsMainnet);
90
+ const confirmationPollingInterval = blockTime.dividedBy(3);
91
+ this.config.pollingIntervalMilliseconds =
92
+ confirmationPollingInterval.toNumber() === 0
93
+ ? minimumPollingInterval
94
+ : Math.max(confirmationPollingInterval.toNumber(), minimumPollingInterval);
101
95
  }
102
- return this.config.pollingIntervalMilliseconds;
103
- });
96
+ catch (exception) {
97
+ return defaultIntervalTestnetsMainnet;
98
+ }
99
+ }
100
+ return this.config.pollingIntervalMilliseconds;
104
101
  }
105
102
  subscribeBlock(_filter) {
106
103
  return new observable_subscription_1.ObservableSubscription(this.newBlock$, this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
107
104
  }
108
105
  subscribe(_filter) {
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
+ return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe((0, operators_1.map)((x) => x?.hash)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);
110
107
  }
111
108
  subscribeOperation(filter) {
112
109
  return new observable_subscription_1.ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)), this.config.shouldObservableSubscriptionRetry, this.config.observableSubscriptionRetryFunction);