Socket
Socket
Sign inDemoInstall

@polkadot/util

Package Overview
Dependencies
Maintainers
2
Versions
1408
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/util - npm Package Compare versions

Comparing version 13.0.2 to 13.1.1

6

bi/consts.js

@@ -66,3 +66,3 @@ import { BigInt } from '@polkadot/x-bigint';

*/
export const _1000n = /*#__PURE__*/ BigInt(1000);
export const _1000n = /*#__PURE__*/ BigInt(1_000);
/**

@@ -72,3 +72,3 @@ * @name _1Mn

*/
export const _1Mn = /*#__PURE__*/ BigInt(1000000);
export const _1Mn = /*#__PURE__*/ BigInt(1_000_000);
/**

@@ -78,3 +78,3 @@ * @name _1Bn

*/
export const _1Bn = /*#__PURE__*/ BigInt(1000000000);
export const _1Bn = /*#__PURE__*/ BigInt(1_000_000_000);
/**

@@ -81,0 +81,0 @@ * @name _1Qn

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/index.js';

@@ -3,0 +2,0 @@ import type { ToBigInt, ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ import type { ToBigInt, ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ import type { HexString, NumberOptions, ToBigInt, ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ import type { NumberOptions, ToBigInt, ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import { BN } from './bn.js';

@@ -3,0 +2,0 @@ /**

@@ -66,3 +66,3 @@ import { BN } from './bn.js';

*/
export const BN_THOUSAND = /*#__PURE__*/ new BN(1000);
export const BN_THOUSAND = /*#__PURE__*/ new BN(1_000);
/**

@@ -72,3 +72,3 @@ * @name BN_MILLION

*/
export const BN_MILLION = /*#__PURE__*/ new BN(1000000);
export const BN_MILLION = /*#__PURE__*/ new BN(1_000_000);
/**

@@ -78,3 +78,3 @@ * @name BN_BILLION

*/
export const BN_BILLION = /*#__PURE__*/ new BN(1000000000);
export const BN_BILLION = /*#__PURE__*/ new BN(1_000_000_000);
/**

@@ -81,0 +81,0 @@ * @name BN_QUINTILL

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from './bn.js';

@@ -3,0 +2,0 @@ /**

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { ToBn } from '../types.js';

@@ -3,0 +2,0 @@ import { BN } from './bn.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { ToBigInt, ToBn } from '../types.js';

@@ -3,0 +2,0 @@ import { BN } from './bn.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { HexString, NumberOptions, ToBn } from '../types.js';

@@ -3,0 +2,0 @@ import type { BN } from './bn.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { NumberOptions, ToBn } from '../types.js';

@@ -3,0 +2,0 @@ import type { BN } from './bn.js';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayChunk = void 0;
exports.arrayChunk = arrayChunk;
/**

@@ -31,2 +31,1 @@ * @name arrayChunk

}
exports.arrayChunk = arrayChunk;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayFilter = void 0;
exports.arrayFilter = arrayFilter;
/**

@@ -23,2 +23,1 @@ * @name arrayFilter

}
exports.arrayFilter = arrayFilter;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayFlatten = void 0;
exports.arrayFlatten = arrayFlatten;
/**

@@ -43,2 +43,1 @@ * @name arrayFlatten

}
exports.arrayFlatten = arrayFlatten;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayRange = void 0;
exports.arrayRange = arrayRange;
/**

@@ -29,2 +29,1 @@ * @name arrayRange

}
exports.arrayRange = arrayRange;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayShuffle = void 0;
exports.arrayShuffle = arrayShuffle;
/**

@@ -23,2 +23,1 @@ * @name arrayShuffle

}
exports.arrayShuffle = arrayShuffle;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayUnzip = void 0;
exports.arrayUnzip = arrayUnzip;
/**

@@ -17,2 +17,1 @@ * @name arrayUnzip

}
exports.arrayUnzip = arrayUnzip;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayZip = void 0;
exports.arrayZip = arrayZip;
/**

@@ -16,2 +16,1 @@ * @name arrayZip

}
exports.arrayZip = arrayZip;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertUnreachable = exports.assertReturn = exports.assert = void 0;
exports.assert = assert;
exports.assertReturn = assertReturn;
exports.assertUnreachable = assertUnreachable;
const function_js_1 = require("./is/function.js");

@@ -28,3 +30,2 @@ /**

}
exports.assert = assert;
/**

@@ -38,3 +39,2 @@ * @name assertReturn

}
exports.assertReturn = assertReturn;
/**

@@ -47,2 +47,1 @@ * @name assertUnreachable

}
exports.assertUnreachable = assertUnreachable;

@@ -69,3 +69,3 @@ "use strict";

*/
exports._1000n = (0, x_bigint_1.BigInt)(1000);
exports._1000n = (0, x_bigint_1.BigInt)(1_000);
/**

@@ -75,3 +75,3 @@ * @name _1Mn

*/
exports._1Mn = (0, x_bigint_1.BigInt)(1000000);
exports._1Mn = (0, x_bigint_1.BigInt)(1_000_000);
/**

@@ -81,3 +81,3 @@ * @name _1Bn

*/
exports._1Bn = (0, x_bigint_1.BigInt)(1000000000);
exports._1Bn = (0, x_bigint_1.BigInt)(1_000_000_000);
/**

@@ -84,0 +84,0 @@ * @name _1Qn

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCmp = void 0;
exports.createCmp = createCmp;
/** @internal */

