Sha256: 7ff60a1a9fa0c6ecda359c75b4aa9f77ab0196ddb952ef26182ce8bc5af7e2ca
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var blocks_1 = require("../../api-node/blocks"); function default_1(base) { return blocks_1.fetchHeadersLast(base).then(function (header) { return base58Decode(header.generator)[1]; }); } exports.default = default_1; var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; var ALPHABET_MAP = {}; for (var i = 0; i < ALPHABET.length; i++) { ALPHABET_MAP[ALPHABET.charAt(i)] = i; } function base58Decode(string) { var bytes, c, carry, j, i; if (string.length === 0) { return new Uint8Array(0); } i = void 0; j = void 0; bytes = [0]; i = 0; while (i < string.length) { c = string[i]; if (!(c in ALPHABET_MAP)) { throw 'Base58.decode received unacceptable input. Character \'' + c + '\' is not in the Base58 alphabet.'; } j = 0; while (j < bytes.length) { bytes[j] *= 58; j++; } bytes[0] += ALPHABET_MAP[c]; carry = 0; j = 0; while (j < bytes.length) { bytes[j] += carry; carry = bytes[j] >> 8; bytes[j] &= 0xff; ++j; } while (carry) { bytes.push(carry & 0xff); carry >>= 8; } i++; } i = 0; while (string[i] === '1' && i < string.length - 1) { bytes.push(0); i++; } return new Uint8Array(bytes.reverse()); } //# sourceMappingURL=getNetworkByte.js.map
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
waves_lib-0.1.0 | js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkByte.js |