{"version":3,"file":"getDomainOwner.cjs","sources":["../../../src/domain/getDomainOwner.ts"],"sourcesContent":["import {\r\n  GetAccountInfoApi,\r\n  GetTokenLargestAccountsApi,\r\n  Rpc,\r\n} from \"@solana/kit\";\r\n\r\nimport { getNftOwner } from \"../nft/getNftOwner\";\r\nimport { RegistryState } from \"../states/registry\";\r\nimport { getDomainAddress } from \"./getDomainAddress\";\r\n\r\ninterface GetDomainOwnerParams {\r\n  rpc: Rpc<GetAccountInfoApi & GetTokenLargestAccountsApi>;\r\n  domain: string;\r\n}\r\n\r\n/**\r\n * Retrieves the owner of the specified domain. If the domain is tokenized,\r\n * the NFT's owner is returned; otherwise, the registry owner is returned.\r\n *\r\n * @param params - An object containing the following properties:\r\n *   - `rpc`: An RPC interface implementing GetAccountInfoApi and GetTokenLargestAccountsApi.\r\n *   - `domain`: The domain whose owner is to be retrieved.\r\n * @returns A promise that resolves to the owner of the domain.\r\n */\r\nexport const getDomainOwner = async ({ rpc, domain }: GetDomainOwnerParams) => {\r\n  const { domainAddress } = await getDomainAddress({ domain });\r\n  const [registry, nftOwner] = await Promise.all([\r\n    RegistryState.retrieve(rpc, domainAddress),\r\n    getNftOwner({ rpc, domainAddress }),\r\n  ]);\r\n  return nftOwner || registry.owner;\r\n};\r\n"],"names":["async","rpc","domain","domainAddress","getDomainAddress","registry","nftOwner","Promise","all","RegistryState","retrieve","getNftOwner","owner"],"mappings":"oJAwB8BA,OAASC,MAAKC,aAC1C,MAAMC,cAAEA,SAAwBC,EAAAA,iBAAiB,CAAEF,YAC5CG,EAAUC,SAAkBC,QAAQC,IAAI,CAC7CC,gBAAcC,SAAST,EAAKE,GAC5BQ,cAAY,CAAEV,MAAKE,oBAErB,OAAOG,GAAYD,EAASO,KAAK"}