@ledgerhq/coin-tester-polkadot 1.4.2 → 1.4.3-nightly.20251126160702

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-tester-polkadot",
3
- "version": "1.4.2",
3
+ "version": "1.4.3-nightly.20251126160702",
4
4
  "description": "Ledger Polkadot Coin Tester",
5
5
  "main": "src/scenarii.test.ts",
6
6
  "keywords": [
@@ -50,13 +50,13 @@
50
50
  "dotenv": "^16.4.5",
51
51
  "expect": "^27.4.6",
52
52
  "msw": "^2.2.1",
53
- "@ledgerhq/coin-framework": "^6.9.0",
54
- "@ledgerhq/coin-polkadot": "^6.13.0",
55
- "@ledgerhq/coin-tester": "^0.12.0",
56
- "@ledgerhq/cryptoassets": "^13.33.0",
53
+ "@ledgerhq/coin-framework": "^6.10.0-nightly.20251126160702",
54
+ "@ledgerhq/coin-polkadot": "^6.13.1-nightly.20251126160702",
55
+ "@ledgerhq/coin-tester": "^0.13.0-nightly.20251126160702",
56
+ "@ledgerhq/cryptoassets": "^13.34.0-nightly.20251126160702",
57
57
  "@ledgerhq/hw-app-polkadot": "^6.34.9",
58
58
  "@ledgerhq/types-cryptoassets": "^7.30.0",
59
- "@ledgerhq/types-live": "^6.89.0"
59
+ "@ledgerhq/types-live": "^6.90.0-nightly.20251126160702"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@polkadot/util": "12.6.2",
@@ -282,16 +282,27 @@ export const PolkadotScenario: Scenario<PolkadotTransaction, PolkadotAccount> =
282
282
  // https://polkadot.js.org/docs/keyring/start/suri/#dev-accounts
283
283
  const alice = keyring.addFromUri("//Alice");
284
284
 
285
- const unsub = await api.tx.balances
286
- .transferAllowDeath(
287
- polkadotScenarioAccountPair.address,
288
- parseCurrencyUnit(polkadot.units[0], "500000").toNumber(),
289
- )
290
- .signAndSend(alice, result => {
291
- if (result.status.isFinalized) {
292
- unsub();
293
- }
294
- });
285
+ // Wait for the transfer to be finalized
286
+ await new Promise<void>((resolve, reject) => {
287
+ api.tx.balances
288
+ .transferAllowDeath(
289
+ polkadotScenarioAccountPair.address,
290
+ parseCurrencyUnit(polkadot.units[0], "500000").toNumber(),
291
+ )
292
+ .signAndSend(alice, result => {
293
+ if (result.status.isFinalized) {
294
+ resolve();
295
+ } else if (
296
+ result.status.type === "Dropped" ||
297
+ result.status.type === "Invalid" ||
298
+ result.status.type === "Usurped" ||
299
+ result.status.type === "FinalityTimeout"
300
+ ) {
301
+ reject(new Error(`Transaction failed: ${result.status.type}`));
302
+ }
303
+ })
304
+ .catch(reject);
305
+ });
295
306
 
296
307
  const account = makeAccount(polkadotScenarioAccountPair.address, polkadot);
297
308
 
@@ -281,16 +281,27 @@ export const WestendScenario: Scenario<PolkadotTransaction, PolkadotAccount> = {
281
281
  // https://polkadot.js.org/docs/keyring/start/suri/#dev-accounts
282
282
  const alice = keyring.addFromUri("//Alice");
283
283
 
284
- const unsub = await api.tx.balances
285
- .transferAllowDeath(
286
- polkadotScenarioAccountPair.address,
287
- parseCurrencyUnit(westend.units[0], "500000").toNumber(),
288
- )
289
- .signAndSend(alice, result => {
290
- if (result.status.isFinalized) {
291
- unsub();
292
- }
293
- });
284
+ // Wait for the transfer to be finalized
285
+ await new Promise<void>((resolve, reject) => {
286
+ api.tx.balances
287
+ .transferAllowDeath(
288
+ polkadotScenarioAccountPair.address,
289
+ parseCurrencyUnit(westend.units[0], "500000").toNumber(),
290
+ )
291
+ .signAndSend(alice, result => {
292
+ if (result.status.isFinalized) {
293
+ resolve();
294
+ } else if (
295
+ result.status.type === "Dropped" ||
296
+ result.status.type === "Invalid" ||
297
+ result.status.type === "Usurped" ||
298
+ result.status.type === "FinalityTimeout"
299
+ ) {
300
+ reject(new Error(`Transaction failed: ${result.status.type}`));
301
+ }
302
+ })
303
+ .catch(reject);
304
+ });
294
305
 
295
306
  const account = makeAccount(polkadotScenarioAccountPair.address, westend);
296
307