ts: Fix empty instructions array (#877)

This commit is contained in:
Pierre 2021-10-14 03:47:16 +11:00 committed by GitHub
parent 48a72e7018
commit 39791dc4af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -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;
};