@@ -15,10 +15,7 @@ npx jsr add @creit-tech/sorobandomains-sdk
1515The first step will be creating a new instance from the main class.
1616
1717``` typescript
18- import * as SDK from " @stellar/stellar-sdk" ;
19- import config from " ./myconfigfile.ts" ;
20-
21- const sdk: SorobanDomainsSDK = new SorobanDomainsSDK ({ rpcUrl: config .RPC_URL });
18+ const sdk: SorobanDomainsSDK = new SorobanDomainsSDK ();
2219```
2320
2421> There are more parameters you can provide to the SDK, check the ` SorobanDomainsSDKParams ` interface in the
@@ -27,33 +24,16 @@ const sdk: SorobanDomainsSDK = new SorobanDomainsSDK({ rpcUrl: config.RPC_URL })
2724## Fetch a registered domain
2825
2926``` typescript
30- import { Record } from " @creit.tech/sorobandomains-sdk" ;
27+ import { Domain , SubDomain } from " @creit.tech/sorobandomains-sdk" ;
3128
32- const domainRecord: Record = await sdk .searchDomain ({ domain: " jhon" } );
33- const subDomainRecord: Record = await sdk .searchDomain ({ domain: " jhon" , subDomain: " payments " } );
29+ const domainRecord: Domain = await sdk .searchDomain (" jhon.xlm " );
30+ const subDomainRecord: SubDomain = await sdk .searchDomain (" payments. jhon.xlm " );
3431```
3532
36- When searching for a domain, you can receive two types of errors: an expected error by the SDK or a simulation error.
37- Currently, there is only one expected error by the SDK: ` Domain404Error ` .
38-
39- If you need to catch this type of error you can do this:
40-
41- ``` typescript
42- import { Domain404Error } from " @creit.tech/sorobandomains-sdk" ;
43-
44- try {
45- const domainRecord: Record = await sdk .searchDomain ({ domain: " nonexistingrecord" });
46- } catch (e ) {
47- if (e .name === Domain404Error .name ) {
48- // ... Do something here
49- } else {
50- // ... Do this instead
51- }
52- }
53- ```
33+ This method will fail in two cases:
5434
55- > Note: In the example we check by the name and not if is an instance of the class because depending on your environment
56- > that validation method could fail .
35+ - The domain doesn't exist
36+ - The domain is expired .
5737
5838## Fetch the reverse domain of an address
5939
8060
8161![ ] ( https://img.shields.io/badge/License-MIT-lightgrey )
8262
83- Licensed under the MIT License, Copyright © 2024 -present Creit Technologies LLP .
63+ Licensed under the MIT License, Copyright © 2026 -present Creit Tech .
8464
8565Checkout the ` LICENSE.md ` file for more details.
0 commit comments