1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.u8aToHex = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | function u8aToHex(value, bitLength = -1, isPrefixed = true) {
|
19 | const length = Math.ceil(bitLength / 8);
|
20 | return `${isPrefixed ? '0x' : ''}${!value?.length
|
21 | ? ''
|
22 | : (bitLength > 0 && value.length > length)
|
23 | ? `${Buffer.from(value.subarray(0, length / 2)).toString('hex')}…${Buffer.from(value.subarray(value.length - length / 2)).toString('hex')}`
|
24 | : Buffer.from(value).toString('hex')}`;
|
25 | }
|
26 | exports.u8aToHex = u8aToHex;
|