Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 870d079

Browse files
committed
fix: 🐛 use custom middleware awaiter for asset test
1 parent cec1710 commit 870d079

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/sdk/settlements/tradeAssets.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { VenueType } from '@polymeshassociation/polymesh-sdk/types';
44
import assert from 'node:assert';
55

66
import { addIsNotBlocked } from '~/sdk/settlements/util';
7+
import { awaitMiddlewareSynced } from '~/util';
78

89
interface Leg {
910
asset: FungibleAsset;
@@ -89,13 +90,10 @@ export const tradeAssets = async (
8990
memo: 'Some message', // optional - passing a message with the instruction
9091
});
9192

92-
const middlewareSynced = () =>
93-
new Promise((resolve) => addInstructionTx.onProcessedByMiddleware(resolve));
94-
9593
const instruction = await addInstructionTx.run();
9694
assert(addInstructionTx.isSuccess, 'add instruction should succeed');
9795

98-
await middlewareSynced();
96+
await awaitMiddlewareSynced(addInstructionTx, sdk, 15, 2000);
9997

10098
const details = await instruction.details();
10199
assert(details.memo, 'the instruction should have a memo');

0 commit comments

Comments
 (0)