UNPKG

691 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.nToHex = nToHex;
7
8var _spread = require("../object/spread");
9
10var _u8a = require("../u8a");
11
12var _toU8a = require("./toU8a");
13
14// Copyright 2017-2022 @polkadot/util authors & contributors
15// SPDX-License-Identifier: Apache-2.0
16const ZERO_STR = '0x00';
17/**
18 * @name nToHex
19 * @summary Creates a hex value from a bigint object.
20 */
21
22function nToHex(value, options) {
23 return !value ? ZERO_STR : (0, _u8a.u8aToHex)((0, _toU8a.nToU8a)(value, (0, _spread.objectSpread)( // We spread here, the default for hex values is BE (JSONRPC via substrate)
24 {
25 isLe: false,
26 isNegative: false
27 }, options)));
28}
\No newline at end of file