createIncrementInstruction.ts 513 B

1234567891011121314151617181920
  1. import { type PublicKey, TransactionInstruction } from '@solana/web3.js';
  2. import { PROGRAM_ID } from '../';
  3. export type IncrementInstructionAccounts = {
  4. counter: PublicKey;
  5. };
  6. export function createIncrementInstruction(accounts: IncrementInstructionAccounts): TransactionInstruction {
  7. return new TransactionInstruction({
  8. programId: PROGRAM_ID,
  9. keys: [
  10. {
  11. pubkey: accounts.counter,
  12. isSigner: false,
  13. isWritable: true,
  14. },
  15. ],
  16. data: Buffer.from([0x0]),
  17. });
  18. }