Releases: polkadot-js/api
Releases · polkadot-js/api
v1.6.1
- Breaking change
api.rpc.state.queryStorage(...)
now fully decodes theVec<StorageChangeSet>
and returns a decoded[Hash, Codec[]][]
when using this RPC. StorageKey
now has an.args
property, decoded from meta wheretwox64_concat
orblake128_concat
are used on maps- Fix
api.query.*.*.entries
type conversions to return exact types (notOption
in some cases) - Add
api.query.*.*.keys
to retrieve only the storage keys, similar to.entries
- Full linked map retrievals will now use direct getStorage queries for faster operation
- Underlying rpc-core interfaces now unwraps
Error("...")
when found in responses - Added
derive.eras*
interfaces for queries to new Substrate staking interfaces - Update
derive.account
to cater for new indices module storage (detected with fallbacks) - Adjust derive queries for session without module prefix (DoubleMap -> Map), detected on use
- Add runtime validation for map arguments to
api.query.*
- TypeScript interfaces for linked maps now correctly generates as
[Type, Linkage<Next>]
v1.5.1
- Important Substrate master has updated staking, on older chains supply
StakingLedger: 'StakingLedgerTo223'
- Important Substrate master has updated collective, on older chains supply
Votes: 'VotesTo230'
- Add proper support for type generation with an Enum containing an Tuple (Thanks to https://github.com/monitz87)
- Fix storage parsing not resulting in rejected Promises (Fix from https://github.com/aniiantt applied)
- Remove use of deprecated
Observable.create
(Thanks to https://github.com/Himself65) - Add types & metadata for the latest Polkadot/Substrate runtime versions (master branches)
- Type extraction will now allow the same sub-module name across packages, i.e.
@polkadot/types/interfaces/runtime
&@mine/interfaces/runtime
will be valid - Add
.range([from, to]: [Hash, Hash?], ...args: any[]): [Hash, Codec][]
on all storage entries - Add
.raw(...args: any[]): Promise<Uint8Array & Codec>
to all RPC calls, returning the un-encoded result - Allow pre-module type aliasing with
typesAlias: { <moduleName>: { <meta-type>: <alias-type> } }
in API construction options - Allow
BTreeMap
to be initialized with aRecord<string, any>
object (in addition toMap
) - Allow for
HashMap<KeyType, ValueType>
definitions Bool
will now correctly returnisEmpty
on false/default values- Refresh the
NetworkState
types as returned by therpc.system.networkState()
call to current - Expose
registry.createClass(<typeName>)
to allow for creating type classes. If you are usingcreateClass
orClassOf
in your code, it is recommended to swap to this instance. - Add additional derives to
api.derive.staking
to handle lazy-payout retrievals - Update
@polkadot/{util, util-crypto, keyring}
to 1.6.1 &@polkadot/wasm
to 1.2.1
1.4.1
- Breaking change (TypeScript only) The
*.d.ts
files now contain TypeScript 3.8 features (specifically#private
), which is not usable in TS versions < 3.8 - Breaking change -
api.derive.staking.*
has updated result types and detects support for lazy payouts queries - Rework type generation for
api.{query, tx}
to properly handle complex type inputs (Thanks to https://github.com/monitz87) - Rework metadata
--strict
mode to effectively decorate chain metadata (Thanks to https://github.com/monitz87) - Add
api.rpc.chain.subscribeAllHeads
(not just best) (Thanks to https://github.com/jak-pan) - Add
api.rpc.engine.*
for manual seal support - Add
api.injectMetadata(metadata)
to initialize API with a specific metadata version - The api now checks for runtime upgrades, augmenting the interfaces with new metadata when found
- Support types & interfaces required for lazy reaping, lazy payouts & offchain phragmen
Option
types now has an.unwrapOrDefault
as an complement to.unwrap
&.unwrapOr
- Support JS
BigInt
inputs in any derivedUInt
andInt
object, e.g.api.tx.balances.transfer(..., 9876543210123456789n)
UInt
&Int
now does source bitLength checks upon construction- Registry now exposes
.createType(<type>, ...args)
as an additional helper (like the API) - Expand
.toHuman
onExtrinsicEra
,SubmittableResult
&Vote
- Move
DigestItem
,Fixed64
,H160
,H256
&H512
to interfaces in@polkadot/types/interfaces
- Align construction of unknown types in
registry.get
consistently warn on detection, throw on use - Support for arbitrary
u*
types viaUInt<bitLength>
type definitions - Expose static
.with
onUInt
,Int
&U8aFixed
classes with optional type name override - Remove 11 Jan 2019 extrinsic length hack
- Use ES
#field
on private class fields as applicable - Move
types/primitive/{extrinsics, generic}
totypes/{extrinsics, generic}
- Cleanup augmentation and generation scripts for type definitions, aligning with api augmentation
- Bump to
@polkadot/{util, util-crypto, keyring}
2.5.1
v1.3.1
This is a slightly-out-of-band release, with mostly internal refactoring. It was pushed earlier than normal to ensure there is a minor release available that fixing the TypeScript typing issues. Unless you are running @polkadot/util
2.4.1, or don't want to explicitly install @types/bn.js
to the use the API (TS) an upgrade is not strictly required for on-chain functionality.
- Add
@types/bn.js
as a normal dependency, exposed in*.d.ts
((Thanks to https://github.com/monitz87) - Type generation scripts (including
polkadot-types-from-{chain,defs}
) has been moved to the@polkadot/typegen
package - The
@polkadot/types/codec/create
has been moved to@polkadot/types/create
, imports from@polkadot/types
are unaffected - Expose chain properties on registry (and use for API type formatting)
- Add
toHuman(isExtended?: boolean)
to all codec types, formatting into a human-readable structure
v1.2.1
- Important Update RPC status codes (latest Substrate 2), with the
isInBlock
(isFinalized
now indicates finality) - Storage
.entries(arg?: any)
now has the correct argument type for DoubleMap (Thanks to https://github.com/monitz87) - Swap Kusama and Polkadot aliasses for
Address
toAccountId
(future update) - Add
LookupSource
andLookupTarget
types instead of mapping these directly for aliassing - Add
BitVec
type primitive - Add support for
system.account
for balance & nonce queries in derives as well as Submittables (Substrate composites) - Add
rpc.author.hasKey
andrpc.author.hasSessinKeys
RPCs - Add derives for the parachains interfaces
- Applied the latest types for Polkadot parachains
registry.findMetaError
now can take in aDispatchErrorModule
object for error lookups (fromasModule
inDispatchError
)- Metadata now correctly serializes to the original input data via
toHex()
&toU8a()
- Metadata documentation generation rework, including the output of errors from metadata
- Update all examples and comments to use latest
system.account
queries (instead ofsystem.accountNonce
andbalances.freeBalance
/balances.reservedBalance
) - Cleanup
codec/Date
tests to make it run properly on all timezones - Add explicit dependencies to all packages and move TypeScript
@types/*
to dev deps
1.1.1
- Important Chains without
balances.account
orsystem.account
should supply"BalanceLock": "BalanceLockTo212"
to their types to use the previous-generationBalanceLock
(when querying locks) - Add support for
balances.account
in all applicable derives (incl.vesting
module) - Inject and use SignedExtensions by name from V11 metadata (V4 extrinsics only)
- Add typings for
api.tx.*.*
- thepolkadot-types-from-chain
now also generates these - Remove additional V1-only derives
(staking.recentlyOffline
,balances.nominatorsFor
) - Add
.isMax()
on int values, an opposite ofisZero()
(e.g.u128
, as well as derived, e.g.Balances
) - Add
.keyPrefix()
to allapi.query.*
complementing the.key()
call, both returning a hex string - Council derives now takes bootstrapping (member, no elections) into account
- Account derives now allow for an optional indices module (not required)
- Adjust balances fees derivation with optional transfer and creation fees (removed in Substrate)
- Adjust enum
.toJSON()
to return type name as specified
v1.0.1
- Breaking change Drop support for Substrate v1 chain in all derives
- Return unsub functions from provider .on emitters (Thanks to https://github.com/jak-pan)
ApiPromise.isReady
now rejects on unrecoverable errors (Thanks to https://github.com/laec)- Add
polkadot-types-from-chain
&polkadot-types-from-defs
TypeScript generators to@polkadot/types
- Only decorate derives where relevant parent
api.query.*
is available - Support
.entries(arg?: any)
lookups on DoubleMaps (in addition to previously supported maps) - Allow v9 metadata to parse even in cases where it was wrongly deployed pre-v10
- Allow type-aliases on a per-module basis (e.g.
Judgement
in identity as well as society) - Allow passing
{ signer }
to bothapi.tx.*
andapi.sign
(in addition toapi.setSigner
) - Add derives for the society module
- Don't map empty tuples, e..
()
toNull
, rather keep them empty - Add lookups to the metadata errors via
findMetaError
- Update metadata and types for the latest Substrate & Polkadot versions
- Support metadata V11 as per latest Substrate
- Remove support for un-deployed metadata
- Remove old known types for Substrate V1
v0.100.1
- Important This will the the last API version with Substrate 1.x support. Although you will still be able to use subsequent versions with older chans, dependent libraries such as sr25519 may not be compatible.
- Add support for the Substrate identity module
- Remove the
codec/Data
type, to remove a conflict with Substrate. This type is now namedRaw
- Fix for linked maps using
Option
- Add support for
BTreeSet
(Thanks to https://github.com/satellitex) - Add support for Metadata v10
- Add support for latest Polkadot/Substrate types
- Add
paymentInfo
to submittables to calculate fees
v0.99.1
- Breaking change The
Data
andU8a
type has been renamed and just replaced with theRaw
type - Breaking change The
api.derive.staking.info
has been split into 2 -staking.query
for non-balance related information (more effective) andstaking.account
that enhances query for all the information previously found.info
- Cleanup
DoubleMap
hashing to always hash over the full value (in the case ofVec<T>
, this includes the length) - Update democracy derives to take care of nextTally and lowestUnbaked
- Add additional derives for both council & treasury
- Alignment with latest Polkadot/Substrate master branch types
v0.98.1
- Make the TypeScript generation script more re-usable (Thanks to @xlc)
- Add
.entries()
for all map-types, returning storage keys and values - Add
.signAsync
to submittable extrinsics (Thanks to @c410-f3r) - Cleanup circular references between internal dependencies
- Support for new Substrate democracy with preimages in derive
- Alignment of types with Substrate/Polkadot master branches