Skip to content

Commit

Permalink
feat: add missed apply in SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
obstoody authored and notdanilo committed Nov 29, 2024
1 parent d597787 commit 8c3ae4a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions clients/bolt-sdk/src/world/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
createApplyInstruction,
createAddEntityInstruction,
createInitializeComponentInstruction,
createInitializeNewWorldInstruction,
Expand Down Expand Up @@ -303,6 +304,40 @@ export async function InitializeComponent({
};
}

export async function Apply({
authority,
boltSystem,
boltComponent,
componentProgram,
anchorRemainingAccounts,
args
}: {
authority: PublicKey;
boltSystem: PublicKey;
boltComponent: PublicKey;
componentProgram: PublicKey;
anchorRemainingAccounts?: web3.AccountMeta[];
args: Uint8Array;
}): Promise<{
instruction: TransactionInstruction;
transaction: Transaction;
}> {
const initializeComponentIx = createApplyInstruction({
authority,
boltSystem,
boltComponent,
componentProgram,
instructionSysvarAccount: SYSVAR_INSTRUCTIONS_PUBKEY,
anchorRemainingAccounts
}, {
args
});
return {
instruction: initializeComponentIx,
transaction: new Transaction().add(initializeComponentIx)
};
}

interface ApplySystemInstruction {
authority: PublicKey;
systemId: PublicKey;
Expand Down

0 comments on commit 8c3ae4a

Please sign in to comment.