{"version":3,"file":"updateNameRegistryInstruction.mjs","sources":["../../../src/instructions/updateNameRegistryInstruction.ts"],"sourcesContent":["import { AccountMeta, AccountRole, Address, Instruction } from \"@solana/kit\";\r\nimport { serialize } from \"borsh\";\r\n\r\n/**\r\n * Input for updating an SNS name-registry account.\r\n *\r\n * @example\r\n * ```ts\r\n * const params: UpdateNameRegistryInstructionParams = { offset: 0, inputData };\r\n * ```\r\n */\r\nexport interface UpdateNameRegistryInstructionParams {\r\n  /** Byte offset where the update begins. */\r\n  offset: number;\r\n  /** Bytes to write. */\r\n  inputData: Uint8Array;\r\n}\r\n\r\n/** Builder for updating the data of an SNS name-registry account. */\r\nexport class UpdateNameRegistryInstruction {\r\n  /** Instruction discriminator. */\r\n  tag: number;\r\n  /** Byte offset where the update begins. */\r\n  offset: number;\r\n  /** Bytes to write. */\r\n  inputData: Uint8Array;\r\n\r\n  static schema = {\r\n    struct: {\r\n      tag: \"u8\",\r\n      offset: \"u32\",\r\n      inputData: { array: { type: \"u8\" } },\r\n    },\r\n  };\r\n\r\n  constructor(obj: UpdateNameRegistryInstructionParams) {\r\n    this.tag = 1;\r\n    this.offset = obj.offset;\r\n    this.inputData = obj.inputData;\r\n  }\r\n\r\n  serialize(): Uint8Array {\r\n    return serialize(UpdateNameRegistryInstruction.schema, this);\r\n  }\r\n\r\n  getInstruction(\r\n    programAddress: Address,\r\n    domainAddress: Address,\r\n    signer: Address\r\n  ): Instruction {\r\n    const data = this.serialize();\r\n\r\n    const accounts: AccountMeta[] = [\r\n      {\r\n        address: domainAddress,\r\n        role: AccountRole.WRITABLE,\r\n      },\r\n      {\r\n        address: signer,\r\n        role: AccountRole.READONLY_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":[],"mappings":";;;AAkBA;MACa,6BAA6B,CAAA;;AAExC,IAAA,GAAG;;AAEH,IAAA,MAAM;;AAEN,IAAA,SAAS;IAET,OAAO,MAAM,GAAG;AACd,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;AACrC,SAAA;KACF;AAED,IAAA,WAAA,CAAY,GAAwC,EAAA;AAClD,QAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,QAAA,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;AACxB,QAAA,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS;;IAGhC,SAAS,GAAA;QACP,OAAO,SAAS,CAAC,6BAA6B,CAAC,MAAM,EAAE,IAAI,CAAC;;AAG9D,IAAA,cAAc,CACZ,cAAuB,EACvB,aAAsB,EACtB,MAAe,EAAA;AAEf,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAE7B,QAAA,MAAM,QAAQ,GAAkB;AAC9B,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,WAAW,CAAC,QAAQ;AAC3B,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,WAAW,CAAC,eAAe;AAClC,aAAA;SACF;QAED,OAAO;YACL,cAAc;YACd,QAAQ;YACR,IAAI;SACL;;;;;;"}