instructions.ts 587 B

1234567891011121314151617181920212223242526
  1. // @ts-nocheck
  2. import { Idl, InstructionCoder } from "@coral-xyz/anchor";
  3. export class SplMemoInstructionCoder implements InstructionCoder {
  4. constructor(_idl: Idl) {}
  5. encode(ixName: string, ix: any): Buffer {
  6. switch (ixName) {
  7. case "addMemo": {
  8. return encodeAddMemo(ix);
  9. }
  10. default: {
  11. throw new Error(`Invalid instruction: ${ixName}`);
  12. }
  13. }
  14. }
  15. encodeState(_ixName: string, _ix: any): Buffer {
  16. throw new Error("SplMemo does not have state");
  17. }
  18. }
  19. function encodeAddMemo({ memo }: any): Buffer {
  20. return Buffer.from(memo);
  21. }