{"version":3,"file":"createV2Instruction.cjs","sources":["../../../src/instructions/createV2Instruction.ts"],"sourcesContent":["import { AccountRole, Address, IAccountMeta, IInstruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nimport {\r\n  SYSTEM_PROGRAM_ADDRESS,\r\n  TOKEN_PROGRAM_ADDRESS,\r\n} from \"../constants/addresses\";\r\n\r\nexport class createV2Instruction {\r\n  tag: number;\r\n  name: string;\r\n  space: number;\r\n\r\n  static schema = {\r\n    struct: {\r\n      tag: \"u8\",\r\n      name: \"string\",\r\n      space: \"u32\",\r\n    },\r\n  };\r\n\r\n  constructor(obj: { name: string; space: number }) {\r\n    this.tag = 9;\r\n    this.name = obj.name;\r\n    this.space = obj.space;\r\n  }\r\n\r\n  serialize(): Uint8Array {\r\n    return serialize(createV2Instruction.schema, this);\r\n  }\r\n\r\n  getInstruction(\r\n    programAddress: Address,\r\n    rentSysvarAccount: Address,\r\n    nameProgramId: Address,\r\n    rootDomain: Address,\r\n    nameAccount: Address,\r\n    reverseLookupAccount: Address,\r\n    centralState: Address,\r\n    buyer: Address,\r\n    buyerTokenAccount: Address,\r\n    usdcVault: Address,\r\n    state: Address\r\n  ): IInstruction {\r\n    const data = this.serialize();\r\n\r\n    const accounts: IAccountMeta[] = [\r\n      {\r\n        address: rentSysvarAccount,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: nameProgramId,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: rootDomain,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: nameAccount,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: reverseLookupAccount,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: SYSTEM_PROGRAM_ADDRESS,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: centralState,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: buyer,\r\n        role: AccountRole.WRITABLE_SIGNER,\r\n      },\r\n      {\r\n        address: buyerTokenAccount,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: usdcVault,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: TOKEN_PROGRAM_ADDRESS,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: state,\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":["createV2Instruction","tag","name","space","static","struct","constructor","obj","this","serialize","schema","getInstruction","programAddress","rentSysvarAccount","nameProgramId","rootDomain","nameAccount","reverseLookupAccount","centralState","buyer","buyerTokenAccount","usdcVault","state","data","accounts","address","role","AccountRole","READONLY","WRITABLE","SYSTEM_PROGRAM_ADDRESS","WRITABLE_SIGNER","TOKEN_PROGRAM_ADDRESS"],"mappings":"6IAQaA,EACXC,IACAC,KACAC,MAEAC,cAAgB,CACdC,OAAQ,CACNJ,IAAK,KACLC,KAAM,SACNC,MAAO,QAIX,WAAAG,CAAYC,GACVC,KAAKP,IAAM,EACXO,KAAKN,KAAOK,EAAIL,KAChBM,KAAKL,MAAQI,EAAIJ,MAGnB,SAAAM,GACE,OAAOA,YAAUT,EAAoBU,OAAQF,MAG/C,cAAAG,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAOf,KAAKC,YAqDlB,MAAO,CACLG,iBACAY,SArD+B,CAC/B,CACEC,QAASZ,EACTa,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASX,EACTY,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASV,EACTW,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAAST,EACTU,KAAMC,EAAWA,YAACE,UAEpB,CACEJ,QAASR,EACTS,KAAMC,EAAWA,YAACE,UAEpB,CACEJ,QAASK,EAAsBA,uBAC/BJ,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASP,EACTQ,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASN,EACTO,KAAMC,EAAWA,YAACI,iBAEpB,CACEN,QAASL,EACTM,KAAMC,EAAWA,YAACE,UAEpB,CACEJ,QAASJ,EACTK,KAAMC,EAAWA,YAACE,UAEpB,CACEJ,QAASO,EAAqBA,sBAC9BN,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASH,EACTI,KAAMC,EAAWA,YAACC,WAOpBL"}