{"version":3,"file":"registerFavoriteInstruction.cjs","sources":["../../../src/instructions/registerFavoriteInstruction.ts"],"sourcesContent":["import { AccountRole, Address, IAccountMeta, IInstruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nexport class registerFavoriteInstruction {\r\n  tag: number;\r\n  static schema = {\r\n    struct: {\r\n      tag: \"u8\",\r\n    },\r\n  };\r\n\r\n  constructor() {\r\n    this.tag = 6;\r\n  }\r\n\r\n  serialize(): Uint8Array {\r\n    return serialize(registerFavoriteInstruction.schema, this);\r\n  }\r\n\r\n  getInstruction(\r\n    programAddress: Address,\r\n    nameAccount: Address,\r\n    favouriteAccount: Address,\r\n    owner: Address,\r\n    systemProgram: Address,\r\n    optParent?: Address\r\n  ): IInstruction {\r\n    const data = this.serialize();\r\n    const accounts: IAccountMeta[] = [\r\n      {\r\n        address: nameAccount,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: favouriteAccount,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: owner,\r\n        role: AccountRole.WRITABLE_SIGNER,\r\n      },\r\n      {\r\n        address: systemProgram,\r\n        role: AccountRole.READONLY,\r\n      },\r\n    ];\r\n\r\n    if (optParent) {\r\n      accounts.push({\r\n        address: optParent,\r\n        role: AccountRole.READONLY,\r\n      });\r\n    }\r\n\r\n    return {\r\n      programAddress,\r\n      accounts,\r\n      data,\r\n    };\r\n  }\r\n}\r\n"],"names":["registerFavoriteInstruction","tag","static","struct","constructor","this","serialize","schema","getInstruction","programAddress","nameAccount","favouriteAccount","owner","systemProgram","optParent","data","accounts","address","role","AccountRole","READONLY","WRITABLE","WRITABLE_SIGNER","push"],"mappings":"qGAGaA,EACXC,IACAC,cAAgB,CACdC,OAAQ,CACNF,IAAK,OAIT,WAAAG,GACEC,KAAKJ,IAAM,EAGb,SAAAK,GACE,OAAOA,YAAUN,EAA4BO,OAAQF,MAGvD,cAAAG,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAOV,KAAKC,YACZU,EAA2B,CAC/B,CACEC,QAASP,EACTQ,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASN,EACTO,KAAMC,EAAWA,YAACE,UAEpB,CACEJ,QAASL,EACTM,KAAMC,EAAWA,YAACG,iBAEpB,CACEL,QAASJ,EACTK,KAAMC,EAAWA,YAACC,WAWtB,OAPIN,GACFE,EAASO,KAAK,CACZN,QAASH,EACTI,KAAMC,EAAWA,YAACC,WAIf,CACLX,iBACAO,WACAD"}