UNPKG

907 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6var bn_js_1 = __importDefault(require("bn.js"));
7var crypto_utils_1 = require("./crypto-utils");
8var loom_pb_1 = require("./proto/loom_pb");
9function unmarshalBigUIntPB(value) {
10 var bytes = value.getValue_asU8();
11 var buf = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
12 return new bn_js_1.default(buf, 10, 'be');
13}
14exports.unmarshalBigUIntPB = unmarshalBigUIntPB;
15function marshalBigUIntPB(value) {
16 var buf = value.toArrayLike(Buffer, 'be');
17 var pb = new loom_pb_1.BigUInt();
18 pb.setValue(crypto_utils_1.bufferToProtobufBytes(buf));
19 return pb;
20}
21exports.marshalBigUIntPB = marshalBigUIntPB;
22//# sourceMappingURL=big-uint.js.map
\No newline at end of file