How to use the nem2-sdk.NamespaceId function in nem2-sdk

To help you get started, we’ve selected a few nem2-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 44uk / nem2-dev-ui / src / util / convert.ts View on Github external
export const convertIdentifierToNamespaceId = (value: string) => {
  if(/[0-9a-fA-F]{16}/.test(value)) {
    return NamespaceId.createFromEncoded(value)
  }
  try {
    const namespaceId = new NamespaceId(value)
    return namespaceId
  } catch (_) {
    // try next
  }
  const hex = convertUInt64ToHex(value)
  if(! /[0-9a-fA-F]{16}/.test(hex)) {
    throw new Error("Can't convert")
  }
  return NamespaceId.createFromEncoded(hex)
}
github nemtech / nem2-cli / src / service / mosaic.service.ts View on Github external
static getMosaicId(rawMosaicId: string): MosaicId | NamespaceId {
        let mosaicId: MosaicId | NamespaceId;
        if (rawMosaicId.charAt(0) === MosaicService.ALIAS_TAG) {
            mosaicId = new NamespaceId(rawMosaicId.substring(1));
        } else {
            mosaicId = new MosaicId(rawMosaicId);
        }
        return mosaicId;
    }

nem2-sdk

Reactive Nem2 sdk for typescript and javascript

Apache-2.0
Latest version published 5 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages