{"version":3,"file":"setRecordRoaVerifierInstruction.cjs","sources":["../../../src/instructions/setRecordRoaVerifierInstruction.ts"],"sourcesContent":["import {\r\n  AccountMeta,\r\n  AccountRole,\r\n  Address,\r\n  Instruction,\r\n  ReadonlyUint8Array,\r\n} from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\nimport { addressCodec } from \"../codecs\";\r\n\r\n/**\r\n * Input for setting an SNS record's Right of Association verifier.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: SetRecordRoaVerifierInstructionParams = { verifier };\r\n * ```\r\n */\r\nexport interface SetRecordRoaVerifierInstructionParams {\r\n  /** Verifier account address. */\r\n  verifier: Address;\r\n}\r\n\r\n/** Builder for setting an SNS record's Right of Association verifier. */\r\nexport class SetRecordRoaVerifierInstruction {\r\n  /** Instruction discriminator. */\r\n  tag: number;\r\n  /** Encoded verifier address. */\r\n  roaId: ReadonlyUint8Array;\r\n\r\n  static schema = {\r\n    struct: {\r\n      tag: \"u8\",\r\n      roaId: { array: { type: \"u8\" } },\r\n    },\r\n  };\r\n\r\n  constructor(obj: SetRecordRoaVerifierInstructionParams) {\r\n    this.tag = 6;\r\n    this.roaId = addressCodec.encode(obj.verifier);\r\n  }\r\n\r\n  serialize(): Uint8Array {\r\n    return serialize(SetRecordRoaVerifierInstruction.schema, this);\r\n  }\r\n\r\n  getInstruction(\r\n    programAddress: Address,\r\n    systemProgram: Address,\r\n    splNameServiceProgram: Address,\r\n    feePayer: Address,\r\n    record: Address,\r\n    domain: Address,\r\n    domainOwner: Address,\r\n    centralState: Address\r\n  ): Instruction {\r\n    const data = this.serialize();\r\n\r\n    const accounts: AccountMeta[] = [\r\n      {\r\n        address: systemProgram,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: splNameServiceProgram,\r\n        role: AccountRole.READONLY,\r\n      },\r\n      {\r\n        address: feePayer,\r\n        role: AccountRole.WRITABLE_SIGNER,\r\n      },\r\n      {\r\n        address: record,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: domain,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: domainOwner,\r\n        role: AccountRole.WRITABLE_SIGNER,\r\n      },\r\n      {\r\n        address: centralState,\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":["addressCodec","serialize","AccountRole"],"mappings":";;;;;;;;AAwBA;MACa,+BAA+B,CAAA;;AAE1C,IAAA,GAAG;;AAEH,IAAA,KAAK;IAEL,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;YACT,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACjC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAA0C,EAAA;AACpD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;QACZ,IAAI,CAAC,KAAK,GAAGA,mBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;;IAGhD,SAAS,GAAA;QACP,OAAOC,eAAS,CAAC,+BAA+B,CAAC,MAAM,EAAE,IAAI,CAAC;;AAGhE,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,qBAA8B,EAC9B,QAAiB,EACjB,MAAe,EACf,MAAe,EACf,WAAoB,EACpB,YAAqB,EAAA;AAErB,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAEC,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAEA,eAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,QAAQ;gBACjB,I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