# Integrating using our SDK

## How to access our domain SDK?

You can access the package at this link: <https://www.npmjs.com/package/@cronosid/croidjs?activeTab=code>

## How to set up the Domain SDK?

Before you can begin interacting with Cronos ID, you will need to obtain a reference to the CROID registry.

<pre><code>import CROID, { getCroidAddress } from '@cronosid/croidjs'



<a data-footnote-ref href="#user-content-fn-1">const</a> croid = new CROID({ provider, croidAddress: getCroidAddress('25') }) // Cronos Mainnet Chain Id

croid.name('cronos.cro').getAddress() // 0x123
</code></pre>

### **Resolving a name to a Cronos address**

```javascript
var address = await croid.name('cronos.cro').getAddress();
```

### Reverse Resolution

While 'regular' resolution involves mapping from a name to an address, reverse resolution maps from an address back to a name. Cronos ID supports reverse resolution to allow applications to display Cronos ID names in place of hexadecimal addresses.

```javascript
const address = '0x1234...';
let croidName = null;
({ name: croidName } = await croid.getName(address))
// Check to be sure the reverse record is correct. skip check if the name is null
if(croidName == null || address != await croid.name(croidName).getAddress()) {
  croidName = null;
}
```

### Exports

```
default - CROID
getCroidAddress
getResolverContract
getCROIDContract
namehash
labelhash
```

### CROID Interface

```typescript
name(name: String) => Name
```

* Returns a Name Object, that allows you to make record queries.

```typescript
resolver(address: CronosAddress) => Resolver
```

* Returns a Resolver Object, allowing you to query names from this specific resolver. Most useful when querying a different resolver that is different than is currently recorded on the registry. E.g. migrating to a new resolver

```typescript
async getName(address: CronosAddress) => Promise<Name>
```

* Returns the reverse record for a particular Cronos address.

### Name Interface

```ts
async getOwner() => Promise<CronosAddress>
```

* Returns the owner/controller for the current CROID name.

```ts
async getResolver() => Promise<CronosAddress>
```

* Returns the resolver for the current CROID name.

```ts
async getAddress(coinId: String) => Promise<CronosAddress>
```

* Returns the address for the current CROID name for the coinId provided.

```ts
async getContent() => Promise<ContentHash>
```

* Returns the contentHash for the current CROID name.

```ts
async getText(key: String) => Promise<String>
```

* Returns the text record for a given key for the current CROID name.

### Resolver Interface

```ts
address
```

* Static property that returns current resolver address

```ts
name(name) => Name
```

* Returns a Name Object that hardcodes the resolver

## Who should I contact for support?

If you have any questions about the integration with Cronos ID Domain, drop us a message on our [Discord server](https://discord.com/invite/cronosid) and we will get in touch with you!

[^1]:
