mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-21 23:48:05 +00:00
a5542fdd87
- Fixed internal @polkadot references to @pezkuwi - Updated hw-ledger and hw-ledger-transports packages - Updated keyring and networks packages - Version 14.0.7
46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
// Copyright 2017-2025 @pezkuwi/util-crypto authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
|
|
|
|
import { base58Decode } from '../base58/index.js';
|
|
import { checkAddressChecksum } from './checksum.js';
|
|
|
|
describe('checkAddressChecksum', (): void => {
|
|
it('correctly extracts the info from a 1-byte-prefix address', (): void => {
|
|
expect(
|
|
checkAddressChecksum(base58Decode('F3opxRbN5ZbjJNU511Kj2TLuzFcDq9BGduA9TgiECafpg29'))
|
|
).toEqual([true, 33, 1, 2]);
|
|
});
|
|
|
|
it('correctly extracts the info from a 2-byte-prefix address (66)', (): void => {
|
|
expect(
|
|
checkAddressChecksum(base58Decode('cTGShekJ1L1UKFZR9xmv9UTJod7vqjFAPo4sDhXih2c3y1yLS'))
|
|
).toEqual([true, 34, 2, 66]);
|
|
});
|
|
|
|
it('correctly extracts the info from a 2-byte-prefix address (69)', (): void => {
|
|
expect(
|
|
checkAddressChecksum(base58Decode('cnVvyMzRdqjwejTFuByQQ4w2yu78V2hpFixjHQz5zr6NSYsxA'))
|
|
).toEqual([true, 34, 2, 69]);
|
|
});
|
|
|
|
it('correctly extracts the info from a 2-byte-prefix address (252)', (): void => {
|
|
expect(
|
|
checkAddressChecksum(base58Decode('xw8Ffc2SZtDqUJKd9Ky4vc7PRz2D2asuVkEEzf3WGAbw9cnfq'))
|
|
).toEqual([true, 34, 2, 252]);
|
|
});
|
|
|
|
it('correctly extracts the info from a 2-byte-prefix address (255)', (): void => {
|
|
expect(
|
|
checkAddressChecksum(base58Decode('yGHU8YKprxHbHdEv7oUK4rzMZXtsdhcXVG2CAMyC9WhzhjH2k'))
|
|
).toEqual([true, 34, 2, 255]);
|
|
});
|
|
|
|
it('correctly extracts the info from a 2-byte-prefix address (ecdsa, from Substrate)', (): void => {
|
|
expect(
|
|
checkAddressChecksum(base58Decode('4pbsSkWcBaYoFHrKJZp5fDVUKbqSYD9dhZZGvpp3vQ5ysVs5ybV'))
|
|
).toEqual([true, 35, 2, 200]);
|
|
});
|
|
});
|