@@ -20,2 +20,1 @@ function createCmp(cmp) {

}
exports.createCmp = createCmp;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nSqrt = void 0;
exports.nSqrt = nSqrt;
const x_bigint_1 = require("@polkadot/x-bigint");

@@ -33,2 +33,1 @@ const consts_js_1 = require("./consts.js");

}
exports.nSqrt = nSqrt;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nToBigInt = void 0;
exports.nToBigInt = nToBigInt;
const x_bigint_1 = require("@polkadot/x-bigint");

@@ -29,2 +29,1 @@ const toBigInt_js_1 = require("../hex/toBigInt.js");

}
exports.nToBigInt = nToBigInt;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nToHex = void 0;
exports.nToHex = nToHex;
const index_js_1 = require("../u8a/index.js");

@@ -13,2 +13,1 @@ const toU8a_js_1 = require("./toU8a.js");

}
exports.nToHex = nToHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nToU8a = void 0;
exports.nToU8a = nToU8a;
const x_bigint_1 = require("@polkadot/x-bigint");

@@ -53,2 +53,1 @@ const consts_js_1 = require("./consts.js");

}
exports.nToU8a = nToU8a;

@@ -69,3 +69,3 @@ "use strict";

*/
exports.BN_THOUSAND = new bn_js_1.BN(1000);
exports.BN_THOUSAND = new bn_js_1.BN(1_000);
/**

@@ -75,3 +75,3 @@ * @name BN_MILLION

*/
exports.BN_MILLION = new bn_js_1.BN(1000000);
exports.BN_MILLION = new bn_js_1.BN(1_000_000);
/**

@@ -81,3 +81,3 @@ * @name BN_BILLION

*/
exports.BN_BILLION = new bn_js_1.BN(1000000000);
exports.BN_BILLION = new bn_js_1.BN(1_000_000_000);
/**

@@ -84,0 +84,0 @@ * @name BN_QUINTILL

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bnSqrt = void 0;
exports.bnSqrt = bnSqrt;
const bn_js_1 = require("./bn.js");

@@ -42,2 +42,1 @@ const consts_js_1 = require("./consts.js");

}
exports.bnSqrt = bnSqrt;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bnToBn = void 0;
exports.bnToBn = bnToBn;
const toBn_js_1 = require("../hex/toBn.js");

@@ -41,2 +41,1 @@ const bigInt_js_1 = require("../is/bigInt.js");

}
exports.bnToBn = bnToBn;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bnToHex = void 0;
exports.bnToHex = bnToHex;
const index_js_1 = require("../u8a/index.js");

@@ -24,2 +24,1 @@ const toU8a_js_1 = require("./toU8a.js");

}
exports.bnToHex = bnToHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bnToU8a = void 0;
exports.bnToU8a = bnToU8a;
const toBn_js_1 = require("./toBn.js");

@@ -37,2 +37,1 @@ const DEFAULT_OPTS = { bitLength: -1, isLe: true, isNegative: false };

}
exports.bnToU8a = bnToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bufferToU8a = void 0;
exports.bufferToU8a = bufferToU8a;
/**

@@ -21,2 +21,1 @@ * @name bufferToU8a

}
exports.bufferToU8a = bufferToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compactAddLength = void 0;
exports.compactAddLength = compactAddLength;
const index_js_1 = require("../u8a/index.js");

@@ -24,2 +24,1 @@ const toU8a_js_1 = require("./toU8a.js");

}
exports.compactAddLength = compactAddLength;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compactFromU8aLim = exports.compactFromU8a = void 0;
exports.compactFromU8a = compactFromU8a;
exports.compactFromU8aLim = compactFromU8aLim;
const index_js_1 = require("../bn/index.js");

@@ -32,3 +33,3 @@ const index_js_2 = require("../u8a/index.js");

// 32-bit, in the case where the top-most bit is set this yields a negative value
return [4, new index_js_1.BN((u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 16777216)) >>> 2)];
return [4, new index_js_1.BN((u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 0x1_00_00_00)) >>> 2)];
// 0b11

@@ -44,8 +45,8 @@ default: {

// 32-bit, in the case where the top-most bit is set this yields a negative value
return [5, new index_js_1.BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 16777216))];
return [5, new index_js_1.BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 0x1_00_00_00))];
case 6:
return [6, new index_js_1.BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 16777216))];
return [6, new index_js_1.BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 0x1_00_00_00))];
// 6 bytes data is the maximum, 48 bits (56 would overflow)
case 7:
return [7, new index_js_1.BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 16777216))];
return [7, new index_js_1.BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 0x1_00_00_00))];
// for anything else, use the non-unrolled version

@@ -58,3 +59,2 @@ default:

}
exports.compactFromU8a = compactFromU8a;
/**

@@ -75,3 +75,3 @@ * @name compactFromU8aLim

// 32-bit, in the case where the top-most bit is set this yields a negative value
return [4, (u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 16777216)) >>> 2];
return [4, (u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 0x1_00_00_00)) >>> 2];
// 0b11

@@ -84,8 +84,8 @@ default: {

case 5:
return [5, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 16777216)];
return [5, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 0x1_00_00_00)];
case 6:
return [6, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 16777216)];
return [6, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 0x1_00_00_00)];
// 6 bytes data is the maximum, 48 bits (56 would overflow)
case 7:
return [7, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 16777216)];
return [7, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 0x1_00_00_00)];
// for anything else, we are above the actual MAX_SAFE_INTEGER - bail out

@@ -98,2 +98,1 @@ default:

}
exports.compactFromU8aLim = compactFromU8aLim;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compactStripLength = void 0;
exports.compactStripLength = compactStripLength;
const fromU8a_js_1 = require("./fromU8a.js");

@@ -25,2 +25,1 @@ /**

}
exports.compactStripLength = compactStripLength;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compactToU8a = void 0;
exports.compactToU8a = compactToU8a;
const index_js_1 = require("../bn/index.js");

@@ -49,2 +49,1 @@ const index_js_2 = require("../u8a/index.js");

}
exports.compactToU8a = compactToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectPackage = exports.POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG = void 0;
exports.POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG = void 0;
exports.detectPackage = detectPackage;
const x_global_1 = require("@polkadot/x-global");

@@ -100,2 +101,1 @@ const function_js_1 = require("./is/function.js");

}
exports.detectPackage = detectPackage;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractTime = void 0;
exports.extractTime = extractTime;
const MIN_MS = 60 * 1000;

@@ -57,2 +57,1 @@ const HR_MS = MIN_MS * 60;

}
exports.extractTime = extractTime;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.floatToU8a = void 0;
exports.floatToU8a = floatToU8a;
/**

@@ -23,2 +23,1 @@ * @name floatToU8a

}
exports.floatToU8a = floatToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatDate = void 0;
exports.formatDate = formatDate;
/** @internal */

