@polkadot/api-base
API Base interfaces
Interfaces for interacting with contracts and contract ABIs
API Base interfaces
Changes:
Changes:
Changes:
Changes:
Changes:
Contributions:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Contributed:
Changes:
Changes:
Breaking Changes:
type: This field has been completely removed in Metadata.version: Previously part of ExtrinsicMetadata. Replaced by versions, which now holds an array Vec<u8> of supported extrinsic versions instead of a single value.extraType: This field has been completely removed in ExtrinsicMetadata.signedExtensions: Previously part of ExtrinsicMetadata. Replaced by transactionExtensions, which provides a more structured definition of extensions, and transactionExtensionsByVersion, mapping versions to active extensions.Changes:
Changes:
Changes:
Contributed:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
Changes:
class GenericExtrinsicPayloadV4.Contributed:
offchain_localStorageClear RPC method (#6070) (Thanks to https://github.com/khssnv)Changes:
GenericAccountId description (#6072)Changes:
subs to the DeriveAccountRegistration output of api.derive.accounts.identity()Changes:
--metadataVer to polkadot-types-internal-metadata. It is meant to be used along side --endpoint which will allow for the use of metadata versions above v14.Changes:
getSeparator for nodejs 22.12Changes:
Changes:
Breaking Changes:
allowCallDataAlteration to SignatureOptions, and SignerOptions. This will default to true when its not inputted. This is strictly tied to signing payloads via external signers.Contributed:
Changes:
signed functionality for ExtrinsicV5 since it is no longer supportedChanges:
Changes:
Changes:
api.derive.staking.nextElected to use erasStakersOverview (#6011)Changes:
Changes:
Changes:
Changes:
Changes:
Breaking Changes:
SignerPayloadJSON to HexString (#5967)toPayload (#5968)NOTE: This is part of the current change to generalize the SignerPayloadJSON in order to simplify its integration across other tools. The return value of assetId field with toPayload will always be its true type now, which in this case is Option<TAssetConversion> where TAssetConversion is equal to MultiLocation | AssetId.
Changes:
Changes:
Contributed:
Changes:
transferable and frameSystemAccountInfo to the output of api.derive.balance.allContributed:
Changes:
Contributed:
Changes:
Changes:
@polkadot/hw-ledger. For more info please see (13.0.1)Contributed:
Changes:
Important Changes:
withSignedTransaction: This option has been added to SignerOptions. When using signAndSend, signAsync, and dryRun you may now enable or disable the use of the signedTransaction field by adding the withSignedTransaction option. When withSignedTransaction is not enabled but the signer adds a signedTransaction the api will error.signPayload.withSignedTransaction has also been added to the SignerPayload type which allows for payload.toPayload() to include the option.signAsync: now accepts the signedTransaction field as well. This means that if withSignedTransaction is enabled, and signedTransaction is present the api will adjust the current payload attached to the SubmittableExtrinsic, and add the signature. Then the user can call .send() as they please.dryRun: All steps will be the same as signAsync with the exception that .send() has never needed to be called.Contributed:
Important Changes:
signedTransaction field to the SignerResult response for injected signers. This only applies to the signPayload method exposed in the Signer interface for polkadot-js. As the name suggests the field expects a signed transaction (extrinsic) when inputted. When its present, the api will not add the signature to the payload, but instead broadcast the inputted signed transaction. This means the signer may modify the payload it's given. The only part of the payload that may not be modified is the call data. This is verified on the api, and will throw an error if it does not match the initial payloads call data.mode and metadataHash field for the CheckMetadataHash signed extension.Changes:
system_accountNextIndex with runtime api call accountNonceApi for api.derive.tx.signingInfoeras for api.derive.staking._stakerRewardsChanges:
Contributed:
Changes:
Changes
api.derive.staking.nextElectedtoHuman (Thanks to https://github.com/bee344)api.derive.accounts.{info && identity}CheckMetadataHash signedExtension (Thanks to https://github.com/bee344)Changes
api.derive.staking.* backwards compatibleclaimedRewards regression in api.derive.staking.queryMultiChanges
Breaking Changes:
Note! The following breaking changes only refer to @polkadot/api-derive calls under api.derive.staking.* due to the most recent breaking changes in runtime version v1.2. Please refer to the link next to the bullet points for more information.
api.derive.staking calls with breaking changes (#5860)claimedRewardsEra to api.derive.staking.query for compatibility with legacyClaimedRewards (#5862)Contributed:
Changes:
Changes:
NOTE: Because of a broken CI build for 10.12.5 -> 10.12.6 is a replacement
Contributed:
Changes:
disableAscii option for toHuman, and toPrimitiveassetId getter field to to necessary ExtrinsicPayloadsContributed:
Changes:
disableAscii option for toHuman, and toPrimitiveassetId getter field to to necessary ExtrinsicPayloadsContributed:
Contributed:
Changes:
Contributed:
Changes:
Contributed:
Contributed:
Option values and error on duplicates from BTreeSet/BTreeMap (Thanks to https://github.com/Neopallium)Changes:
cacheCapacity option for the WsProviderContributed:
chainIsEthereum key to Registry interface (Thanks to https://github.com/fgamundi)ChargeAssetTxPayment (Thanks to https://github.com/bee344)Changes:
[8a;32] types in known keysContributed:
ChargeAssetTxPayment (Thanks to https://github.com/bee344)beefy::subscribeJustifications() (Thanks to https://github.com/serban300)Changes:
intrablockEntropy storage keySkipCheckIfFeeless signed extensionbalances.transfer (in tests) have been removedContributed:
FungliblesApi version 2 (Thanks to https://github.com/bkontur)EthereumApi version 5 (Thanks to https://github.com/timbrinded)AssetConversionApi (Thanks to https://github.com/jsidorenko)AssetConversionApi (Thanks to https://github.com/jsidorenko)Int conversions (Thanks to https://github.com/peetzweg)isEthereum to chain properties (Thanks to https://github.com/fgamundi)Changes:
toJSON()rpc-core stats on api.stats getterBeefyApi version 3ParachainHost version 5chain.subscribeFinalizedBlocks deriveimport.meta.url inside testsUint/Int tests for maintainabilityChanges:
Contributed:
Changes:
Changes:
.paymentInfo never mutates the underlying/existing signatureContributed:
api.setSigner(...) to clear existing (Thanks to https://github.com/polymath-eric)Changes:
@polkadot/types-create exports with no duplicatesChanges:
module to package.json export map (ESM-only)Contributed:
Changes:
Scheduled types for Kusama (as reported, non-comprehensive)WsProviderChanges:
Int/UInt.toJSON for > 128-bit valuesisPedantic storage checks in API optionsobjectSpread, default to runtime as required__internal__ class fieldsContributed:
noInitWarn flag to signed extension warnings (Thanks to https://github.com/xlc)Changes:
AccountId20 detection with partial matchChanges:
Contributed:
Changes:
@tsconfig/stricter setupChanges:
toHuman() output is still incorrect)Changes:
BitVec.toBoolArray() helper functionBitVec from metadata to only allow (default) LsbTransactionPaymentApi/4Contributed:
Changes:
Contributed:
AccountId20 mapping (Thanks to https://github.com/koushiro)Changes:
ParachainHost v4 runtime callsISize type support (same as USize, throwing on use - added for completeness)AccountId20.eq does not fail on null/undefined inputstoU8a() where the isBare flag is is being usedChanges:
Metadata_* runtime callsChanges:
.module. specifiers in typegen coderpc.md generation)Changes:
/src//*#__PURE__*/ exports in api-deriveContributed:
Changes:
.js imports in source files (TS moduleResolution)Contributed:
Changes:
import() (catering for ESM provided types)node:test runner (ESM variants)Changes:
WsProvider.connect() on an open connection (creates resource leaks)Changes:
*_runtime::Runtime{Call, Event} from metadataContributed:
eth_getTransactionCount with frontier (Thanks to https://github.com/alko89)Changes:
Compact<{ refTime: u64 }> chainsChanges:
Weight alias for 1.5 chainsChanges:
Changes:
Weight alias detection to cater for WeightV0/u32 overrides (e.g. early Kusama blocks)Changes:
Contributed:
TransactionPaymentApi (Thanks to https://github.com/notlesh)Changes:
Weight alias detection (moved from PortableRegistry -> Registry)WeightV2 (does not affect runtime detection)PortableRegistryChanges:
isStorageFallback on the Codec interface. (true if entry was created from a metadata fallback value from an empty storage item)api.queryMulti returns empty result when no keys are providedVec/Tuple inputsStruct.{toU8a/toPrimitive/toHuman/toJSON} population of resultsChanges:
Changes:
derive.democracy.preimages retrieves correctly from (current-gen) preimageScProvider you now need to explicitly pass @substrate/connect as a parameter. This means the code needs to be adjusted as follows -import { ScProvider } from '@polkadot/api';
import * as Sc from '@substrate/connect';
const provider = new ScProvider(Sc, Sc.WellKnownChain.polkadot);Contributed:
Changes:
ScProvider interface now needs receive an @substrate/connect instanceScProvider.WellKnownChains has been removedChanges:
Weight)Changes:
paymentInfo calls with Substrate (w/ decoding fallbacks)Changes:
registry appear as a fieldChanges:
derive.balances.account detection for system vs balancesWellKnownChain for light clients is via ScProvider.WellKnownChain. This release removes the explicit export from the ScProvider root.Changes:
BlockHash types (as applicable)ScProvider@polkadot/util 10.2.1Changes:
Changes:
Changes:
Changes:
api.rpc.payment.queryInfo to always return WeightV1 responsesapi.rpc.payment.queryInfo as deprecated (will be in a future Substrate version)Contributed:
api.rpc(...) (Thanks to https://github.com/xlc)WeightV2 contract interfaces (Thanks to https://github.com/jasl)Changes:
TransactionPaymentApi/2 runtime callshas{DryRun, PaymentInfo} on submittables (feature detection)Contributed:
@substrate/connect to latest (Thanks to https://github.com/wirednkod)api.rpc(method, ...params) support (Thanks to https://github.com/xlc)Changes:
ScProvider code structure with other providersisClonable getter on providers (some, e.g. sc doesn't support this)Changes:
DispatchError type for statemint/statemineContributed:
@substrate/connect to latest (Thanks to https://github.com/wirednkod).? operators in submittable class (Thanks to https://github.com/shunjizhan)Changes:
DispatchError (additional preimage statuses)api.derive.democracy.* to return imageHash as HexString (as applicable, supports current-gen preimages)api.derive.preimages.* to retrieve via democracy or preimage palletsapiAt.<section>.<method>.key(...) passes through the correct argumentsChanges:
ParachainHost version 3 runtime callsWeight type (used in runtime calls and RPCs) has not been swapped from the old u64 variant. This means that on new chains using WeightV2, the TS decorated type will still reflect the old version.Changes:
Weight type for V2 structuresWeight{V1, V2} (used for type overrides)api-contractContributed:
ink_primitives types (Thanks to https://github.com/statictype)instantiate call params (Thanks to https://github.com/statictype)Changes:
currentEra vs activeEra usage)@deprecated flag to RPC interface generation (contracts_* & state_get{Pairs/Keys})Contributed:
ScProvider (Thanks to https://github.com/wirednkod)Changes:
Contributed:
@substrate/connect to latest (Thanks to https://github.com/wirednkod)Changes:
Contributed:
Changes:
AccountId{32, 33}Changes:
Changes:
pendingRewards return typeAccountId33 (raw/compressed 33-byte ecdsa)Changes:
Enum in Struct typegen (no lookupName)Contributed:
@substrate/connect to latest (Thanks to https://github.com/wirednkod)Changes:
StakingLedger with fallback for Kusama 1050 (2 different structures on-chain)TryRuntime state call definitions (only off-chain usage)Changes:
rpc.payment.queryInfo usage with call.transactionPaymentApi.queryInfoapi.call.* is decorated on historic blocksimport { WellKnownChain } from '@polkadot/rpc-provider' it is recommended that you rather use ScProvider.WellKnownChain (the import may be dropped in a future major version)Changes:
ScProvider in @polkadot/api, aligning with {Http, Ws}ProviderWellKnownChain as static on ScProvider.WellKnownChain.entries/.keys arguments is less than map-entry queryContributed:
@substrate/connect to latest (Thanks to https://github.com/wirednkod)CodecMap (Thanks to https://github.com/CertainLach)Changes:
noInitWarn: boolean flag to API options, disabling runtime & RPC warningsapi.at(...) instancesStruct were moved to the prototype class for performance reasons. While struct.<field> access still behaves in the same way, with the same results, this does mean that the prototype getters are not visible when doing an Object.keys(struct) or when doing an object spread.tx.sign(...) (use signAsync), Result.{is, as}Error (use {is, as}Err) as well as storage .range(...) operations.api-contract have been removed. Always ensure you pass an options object to construction and query methods.api-contract will now detect the usage of storageDepositLimit in params, if not available the contract interfaces will not be decorated.Changes:
Struct/Enum/Set field getters on class prototypesapi-contract usage of api.rpc.* to api.call.*storageDepositLimit (runtime contractsApi only has support for latest)api.rx.call.* for internal usage (derive, contracts)api-contractContributed:
@substrate/connect with dual ESM/CJS support (Thanks to https://github.com/wirednkod)Changes:
{BTree|Hash}Map.toHuman() now display Raw keys as ascii (if detected)toPrimitive() to all base Codec interfaces (string/boolean/number)objectSpread (where missing)TransactionPaymentCallApi runtime interfaceregistry.getModuleInstances against metadata paths (fallback)@polkadot/util 10.1.1Changes:
derive.chain.subscribeFinalized{Heads, Blocks} which returns all finalized, no skipsderive.chain.* (w/ shared logic dedupe)BlockBuilder 2/3/4 & GrandpaApi 2 runtime interface definitionsNominationPoolsApi runtime interfaceDebugRuntimeApi runtime interface, Frontier-specificNimbusApi runtime interface (& older AuthorFilterAPI)DispatchError enum variant for asset chainsChanges:
@polkadot/util 10.0.2Changes:
Opaque{Metadata, Multiaddr, PeerId} decoding to Opaque<Bytes>XcmV0 definitions for BuyExecutionOption<...> types@polkadot/util methodssystem.version constant valuederive.staking.account@polkadot/util 10.0.1Changes:
DispatchError is always the non-current variant@types/nodeChanges:
@polkadot/util-crypto 9.7.2 (w/ @polkadot/wasm-crypto 6.2.2)Contributed:
api.{tx, query, ...} with no external side-effects (Thanks to https://github.com/btwiuse)Changes:
state_call definitions via API config (exposed on api.call.*)state_call from Substrate, Polkadot & OrmlContributed:
@substrate/connect to 0.7.7 (Thanks to https://github.com/wirednkod)feeHistory & maxPriorityFeePerGas eth RPCs (Thanks to https://github.com/crystalin)Changes:
BeefyPayload with Substrate masterstatic get [Symbol.species] () for Array & Uint8Array typesf32 & f64 typesAbstrateBigInt wrapper extensionContributed:
@substrate/connect to 0.7.6 (Thanks to https://github.com/tomaka)Changes:
@polkadot/types-codec assertsBase type to AbstractBase (reflecting usage)blockHash on rpc.engine.createBlock returnCompact/UInt/Int with number when passedPortableRegistry (maintainability)Changes:
DispatchErrorModule with U8 variantContributed:
Changes:
Option<Option<Type>> are correctly handledruntimeVersion on api.at interfacesDispatchError{U8, U8a} (default to new U8a variant)DispatchError definition with latest SubstrateDispatchError returnblockHash is passed through with era sign optionsderive.bagsList to detect voterList palletChanges:
.statsRange in typegen for EnumChanges:
Option<bool> opt-inChanges:
Option<bool>createClass with shortcut typeDef creationregistry.getOrUnknown with lookup cachecompactFromU8aLim & u8aConcatStrict variants.inspect() for ExtrinsicPayloadStakingLedger for runtime 1051Contributed:
@substrate/connect to 0.7.5 (Thanks to https://github.com/wirednkod)Changes:
mmr_generateBatchProof RPCisCodec checks to error/event .isVec<Option<X>> in typegenChanges:
MortalEra.{birth, death}(...)Changes:
Range/RangeInclusive typesCall typegen (inclusive of non-defaults)wss:// handling in polkadot-types-from-{chain, defs}definitions.ts in typegen (only use chain)Compact<*> decoding in Uint8Array streamsI* interfaces for extrinsic payload gettersContributed:
@substrate/connect to 0.7.4 (Thanks to https://github.com/wirednkod)Changes:
BTreeSet in typegen top-level generationContributed:
types-from-defs (Thanks to https://github.com/alex-nax)Changes:
BTreeSet types into correct type[u8; <size>] has exact sizes (non-u8a inputs)tx.paymentInfo signing process for existing signatureContributed:
Changes:
paymentInfo if already signedapi.derive.balances.fees (use direct constants as applicable)Contributed:
Vec<{ struct: <type> }> (Thanks to https://github.com/zannis)Changes:
entriesPaged where no at?: BlockHash is specifieddemocracy::vote::Vote and identity::type::DataChanges:
Contributed:
rpc-provider README (Thanks to https://github.com/josepot)Vec<[<Type>;<length>]> in typegen (Thanks to https://github.com/zannis)Changes:
apiAt.tx(...) to construct at a specific pointapi.derive.bagsList.* supportapi.registry.lookup.namescjs/** root@polkadot/util 9.0.1Contributed:
WellKnownChain for substrate-connect (Thanks to https://github.com/josepot){entries, keys}Paged in .at (Thanks to https://github.com/xlc)WeightsPerClass interface on maxExtrinsic (Thanks to https://github.com/HackFisher)Changes:
DispatchError with error as [u8; 4]@polkadot/util-crypto init (adjustment for React Native)Changes:
BitVec with MSB does not fail (used in Polkadot DeliveredMessages)Changes:
ScProvider top-level in @polkadot/rpc-providerContributed:
ScProvider for @substrate/substrate-connect (Thanks to https://github.com/josepot)BTree{Map, Set} in typegen (Thanks to https://github.com/CertainLach)Changes:
BitVec typestoHuman() on BitVec to output default LSBbytes{Sent, Recv} to provider statsdisconnect()dev_getBlockStats RPCImportant This contains an upgraded version of @polkadot/wasm-crypto. For users of asm.js, e.g. React Native, there are some additional upgrade instructions in the release notes for this version https://github.com/polkadot-js/wasm/releases/tag/v5.0.1
Contributed:
Changes:
.stats to provider interfaces with running countersstate_trieMigrationStatus RPC@polkadot/util 8.6.1Changes:
Option<Null> typesimport.meta.url is undefined@polkadot/util 8.5.1Changes:
era{Exposure, Prefs, Slashes}Contributed:
updateId is correct in signer callbacks (Thanks to https://github.com/coolcorexix)Changes:
BTreeSet has the correct decoded lengthPortableRegistry at point of metadata setderive.chain.getBlockByNumberderive.balances.allv13 -> v14 metadata conversion attaches primitivesContributed:
Changes:
grandpa_proveFinality with SubstrateContributed:
isHistoric flag to ETH RPCs (Thanks to https://github.com/stwiname)Changes:
BitVec tests for toU8atxIndex as event index on extrinsic results@polkadot/util to 8.4.1Upgrade priority: Low. Recommended for users with long-running scripts.
Contributed:
Changes:
Lookup* types missing (these are resolvable)PortableRegistry types on runtime upgradeCall/Event on non-meta v14 runtimesbeefy_getFinalizedHead RPC supportUpgdare priority: Low. Recommended for users with long-running scripts and those chains based around the latest Substrate master versions.
Contributed:
.raw RPC calls (Thanks to https://github.com/r0t0r-r0t0r)Changes:
Call & Event types for metadata v14WinningData and SlotRange types (36-entry variant)decorated event on API on metadata decorationWrapperKeepOpaque/WrapperOpaqueRange/RangeInclusive usage with similar types{treasury, bounties}.bountiesTypeDefInfo keys in extractionrpc.contracts.uploadCode#private = { this... } yields undefinedUpgrade priority: Low. Recommended for users of the latest contract pallet and ink! versions.
Contributed:
Changes:
Registry consistency, augment extensions.multi support on api.at(...).<section>.<method>contract.{query, tx}.<method>.meta, aligning with APIUpgrade priority: Medium. Required for all chains using Range and RangeInclusive types. Also includes better error handling for number conversions.
Changes:
Range/RangeInclusive variant check does not fail on encoding@deprecated@polkadot/util to 8.3.2Upgrade priority: Low. Maintenance upgrade, tracking the latest @polkadot libraries.
Changes:
WrapperKeepOpaque with internal decoding (allowed to fail)@polkadot/util to 8.3.1Upgrade priority: Low. Recommended for users generating TS chain-specific augmentations.
Changes:
ReturnFlags to set (as opposed to bare u32)Upgrade priority: Low. Recommended for users of contracts form Substrate master & Polkador/Kusama TS app developers where specific chain augmentation would be helpful.
Contributed:
storageDepositLimit on contract options (Thanks to https://github.com/kwingram25)Changes:
@polkadot/api-augment/{kusama, polkadot, substrate} for specific augmentations (The bare @polkadot/api-augment is equivalent to /substrate, keeping the existing behavior)@polkadot/types-augment/{lookup, registry} variants (The bare @polkadot/types-augment applies both)txHash on submittable results, e.g. tx.signAndSend(..., ({ txHash }) => ...)ALLCAPS entries)Option codec (explicit in expectations)Upgrade priority: Low. Recommended for applications where collective derives with aliasses are being used.
Changes:
dispathchQueue derive to align with latest SubstrateUpgrade priority: Low. Recommended for TS users with their own non-Polkadot/Kusama chains.
Breaking changes For TS users the default API augmentation is now optional. This means that the API, for TypeScript, is not decorated by default with the Substrate types and encpoints. TS users should add a singular import '@polkadot/api-augment'; in their code to restore old behavior. A full writeup of the rationale and other options can be found in the FAQ
Breaking change To cater for the above, chain-specific interfaces generated with older versions may not be compatible with the current version of the API. Additionally, TS interfaces generated with this version of the API is not compatible with older API versions.
Contributed:
Changes:
@polkadot/types-{codec, create} packages from types@polkadot/{api, rpc, types}-augment (now optional, TS-user applied)Upgrade priority: Low. Recommended for users of contracts on the current Substrate master version and TS users who generate metadata v14 interfaces.
Changes:
CheckNonZeroSender signed extension supporttype (with allowed values)Upgrade priority: Low. Maintenance upgrade, tracking the latest @polkadot libraries.
Changes:
state_traceBlock RPC with SubstrateUpgrade priority: Medium. Recommended for 6.10.x users
Changes:
Upgrade priority: Low. Aligns TS augmentation and decoration with older behavior for ALL_CAPS identifiers.
Changes:
@polkadot/util to 8.0.4 with adjusted stringCamelCaseUpgrade priority: Low. Recommended for users of HttpProvider and for chains generating types using TS augmentation.
Changes:
Upgrade priority: Medium. Pulls in @polkadot/util-crypto fix for TS projects.
Changes:
@polkadot/util-crypto with TS compilation work-aroundUpgrade priority: Medium. Recommended for metadata v14 parachains. For TS users, the package now support TypeScript 4.5.2 and allows extraction of user types from metadata v14.
Contributed:
BeefySignedCommitment type (Thanks to https://github.com/czl1378)Changes:
*::{Call, Event} matching for metadata v14*{Call, Event, Error} TS types for metadata v14.toJSON output with Substrate inputUpgrade priority: Low. Recommended for chains with non-MultiSignature variants where paymentInfo is required.
Changes:
paymentInfo signatures to cater for non-MultiSignature variants::generic:: from names & namespaces under metadata v14decorateMethod{Promise, Rx} renamed to to{Promise, Rx}Methodrx.queryAtUpgrade priority: Low. Recommended for chains on metadata v14 with non-default Address implementations.
Changes:
AccountId & Address types via SpRuntime* definitions.queryAtUpgrade priority: Low. Internal maintenance updates, focussed on internal optimizations.
Changelog:
account::AccountId20 mapping (Thanks to https://github.com/joelamouche)Changes:
voteLockingPeriod in democracy derives (as available)Extrinsic payloadsVec (different from general path)Struct, Set, Json & EnumPortableRegistry location inside @polkadot/types/metadataUpgrade priority: Low. Internal maintenance updates.
Changes:
palletVersion keys with correct prefixEthereumAddress as a known PortableRegistry overridePortableRegistry namespace splitting operationsAbstractArray & Struct u8a decodingStruct construction from Struct instancelookupName in createClass (allows deeply recursive lookups)toHex() will now correctly return the TS HexString typeUpgrade priority: Low. Recommended for users with .at queries on unknown blocks.
Changes:
toHuman on Call to return names & (not only) valuesRuntimeVersion to short-circuit api.atStruct decodes fully on null input (equivalent to undefined & {})Upgrade priority: Low. Internal maintenance upgrades.
Contributed:
Auction to Polkadot pre-0.9.11 ProxyType (Thanks to https://github.com/wirednkod)Changes:
palletVersion storage itemmaxReceivedFrameSize under NodeTypeDef structures now contain the typeName from metadata v14 on fieldstypes-known)PortableRegistrytoJSON (Ascii) output detection on Rawapi.rpc.*.*.raw(..args) return to the actual over-the-wire JSON resultapi.rpc.*.*.json(..args) since it now overlaps with new .rawUpgrade priority: Low. Recommended for Westmint runtime 500+
Changes:
SignerPayload correctly serializes Option with NoneBlockV{0, 1, 2} types, aligning with latest FrontierUpgrade priority: Low. Recommended for Kusama & Polkadot runtime 9110+
Changes:
Accountindex typesPortableRegistry (remove old-generation)InstantiateReturnValue type (no rent projection after 267)Upgrade priority: Low. Recommended for Kusama & Polkadot runtime 9100+
Changes:
api.query.*.*.at as deprecated (use api.at)queryMulti, findError and findCall on api.at.at to ensure no additional metadata callsUpgrade priority: Low. Maintenance updates.
Contributed:
Changes:
queryMulti inputsqueryMulti in map form.multi queriesUpgrade priority: Low. Recommended for 6.x users using historic queries.
Changes:
.at queries/decoration for pre-V13 metadataBridgeMessageId & SpecVersion types for bridgesWrapperOpaque encoding/decoding (as per latest Substrate)Upgrade priority: Low. Minor maintenance changes from the 6.0.x versions.
Contributed:
OutboundLaneData type (Thanks to https://github.com/HackFisher)Changes:
childstate_getStorageEntries RPCUpgrade priority: Low. Recommended for all users on 6.0.4 using api.query.*.*.at calls
Changes:
Option is correctly imported for TS query generationUpgrade priority: Low. Recommended for all users on 6.0.3 using api.query.*.*.at calls
Changes:
api.query.<module>.<method>.at will now use at.at(<hash>)metadata/util/getSiName to get human type namesUpgrade priority: Low. Recommended for all users on 6.0.2 using api.query.*.*.at calls
Changes:
api.query.<module>.<method>.at queriesUpgrade priority: Low. Recommended for all users on 6.0.1, especially those using api.query.substrate.* calls
Changes:
api.query.substrate.* key generationUpgrade priority: Low. Recommended for users of the latest Substrate/Polkadot with Metadata v14.
Contributed:
.clone on Http provider (Thanks to https://github.com/ianhe8x)Changes:
DigestItem to latest SubstrateIdentityInfo type for historic versionsnull values in bundles min/maxUpgrade priority: Low. Recommended for chains using Xcm.
Contributed:
ProxyType (Thanks to https://github.com/branan)Changes:
Upgrade priority: Low.
Changes:
Upgrade priority: Low.
Contributed:
MultiLocation definitions (Thanks to https://github.com/apopiak)Changes:
Upgrade priority: Low.
Changes:
Auction to Kusama ProxyType definitionscale-info 1.0 Range mappingUpgrade priority: Low.
Changes:
Vec construction (no re-create on new arrays)toHumanRange in PortableRegistry (used in Metadata 14)Upgrade priority: Low. Recommended for users of Xcm, preparing for Kusama/Westend 9100
Contributed:
keys/entries (Thanks to https://github.com/hamidra)Changes:
AssetId, MultiAssets, MultiAssetV1, AssetInstanceV1, XcmOrderV1Null entry in MultiLocation to Here (Xcm V1)Upgrade priority: Medium. Contains fixes for parachain types, affecting historic block retrieval on Kusama.
Changes:
ValidDisputeStatementKind enum to latest versionUpgrade priority: Low. Recommended for users of TS (createType and bigint adjustments)
Contributed:
Range & RangeInclusive types (Thanks to https://github.com/c410-f3r)bigint type (Thanks to https://github.com/ntduan)Changes:
createType auto-TS decoration for BreeMap, BTreeSet, HashMap, RangeUpgrade priority: Low. Recommended for potential users of NMap.
ClassOf alias for createClass has been removed, use createClass (with new generics) directlyContributed:
.keys()/.entries() on NMap (Thanks to https://github.com/hamidra)Changes:
createType<T = Codec>('...': K) now returns Codec when K is not knowncreateType does basic TypeScript type matching on the input typeBitSequence in PortableRegistryisConnected is set before connect/disconnect events are fired@polkadot/types-supportUpgrade priority: Low. Recommended for users of bridges.
Contributed:
Changes:
Upgrade priority: Low. Recommended for users of api.at(...) interfaces
Changes:
api.at(<blockHash>) to decorate with the correct storage hashPortableRegistryUpgrade priority: Low. Recommended for users of BTreeMap and BTreeSet
Contributed:
BTree{Map, Set}, aligning with Substrate (Thanks to https://github.com/Lezek123)Changes:
registry.createType with optionality (required for metadata v14)PortableRegistryUpgrade priority: Low. Recommended for users of XCM with type fixes.
documentation fields on metadata was renamed to docs for consistency, aligning with the SCALE type generators.Contributed:
Changes:
ParaPastCodeMeta with ReplacementTimesAccountId20 & AccountId32 typesUpgrade priority: Low. Recommended for users of current-generation Substrate chains.
@polkadot/metadata package has been removed, adjust imports to @polkadot/typesApiRx interfaceChanges:
@polkadot/metadata package, consolidate into @polkadot/typesgasRequired (total estimated)Heartbeat: HeartbeatTo244 mapping to Westend.disconnect() logic to always clear auto-connectBlockNumberFor type mappingderive.crowdloan.contributions(paraId)@polkadot/x-rxjs with RxJs 7.2Upgrade priority: Low. Allows cleaner access to multiple .at queries via new API.
Contributed:
Emergency to ElectionPhase (Thanks to https://github.com/arjanz)Changes:
await api.at(<blockHash>) to retrieve API instances at a pointfallbackType for type classes (only struct, as defined)instances API config to drive derive collective locationsUpgrade priority: Low. Recommended for Polkadot with runtime >= 9050.
Changes:
CompactAssignments & RawSolution types for PolkadotUpgrade priority: Low. Recommended for full from-genesis queries on Kusama.
Contributed:
Changes:
override as applicable (with --noImplicitOverrides option)Heartbeat: HeartbeatTo244 mapping to KusamaUpgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new XcmOrigin)
Contributed:
ChargeAssetTxPayment extension (Thanks to https://github.com/apopiak)Changes:
childstate_getKeysPaged RPCXcmOrigin mapping for OriginCaller generationapi.derive.balances.accountGenericAddress -> GenericMultiAddressUpgrade priority: Low. Internal adjustment only, no major external usage changes.
Contributed:
ValidationCodeHash type (Thanks to https://github.com/andresilva)OriginCaller type creation (Thanks to https://github.com/xlc)Changes:
[u8; <length>] type inputsBN imports from @polkadot/utilUpgrade priority: Medium. Required for users connecting to Statemine and future Kusama upgrades.
Changes:
westmint spec (same as statemint)tx.session.setKeys TS augmentation to allow string & Uint8Array keysBN imports to type-only as requiredUpgrade priority: Low. Internal adjustment only, no major external usage changes.
Changelog:
FundInfo type with Polkadot (Thanks to https://github.com/arjanz)Changes:
Data to limit to 32 bytes in the Raw enum (as per Substrate)@polkadot/rpc-core (recommended for internal-usage only)Upgrade priority: Low. Recommended where users are having TS mismatches with type definitions created on older versions.
Changes:
AugmentedQueryDoubleMap type (unused now in type generation)Upgrade priority: Low. Recommended for users using staking entries on Polkadot and users of Substrate master.
Changes:
NMapDisallowSigned (as per shell runtime) extensionstate_getChildReadProof RPCUpgrade priority: Medium. Recommended for uses of Polkadot/Kusama 9010 runtimes.
@polkadot/api-contractContributed:
.meta (Thanks to https://github.com/jiqiang90)Changes:
Bounded* type usage (as per latest Substrate)ContractRx query result definitions (no extra Observable)Raw (returned as hex)BN_* constants as non-specified defaults in contract interfaces@polkadot/api-contractgetHeader, getMetadata & getRuntimeVersionVecFixed to allow for the handling of hex inputsCompact<*> to allow for wrapped toBigInt() conversionsisPedantic decoding to correctly handle TextphragmenElection module namingCompactSolution for 24 nominatorsUpgrade priority: Medium. Required for the next v0.9.0 Polkadot/Kusama chain upgrades where parachains are used.
<myContract>.query.*, <myContract>.tx.* and <myCode>.tx.* interfaces as per the previous code usage hints.isPedantic mode is now switched on for storage queries. This means that the API will fail on any types where the input/output decoding doesn't match 100%Changes:
ConsensusEngineId now implements [u8;4] (mapping closer to Rust source)ContractInfo type as per latest SubstrateDigestItem type as per latest SubstrateBitVec based on decoded lengthcontracts_instantiate, state_traceBlock & system_reservedPeers RPCs.at queries@polkadot/api-contractsUpgrade priority: Low. Recommended when using or developing for parachains.
Changes:
Outcome (used in multiple pallettes)XcmError:code)Map or Recordmethod on AbiMessage (maps to decorated name)AccountId encoding testUpgrade priority: Low. Recommended for users of 4.7.1 using nvm
Changes:
EthBlock/EthHeader types (as per Rust origin)OriginKind enummembership.nvmrc to reflect engines changesUpgrade priority: Low. Recommended for users following Substrate master.
Changes:
BoundedVec typeData type (as used in identity), with all is/as gettersXcm types (with Plularity)DispatchError type as per current Substrate masterProxy typeengines config to package.jsonNone in RewardDestinationUpgrade priority: Low. Recommended for users of Kusama/Polkadot.
Changes:
Upgrade priority: Low. Recommended if used in a Node.js 15.x environment.
Changes:
internalError on submittable results (e.g. event decoding errors)rpc.beefy.subscribeJustificationsisReadyOrError with Api.createUpgrade priority: Low. Recommended with usage with the Rococo testnet.
Changes:
Keys with BEEFY session keysKeys injection to allow for on-chain type detectionWestend known upgrade block for runtime 50system_health timerUpgrade priority: Low. Recommended with usage with the Rococo testnet.
Changes:
ServiceQuality type for CumulusUpgrade priority: Low.
Contributed:
Changes:
ParaInfo typeUpgrade priority: Low. Recommended when tracking the latest updates from Substrate.
Contributed:
Changes:
Extender{Header, SignedBlock} types to ensure at-block Header types are usedAccountData typesSignedBlock type for new justifications fieldUpgrade priority: Low. Recommended when tracking the latest updates from Substrate.
Changes:
SignerPayload to inject/expose custom signed extensionsConsensusEngineId formats non-Ascii engines correctlygetBlock/Header derives to use as-at registry (instead of latest)RpcCore augmentation (removing TS warnings on typegen chains)mmr_generateProof RPCUpgrade priority: Low. Recommended if you use the API to sync the full chain, most notably Polkadot.
Contributed:
SudoBalances to ProxyType (Thanks to https://github.com/emostov)Upgrade priority: High. Required if you are using 4.0.1 in a Node.js environment.
Changes:
@polkadot/x-rxjs in Node environments (From common)Phase is new validator elections moduleUpgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
Important In the 4.0 version the default package type has been changed to ESM modules by default. This should not affect usage, however since the output formats changed, a new major version is required.
Contributed:
unknownTypes on the registry interface (Thanks to https://github.com/ii-ii-ii)Changes:
.toSON() now encodes all keys as camelCase (aligning with the output from Substrate)createdAtHash?: Hash to Codec interface (filled-in by storage retrievals)wamHash on Abi parsed instancesparentHash when creating mortal era (handles frequent forks better)AccountInfoWithTripleRefCount to cater for latest SubstrateUpgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
Contributed:
Changes:
.toJSON() does apply type aliassesUpgrade priority: Medium. Recommended for users of chains where MultiAddress is in-use and blocks are decoded.
Changes:
MultiAddress enum where non-AccountId variable-lengths are provided as part of a streamSchedule typesUpgrade priority: Low.
Changes:
.json dependencies (Better behavior using Node.js with ESM)Upgrade priority: Low. Recommended for parachain builders since it contains the updated parachain types.
Changes:
PersistedValidationData structureUpgrade priority: Low. Recommended for parachain builders since it contains the latest parachain types.
Contributed:
Changes:
ParachainInherentData & MessageQueueChain typessystem_unstable_networkState RPCUpgrade priority: Low.
Result<T, E> has been updated in the generation and the base types to follow the Rust version 100%. This means {as, is}Error is now available as {as, is}Err on the Result type. The older versions can still be used, but the *Error interfaces are now marked as deprecated.Changes:
Result<T, E> interface to be 100% compatible with the Rust version2028 upgrade to the known upgrades (optimizing certain .at queries).entries/.keys to deal with the key typingsUpgrade priority: Low. Recommended for users of the latest Substrate master, especially using contracts.
api-contract Code now supports deploying the code and a contract in on operation. This aligns with the latest Substrate where code cannot be uploaded with a contract. The createBlueprint is therefore deprecated, use code.tx.<constructor>(...) to deploy code. (Compatible with both old and new versions of Substrate)Contributed:
Changes:
api-contract to allow for Code to deploy contract alongside code. createBlueprint is now deprecated, replaced by createContract or the preferred code.tx.<constructor>, which uploads and deploys the code in one operation. This aligns with the current Substrate master contracts implementation.CancelProxy to `ProxyTypes on Polkadot, Kusama & WestendChanges:
Changes:
Keys type for the 28 runtime on Kusama, Polkadot & WestendUpgrade priority: Low. However recommended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new MultiAddress.
Address/LookupSource defaults have now been adjusted for MultiAddress. If your chain does not use these types, explicitly add the correct Address/LookupSource types. This new extensible format is mean to cater for all address types into the future, removing a lot of discrepancies between chains.Contributed:
Changes:
.slice operator on the Vec typeMultiAddress as a defaultglobal, use the x-global detectionmodule in package.json (exports map available)Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
ChainProperties type now returns an array of tokens and decimals (instead of singular values) in the token{Decimals, Symbol} getters. Additionally, this means that the registry interfaces has been changes, to registry.chainDecimals: number[] and registry.chainTokens: string[]. Where used the [0] index will return the first value if only interested in a single, for a straight conversion.Changes:
AccountData, ValidatorPrefs)system.properties (as per the chain specification)instances: { [key]: [module1, module2] } definition in teh bundle types, allowing for multiple instances (e.g. Balances)api-derive for balances to retrieve values via instances as well as across multiple modulesrpc.payment.queryFeeDetails RPC endpoint@polkadot/x-rxjs package into the common repoUpgrade priority: Low. Recommended for parachain developers.
MultiAddress. It is recommended that chains add explicit definitions for Address and LookupSource in their types, instead of relying on the API-defaults. A future update will swap the API defaults to align with Substrate.AccountInfo structure has also changed. It is recommended that chain developers explicitly add AccountInfo: 'AccountInfoWithRefCount' for the version with refCount on and AccountInfoWithProviders for the latest Substrate version. As per the above, the API defaults will be changed to align with Substrate.Contributed:
toBigInt() (Thanks to https://github.com/ianhe8x)Changes:
MultiAddress on specVersion >= 100Upgrade priority: Low. Fixes for parachain types, .entries() (with no values) and event.is(...) checks, users of these interfaces will have benefit.
derive.chain.{getBlock, subscribeNewBlocks} now return SignedBlockExtended, all with the actual extrinsics and events mapped. Users of the latter interface should take note.Contributed:
SessionKeys{6-9} definitions (Thanks to https://github.com/icodezjb)Vec<(a, b)> in enums (Thanks to https://github.com/monitz87)Changes:
derive.chain.getBlock() now maps events to extrinsics via .extrinsics gettergetBlock derive)ParaGenesisArgsEthTransaction type (as per the correct cargo crate).entries() call where 0 keys are present.is on events not checking the correct indexi* types ow correctly checks for max positive/negativeUpgrade priority: Low. Recommended for users of frontier evm module with additional types.
Contributed:
Changes:
ExitReason types for the frontier evm modulesystem.ss58Prefix as exposed (current Substrate master)blockWeights.maxBlock in estimationUpgrade priority: Low. Recommended for users of parachains.
Contributed:
.asV12 type signature (Thanks to https://github.com/yjhmelody)Changes:
api.{errors, events, query, tx}.<section>.<name>.is(...)AccountInfo with new provider/consumer refCount structure@polkadot/util to 5.2.1Upgrade priority: Low. Recommended for users of parachains.
Contributed:
HttpProvider (Thanks to https://github.com/ianhe8x)createTypeUnsafe (Thanks to https://github.com/dvdplm)Changes:
detectPackage as known side-effectdetectPackage to @polkadot/metadata (a number of requests on this)@polkadot/util to 5.1.1Upgrade priority: Low. Recommended for the next Kusama/Polkadot upgrades due to additional types and those following chains following Substrate master closely.
Important While this package contains no external interface changes, it now compiles and ships both cjs and esm modules. This means that modern bundlers will have more information for tree-shaking available. Additionally when using Node with .mjs extensions, the esm version imports will be used on recent Node versions. Adding an export map, as here, may have some impacts so a major semver bump is advised. There may be (small) dragons hiding in the dark corners...
Contributed:
Changes:
query.<section>.<method>.sizeAt(hash, [...params]) for all storageSessionKeys<n> definitions (up to 9)Type <-> Text definitionsMetadata <-> TypeRegistry imports@polkadot/util to 5.0.1Upgrade priority: Low. Recommended when following Substrate master and/or parachains development, contains the latest types for both.
staking.query derive, you now need to pass flags as to which values to retrieveChanges:
consts.system.blockHashCount (don't overflow on very low blocktimes)system_{addLogFilter, resetLogFilter} RPCsimport type in all casesUpgrade priority: Low. No major changes when on at least 2.8.2. Users encouraged to upgrade to at least that patch.
Contributed:
Changes:
electedInfo to contain details of current validatorsaccounts.info for simpler reusabilityMultiAddress)Bytes with .slice to be consistent for Uint8array extensions (already released in 2.8.2 as a bugfix)Upgrade priority: Low. Recommended if using Substrate master with new MultiAddress.
Contributed:
derive.chain.getBlock (Thanks to https://github.com/lovesh)Changes:
MultiAddress construction with multi type detectionGenericLookupSource to IndicesLookupSource (internal use)Raw data results for undecodable entriesRegistryMetadataUpgrade priority: Medium. Recommended for users of Polkadot/Kusama and api-contract users.
Changes:
ExtrinsicSignature overrides (defaults to MultiSignature)Blueprint to allow for optional salt (auto if not provided).contract files (in addition to ABI .json)BytesSchedule type as per Substrate@polkadot/types imports@polkadot/types imports/exports (overall bundle sizes)Upgrade priority: Low. Should be done alongside an update to @polkadot/util to 4.0
Changes:
AccountId check to take Ethereum-compatible chains into account@polkadot/{util,util-crypto} to 4.0 (optimized WASM layers)Upgrade priority: Low. Recommended for api-contract developers.
ContractExecResult from api.rpc.contracts.call. The API does have pass-through support for both old and new variants via the Contract interface, however it means the structure has changed to accommodate the new Substrate structure. Refer to the docs for the latest interface (including isSuccess/isError -> isOk/isErr, and the availability of the gasConsumed)Contributed:
Changes:
Contract execution will now return contract events decoded in the result.dryRun on extrinsics (alongside .paymentInfo usage)system_syncState and syncstate_genSyncSpec RPCsCall indicates explicit call as found@types/metadataregistry.hash now returns an H256 object (as opposed to raw Uint8Array)derive.council.proposal(<hash>) for retrieval of a single (expanded) proposalUpgrade priority: Low. No breaking changes, however it does move api-contract forward with additional features.
Contributed:
{i,u}256 types on contracts (Thanks to https://github.com/seanyoung)Changes:
.keysAt & .entriesAt to query maps at a specific blockHashtypes: { ... } definitions not have precedenceMultiAddress typeapi.derive.chain.subscribeNewBlocks for full block retrievals.{exec, read}('name', ...) now matches on both snake_case and camelCase (consistency)Upgrade priority: Low. Recommended for api-contract developers and those using large messages via Node.js WS.
Contributed:
Changes:
dispatch{Error, Info} on all .tx results (less boilerplate on info checks)Contract.{query, tx}.<message> and Blueprint.tx.<constructor>BigInt params are passedUpgrade priority: Low.
@polkadot/api-contract now only supports ink! 3.0-rc1 and later formats. Users of ink! 2.1 are recommended to stay on an older version until upgraded.Contributed:
Changes:
OriginCaller type (& apply to scheduler types)ContractInfo type for latest Substrate (contracts)Schedule type for latest Substrate (contracts)null input on Text values in addition to existing undefinedUpgrade priority: Low.
Contributed:
Changes:
Text & Bytes, protecting against OOM on erroneous decodingderive.staking.validatorsFrom to determine validators nominated and own validatorsUpgrade priority: Medium. Required for all teams building on Substrate 2.0 for full compatibility.
RefCount type (used by query.system.accounts) has been changed to a u32. On older chains supply the RefCount: 'RefCountTo259' overridequery.<module>.map() have been dropped, only the existing .keys()/.entries() are available for map iteration.Contributed:
Changes:
grandpa_proveFinality RPC.entries() on older chains without queryStorageAt supportRefCount type as per substrate 2.0PalletVersion types for future palette versioningPer{cent, bill, mill} without instance checksUpgrade priority: High. Metadata v12 is the next major version containing structural data exchange changes and will start rolling out to test and live networks in due course.
Decorated (from @polkadot/metadata) class signature has changed. It now always expects a valid Metadata object to be passed-in, instead of raw data. It is recommended to create a Metadata object, set it on the registry with .setMetadata and then only create a Decorated instance. (Only affects metadata-only users of the API)Contributed:
Changes:
{ nonce: -1 } to signAndSend the API will use system.accountNextIndex to determine the nonceiterKeyUpgrade priority: Low. Recommended when using clones instances.
Changes:
paymentInfo on any extrinsic with tx.paymentInfo(<address>, <at>) (hash specified)receivedHeartbeats to not re-create the full objectstaking.stakerPrefs derive to retrieve validatorPrefs over a range of erasUpgrade priority: Low. Recommended when manually using provider connect/disconnect or using multiple instances in a single process.
.isReady could throw an error, now it will always succeed on connection. For trapping errors, use the .isReadyOrError variant on the APIisConnected provider interface is now a getter, replacing previous calls to provider.isConnected(). Additionally the provider.disconnect() is now async, aligning with .connect().Contributed:
isReadyOrError to API, isReady always succeeds (Thanks to https://github.com/shawntabrizi)Changes:
derive.chain.getBlock(hash) to retrieve a SignedBlock extended with an .author (same as derive.chain.getHeader(...))api.{connect, disconnect}() as well as isConnected interfaces. The first functions async returning Promise<void>api.derive.staking.query/queryMulti no longer retrieves session keys (can be done via .keys/keysMulti)api.derive.accounts.accountId to perform AccountId lookups (from indices or actual AccountId)paymentInfo queries to only use accounId mappings as availablegrandpa_subscribeJustifications RPCCall.toHuman() to remove decoding-related technical internal detailstoHuman() & .toBigInt() has been explicitly added to the API documentationUpgrade priority: Medium, especially for staking users on Polkadot, Kusama & Westend (type updates applied for v23 onwards) or if transparent .at(hash) queries are required/used
RewardDestination enum with an extra field for payout-to-any account for staking preferences. If on an older chain consider adding RewardDestination: 'RewardDestinationTo257'CompactAssignment type enhanced types for session solution submissions. If on an older chain consider adding CompactAssignments: 'CompactAssignmentsTo257'Contributed:
TransactionPriority type (Thanks to https://github.com/aniiantt)CompactAssignments, including tests (Thanks to https://github.com/kianenigma)Changes:
rpc.chain.getBlock(<hash>) & query.system.events.at(<hash>) now works out-of-the-box injecting the correct metadata & types.AccountId for valid sizestoBigInt() (JS built-in BigInt) on Int/Uint, & Compact<*> types.concat on Codec arraysisBare flag on enumsapi.getBlockRegistry(blockHash?) to create registry/types for a specific blockderive.democracy.locks now returns delegated locks for an account as well.sign on submittables is marked deprecated (not due for removal, but rather use .signAsync for consistency with .signAndSend)CompactAssignments & RewardDestination for Polkadot, Kusama & Westend@polkadot/util 3.4@polkadot/wasm-crypto 1.4Upgrade priority: Low, unless using the proposeParachain module.
Changes:
system.account for new/old determinationproposeParachain module (as per Rococo)Address <-> LookupSource definitions (no external impact, both in existence)Ethereum{AccountId, LookupSource} types, underlying H160registry.setHasher(...) (defaults to blake2AsU8a)@polkadot/util 3.3Upgrade priority: Low, unless on bleeding-edge chain with new compact CompactAssignments.
CompactAssignments type has changed for better space utilization. On older chains, supply CompactAssignments: 'CompactAssignmentsTo257'Contributed:
Changes:
Fixed{I,U}{64,128} and {I,U}32F32 typesdesiredRunnersUp to council derives@polkadot/util 3.2Upgrade priority: Low, unless using Centrifuge or parachains
Contributed:
Changes:
@polkadot/util 3.1@polkadot/wasm-crypto 1.3Upgrade priority: Low, unless using the Rococo chain
Contributed:
Changes:
toHuman detects ASCII sequence for text outputUpgrade priority: Low
Contributed:
system.accountNextIndex (Thanks to https://github.com/shawntabrizi)Changes:
freeBalance (only council voting is free + reserved)typesBundle option to inject a group of chain versions types@polkadot/util 3.0Upgrade priority: Medium, especially if using contracts.
ContractExecResult: 'ContractExecResultTo255'Contributed:
Changes:
toHuman() displays utf-8 as availablesetImmediate when not polyfilledNetworkState reputation type for system_networkState RPCpurchase palletChanges:
isAscii & isUtf8 getters to Bytes & Raw typestoUtf8() helper to Bytes & Raw types@polkadot/util 2.18Contributed:
Changes:
<Codec>.toRawType() to use registry name as availableProxyType for Kusama, Polkadot & Westend with IdentityJudgement@polkadot/util 2.17OpenTip: 'OpenTipTo225'Contributed:
[u8; 33] in U8aFixed (Thanks to https://github.com/akru)Changes:
derive.balances.all has been updated for locks@polkadot/util 2.16Contributed:
Changes:
CheckMortality signed extension (old CheckEra is now an alias)getStorage on non-subscription calls, reducing RPC overheadEquivocationProofReleases enum to use a shared instanceaccount_nextIndex has been moved to system_accountNextIndex (Aligning with Substrate as a primary alias)Changes:
system_dryRun RPCderive.staking.queryMulti retrievals with additional per-type batchingderive.staking.waitingInfo (same as electedInfo for waiting validators)@polkadot/util 2.15Contributed:
.entries() queries (Thanks to https://github.com/monitz87)Changes:
@polkadot/util 2.14Contributed:
Option types in enum/Result type generation (Thanks to http://github.com/xlc).entriesPaged and .keysPaged methods for state maps (https://github.com/monitz87)Changes:
Call now exposes method & section fields (aligned with toHuman() representation)@polkadot/util 2.13Changes:
Contributed:
ElectionSize type (Thanks to https://github.com/arjanz)Changes:
BTreeSet decoding from Array/JSON inputs@polkadot/util 2.12Changes:
Perbill/Permill toHuman() formatting to output percentage@polkadot/util 2.11Contributed:
keyPrefix() with DoubleMap args (Thanks to https://github.com/KiChjang)WeightToFeeCoefficient type (Thanks to https://github.com/danforbes)transactionVersion getter in payloads (Thanks to https://github.com/amaurymartiny)Changes:
stakerRewards derive ordering for improved on-payout refreshesMultiplier type to Fixed128 (as per latest Substrate)DispatchInfo changed paysFee to an enum, if using an older version use, DispatchInfo: 'DispatchInfoTo244'Contributed:
Heartbeat with Substrate (Thanks to https://github.com/arjanz)Vicinity (Thanks to https://github.com/drewstone)Changes:
ExtrinsicEra constructionRegistry to direct access to available signed extensions (in addition to exposed types)CheckSpecVersion and CheckTxVersion signed extensions (with SignerPayload adjustments)PrevalidateAttests signed extensions (Polkadot claims)democracy.depositOf in derivesProxyState types@polkadot/util to 2.10Contributed:
sign/signAsync signature to optional options (Thanks to https://github.com/KiChjang)WsProvider with array of urls (Thanks to https://github.com/hoani)Changes:
.encodedLength calculation on [Type; N] typesrpc.grandpa.roundState RPCChanges:
@polkadot/util to stable 2.9.1 (sadly missed in the previous version, stable should match to stable)Contributed:
CompactAssignments types (Thanks to https://github.com/arjanz)Changes:
Changes:
Weight (to u64), on older chains apply Weight: 'u32' (This does affect event decoding if wrongly set)Contributed:
accounts.flags(accountId) (Thanks to https://github.com/kwingram25)Changes:
Option<Number> (& simplify, decoding correctly on rpc layer)system.{localPeerId, localListenAddresses} & state.getReadProof RPCsapi.runtimeVersion (used for signing) after upgradeLinkage (used in linked maps)derive.account.info now returns all field enum types decoded (not only raw)Digest has been moved to definitions, removal of GenericDigest typeFixed128 typetransactionVersion to RuntimeVersion structStakingLedger)StakingLedger: 'StakingLedgerTo240'Changes:
rpc.system.chainType to retrieve the chain type (Development. Local, Live & Custom)tx.staking.payoutStakers@polkadot/types-known_ prefixed (Aligning with the private/protected indicators in the TS definitions)api.derive.* have been adjusted for consistency, all starting with Derive* (previously a mixture of Derived* and Derive*)Changes:
signAndSend & signAsync now tries to use the last finalized block (depending on finalized drift)api.rpc.childstate.* Substrate RPCs, older nodes with still populate api.rpc.state.* with the child methodsError.message on RPC failures to not include the (already known) method signature@polkadot/types/known into @polkadot/types-known, allowing for base API overridesapi.derive.democracy to cater for dispatchQueue and externalsapi.derive.council to cater for new phragmen electionsqueryStorageAt for query .entries, removing unneeded subscriptions (use as available)BTreeSet initialization when it forms part of query interfacesVec<u8>-related types as part of constants@polkadot/types/interfaces)@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/interfacesReferendumInfo: 'ReferendumInfoTo239' type when using referendumsChanges:
isRetracted Extrinsic status is now a warning, not a fatal error, correctly aligning with Polkadot/SubstrateInitialization to align with the latest versionsisCouncil, isSudo, ...referendumInfo now includes status field, not infoinitWasm flag to API options. When set to false does not init the WASM portion (leaving it to the user elsewhere)staking.{nominators,validators}() and using an upgraded chain, you need to swap to retrieving entries via .entries() or .keys() for the keys.Changes:
state_getKeysPaged RPC, including use in storage keysderive.staking.controllers to derive.staking.stashes, reflecting actual contentderive.staking.stashes queries (with old-compat)derive.staking.* derives, including addition of derive.staking.own*Changes:
.at() queries (proper fix in next version)api.rpc.state.queryStorage(...) now fully decodes the Vec<StorageChangeSet> and returns a decoded [Hash, Codec[]][] when using this RPC.Changes:
StorageKey now has an .args property, decoded from meta where twox64_concat or blake128_concat are used on mapsapi.query.*.*.entries type conversions to return exact types (not Option in some cases)api.query.*.*.keys to retrieve only the storage keys, similar to .entriesError("...") when found in responsesderive.eras* interfaces for queries to new Substrate staking interfacesderive.account to cater for new indices module storage (detected with fallbacks)api.query.*[Type, Linkage<Next>]StakingLedger: 'StakingLedgerTo223'Votes: 'VotesTo230'Contributed:
Observable.create (Thanks to https://github.com/Himself65)Changes:
@polkadot/types/interfaces/runtime & @mine/interfaces/runtime will be valid.range([from, to]: [Hash, Hash?], ...args: any[]): [Hash, Codec][] on all storage entries.raw(...args: any[]): Promise<Uint8Array & Codec> to all RPC calls, returning the un-encoded resulttypesAlias: { <moduleName>: { <meta-type>: <alias-type> } } in API construction optionsBTreeMap to be initialized with a Record<string, any> object (in addition to Map)HashMap<KeyType, ValueType> definitionsBool will now correctly return isEmpty on false/default valuesNetworkState types as returned by the rpc.system.networkState() call to currentregistry.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.api.derive.staking to handle lazy-payout retrievals@polkadot/{util, util-crypto, keyring} to 1.6.1 & @polkadot/wasm to 1.2.1Changes:
api.tx(<extrinsic>): Submittable decoration (non-working in 1.4.1, now with proper test)*.d.ts files now contain TypeScript 3.8 features (specifically #private), which is not usable in TS versions < 3.8api.derive.staking.* has updated result types and detects support for lazy payouts queriesContributed:
api.{query, tx} to properly handle complex type inputs (Thanks to https://github.com/monitz87)--strict mode to effectively decorate chain metadata (Thanks to https://github.com/monitz87)api.rpc.chain.subscribeAllHeads (not just best) (Thanks to https://github.com/jak-pan)Changes:
api.rpc.engine.* for manual seal supportapi.injectMetadata(metadata) to initialize API with a specific metadata versionOption types now has an .unwrapOrDefault as an complement to .unwrap & .unwrapOrBigInt inputs in any derived UInt and Int object, e.g. api.tx.balances.transfer(..., 9876543210123456789n)UInt & Int now does source bitLength checks upon construction.createType(<type>, ...args) as an additional helper (like the API).toHuman on ExtrinsicEra, SubmittableResult & VoteDigestItem, Fixed64, H160, H256 & H512 to interfaces in @polkadot/types/interfacesregistry.get consistently warn on detection, throw on useu*` types via UInt<bitLength> type definitions.with on UInt, Int & U8aFixed classes with optional type name override#field on private class fields as applicabletypes/primitive/{extrinsics, generic} to types/{extrinsics, generic}@polkadot/{util, util-crypto, keyring} 2.5.1Contributed:
@types/bn.js as a normal dependency, exposed in *.d.ts (Thanks to https://github.com/monitz87)Changes:
polkadot-types-from-{chain,defs}) has been moved to the @polkadot/typegen package@polkadot/types/codec/create has been moved to @polkadot/types/create, imports from @polkadot/types are unaffectedtoHuman(isExtended?: boolean) to all codec types, formatting into a human-readable structureisInBlock (isFinalized now indicates finality)Contributed:
.entries(arg?: any) now has the correct argument type for DoubleMap (Thanks to https://github.com/monitz87)Changes:
Address to AccountId (future update)LookupSource and LookupTarget types instead of mapping these directly for aliasingBitVec type primitivesystem.account for balance & nonce queries in derives as well as Submittables (Substrate composites)rpc.author.hasKey and rpc.author.hasSessionKeys RPCsregistry.findMetaError now can take in a DispatchErrorModule object for error lookups (from asModule in DispatchError)toHex() & toU8a()system.account queries (instead of system.accountNonce and balances.freeBalance/balances.reservedBalance)codec/Date tests to make it run properly on all timezones@types/* to dev depsbalances.account or system.account should supply "BalanceLock": "BalanceLockTo212" to their types to use the previous-generation BalanceLock (when querying locks)Changes:
balances.account in all applicable derives (incl. vesting module)api.tx.*.* - the polkadot-types-from-chain now also generates these(staking.recentlyOffline, balances.nominatorsFor).isMax() on int values, an opposite of isZero() (e.g. u128, as well as derived, e.g. Balances).keyPrefix() to all api.query.* complementing the .key() call, both returning a hex string.toJSON() to return type name as specifiedContributed:
ApiPromise.isReady now rejects on unrecoverable errors (Thanks to https://github.com/laec)Changes:
polkadot-types-from-chain & polkadot-types-from-defs TypeScript generators to @polkadot/typesapi.query.* is available.entries(arg?: any) lookups on DoubleMaps (in addition to previously supported maps)Judgement in identity as well as society){ signer } to both api.tx.* and api.sign (in addition to api.setSigner)() to Null, rather keep them emptyfindMetaErrorContributed:
BTreeSet (Thanks to https://github.com/satellitex)Changes:
codec/Data type, to remove a conflict with Substrate. This type is now named RawOptionpaymentInfo to submittables to calculate feesData and U8a type has been renamed and just replaced with the Raw typeapi.derive.staking.info has been split into 2 - staking.query for non-balance related information (more effective) and staking.account that enhances query for all the information previously found .infoChanges:
DoubleMap hashing to always hash over the full value (in the case of Vec<T>, this includes the length)Contributed:
.entries() for all map-types, returning storage keys and values.signAsync to submittable extrinsics (Thanks to https://github.com/c410-f3r)Changes:
Registry to all calls to createType as well as all codec classes. If you are upgrading form an older version, use the migration guide to walk through the changes required.@polkadot/types into @polkadot/metadata. If you explicitly create Metadata classes, you now would need to do so with the import Metadata from '@polkadot/metadata'; This is a decorated class, where the previous metadata is now available on Metadata.metadata, alongside decorated consts.*', tx.* and query.*.Keys defaults to 4 keys now (Substrate master), depending on your node config, you would want to override with e.g. Keys: 'SessionKeys3' (1, 2, 3, 4, 5 & 6)ValidatorPrefs now default to the new percentage commission model, to use the previous validatorPayment, you can override with ValidatorPrefs: 'ValidatorPrefsTo196'Changes:
api.derive.* now has built-in memomizationapi.derive.* including era length progress and vesting calculationsChanges:
filterRecords (in addition to findRecord) on submittable resultsChanges:
account_nextIndex use, will be re-added in a future releaseCall.injectMethods is moved to Call.injectMetadata to align with Events (This should not be used externally, however mentioned as breaking here)Changes:
decl_error definitions)BTreeMap<K, V> types and definitionsChanges:
Result<Ok, Error> definitionsderive.imOnline.receivedHeartbeats to query via indexesapi.derive.elections.{approvalsOf|approvalsOfAt} to allow ss58 address inputEnum .eq handling to be more exhaustiveChanges:
rpc.account.nextIndex to retrieve the nonce when availableapi.query.*.* is now properly typed for default Substrate calls, i.e. api.query.balances.freeBalance(...) will return a Balance type. Additionally the api.queryMulti and .multi on queries not allow generic type params.api.rpc.accounts.nextIndex, api.rpc.contracts.call and api.rpc.rpc.methods calls. Optional calls (such as account/contracts) is decorated based on the results from rpc.methods, so they don't show up on nodes where they are not active.Box) in addition to better sanitation of user-defined-typesChanges:
ss58Format@polkadot/util 1.4.1, removing use of ExtErrorKeyring from @polkadot/keyring is now exposed on the API as well. You can do import { Keyring } from '@polkadot/api' - this alleviates the need for extra dependencies (apart from @polkadot/api), and since the keyring is critical for signing operations, aligns everything in one bundleChanges:
getRuntimeVersion and subscribeRuntimeVersion RPCs are now only available on the rpc.state.* endpoints. This aligns with the Substrate implementation.author_insertKey RPC's last argument publicKey is now required, as to reflect Substrate implementation.ExtrinsicUnknownapi.derive now returns the correct values again (bug fix)yarn chain:info [--ws URL] utility to extract a calls-only metadata versionconsole.warn, not via .errorExtrinsic, ExtrinsicPayload & SignerPayload is registered in the type registry and can be overridden nowSignerPayload is renamed to SignerPayloadJSONSignerPayloadJSON, SignerPayloadRawBase and SignerPayloadRaw are all moved to @polkadot/typesIf you are upgrading form an older version, use the CHANGELOG hand-in-hand with the migration guide.
api.rpc.chain.subscribeNewHeads is now available as opposed to the old subscribeNewHead. This aligns with the Substrate implementation.BlockNumber & Index to u32. The API tracks these closely. If you are running a chain with u64 values (for either), pass the type override to the API on creation, e.g. ApiPromise.create({ types: { BlockNumber: 'u64', Index: 'u64' } }) to avoid getting warnings about mismatched types.Api.create(...) and new Api(...) now only takes an options Object, so if you passed the provider directly previously, you need to swap the use to Api.create({ provider: ... })i* and u* (e.g. u32) are now only available in their lowercase versions. Additionally Vector is now only available as Vec, and Method has been renamed to Call, in both cases aligning with Rust.Moment now implements as u64 as per the Substrate codebase. (It it up to the user to interpret, for substrate 2.x it is not ms resolution)createType(<TypeName>, <value>) instead of e.g. new Proposal(...). When passing these to methods/queries, construction should not be needed, the raw value can be passed.@polkadot/types, i.e. import { SetIndex } from '@polkadot/types, now just the interfaces (TypeScript) are available via import { SetIndex } from '@polkadot/types/interfacesusize is now a blacklisted type that will throw on construction. Since it is platform-specific, it creates incompatibilities between native (generally u64) and WASM (always u32) code. Use one of the u32 or u64 types explicitly.Changes:
Method.findFunction(callIndex) (allowing decoding of raw data), is now available on api.findCall(callIndex). To keep backwards compatibility, it is still available on GenericCall.findMethod but the api.findCall is recommended and suggested.types/codec/createType has been moved to types/codec/create with the same exports. If you explicitly imported from here (and not doing the suggested import { createType } from '@polkadot/types), the reference needs to be updatedChanges:
Support for substrate 2.x (master) has been extended,
api.derive.contract is now api.derive.contracts to align with the substrate 2.x rename. (Feature detection is used so it supports both 1.x and 2.x chains)api.derive.electionsSupport latest substrate 2 v6 metadata with module constants using api.consts.
api.query.grandpaFinality to api.query.grandpa.@polkadot/extrinsics and @polkadot/storage have been moved to @polkadot/api-metadata and are now accessible as @polkadot/api-metadata/extrinsics and @polkadot/api-metadata/storage, respectively.isAye, isNay, and conviction getters. Votes can still be constructed as before with a raw JS boolean, a SCALE encoded Boolean, an i8 number, or a JS object with properties aye and conviction defined.Support V2 Extrinsics in addition to V1, v2 includes an optional tip
Signer interface has deprecated the sign method and replaced it with signPayloadsign interfaces (API detection and calling when signPayload is not available) will be removed in subsequent versions.The ContractsAbi type has been moved from @polkadot/types to import { Abi } from '@polkadot/api-contract. This paves the way for an enhanced contracts interface, instead of dealing with low-level API calls.
Changes:
@polkadot/keyring has been removed - if you relied on the API to provide this, you would now need to manually add itcreateType allows for the creation of [u8; <length>] types (opening the door for contract support)api.derive.staking.info now returns the rewardDestinationSupport latest substrate 2.x v5 metadata
ApprovalFlag, SetIndex, VoterInfo types for council as per substrateContractInfo to match substrate masterAdd support for new inherent digests from substrate.
Seal, the old/new Seals are not compatible. If you were using the old Seal from the Digests, you would now use isSealV0 for the pre-substrate 1.0 version and the new isSeal for the current versionHeaderExtended to retrieve author information from substrate 2.x (new PreRuntime digests)Cater for Vec, Option, Result, tuples and fixed vectors for contracts ABIs
off method to Api (Base, for both ApiPromise & ApiRx) to remove an event listenerChanges:
Changes:
api.queryMulti and api.query.<module>.<method>.multiapi.derive.* to use multi queriestypes/codec/Set now extends the base JS Set (breaking change: set.values -> set.strings)meta.arguments to meta.args in function metadata (arguments is a JS reserved word)toRawType on all type classes (breakdown into primitive types)Changes:
Changes:
Changes:
Changes:
Changes:
result.type === 'Finalised' now check on the status for result.status.isFinalized or result.status.isBroadcast, ... (the type property is now accessible only on result.status.type)subscribeFinalisedHeads update this to subscribeFinalizedHeads (likewise getFinalisedHead should be updated to getFinalizedHead and derive.bestNumberFinalized)Changes:
derive.staking.controllers to retrieve all active staking controllersChanges:
Changes:
Changes:
Changes:
Changes:
Changes:
Extrinsic and Method is used as types, consider importing { IMethod, IExtrinsic } from @polkadot/types/types, especially in the cases where this is used from a SubmittableExtrinsictypeRegistry constant is now getTypeRegistry() as a functionChanges:
Option<Type> and is indicated as such in the documentation// old
const ll = await api.query.session.lastLengthChange();
console.log('ll', ll /* BlockNumber */); // would be 0 if not set yet
// new
const llo = await api.query.session.lastLengthChange();
console.log('llo', llo.unwrapOr('not set') /* Option<BlockNumber> */)Changes:
// old (affected)
import Method from '@polkadot/types/Method';
import Signature from '@polkadot/types/Signature';
// new locations
import Method from '@polkadot/types/primitive/Method';
import Signature from '@polkadot/types/type/Signature';
// unaffected
import { Method, Signature } from '@polkadot/types';Changes:
Changes:
Changes:
Changes:
Changes:
Promise<UnsubFunction> instead of UnsubFunction when making subscriptions.Changes:
Substrate has been updated with a breaking new transaction format where the Index/Nonce is now encoded as a Compact. This change is being rolled out to both Alexander (Polkadot testnet) as well as Charred Cherry (Substrate testnet) - transactions between old and new are not compatible.
Changes:
api-observable has been removed. This was only used in /apps and inconsistent with the api/rx and api/promise APIs. Future work will include derives like was included in api-observable into the base.
Tuples now return single types when only one type is available, i.e. (AccountId) would now resolve as AccountId. The extra type wrapper adds no benefit to users here.
Changes:
Api Promise has been updated in the way we deal with subscriptions. Previously a subscription returned Promise<number> where the caller was to keep track of the id and use it in subsequent unsubscribes. Now any subscriptions return an unsubscribe/destroy function (): void, that is use for removing the subscriptions, e.g.
const unsubscribe = api.query.balance.freeBalance(Alice, (balance) => {...});
unsubscribe(); // here we destroy the subscriptionChanges:
Swapped to new metadata structures from Substrate. If the API is not working with your node, update Substrate to latest master branch. (Or 0.9.1 for Charred Cherry). Dropped support for old metadata as found as far back as BBQ Birch.
Changes:
Changed the send signature (for future expansion of eg. events) to return result: { status: ExtrinsicStatus } instead of status: ExtrinsicStatus. For most cases where only status type checks are used, i.e. status.type === 'Finalised' this should not be a breaking change. Deep inspection of the status object however will need to adapt.