Initial rebrand: @polkadot -> @pezkuwi (14 packages)

- Package namespace: @polkadot/* -> @pezkuwi/*
- Repository: polkadot-js/common -> pezkuwichain/pezkuwi-common
- Author: Pezkuwi Team <team@pezkuwichain.io>

Core packages:
- @pezkuwi/util (utilities)
- @pezkuwi/util-crypto (crypto primitives)
- @pezkuwi/keyring (account management)
- @pezkuwi/networks (chain metadata)
- @pezkuwi/hw-ledger (Ledger hardware wallet)
- @pezkuwi/x-* (10 polyfill packages)

Total: 14 packages
Upstream: polkadot-js/common v14.0.1
This commit is contained in:
2026-01-05 14:00:34 +03:00
commit ec06da0ebc
687 changed files with 48096 additions and 0 deletions
@@ -0,0 +1,30 @@
// Copyright 2017-2025 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { waitReady } from '@pezkuwi/wasm-crypto';
import { keccakAsHex } from './index.js';
const BITS: (256 | 512)[] = [256, 512];
const value = 'test';
const result = {
256: '9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
512: '1e2e9fc2002b002d75198b7503210c05a1baac4560916a3c6d93bcce3a50d7f00fd395bf1647b9abb8d1afcc9c76c289b0c9383ba386a956da4b38934417789e'
};
describe('keccakAsHex', (): void => {
beforeEach(async (): Promise<void> => {
await waitReady();
});
BITS.forEach((bitLength): void => {
it('returns a prefixed hex representation', (): void => {
expect(
keccakAsHex(value, bitLength)
).toEqual(`0x${result[bitLength]}`);
});
});
});
@@ -0,0 +1,56 @@
// Copyright 2017-2025 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { hexToU8a, stringToU8a } from '@pezkuwi/util';
import { waitReady } from '@pezkuwi/wasm-crypto';
import { perfWasm } from '../test/index.js';
import { keccakAsU8a } from './index.js';
describe('keccakAsU8a', (): void => {
beforeEach(async (): Promise<void> => {
await waitReady();
});
const input = 'test value';
const output = {
256: hexToU8a(
'0x2d07364b5c231c56ce63d49430e085ea3033c750688ba532b24029124c26ca5e'
),
512: hexToU8a(
'0xc1b50cc57f85ccd968a9d7c7a809dcebd140a548c8e0b67f3afcdd6fc14cca2b1d04187aef24ba0081b74f2ec362431e425760febe94a5607790854cafe5b197'
)
};
for (const bitLength of [256, 512] as const) {
describe(`bitLength=${bitLength}`, (): void => {
for (const onlyJs of [false, true]) {
describe(`onlyJs=${(onlyJs && 'true') || 'false'}`, (): void => {
it('returns an hex representation (string)', (): void => {
expect(
keccakAsU8a(input, bitLength, onlyJs)
).toEqual(output[bitLength]);
});
it('returns an hex representation (Buffer)', (): void => {
expect(
keccakAsU8a(Buffer.from(input), bitLength, onlyJs)
).toEqual(output[bitLength]);
});
it('returns an hex representation (Uint8Array)', (): void => {
expect(
keccakAsU8a(stringToU8a(input), bitLength, onlyJs)
).toEqual(output[bitLength]);
});
});
}
perfWasm(`keccakAsU8a, bitLength=${bitLength}`, 128000, (input, onlyJs) =>
keccakAsU8a(input, bitLength, onlyJs)
);
});
}
});
+45
View File
@@ -0,0 +1,45 @@
// Copyright 2017-2025 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { keccak_256 as keccak256Js, keccak_512 as keccak512Js } from '@noble/hashes/sha3';
import { keccak256, keccak512 } from '@pezkuwi/wasm-crypto';
import { createAsHex, createBitHasher, createDualHasher } from '../helpers.js';
/**
* @name keccakAsU8a
* @summary Creates a keccak Uint8Array from the input.
* @description
* From either a `string` or a `Buffer` input, create the keccak and return the result as a `Uint8Array`.
* @example
* <BR>
*
* ```javascript
* import { keccakAsU8a } from '@pezkuwi/util-crypto';
*
* keccakAsU8a('123'); // => Uint8Array
* ```
*/
export const keccakAsU8a = /*#__PURE__*/ createDualHasher(
{ 256: keccak256, 512: keccak512 },
{ 256: keccak256Js, 512: keccak512Js }
);
/**
* @name keccak256AsU8a
* @description Creates a keccak256 Uint8Array from the input.
*/
export const keccak256AsU8a = /*#__PURE__*/ createBitHasher(256, keccakAsU8a);
/**
* @name keccak512AsU8a
* @description Creates a keccak512 Uint8Array from the input.
*/
export const keccak512AsU8a = /*#__PURE__*/ createBitHasher(512, keccakAsU8a);
/**
* @name keccakAsHex
* @description Creates a keccak hex string from the input.
*/
export const keccakAsHex = /*#__PURE__*/ createAsHex(keccakAsU8a);
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2017-2025 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
/**
* @summary Create Keccak256/512 values as hex & Uint8Array output
*/
export { keccak256AsU8a, keccak512AsU8a, keccakAsHex, keccakAsU8a } from './asU8a.js';