@@ -21,2 +21,1 @@ function zeroPad(value) {

}
exports.formatDate = formatDate;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatDecimal = void 0;
exports.formatDecimal = formatDecimal;
const NUMBER_REGEX = new RegExp('(\\d+?)(?=(\\d{3})+(?!\\d)|$)', 'g');

@@ -20,2 +20,1 @@ /**

}
exports.formatDecimal = formatDecimal;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatElapsed = void 0;
exports.formatElapsed = formatElapsed;
const toBn_js_1 = require("../bn/toBn.js");

@@ -31,2 +31,1 @@ /** @internal */

}
exports.formatElapsed = formatElapsed;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatNumber = void 0;
exports.formatNumber = formatNumber;
const toBn_js_1 = require("../bn/toBn.js");

@@ -15,2 +15,1 @@ const formatDecimal_js_1 = require("./formatDecimal.js");

}
exports.formatNumber = formatNumber;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSeparator = void 0;
exports.getSeparator = getSeparator;
/**

@@ -15,2 +15,1 @@ * Get the decimal and thousand separator of a locale

}
exports.getSeparator = getSeparator;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calcSi = exports.findSi = exports.SI = exports.SI_MID = void 0;
exports.SI = exports.SI_MID = void 0;
exports.findSi = findSi;
exports.calcSi = calcSi;
/** @internal */

@@ -36,3 +38,2 @@ exports.SI_MID = 8;

}
exports.findSi = findSi;
/** @internal */

@@ -46,2 +47,1 @@ function calcSi(text, decimals, forceUnit) {

}
exports.calcSi = calcSi;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexAddPrefix = void 0;
exports.hexAddPrefix = hexAddPrefix;
const hasPrefix_js_1 = require("./hasPrefix.js");

@@ -24,2 +24,1 @@ /**

}
exports.hexAddPrefix = hexAddPrefix;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexFixLength = void 0;
exports.hexFixLength = hexFixLength;
const addPrefix_js_1 = require("./addPrefix.js");

@@ -31,2 +31,1 @@ const stripPrefix_js_1 = require("./stripPrefix.js");

}
exports.hexFixLength = hexFixLength;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexHasPrefix = void 0;
exports.hexHasPrefix = hexHasPrefix;
const hex_js_1 = require("../is/hex.js");

@@ -22,2 +22,1 @@ /**

}
exports.hexHasPrefix = hexHasPrefix;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexStripPrefix = void 0;
exports.hexStripPrefix = hexStripPrefix;
const hex_js_1 = require("../is/hex.js");

@@ -31,2 +31,1 @@ /**

}
exports.hexStripPrefix = hexStripPrefix;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexToBigInt = void 0;
exports.hexToBigInt = hexToBigInt;
const x_bigint_1 = require("@polkadot/x-bigint");

@@ -16,2 +16,1 @@ const toBigInt_js_1 = require("../u8a/toBigInt.js");

}
exports.hexToBigInt = hexToBigInt;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexToBn = void 0;
exports.hexToBn = hexToBn;
const bn_js_1 = require("../bn/bn.js");

@@ -36,2 +36,1 @@ const stripPrefix_js_1 = require("./stripPrefix.js");

}
exports.hexToBn = hexToBn;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexToNumber = void 0;
exports.hexToNumber = hexToNumber;
const toBn_js_1 = require("./toBn.js");

@@ -24,2 +24,1 @@ /**

}
exports.hexToNumber = hexToNumber;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexToString = void 0;
exports.hexToString = hexToString;
const toString_js_1 = require("../u8a/toString.js");

@@ -23,2 +23,1 @@ const toU8a_js_1 = require("./toU8a.js");

}
exports.hexToString = hexToString;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexToU8a = void 0;
exports.hexToU8a = hexToU8a;
const CHR = '0123456789abcdef';

@@ -58,2 +58,1 @@ const U8 = new Uint8Array(256);

}
exports.hexToU8a = hexToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hexToU8a = void 0;
exports.hexToU8a = hexToU8a;
/**

@@ -44,2 +44,1 @@ * @name hexToU8a

}
exports.hexToU8a = hexToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isArray = void 0;
exports.isArray = isArray;
/**

@@ -11,2 +11,1 @@ * @name isArray

}
exports.isArray = isArray;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAscii = void 0;
exports.isAscii = isAscii;
const toU8a_js_1 = require("../u8a/toU8a.js");

@@ -44,2 +44,1 @@ const hex_js_1 = require("./hex.js");

}
exports.isAscii = isAscii;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBigInt = void 0;
exports.isBigInt = isBigInt;
/**

@@ -21,2 +21,1 @@ * @name isBigInt

}
exports.isBigInt = isBigInt;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBn = void 0;
exports.isBn = isBn;
const bn_js_1 = require("../bn/bn.js");

@@ -23,2 +23,1 @@ /**

}
exports.isBn = isBn;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBoolean = void 0;
exports.isBoolean = isBoolean;
/**

@@ -21,2 +21,1 @@ * @name isBoolean

}
exports.isBoolean = isBoolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBuffer = void 0;
exports.isBuffer = isBuffer;
const x_global_1 = require("@polkadot/x-global");

@@ -25,2 +25,1 @@ const has_js_1 = require("../has.js");

}
exports.isBuffer = isBuffer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isChildClass = void 0;
exports.isChildClass = isChildClass;
const class_js_1 = require("./class.js");

@@ -27,2 +27,1 @@ /**

}
exports.isChildClass = isChildClass;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCodec = void 0;
exports.isCodec = isCodec;
const helpers_js_1 = require("./helpers.js");

@@ -10,2 +10,1 @@ const checkCodec = /*#__PURE__*/ (0, helpers_js_1.isOnObject)('toHex', 'toHuman', 'toU8a');

}
exports.isCodec = isCodec;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isError = void 0;
exports.isError = isError;
/**

@@ -22,2 +22,1 @@ * @name isError

}
exports.isError = isError;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isFunction = void 0;
exports.isFunction = isFunction;
/**

@@ -21,2 +21,1 @@ * @name isFunction

}
exports.isFunction = isFunction;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOnObject = exports.isOnFunction = exports.isOn = void 0;
exports.isOn = isOn;
exports.isOnFunction = isOnFunction;
exports.isOnObject = isOnObject;
const function_js_1 = require("./function.js");

@@ -10,3 +12,2 @@ const object_js_1 = require("./object.js");

}
exports.isOn = isOn;
function isOnFunction(...fns) {

@@ -16,3 +17,2 @@ return (value) => (0, function_js_1.isFunction)(value) &&

}
exports.isOnFunction = isOnFunction;
function isOnObject(...fns) {

@@ -22,2 +22,1 @@ return (value) => (0, object_js_1.isObject)(value) &&

}
exports.isOnObject = isOnObject;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isHex = exports.REGEX_HEX_NOPREFIX = exports.REGEX_HEX_PREFIXED = void 0;
exports.REGEX_HEX_NOPREFIX = exports.REGEX_HEX_PREFIXED = void 0;
exports.isHex = isHex;
exports.REGEX_HEX_PREFIXED = /^0x[\da-fA-F]+$/;

@@ -27,2 +28,1 @@ exports.REGEX_HEX_NOPREFIX = /^[\da-fA-F]+$/;

}
exports.isHex = isHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInstanceOf = void 0;
exports.isInstanceOf = isInstanceOf;
/**

@@ -22,2 +22,1 @@ * @name isInstanceOf

}
exports.isInstanceOf = isInstanceOf;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isIp = void 0;
exports.isIp = isIp;
const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';

@@ -45,2 +45,1 @@ const v6s = '[a-fA-F\\d]{1,4}';

}
exports.isIp = isIp;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isJsonObject = void 0;
exports.isJsonObject = isJsonObject;
const stringify_js_1 = require("../stringify.js");

@@ -41,2 +41,1 @@ /**

}
exports.isJsonObject = isJsonObject;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNull = void 0;
exports.isNull = isNull;
/**

@@ -21,2 +21,1 @@ * @name isNull

}
exports.isNull = isNull;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNumber = void 0;
exports.isNumber = isNumber;
/**

@@ -21,2 +21,1 @@ * @name isNumber

}
exports.isNumber = isNumber;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isObject = void 0;
exports.isObject = isObject;
/**

@@ -22,2 +22,1 @@ * @name isObject

}
exports.isObject = isObject;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRiscV = void 0;
exports.isRiscV = isRiscV;
const eq_js_1 = require("../u8a/eq.js");

@@ -21,2 +21,1 @@ const u8a_js_1 = require("./u8a.js");

}
exports.isRiscV = isRiscV;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isString = void 0;
exports.isString = isString;
/**

@@ -21,2 +21,1 @@ * @name isString

}
exports.isString = isString;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTestChain = void 0;
exports.isTestChain = isTestChain;
const REGEX_DEV = /(Development|Local Testnet)$/;

@@ -11,2 +11,1 @@ function isTestChain(chain) {

}
exports.isTestChain = isTestChain;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isU8a = void 0;
exports.isU8a = isU8a;
/**

@@ -24,2 +24,1 @@ * @name isU8a

}
exports.isU8a = isU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUndefined = void 0;
exports.isUndefined = isUndefined;
/**

@@ -21,2 +21,1 @@ * @name isUndefined

}
exports.isUndefined = isUndefined;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUtf8 = void 0;
exports.isUtf8 = isUtf8;
const toU8a_js_1 = require("../u8a/toU8a.js");

@@ -201,2 +201,1 @@ const string_js_1 = require("./string.js");

}
exports.isUtf8 = isUtf8;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWasm = void 0;
exports.isWasm = isWasm;
const eq_js_1 = require("../u8a/eq.js");

@@ -16,2 +16,1 @@ const u8a_js_1 = require("./u8a.js");

}
exports.isWasm = isWasm;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lazyMethods = exports.lazyMethod = void 0;
exports.lazyMethod = lazyMethod;
exports.lazyMethods = lazyMethods;
/**

@@ -44,3 +45,2 @@ * @name lazyMethod

}
exports.lazyMethod = lazyMethod;
/**

@@ -57,2 +57,1 @@ * @name lazyMethods

}
exports.lazyMethods = lazyMethods;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.logger = exports.loggerFormat = void 0;
exports.loggerFormat = loggerFormat;
exports.logger = logger;
const x_global_1 = require("@polkadot/x-global");

@@ -42,3 +43,2 @@ const formatDate_js_1 = require("./format/formatDate.js");

}
exports.loggerFormat = loggerFormat;
function formatWithLength(maxLength) {

@@ -124,2 +124,1 @@ return (v) => {

}
exports.logger = logger;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.memoize = void 0;
exports.memoize = memoize;
const stringify_js_1 = require("./stringify.js");

@@ -34,2 +34,1 @@ function defaultGetId() {

}
exports.memoize = memoize;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.nextTick = void 0;
exports.nextTick = nextTick;
/**

@@ -28,2 +28,1 @@ * @name nextTick

}
exports.nextTick = nextTick;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.noop = exports.identity = void 0;
exports.identity = identity;
exports.noop = noop;
/**

@@ -10,3 +11,2 @@ * A sharable identity function. Returns the input as-is with no transformation applied.

}
exports.identity = identity;
/**

@@ -18,2 +18,1 @@ * A sharable noop function. As the name suggests, does nothing

}
exports.noop = noop;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.numberToHex = void 0;
exports.numberToHex = numberToHex;
const fixLength_js_1 = require("../hex/fixLength.js");

@@ -24,2 +24,1 @@ /**

}
exports.numberToHex = numberToHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.numberToU8a = void 0;
exports.numberToU8a = numberToU8a;
const toU8a_js_1 = require("../hex/toU8a.js");

@@ -23,2 +23,1 @@ const toHex_js_1 = require("./toHex.js");

}
exports.numberToU8a = numberToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectClear = void 0;
exports.objectClear = objectClear;
/**

@@ -15,2 +15,1 @@ * @name objectClear

}
exports.objectClear = objectClear;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectCopy = void 0;
exports.objectCopy = objectCopy;
const spread_js_1 = require("./spread.js");

@@ -12,2 +12,1 @@ /**

}
exports.objectCopy = objectCopy;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectEntries = void 0;
exports.objectEntries = objectEntries;
/**

@@ -11,2 +11,1 @@ * @name objectEntries

}
exports.objectEntries = objectEntries;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectKeys = void 0;
exports.objectKeys = objectKeys;
/**

@@ -11,2 +11,1 @@ * @name objectKeys

}
exports.objectKeys = objectKeys;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectProperties = exports.objectProperty = void 0;
exports.objectProperty = objectProperty;
exports.objectProperties = objectProperties;
/**

@@ -29,3 +30,2 @@ * @name objectProperty

}
exports.objectProperty = objectProperty;
/**

@@ -40,2 +40,1 @@ * @name objectProperties

}
exports.objectProperties = objectProperties;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectSpread = void 0;
exports.objectSpread = objectSpread;
/**

@@ -24,2 +24,1 @@ * @name objectSpread

}
exports.objectSpread = objectSpread;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectValues = void 0;
exports.objectValues = objectValues;
/**

@@ -11,2 +11,1 @@ * @name objectValues

}
exports.objectValues = objectValues;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageInfo = void 0;
exports.packageInfo = { name: '@polkadot/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '13.0.2' };
exports.packageInfo = { name: '@polkadot/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '13.1.1' };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.promisify = void 0;
exports.promisify = promisify;
/**

@@ -31,2 +31,1 @@ * @name promisify

}
exports.promisify = promisify;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringShorten = void 0;
exports.stringShorten = stringShorten;
/**

@@ -23,2 +23,1 @@ * @name stringShorten

}
exports.stringShorten = stringShorten;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringToHex = void 0;
exports.stringToHex = stringToHex;
const toHex_js_1 = require("../u8a/toHex.js");

@@ -23,2 +23,1 @@ const toU8a_js_1 = require("./toU8a.js");

}
exports.stringToHex = stringToHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringToU8a = void 0;
exports.stringToU8a = stringToU8a;
const x_textencoder_1 = require("@polkadot/x-textencoder");

@@ -25,2 +25,1 @@ const encoder = new x_textencoder_1.TextEncoder();

}
exports.stringToU8a = stringToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringify = void 0;
exports.stringify = stringify;
const bigInt_js_1 = require("./is/bigInt.js");

@@ -19,2 +19,1 @@ /** @internal */

}
exports.stringify = stringify;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aCmp = void 0;
exports.u8aCmp = u8aCmp;
const toU8a_js_1 = require("./toU8a.js");

@@ -50,2 +50,1 @@ /**

}
exports.u8aCmp = u8aCmp;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aConcatStrict = exports.u8aConcat = void 0;
exports.u8aConcat = u8aConcat;
exports.u8aConcatStrict = u8aConcatStrict;
const toU8a_js_1 = require("./toU8a.js");

@@ -32,3 +33,2 @@ /**

}
exports.u8aConcat = u8aConcat;
/**

@@ -53,2 +53,1 @@ * @name u8aConcatStrict

}
exports.u8aConcatStrict = u8aConcatStrict;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aConcat = void 0;
exports.u8aConcat = u8aConcat;
const toU8a_js_1 = require("./toU8a.js");

@@ -30,2 +30,1 @@ /**

}
exports.u8aConcat = u8aConcat;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aEmpty = void 0;
exports.u8aEmpty = u8aEmpty;
/**

@@ -21,2 +21,1 @@ * @name u8aEmpty

}
exports.u8aEmpty = u8aEmpty;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aEq = void 0;
exports.u8aEq = u8aEq;
const toU8a_js_1 = require("./toU8a.js");

@@ -41,2 +41,1 @@ /**

}
exports.u8aEq = u8aEq;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aFixLength = void 0;
exports.u8aFixLength = u8aFixLength;
/**

@@ -32,2 +32,1 @@ * @name u8aFixLength

}
exports.u8aFixLength = u8aFixLength;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aSorted = void 0;
exports.u8aSorted = u8aSorted;
const cmp_js_1 = require("./cmp.js");

@@ -22,2 +22,1 @@ /**

}
exports.u8aSorted = u8aSorted;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToBigInt = void 0;
exports.u8aToBigInt = u8aToBigInt;
const x_bigint_1 = require("@polkadot/x-bigint");

@@ -25,7 +25,7 @@ const consts_js_1 = require("../bi/consts.js");

case 1:
return (0, x_bigint_1.BigInt)(((value[0] ^ 255) * -1) - 1);
return (0, x_bigint_1.BigInt)(((value[0] ^ 0x0000_00ff) * -1) - 1);
case 2:
return (0, x_bigint_1.BigInt)((((value[0] + (value[1] << 8)) ^ 65535) * -1) - 1);
return (0, x_bigint_1.BigInt)((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
case 4:
return (0, x_bigint_1.BigInt)((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) * -1) - 1);
return (0, x_bigint_1.BigInt)((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
}

@@ -54,3 +54,3 @@ const dvI = new DataView(value.buffer, value.byteOffset);

case 4:
return (0, x_bigint_1.BigInt)(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216));
return (0, x_bigint_1.BigInt)(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
}

@@ -76,2 +76,1 @@ const dvI = new DataView(value.buffer, value.byteOffset);

}
exports.u8aToBigInt = u8aToBigInt;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToBn = void 0;
exports.u8aToBn = u8aToBn;
const bn_js_1 = require("../bn/bn.js");

@@ -39,15 +39,15 @@ /**

case 1:
return new bn_js_1.BN(((value[0] ^ 255) * -1) - 1);
return new bn_js_1.BN(((value[0] ^ 0x0000_00ff) * -1) - 1);
case 2:
return new bn_js_1.BN((((value[0] + (value[1] << 8)) ^ 65535) * -1) - 1);
return new bn_js_1.BN((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
case 3:
return new bn_js_1.BN((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 16777215) * -1) - 1);
return new bn_js_1.BN((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 0x00ff_ffff) * -1) - 1);
case 4:
// for the 3rd byte, we don't << 24 - since JS converts all bitwise operators to
// 32-bit, in the case where the top-most bit is set this yields a negative value
return new bn_js_1.BN((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) * -1) - 1);
return new bn_js_1.BN((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
case 5:
return new bn_js_1.BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + ((value[4] ^ 0xff) * 4294967296)) * -1) - 1);
return new bn_js_1.BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + ((value[4] ^ 0xff) * 0x1_00_00_00_00)) * -1) - 1);
case 6:
return new bn_js_1.BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + (((value[4] + (value[5] << 8)) ^ 65535) * 4294967296)) * -1) - 1);
return new bn_js_1.BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + (((value[4] + (value[5] << 8)) ^ 0x0000_ffff) * 0x1_00_00_00_00)) * -1) - 1);
default:

@@ -74,7 +74,7 @@ return new bn_js_1.BN(value, 'le').fromTwos(count * 8);

// 32-bit, in the case where the top-most bit is set this yields a negative value
return new bn_js_1.BN(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216));
return new bn_js_1.BN(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
case 5:
return new bn_js_1.BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 16777216));
return new bn_js_1.BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 0x1_00_00_00));
case 6:
return new bn_js_1.BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 16777216));
return new bn_js_1.BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 0x1_00_00_00));
default:

@@ -84,2 +84,1 @@ return new bn_js_1.BN(value, 'le');

}
exports.u8aToBn = u8aToBn;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToBuffer = void 0;
exports.u8aToBuffer = u8aToBuffer;
const x_global_1 = require("@polkadot/x-global");

@@ -25,2 +25,1 @@ const has_js_1 = require("../has.js");

}
exports.u8aToBuffer = u8aToBuffer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToFloat = void 0;
exports.u8aToFloat = u8aToFloat;
/**

@@ -21,2 +21,1 @@ * @name u8aToFloat

}
exports.u8aToFloat = u8aToFloat;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToHex = void 0;
exports.u8aToHex = u8aToHex;
const U8 = new Array(256);

@@ -57,2 +57,1 @@ const U16 = new Array(256 * 256);

}
exports.u8aToHex = u8aToHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToHex = void 0;
exports.u8aToHex = u8aToHex;
/**

@@ -26,2 +26,1 @@ * @name u8aToHex

}
exports.u8aToHex = u8aToHex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToNumber = void 0;
exports.u8aToNumber = u8aToNumber;
/**

@@ -24,15 +24,15 @@ * @name u8aToNumber

case 1:
return (((value[0] ^ 255) * -1) - 1);
return (((value[0] ^ 0x0000_00ff) * -1) - 1);
case 2:
return ((((value[0] + (value[1] << 8)) ^ 65535) * -1) - 1);
return ((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
case 3:
return ((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 16777215) * -1) - 1);
return ((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 0x00ff_ffff) * -1) - 1);
case 4:
// for the 3rd byte, we don't << 24 - since JS converts all bitwise operators to
// 32-bit, in the case where the top-most bit is set this yields a negative value
return ((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) * -1) - 1);
return ((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
case 5:
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + ((value[4] ^ 0xff) * 4294967296)) * -1) - 1);
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + ((value[4] ^ 0xff) * 0x1_00_00_00_00)) * -1) - 1);
case 6:
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + (((value[4] + (value[5] << 8)) ^ 65535) * 4294967296)) * -1) - 1);
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + (((value[4] + (value[5] << 8)) ^ 0x0000_ffff) * 0x1_00_00_00_00)) * -1) - 1);
default:

@@ -54,7 +54,7 @@ throw new Error('Value more than 48-bits cannot be reliably converted');

// 32-bit, in the case where the top-most bit is set this yields a negative value
return value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216);
return value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00);
case 5:
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 16777216);
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 0x1_00_00_00);
case 6:
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 16777216);
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 0x1_00_00_00);
default:

@@ -64,2 +64,1 @@ throw new Error('Value more than 48-bits cannot be reliably converted');

}
exports.u8aToNumber = u8aToNumber;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToString = void 0;
exports.u8aToString = u8aToString;
const x_textdecoder_1 = require("@polkadot/x-textdecoder");

@@ -25,2 +25,1 @@ const decoder = new x_textdecoder_1.TextDecoder('utf-8');

}
exports.u8aToString = u8aToString;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aToU8a = void 0;
exports.u8aToU8a = u8aToU8a;
const toU8a_js_1 = require("../hex/toU8a.js");

@@ -38,2 +38,1 @@ const buffer_js_1 = require("../is/buffer.js");

}
exports.u8aToU8a = u8aToU8a;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.u8aWrapBytes = exports.u8aUnwrapBytes = exports.u8aIsWrapped = exports.U8A_WRAP_POSTFIX = exports.U8A_WRAP_PREFIX = exports.U8A_WRAP_ETHEREUM = void 0;
exports.U8A_WRAP_POSTFIX = exports.U8A_WRAP_PREFIX = exports.U8A_WRAP_ETHEREUM = void 0;
exports.u8aIsWrapped = u8aIsWrapped;
exports.u8aUnwrapBytes = u8aUnwrapBytes;
exports.u8aWrapBytes = u8aWrapBytes;
const concat_js_1 = require("./concat.js");

@@ -23,3 +26,2 @@ const eq_js_1 = require("./eq.js");

}
exports.u8aIsWrapped = u8aIsWrapped;
/**

@@ -36,3 +38,2 @@ * @name u8aUnwrapBytes

}
exports.u8aUnwrapBytes = u8aUnwrapBytes;
/**

@@ -51,2 +52,1 @@ * @name u8aWrapBytes

}
exports.u8aWrapBytes = u8aWrapBytes;

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { U8aLike } from '../types.js';

@@ -3,0 +2,0 @@ import { BN } from '../bn/index.js';

@@ -29,3 +29,3 @@ import { BN } from '../bn/index.js';

// 32-bit, in the case where the top-most bit is set this yields a negative value
return [4, new BN((u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 16777216)) >>> 2)];
return [4, new BN((u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 0x1_00_00_00)) >>> 2)];
// 0b11

@@ -41,8 +41,8 @@ default: {

// 32-bit, in the case where the top-most bit is set this yields a negative value
return [5, new BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 16777216))];
return [5, new BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 0x1_00_00_00))];
case 6:
return [6, new BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 16777216))];
return [6, new BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 0x1_00_00_00))];
// 6 bytes data is the maximum, 48 bits (56 would overflow)
case 7:
return [7, new BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 16777216))];
return [7, new BN(u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 0x1_00_00_00))];
// for anything else, use the non-unrolled version

@@ -70,3 +70,3 @@ default:

// 32-bit, in the case where the top-most bit is set this yields a negative value
return [4, (u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 16777216)) >>> 2];
return [4, (u8a[0] + (u8a[1] << 8) + (u8a[2] << 16) + (u8a[3] * 0x1_00_00_00)) >>> 2];
// 0b11

@@ -79,8 +79,8 @@ default: {

case 5:
return [5, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 16777216)];
return [5, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + (u8a[4] * 0x1_00_00_00)];
case 6:
return [6, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 16777216)];
return [6, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8)) * 0x1_00_00_00)];
// 6 bytes data is the maximum, 48 bits (56 would overflow)
case 7:
return [7, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 16777216)];
return [7, u8a[1] + (u8a[2] << 8) + (u8a[3] << 16) + ((u8a[4] + (u8a[5] << 8) + (u8a[6] << 16)) * 0x1_00_00_00)];
// for anything else, we are above the actual MAX_SAFE_INTEGER - bail out

@@ -87,0 +87,0 @@ default:

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import { BN } from '../bn/index.js';

@@ -3,0 +2,0 @@ /**

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ import type { SiDef, ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ import type { ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ import type { ToBn } from '../types.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { ToBnOptions } from '../types.js';

@@ -3,0 +2,0 @@ import { BN } from '../bn/bn.js';

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ /**

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from '../bn/bn.js';

@@ -3,0 +2,0 @@ interface Compact<T> {

@@ -21,3 +21,3 @@ {

"type": "module",
"version": "13.0.2",
"version": "13.1.1",
"main": "./cjs/index.js",

@@ -877,10 +877,10 @@ "module": "./index.js",

"dependencies": {
"@polkadot/x-bigint": "13.0.2",
"@polkadot/x-global": "13.0.2",
"@polkadot/x-textdecoder": "13.0.2",
"@polkadot/x-textencoder": "13.0.2",
"@polkadot/x-bigint": "13.1.1",
"@polkadot/x-global": "13.1.1",
"@polkadot/x-textdecoder": "13.1.1",
"@polkadot/x-textencoder": "13.1.1",
"@types/bn.js": "^5.1.5",
"bn.js": "^5.2.1",
"tslib": "^2.6.2"
"tslib": "^2.7.0"
}
}

@@ -1,1 +0,1 @@

export const packageInfo = { name: '@polkadot/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '13.0.2' };
export const packageInfo = { name: '@polkadot/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '13.1.1' };

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { BN } from './bn/bn.js';

@@ -3,0 +2,0 @@ /** An interface that defines an actual JS class */

@@ -22,7 +22,7 @@ import { BigInt } from '@polkadot/x-bigint';

case 1:
return BigInt(((value[0] ^ 255) * -1) - 1);
return BigInt(((value[0] ^ 0x0000_00ff) * -1) - 1);
case 2:
return BigInt((((value[0] + (value[1] << 8)) ^ 65535) * -1) - 1);
return BigInt((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
case 4:
return BigInt((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) * -1) - 1);
return BigInt((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
}

@@ -51,3 +51,3 @@ const dvI = new DataView(value.buffer, value.byteOffset);

case 4:
return BigInt(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216));
return BigInt(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
}

@@ -54,0 +54,0 @@ const dvI = new DataView(value.buffer, value.byteOffset);

@@ -1,2 +0,1 @@

/// <reference types="bn.js" />
import type { ToBnOptions } from '../types.js';

@@ -3,0 +2,0 @@ import { BN } from '../bn/bn.js';

@@ -36,15 +36,15 @@ import { BN } from '../bn/bn.js';

case 1:
return new BN(((value[0] ^ 255) * -1) - 1);
return new BN(((value[0] ^ 0x0000_00ff) * -1) - 1);
case 2:
return new BN((((value[0] + (value[1] << 8)) ^ 65535) * -1) - 1);
return new BN((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
case 3:
return new BN((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 16777215) * -1) - 1);
return new BN((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 0x00ff_ffff) * -1) - 1);
case 4:
// for the 3rd byte, we don't << 24 - since JS converts all bitwise operators to
// 32-bit, in the case where the top-most bit is set this yields a negative value
return new BN((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) * -1) - 1);
return new BN((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
case 5:
return new BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + ((value[4] ^ 0xff) * 4294967296)) * -1) - 1);
return new BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + ((value[4] ^ 0xff) * 0x1_00_00_00_00)) * -1) - 1);
case 6:
return new BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + (((value[4] + (value[5] << 8)) ^ 65535) * 4294967296)) * -1) - 1);
return new BN(((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + (((value[4] + (value[5] << 8)) ^ 0x0000_ffff) * 0x1_00_00_00_00)) * -1) - 1);
default:

