Skip to content

Releases: polkadot-js/api

v1.10.1

13 Apr 05:29
Compare
Choose a tag to compare
  • Important Substrate master has updated staking, on older chains apply StakingLedger: 'StakingLedgerTo240'
  • Add rpc.system.chainType to retrieve the chain type (Development. Local, Live & Custom)
  • Adjust types for Westend after the reset
  • Adjust democracy derives, including the support of the frame-scheduler for scheduled deployments
  • Allow staking derives to work with new staking payouts, specifically tx.staking.payoutStakers
  • Cleanups to derives for democracy & staking to be more performant
  • Add Centrifuge base types to @polkadot/types-known
  • Adjust with all the latest substrate master types
  • Internally all private/protected methods/variables are now _ prefixed (Aligning with the private/protected indicators in the TS definitions)
  • Update metadata/docs-from-metadata to the latest Substrate

v1.9.1

01 Apr 10:30
Compare
Choose a tag to compare
  • Breaking change (TypeScript with derives only) The return type names for api.derive.* have been adjusted for consistency, all starting with Derive* (previously a mixture of Derived* and Derive*)
  • Breaking change (derives only) Additional cleanups of democracy proposal & referenda derives, including support for new Polkadot/Substrate vote retrievals
  • Tx signing via signAndSend & signAsync now tries to use the last finalized block (depending on finalized drift)
  • Add support for api.rpc.childstate.* Substrate RPCs, older nodes with still populate api.rpc.state.* with the child methods
  • Adjust Error.message on RPC failures to not include the (already known) method signature
  • Split @polkadot/types/known into @polkadot/types-known, allowing for base API overrides
  • Extended api.derive.democracy to cater for dispatchQueue and externals
  • Extended api.derive.council to cater for new phragmen elections
  • Use new queryStorageAt for query .entries, removing unneeded subscriptions (use as available)
  • Fix BTreeSet initialization when it forms part of query interfaces
  • Fix encoding for Vec<u8>-related types as part of constants
  • Internal adjustment of interface type locations (no impact on imports via @polkadot/types/interfaces)

v1.8.1

22 Mar 18:00
Compare
Choose a tag to compare
  • Breaking change The format for any custom RPCs have been changed alongside API-internal changes to allow for better RPC management. If you are currently using custom RPCs (or planning to do so), look at the updated documentation
  • Breaking change Alongside API RPC changes, the @polkadot/jsonrpc package has been removed. Since it was never documented and only used internally, this should not have adverse impacts. All RPC definitions itself has now been moved to the relevant modules inside @polkadot/types/interfaces
  • Important Substrate has an updated democracy module. If using an older chain add the ReferendumInfo: 'ReferendumInfoTo239' type when using referendums
  • The isRetracted Extrinsic status is now a warning, not a fatal error, correctly aligning with Polkadot/Substrate
  • The Substrate extrinsic phase definitions has been expanded with Initialization to align with the latest versions
  • Add support for all known substrate RPC methods
  • Extend account derives to include status flags, e.g. isCouncil, isSudo, ...
  • Adjusted referendum derives to cater for bot new/old democracy. Derived referendumInfo now includes status field, not info
  • Add initWasm flag to API options, that when set to false does not init the WASM portion (leaving it to the user elsewhere)

v1.7.1

17 Mar 14:03
Compare
Choose a tag to compare
  • Important Current versions of Polkadot/Substrate have dropped support for linked maps on storage entries. If you are using these queries to retrieve all entries, for instance staking.{nominators,validators}() and using an upgraded chain, you need to swap to retrieving entries via .entries() or .keys() for the keys.
  • Pull in support and types for latest Polkadot/Substrate
  • Add support for the new Substrate state_getKeysPaged RPC, including use in storage keys
  • Move derive.staking.controllers to derive.staking.stashes, reflecting actual content
  • Cater for adjusted storage (non-linked mapped) for derive.staking.stashes queries (with old-compat)
  • Expanded derive.staking.* derives, including addition of derive.staking.own*
  • Re-add fixed (with tests) checks for query args, previously disabled in 1.6.2

v1.6.2

13 Mar 05:41
Compare
Choose a tag to compare
  • Revert checks for query args, not working on .at() queries (proper fix in next version)

v1.6.1

12 Mar 10:11
Compare
Choose a tag to compare
  • Breaking change api.rpc.state.queryStorage(...) now fully decodes the Vec<StorageChangeSet> and returns a decoded [Hash, Codec[]][] when using this RPC.
  • StorageKey now has an .args property, decoded from meta where twox64_concat or blake128_concat are used on maps
  • Fix api.query.*.*.entries type conversions to return exact types (not Option 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

06 Mar 10:34
Compare
Choose a tag to compare
  • 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 a Record<string, any> object (in addition to Map)
  • Allow for HashMap<KeyType, ValueType> definitions
  • Bool will now correctly return isEmpty on false/default values
  • Refresh the NetworkState types as returned by the rpc.system.networkState() call to current
  • Expose registry.createClass(<typeName>) to allow for creating type classes. If you are using createClass or ClassOf 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

26 Feb 11:03
Compare
Choose a tag to compare
  • 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 derived UInt and Int 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 on ExtrinsicEra, 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 via UInt<bitLength> type definitions
  • Expose static .with on UInt, 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} to types/{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

18 Feb 08:47
Compare
Choose a tag to compare

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

16 Feb 08:00
Compare
Choose a tag to compare
  • 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 to AccountId (future update)
  • Add LookupSource and LookupTarget 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 and rpc.author.hasSessinKeys RPCs
  • Add derives for the parachains interfaces
  • Applied the latest types for Polkadot parachains
  • registry.findMetaError now can take in a DispatchErrorModule object for error lookups (from asModule in DispatchError)
  • 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 of system.accountNonce and balances.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