@acala-network/chopsticks-utils 1.3.1 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -178,15 +178,21 @@ function defer() {
178
178
  const sendTransaction = async (tx)=>{
179
179
  const signed = await tx;
180
180
  const deferred = defer();
181
- await signed.send((status)=>{
181
+ // Swallow rejections that arrive after the deferred has already settled (the
182
+ // subscription continues to fire callbacks after isInBlock/isFinalized).
183
+ deferred.promise.catch(()=>{});
184
+ let unsub;
185
+ unsub = await signed.send((status)=>{
182
186
  logger.debug({
183
187
  status: status.status.toHuman()
184
188
  }, 'Transaction status');
185
189
  if (status.isInBlock || status.isFinalized) {
186
190
  deferred.resolve(status.events);
191
+ if (unsub) unsub();
187
192
  }
188
193
  if (status.isError) {
189
194
  deferred.reject(status.status);
195
+ if (unsub) unsub();
190
196
  }
191
197
  });
192
198
  return {
package/dist/esm/index.js CHANGED
@@ -152,15 +152,21 @@ export * from './signFake.js';
152
152
  */ export const sendTransaction = async (tx)=>{
153
153
  const signed = await tx;
154
154
  const deferred = defer();
155
- await signed.send((status)=>{
155
+ // Swallow rejections that arrive after the deferred has already settled (the
156
+ // subscription continues to fire callbacks after isInBlock/isFinalized).
157
+ deferred.promise.catch(()=>{});
158
+ let unsub;
159
+ unsub = await signed.send((status)=>{
156
160
  logger.debug({
157
161
  status: status.status.toHuman()
158
162
  }, 'Transaction status');
159
163
  if (status.isInBlock || status.isFinalized) {
160
164
  deferred.resolve(status.events);
165
+ if (unsub) unsub();
161
166
  }
162
167
  if (status.isError) {
163
168
  deferred.reject(status.status);
169
+ if (unsub) unsub();
164
170
  }
165
171
  });
166
172
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks-utils",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -13,8 +13,8 @@
13
13
  "depcheck": "npx depcheck"
14
14
  },
15
15
  "dependencies": {
16
- "@acala-network/chopsticks": "1.3.1",
17
- "@acala-network/chopsticks-core": "1.3.1",
16
+ "@acala-network/chopsticks": "1.4.1",
17
+ "@acala-network/chopsticks-core": "1.4.1",
18
18
  "@polkadot-labs/hdkd": "^0.0.19",
19
19
  "@polkadot-labs/hdkd-helpers": "^0.0.19",
20
20
  "@polkadot/api": "^16.4.1",