- Breaking change Following on the 2.0 release,
@polkadot/wasm
was updated to 1.1+. sr25510 now only verifies 0.8+ signatures, closing the loop on dropping Substrate 1.x-era support - Add
signatureVerify (message: Uint8Array | string, signature: Uint8Array | string, addressOrPublicKey: Uint8Array | string): VerifyResult
to verify any signature, regardless of type. Returns validity & detected crypto type. - Add
cryptoIsReady (): boolean
function to check status of initialization - Add
addressCheckChecksum (decoded: Uint8Array)
as an helper to extract and verify the ss58 checksum - Swap to yarn 2, allow use in yan 2 projects
- Breaking change (TypeScript only) The
*.d.ts
files now contain TypeScript 3.8 features,#private
, which is not usable in older versions - Add
isBigInt(value)
to allowBigInt
checks. Also add support inbnToBn
as well as number conversion utils - Add
isChildClass(Parent, Child?)
to check if a class extends the parent, asserting Child is Parent - (internal) Use
#<field>
instead ofprivate _<field>
for private class variables
- Ensure that
formatBalance
does not apply unit overrides apply when no SI is applicable - Adjust
formatBalance(<balance>, <options>)
to take expandedwithUnit: string | boolean
option where string is an actual unit, e.g.KSM
- The
decimals
option toformatBalance
should now be passed as part of theoptions
(previous last-param deprecated) - The
.setSS58Format
on keyring will now just operate on pairs created on the keyring, not globally. The globalsetSS58Format
in@polkadot/util-crypto
will be deprecated. - The deprecated
addressPrefix
option to keyring has been belatedly removed (Usess58Format
rather)
- Remove dependency on moment.js with
formatDate
function (Thanks to https://github.com/AndreasGassmann) - Move TypeScript
@types/*
to dev deps (Thanks to https://github.com/AndreasGassmann) - Update to
@polkadot/wasm-crypto
1.0 - Cleanup dependencies to pave the way for using yarnpkg 2 (Explicit instead of implicit)
- Add resolver for jest requires (tests from src)
- Update
detectPackage(<package.json>, __dirname?)
with calling folder
- Update w3f/schnorrkel to 0.8.5 (Full Substrate 2.x support, no 1.x support)
- Remove Alice session (ed2551) account from testing keyring (not applicable to Substrate 2.x)
- Remove
chainspec
,db
,trie-codec
,trie-db
andtrie-hash
packages (moved to client) - Renamed
assertSingletonPackage
todetectPackage
with inclusion of version listing - Swap to elliptic library for secp2561 recovery (No node bindings)
- Add cross-client encryption/decryption support (Thanks to https://github.com/hskang9)
formatBalance
signature now allows to force unit displays- Keypair now allows for derive on a pair, with
pair.derive(...)
assert
now acts like a real asserts, with no return - signature adapted for new TS 3.7
pair.sign(message)
now takes an optional secondoptions?: SignOptions
parameter, whereSignOptions
is currently defined as{ withType: boolean }
. HerewithType
instructs the signing to prepend the type of signature (ed2551, sr25519 or ecdsa). This is used for the new Polkadot/Substrate MultiSignature format.
- Fix typings on the Keyring-exposed encode & decodeAddress
- Allow ss58Format = 0 as a valid value
- Loosen type definitions for allowed ss58format values (still checked against allowed array)
- Breaking change To set the
ss58Format
, you should now usesetSS58Format
as opposed to the oldsetAddressPrefix
- Renamed
keyring.setAddressPrefix
tokeyring.setSS58Format
- Deprecated
addressPrefix
on the keyring options, added thess58Format
as a replacement (aligning with chain properties - the old version is still accepted) - Added
stringToHex
andhexToString
conversion utilities to@polkadot/util
- Swap to Babel 7.6.0 for all compilation, for latest improvements in code generation
- Remove the
ExtError
class, always prefer the standard JSError
object for errors. This would bre a breaking change for any applications usingExtError
- Keyring
addFromAddress
can now be used to store external accounts, for example those provided by external signers - Maintainability updates
assertSingletonPackage
now warns via console.warn, but does not throw. This does allow the info to come accross while still allowing the app developers using multiple libraries time to fix.
formatBalance
now allows forCompact
inputsformaBalance
now allows correct formatting of very large decimals
- Add
checkAddress(address, prefix)
to@polkadot/util-crypto
that validates an ss-58 address - Add support for the Kusama network (as a valid checked prefix)
- Add an
asm.js
fallback for the React Native environment (via@polkadot/wasm-crypto
) - The ed25519 key for Alice (representing the session), now appears in the test keyrings
- Fix missing dependencies for keyring (after address moves in 0.93.1)
- Breaking: External pair interface for keyring has been changed. Instead of
getMeta
use themeta
getter, i.e.console.log(pair.meta.name)
address
use theaddress
getter, i.e.console.log(pair.address)
publicKey
use thepublicKey
getter, i.e.console.log(pair.publicKey)
Move decodeAddress
,encodeAddress
&setAddressPrefix
functions into@polkadot/util-crypto
from@polkadot/keyring
. External interfaces should not be affected at this point since it is also (still) exported and exposed on keyring
- Only allow integer input values into
formatBalance
- Allow
formatBalance
,formatDecimal
&formatNumber
to cater for negative numbers - Add 'Bob//stash' to testing keyring, joining the existing 'Alice//stash'
- ed25519/sr25519 sign & verify functions can now take the message input as Uint8Array/string/hex and verify allows for the signature/publicKey to be specified as Uint8Array/hex
- Update
@polkadot/wasm
to include a maintenance bump for thew3f/schnorrkel
libraries
- Moving towards 1.0
- Added bnMin & bnMax functions
- Fix
addFromMnemonic
to generate using new-style derivation. - Pull in
formatBalance
,formatDecimal
,formatElapsed
,formatNumber
,calcSi
,findSi
&isTestChain
utility functions from the originals in@polkadot/ui-util
- Swap out
wasm-schnorrkel
&wasm-ed25519
for combined version withwasm-crypto
- Swap DB interfaces to optional LRU, removing
transactionAsync
(client-only changes)
- Start journey to 1.0
- Add
assertSingletonPackage
to util - Ensure that only a single keyring instance is loaded (uses above)
- Extensions to the client-specific database interfaces (non-breaking for API and util users)
- Add additional derivation path extraction mechanisms to util-crypto
- Add createFromUri function to keypair (creates keypair, does not add it)
- Allow all crypto hashing & ed25519 to use WASM (as available, JS fallbacks)
- Pull in bip39 generation functions from
@poladkot/wasm-crypto
with a fallback to the pure JS versions
- Align with current substrate master for sr25519 keys and hard/soft derivation
- Swap default dev keys to derived (sr25519)
- Swap to publishing -beta.x on merge (non-breaking testing)
- Add
fromUri
to keyring along with hard & soft key derivation.
- Remove NodeJs-only
syncify
function, not exported by the package (with binary dependency for Node)
- Keyring now allows for ed25519 and sr25519 instances. Upon creation, you need to pass the
ed25519
orsr25519
string to denote the type, i.e.new Keyring({ type: 'sr25519' })