How to use the bns/lib/util.label function in bns

To help you get started, we’ve selected a few bns 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 handshake-org / hsd / lib / covenants / ownership.js View on Github external
const hash = br.readBytes(size);
    const fee = br.readVarint();

    if (fee > consensus.MAX_MONEY)
      return null;

    const commitHash = br.readHash();
    const commitHeight = br.readU32();

    br.verifyChecksum(blake2b.digest);

    if (br.left() !== 0)
      return null;

    const name = util.label(target, 0);
    const item = reserved.getByName(name);

    if (!item)
      return null;

    if (target !== item.target)
      return null;

    const value = item.value;

    if (fee > value)
      return null;

    const [inception, expiration] = proof.getWindow();

    if (inception === 0 && expiration === 0)
github handshake-org / hsd / lib / covenants / ownership.js View on Github external
getNames() {
    const target = this.getTarget();

    if (target === '.')
      return ['', target];

    return [util.label(target, 0), target];
  }