@w3ux/util-dedot
v1.0.0
Published
A collection of reusable utilities for manipulating data
Maintainers
Readme
Dedot Utils
Utilities for working with Substrate accounts using dedot.
Installation
npm install @w3ux/util-dedotor
yarn add @w3ux/util-dedotor
pnpm add @w3ux/util-dedotUsage
import { formatAccountSs58, isValidAddress } from '@w3ux/util-dedot'Account Helpers
Validate Substrate addresses and format them to a target ss58 prefix:
import { formatAccountSs58, isValidAddress } from '@w3ux/util-dedot'
const address = '5D4k...'
if (isValidAddress(address)) {
const kusamaAddress = formatAccountSs58(address, 2)
console.log(kusamaAddress)
}API
formatAccountSs58(address, ss58): Returns the address encoded with the suppliedss58prefix, ornullwhen invalid.isValidAddress(address): Returnstruewhen the address is a valid Substrate address.
Documentation
For comprehensive documentation and examples, visit the w3ux documentation.
Keywords
w3ux, polkadot, web3, dedot, ss58, accounts, typescript
Repository
- Source: GitHub
- Package: npm
- Issues: GitHub Issues
License
This package is licensed under the GPL-3.0-only.
Part of the w3ux library - A collection of packages for building Web3 applications.
