mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-10-30 22:19:49 +00:00
Move to @pezkuwi/dev 0.86 (eslint 10 toolchain)
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3 - rethrown errors carry the original as `cause` (hw-ledger, address decode) - optional chain in isEthereumAddress, includes() in bip39 validation - logger calls the lazy formatter through a typed function - x-global: an assertion to the type the value already has removed, with the comment and directive that explained it - type-only re-exports of modules that emit no JavaScript - disable directives renamed for the new rule names, or removed where the rule no longer reports
This commit is contained in:
1 parent
82d6a12c24
commit
c46ce1a9e6
23 files changed
+2630
-3264
No files matched your search
@@ -36,6 +36,6 @@ export function decodeAddress (encoded?: string | Uint8Array | null, ignoreCheck
|
||||
|
||||
return decoded.slice(ss58Length, endPos);
|
||||
} catch (error) {
|
||||
throw new Error(`Decoding ${encoded}: ${(error as Error).message}`);
|
||||
throw new Error(`Decoding ${encoded}: ${(error as Error).message}`, { cause: error });
|
||||
}
|
||||
}
|
||||
@@ -17,5 +17,5 @@ export { createKeyMulti } from './keyMulti.js';
|
||||
export { sortAddresses } from './sort.js';
|
||||
export { validateAddress } from './validate.js';
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
export { setSS58Format } from './setSS58Format.js';
|
||||
@@ -7,7 +7,7 @@ import { encodeAddress, setSS58Format } from './index.js';
|
||||
|
||||
describe('setSS58Format', (): void => {
|
||||
beforeEach((): void => {
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
setSS58Format(2);
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { isHex } from '@pezkuwi/util';
|
||||
import { isEthereumChecksum } from './isChecksum.js';
|
||||
|
||||
export function isEthereumAddress (address?: string): boolean {
|
||||
if (!address || address.length !== 42 || !isHex(address)) {
|
||||
if (address?.length !== 42 || !isHex(address)) {
|
||||
return false;
|
||||
} else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address)) {
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('bip39', (): void => {
|
||||
split
|
||||
).toHaveLength(length);
|
||||
expect(
|
||||
split.some((w) => words.indexOf(w) === -1)
|
||||
split.some((w) => !words.includes(w))
|
||||
).toEqual(false);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2026 @pezkuwi/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable brace-style,camelcase,comma-spacing,curly,one-var,padding-line-between-statements,space-infix-ops */
|
||||
/* eslint-disable @stylistic/brace-style, camelcase, @stylistic/comma-spacing, curly, one-var, @stylistic/padding-line-between-statements, @stylistic/space-infix-ops */
|
||||
|
||||
// Adapted from https://github.com/dchest/tweetnacl-js/blob/6a9594a35a27f9c723c5f1c107e376d1c65c23b3/nacl.js
|
||||
//
|
||||
|
||||
@@ -27,7 +27,7 @@ export function secp256k1Recover (msgHash: string | Uint8Array, signature: strin
|
||||
// time in @noble/curves 1.9 but not in its types (secp256k1 is still
|
||||
// typed as the legacy CurveFn); 2.x has it typed but is ESM-only, which
|
||||
// would break this package's CommonJS build. Kept until then.
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
.recoverPublicKey(msg)
|
||||
.toBytes();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2026 @pezkuwi/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './address/types.js';
|
||||
export * from './json/types.js';
|
||||
export type * from './address/types.js';
|
||||
export type * from './json/types.js';
|
||||
|
||||
export interface Keypair {
|
||||
/** The publicKey for this pair */
|
||||
|
||||
Reference in new issue
Block a user