{"version":3,"file":"deleteNameRegistry.cjs","sources":["../../../src/bindings/deleteNameRegistry.ts"],"sourcesContent":["import { Address, GetAccountInfoApi, IInstruction, Rpc } from \"@solana/kit\";\r\n\r\nimport { NAME_PROGRAM_ADDRESS } from \"../constants/addresses\";\r\nimport { DeleteNameRegistryInstruction } from \"../instructions/deleteNameRegistryInstruction\";\r\nimport { RegistryState } from \"../states/registry\";\r\nimport { deriveAddress } from \"../utils/deriveAddress\";\r\n\r\ninterface DeleteNameRegistryParams {\r\n  rpc: Rpc<GetAccountInfoApi>;\r\n  name: string;\r\n  refundAddress: Address;\r\n  classAddress?: Address;\r\n  parentAddress?: Address;\r\n}\r\n\r\n/**\r\n * Deletes a name registry and refunds the associated rent balance to the specified target.\r\n *\r\n * @param params - An object containing the following properties:\r\n *   - `rpc`: An RPC interface implementing GetAccountInfoApi.\r\n *   - `name`: The name of the registry to be deleted.\r\n *   - `refundTarget`: The address to which the refunded rent balance will be sent.\r\n *   - `classAddress`: (Optional) The address of the class associated with the registry.\r\n *   - `parentAddress`: (Optional) The address of the parent registry.\r\n * @returns A promise which resolves to the delete name registry instruction.\r\n */\r\nexport const deleteNameRegistry = async ({\r\n  rpc,\r\n  name,\r\n  refundAddress,\r\n  classAddress,\r\n  parentAddress,\r\n}: DeleteNameRegistryParams): Promise<IInstruction> => {\r\n  const domainAddress = await deriveAddress(name, parentAddress, classAddress);\r\n\r\n  const owner =\r\n    classAddress || (await RegistryState.retrieve(rpc, domainAddress)).owner;\r\n\r\n  const ix = new DeleteNameRegistryInstruction().getInstruction(\r\n    NAME_PROGRAM_ADDRESS,\r\n    domainAddress,\r\n    refundAddress,\r\n    owner\r\n  );\r\n\r\n  return ix;\r\n};\r\n"],"names":["async","rpc","name","refundAddress","classAddress","parentAddress","domainAddress","deriveAddress","owner","RegistryState","retrieve","DeleteNameRegistryInstruction","getInstruction","NAME_PROGRAM_ADDRESS"],"mappings":"+NA0BkCA,OAChCC,MACAC,OACAC,gBACAC,eACAC,oBAEA,MAAMC,QAAsBC,EAAAA,cAAcL,EAAMG,EAAeD,GAEzDI,EACJJ,UAAuBK,EAAAA,cAAcC,SAAST,EAAKK,IAAgBE,MASrE,OAPW,IAAIG,EAAAA,+BAAgCC,eAC7CC,EAAAA,qBACAP,EACAH,EACAK,EAGO"}