1.1.0 • Published 1 year ago

ibc-domains-sdk v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

IBC Domains SDK

Example usage

import {
  convertAddress,
  resolveDomainDetails,
  resolveDomainIntoAddresses,
  resolvePrimaryDomainByAddress,
  resolveDomainIntoChainAddress
} from "ibc-domains-sdk";

const result = convertAddress("cosmos1elwrkcazwacy3gyj6jg2g4yp243zkzs62mpsd7", "osmo");

if (result.isOk()) {
  console.log(result.value);
} else {
  console.log("error:", result.error);
}

resolveDomainIntoAddresses("jacky").then(result => {
  if (result.isOk()) {
    console.log("f", result.value)
  } else {
    console.log("error:", result.error);
  }
});

resolveDomainIntoChainAddress("jacky.cosmos", "kujira").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

resolvePrimaryDomainByAddress("osmo1elwrkcazwacy3gyj6jg2g4yp243zkzs6zqjqmv").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

resolveDomainDetails("jacky").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

Convert Cosmos address

Example

import {
  convertAddress
} from "ibc-domains-sdk";

const result = convertAddress("cosmos1elwrkcazwacy3gyj6jg2g4yp243zkzs62mpsd7", "osmo");

if (result.isOk()) {
  console.log(result.value);
} else {
  console.log("error:", result.error);
}

API

convertAddress

Input

  • Valid bech32 address, for instance "cosmos1elwrkcazwacy3gyj6jg2g4yp243zkzs62mpsd7"
  • Bech32 prefix of the destination chain, for instance "kujira" or "osmo"

Output

PropertyTypeExplanation
valueString or nullConverted address or null if conversion failed
errornull or StringString explaining why conversion failed or null if conversion was successful
isOkfunctionHelper function that can be called to see if resolution was successful

Relevant bech32 prefixes

bech32 prefixes
agoricchihuahuagravitylumsent
akashcomdexiaamicrosif
axelarcosmosinjosmosomm
bcnacroixopanaceastar
bitsongdesmosjunopersistencestars
bostromdigkiregenterra
certikemoneykujirarebusumee
cheqdevmoslikesecretvdl

Resolve domain

Example

import {
  resolveDomainIntoAddresses,
  resolveDomainIntoChainAddress
} from "ibc-domains-sdk";

resolveDomainIntoAddresses("jacky.cosmos").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

resolveDomainIntoChainAddress("jacky.cosmos", "kujira").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

API

resolveDomainIntoAddresses

Input

  • IBC domain, with or without .cosmos extension, for instance "jacky.cosmos"

Output

PropertyTypeExplanation
valueString [] or nullArray of associated addresses or null if resolution failed / no association was found
errornull or StringString explaining why resolution failed or null if resolution was successful
isOkfunctionHelper function that can be called to see if resolution was successful
import {
  resolveDomainIntoAddresses
} from "ibc-domains-sdk";

resolveDomainIntoAddresses("jacky.cosmos").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

resolveDomainIntoChainAddress

Input

  • IBC domain, with or without .cosmos extension, for instance "jacky.cosmos"
  • bech32 prefix of the destination chain, for instance "kujira" or "osmo"

Output

PropertyTypeExplanation
valueString or nullAssociated addresses on the specified chain or null if resolution failed / no association was found
errornull or StringString explaining why resolution failed or null if resolution was successful
isOkfunctionHelper function that can be called to see if resolution was successful
import {
  resolveDomainIntoChainAddress
} from "ibc-domains-sdk";

resolveDomainIntoChainAddress("jacky.cosmos", "kujira").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

Resolve address into primary domain

Example

import {
  resolvePrimaryDomainByAddress
} from "ibc-domains-sdk";

resolvePrimaryDomainByAddress("osmo1elwrkcazwacy3gyj6jg2g4yp243zkzs6zqjqmv").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

API

resolvePrimaryDomainByAddress

Input

  • Cosmos address, for instance "osmo1elwrkcazwacy3gyj6jg2g4yp243zkzs6zqjqmv"

Output

PropertyTypeExplanation
value{ domain: String, domain_full: String } or nullArray of associated addresses or null if resolution failed / no association was found
errornull or StringString explaining why resolution failed or null if resolution was successful
isOkfunctionHelper function that can be called to see if resolution was successful

Resolve IBC domain details

Example

import {
  resolveDomainDetails
} from "ibc-domains-sdk";

resolveDomainDetails("jacky").then(result => {
  if (result.isOk()) {
    console.log(result.value)
  } else {
    console.log("error:", result.error);
  }
});

API

resolveDomainDetails

Input

  • IBC domain, with or without .cosmos extension, for instance "jacky.cosmos"

Output

PropertyTypeExplanation
valueMetadata or nullMetadata or null if resolution failed / no association was found
errornull or StringString explaining why resolution failed or null if resolution was successful
isOkfunctionHelper function that can be called to see if resolution was successful

Where Metadata is defined as follows:

PropertyTypeExplanation
expirationStringISO date format, for instance "2023-11-04T19:24:14.000Z" or "Never"
imageDataString or nullUser provided information if any
twitterIdString or nullUser provided information if any
discordIdString or nullUser provided information if any
telegramIdString or nullUser provided information if any
keybaseIdString or nullUser provided information if any
pgpPublicKeyString or nullUser provided information if any
1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.5.0

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago