From 66e2382f26296d70916dab7ce925264ea0e8b4e7 Mon Sep 17 00:00:00 2001 From: Jaco Date: Fri, 13 May 2022 07:34:53 +0200 Subject: [PATCH] Re-add top-level cryptoWaitReady (#1486) --- packages/util-crypto/src/bundleInit.ts | 10 +++++----- packages/util/src/u8a/toBn.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/util-crypto/src/bundleInit.ts b/packages/util-crypto/src/bundleInit.ts index ab12673e0..1c3648ec0 100644 --- a/packages/util-crypto/src/bundleInit.ts +++ b/packages/util-crypto/src/bundleInit.ts @@ -7,7 +7,7 @@ import { utils as utilsNobleSecp256k1 } from '@noble/secp256k1'; import { u8aConcat } from '@polkadot/util'; -// import { cryptoWaitReady } from './crypto'; +import { cryptoWaitReady } from './crypto'; import { hmacSha256AsU8a } from './hmac'; // Set overrides on the secp256k1 utils @@ -15,7 +15,7 @@ import { hmacSha256AsU8a } from './hmac'; utilsNobleSecp256k1.hmacSha256Sync = (key: Uint8Array, ...messages: Uint8Array[]) => hmacSha256AsU8a(key, u8aConcat(...messages)); -// // start init process immediately -// cryptoWaitReady().catch((): void => { -// // shouldn't happen, logged above -// }); +// start init process immediately +cryptoWaitReady().catch((): void => { + // shouldn't happen, logged and caught inside cryptoWaitReady +}); diff --git a/packages/util/src/u8a/toBn.ts b/packages/util/src/u8a/toBn.ts index 05c5896ec..e1b2ee08f 100644 --- a/packages/util/src/u8a/toBn.ts +++ b/packages/util/src/u8a/toBn.ts @@ -14,7 +14,7 @@ import { objectSpread } from '../object/spread'; * `UInt8Array` input values return the actual BN. `null` or `undefined` values returns an `0x0` value. * @param value The value to convert * @param options Options to pass while converting - * @param options.isLe Convert using Little Endian + * @param options.isLe Convert using Little Endian (default) * @param options.isNegative Convert using two's complement * @example *
@@ -26,7 +26,7 @@ import { objectSpread } from '../object/spread'; * ``` */ export function u8aToBn (value: Uint8Array, options: ToBnOptions | boolean = {}): BN { - // NOTE: This is the same process as followed in the hextoBn conversion + // NOTE: This is the same process as followed in the hexToBn conversion // For Uint8Array, default to LE const { isLe, isNegative } = objectSpread( { isLe: true, isNegative: false },