mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-05-30 02:21:05 +00:00
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:
@@ -0,0 +1,43 @@
|
||||
// Copyright 2017-2025 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { base58 } from '@scure/base';
|
||||
|
||||
import { createDecode, createEncode, createIs, createValidate } from '../base32/helpers.js';
|
||||
|
||||
const config = {
|
||||
chars: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
|
||||
coder: base58,
|
||||
ipfs: 'z',
|
||||
type: 'base58'
|
||||
};
|
||||
|
||||
/**
|
||||
* @name base58Validate
|
||||
* @summary Validates a base58 value.
|
||||
* @description
|
||||
* Validates that the supplied value is valid base58, throwing exceptions if not
|
||||
*/
|
||||
export const base58Validate = /*#__PURE__*/ createValidate(config);
|
||||
|
||||
/**
|
||||
* @name base58Decode
|
||||
* @summary Decodes a base58 value.
|
||||
* @description
|
||||
* From the provided input, decode the base58 and return the result as an `Uint8Array`.
|
||||
*/
|
||||
export const base58Decode = /*#__PURE__*/ createDecode(config, base58Validate);
|
||||
|
||||
/**
|
||||
* @name base58Encode
|
||||
* @summary Creates a base58 value.
|
||||
* @description
|
||||
* From the provided input, create the base58 and return the result as a string.
|
||||
*/
|
||||
export const base58Encode = /*#__PURE__*/ createEncode(config);
|
||||
|
||||
/**
|
||||
* @name isBase58
|
||||
* @description Checks if the input is in base58, returning true/false
|
||||
*/
|
||||
export const isBase58 = /*#__PURE__*/ createIs(base58Validate);
|
||||
Reference in New Issue
Block a user