@polkadot/util
Version:
A collection of useful utilities for @polkadot
10 lines (9 loc) • 326 B
JavaScript
import { u8aToHex } from '../u8a/index.js';
import { nToU8a } from './toU8a.js';
/**
* @name nToHex
* @summary Creates a hex value from a bigint object.
*/
export function nToHex(value, { bitLength = -1, isLe = false, isNegative = false } = {}) {
return u8aToHex(nToU8a(value || 0, { bitLength, isLe, isNegative }));
}