Skip to content

Commit

Permalink
Add postInstructions
Browse files Browse the repository at this point in the history
  • Loading branch information
SolanaMonkeyBusiness committed Nov 13, 2021
1 parent 468fe79 commit ab7180f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ts/src/program/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export type Context<A extends Accounts = Accounts> = {
*/
instructions?: TransactionInstruction[];

/**
* Instructions to run *after* a given method. Often this is used, for
* example to close accounts after to executing a method.
*/
postInstructions?: TransactionInstruction[];

/**
* Commitment parameters to use for a transaction.
*/
Expand Down
1 change: 1 addition & 0 deletions ts/src/program/namespace/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class TransactionFactory {
const tx = new Transaction();
ctx.instructions?.forEach((ix) => tx.add(ix));
tx.add(ixFn(...args));
ctx.postInstructions?.forEach((ix) => tx.add(ix));
return tx;
};

Expand Down

0 comments on commit ab7180f

Please sign in to comment.