createIncrementInstruction.ts 645 B

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