diff --git a/dapp/src/components/DonateModal.astro b/dapp/src/components/DonateModal.astro index af760b0..451922c 100644 --- a/dapp/src/components/DonateModal.astro +++ b/dapp/src/components/DonateModal.astro @@ -94,6 +94,9 @@ diff --git a/dapp/src/service/SorobanDomainContractService.ts b/dapp/src/service/SorobanDomainContractService.ts new file mode 100644 index 0000000..b4c62ca --- /dev/null +++ b/dapp/src/service/SorobanDomainContractService.ts @@ -0,0 +1,28 @@ +import type { Record } from '@creit.tech/sorobandomains-sdk'; +import { Domain404Error } from '@creit.tech/sorobandomains-sdk'; +import sdk from '../contracts/soroban_domain_sdk'; + +async function getAddressFromDomain ( + domainName: string, +) { + try { + const domainRecord: Record = await sdk.searchDomain({ domain: domainName }); + return domainRecord; + } catch (e) { + if (e instanceof Error && e.name === Domain404Error.name) { + return { + "error": true, + "message": "SDK error", + } + } else { + return { + "error": true, + "message": "Simulation error", + } + } + } +} + +export { + getAddressFromDomain, +} \ No newline at end of file