@@ -71,7 +71,7 @@ return new BN(value, 'le').fromTwos(count * 8);

// 32-bit, in the case where the top-most bit is set this yields a negative value
return new BN(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216));
return new BN(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
case 5:
return new BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 16777216));
return new BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 0x1_00_00_00));
case 6:
return new BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 16777216));
return new BN(value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 0x1_00_00_00));
default:

@@ -78,0 +78,0 @@ return new BN(value, 'le');

@@ -21,15 +21,15 @@ /**

case 1:
return (((value[0] ^ 255) * -1) - 1);
return (((value[0] ^ 0x0000_00ff) * -1) - 1);
case 2:
return ((((value[0] + (value[1] << 8)) ^ 65535) * -1) - 1);
return ((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
case 3:
return ((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 16777215) * -1) - 1);
return ((((value[0] + (value[1] << 8) + (value[2] << 16)) ^ 0x00ff_ffff) * -1) - 1);
case 4:
// for the 3rd byte, we don't << 24 - since JS converts all bitwise operators to
// 32-bit, in the case where the top-most bit is set this yields a negative value
return ((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) * -1) - 1);
return ((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
case 5:
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + ((value[4] ^ 0xff) * 4294967296)) * -1) - 1);
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + ((value[4] ^ 0xff) * 0x1_00_00_00_00)) * -1) - 1);
case 6:
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216)) ^ 4294967295) + (((value[4] + (value[5] << 8)) ^ 65535) * 4294967296)) * -1) - 1);
return (((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) + (((value[4] + (value[5] << 8)) ^ 0x0000_ffff) * 0x1_00_00_00_00)) * -1) - 1);
default:

@@ -51,7 +51,7 @@ throw new Error('Value more than 48-bits cannot be reliably converted');

// 32-bit, in the case where the top-most bit is set this yields a negative value
return value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 16777216);
return value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00);
case 5:
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 16777216);
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8)) * 0x1_00_00_00);
case 6:
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 16777216);
return value[0] + (value[1] << 8) + (value[2] << 16) + ((value[3] + (value[4] << 8) + (value[5] << 16)) * 0x1_00_00_00);
default:

@@ -58,0 +58,0 @@ throw new Error('Value more than 48-bits cannot be reliably converted');

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc