ts: Fix empty instructions array
@@ -16,9 +16,7 @@ export default class TransactionFactory {
const txFn: TransactionFn<IDL, I> = (...args): Transaction => {
const [, ctx] = splitArgsAndCtx(idlIx, [...args]);
const tx = new Transaction();
- if (ctx.instructions !== undefined) {
- tx.add(...ctx.instructions);
- }
+ ctx.instructions?.forEach((ix) => tx.add(ix));
tx.add(ixFn(...args));
return tx;
};
