{"version":3,"file":"createReverseInstruction.cjs","sources":["../../../src/instructions/createReverseInstruction.ts"],"sourcesContent":["import { AccountRole, Address, IAccountMeta, IInstruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nexport class createReverseInstruction {\r\n  tag: number;\r\n  domain: string;\r\n  static schema = {\r\n    struct: {\r\n      tag: \"u8\",\r\n      domain: \"string\",\r\n    },\r\n  };\r\n\r\n  constructor(obj: { domain: string }) {\r\n    this.tag = 12;\r\n    this.domain = obj.domain;\r\n  }\r\n\r\n  serialize(): Uint8Array {\r\n    return serialize(createReverseInstruction.schema, this);\r\n  }\r\n\r\n  getInstruction(\r\n    programAddress: Address,\r\n    namingServiceProgram: Address,\r\n    rootDomain: Address,\r\n    reverseLookup: Address,\r\n    systemProgram: Address,\r\n    centralState: Address,\r\n    payer: Address,\r\n    rentSysvar: Address,\r\n    parentAddress?: Address,\r\n    parentOwner?: Address\r\n  ): IInstruction {\r\n    const data = this.serialize();\r\n\r\n    const accounts: IAccountMeta[] = [\r\n      {\r\n        address: namingServiceProgram,\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: reverseLookup,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: systemProgram,\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: payer,\r\n        role: AccountRole.WRITABLE_SIGNER,\r\n      },\r\n      {\r\n        address: rentSysvar,\r\n        role: AccountRole.READONLY,\r\n      },\r\n    ];\r\n\r\n    if (parentAddress) {\r\n      accounts.push({\r\n        address: parentAddress,\r\n        role: AccountRole.WRITABLE,\r\n      });\r\n    }\r\n\r\n    if (parentOwner) {\r\n      accounts.push({\r\n        address: parentOwner,\r\n        role: AccountRole.WRITABLE_SIGNER,\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":["createReverseInstruction","tag","domain","static","struct","constructor","obj","this","serialize","schema","getInstruction","programAddress","namingServiceProgram","rootDomain","reverseLookup","systemProgram","centralState","payer","rentSysvar","parentAddress","parentOwner","data","accounts","address","role","AccountRole","READONLY","WRITABLE","WRITABLE_SIGNER","push"],"mappings":"qGAGaA,EACXC,IACAC,OACAC,cAAgB,CACdC,OAAQ,CACNH,IAAK,KACLC,OAAQ,WAIZ,WAAAG,CAAYC,GACVC,KAAKN,IAAM,GACXM,KAAKL,OAASI,EAAIJ,OAGpB,SAAAM,GACE,OAAOA,YAAUR,EAAyBS,OAAQF,MAGpD,cAAAG,CACEC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAOd,KAAKC,YAEZc,EAA2B,CAC/B,CACEC,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,YAACC,UAEpB,CACEH,QAASP,EACTQ,KAAMC,EAAWA,YAACC,UAEpB,CACEH,QAASN,EACTO,KAAMC,EAAWA,YAACG,iBAEpB,CACEL,QAASL,EACTM,KAAMC,EAAWA,YAACC,WAkBtB,OAdIP,GACFG,EAASO,KAAK,CACZN,QAASJ,EACTK,KAAMC,EAAWA,YAACE,WAIlBP,GACFE,EAASO,KAAK,CACZN,QAASH,EACTI,KAAMC,EAAWA,YAACG,kBAIf,CACLjB,iBACAW,WACAD"}