From a45e313c84094b45f31e8b225d72e52c970c47da Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 29 Jul 2019 09:48:06 +0200 Subject: [PATCH] Upgrade guide (to current) (#1194) * Upgrade guide (to current) * ClassOf * JSON example * s/srml/interfaces/ * Typos * Update UPGRADING.md Co-Authored-By: Amaury Martiny * Add copy-to-apps script * Properly extend exstended derive types * Round out UPGRADING * Version in CHANGELOG * Typos * Update UPGRADING.md * Update CHANGELOG * Bump common * 0.90.0-beta.0 * Cleanups * Split 0.82 & 0.90 * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update UPGRADING.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update CHANGELOG.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update CHANGELOG.md Co-Authored-By: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Typo * findFunction -> api.findCall --- CHANGELOG.md | 73 ++++++++--- README.md | 2 + UPGRADING.md | 117 ++++++++++++++++++ copy-to-apps.sh | 22 ++++ lerna.json | 2 +- packages/api-contract/package.json | 4 +- packages/api-derive/package.json | 8 +- .../api-derive/src/type/HeaderExtended.ts | 9 +- .../src/type/ReferendumInfoExtended.ts | 8 +- packages/api-metadata/package.json | 10 +- packages/api/package.json | 16 +-- packages/rpc-core/package.json | 10 +- packages/rpc-provider/package.json | 10 +- packages/type-jsonrpc/package.json | 2 +- packages/types/package.json | 8 +- yarn.lock | 30 ++--- 16 files changed, 262 insertions(+), 69 deletions(-) create mode 100644 UPGRADING.md create mode 100755 copy-to-apps.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 50728c989a..2fa7ad6787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,38 +1,56 @@ +# 0.90.0-beta.x + +If you are upgrading form an older version, use the CHANGELOG hand-in-hand with the [migration guide](UPGRADING.md). + +- Support substrate v7 metadata +- The `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. +- Runtime types have been extended and moved to definitions instead of classes + - **Breaking Change** Primitive types for `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. + - **Breaking Change** `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 mili-second resolution) + - **Breaking Change** For creation of types, it is recommended to use `createType(, )` instead of e.g. `new Proposal(...)`. When passing these to methods/queries, construction should not be needed, the raw value can be passed. + - **Breaking Change** For moved types, a previous import would have been from `@polkadot/types`, i.e. `import { SetIndex } from '@polkadot/types`, now just the interfaces (TypeScript) are available via `import { SetIndex } from '@polkadot/types/interfaces` + - `usize` 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. + + # 0.82.0-beta.x - Support for substrate 2.x (master) has been extended, - Additional types have been addedd for the modules - `api.derive.contract` is now `api.derive.contracts` to align with the substrate 2.x rename. (Feture detection is used so it supports both 1.x and 2.x chains) - Addition of `api.derive.elections` -- Support latest substrate 2.x v6 & v7 metadata with module constants using `api.consts`. + +- Support latest substrate 2 v6 metadata with module constants using `api.consts`. - The api now uses the module name for the storage methods, aligning module names for consistency with transactions. The methods of the grandpa module moved from `api.query.grandpaFinality` to `api.query.grandpa`. - Internally the `@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. + - **Breaking Change** Vote interface extends U8a instead of i8. Vote properties can be accessed via the `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` - - An additon to this support, the `Signer` interface has deprecated the `sign` method and replaced it with `signPayload`. Support for the former will be removed in subsequent versions. -- Types have been extended an has been moved to definitions instead of classes for a large number of these type - - - **Breaking Change** For creation of types, it is recommended to use `createType(, )` instead of e.g. `new Proposal(...)`. When passing these to methods, construction should not be neededd, the raw value can be passed. - - **Breaking Change** Vote interface extends U8a instead of I8. Vote properties can be accessed via the `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. - - **Breaking Change** For moved types, a previous import would have been from `@polkadot/types`, i.e. `import { SetIndex } from '@polkaot/types`, not just the definitions are available via `import { SetIndex } from '@polkadot/srml/types` - - 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. - - `usize` 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. + - In addition to this support, the `Signer` interface has deprecated the `sign` method and replaced it with `signPayload` + - Support for the `sign` 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. + # 0.81.1 - The dependency on `@polkadot/keyring` has been removed - if you relied on the API to provide this, you would now need to manually add it -- Update `HeaderExtended` to retrieve author information from substrate 2.x (new `PreRuntime` digests) - `createType` allows for the creation of `[u8; ]` types (opening the door for contract support) - `api.derive.staking.info` now returns the `rewardDestination` - Fix for disconnection when default providers (non-specified) are used - Don't console.log type decoding errors and then throw, only re-throw with additional info - Support latest substrate 2.x v5 metadata + - Add `ApprovalFlag`, `SetIndex`, `VoterInfo` types for council as per substrate + - Update `ContractInfo` to match substrate master + - Add support for new inherent digests from substrate. -- **Breaking change** Because of the new `Seal`, the old/new Seals are not compatible. If you were using the old `Seal` from the `Digest`s, you would now use `isSealV0` for the pre-substrate 1.0 version and the new `isSeal` for the current version -- Add `ApprovalFlag`, `SetIndex`, `VoterInfo` types for council as per substrate -- Update `ContractInfo` to match substrate master + - **Breaking change** Because of the new `Seal`, the old/new Seals are not compatible. If you were using the old `Seal` from the `Digest`s, you would now use `isSealV0` for the pre-substrate 1.0 version and the new `isSeal` for the current version + - Update `HeaderExtended` to retrieve author information from substrate 2.x (new `PreRuntime` digests) + - Cater for `Vec`, `Option`, `Result`, tuples and fixed vectors for contracts ABIs - Additional examples for subscriptions using multi - Add `off` method to `Api` (Base, for both `ApiPromise` & `ApiRx`) to remove an event listener + # 0.80.1 - Support for mortal transactions @@ -42,6 +60,7 @@ - Updated metadata for current substrate master - Misc. cleanups and fixes + # 0.79.1 - DoubleMap query support @@ -53,6 +72,7 @@ - Breaking: rename `meta.arguments` to `meta.args` in function metadata (`arguments` is a JS reserved word) - Add `toRawType` on all type classes (breakdown into primitive types) + # 0.78.1 - Fix linked-maps (not working since 0.77.1) @@ -63,11 +83,13 @@ - Do type assertion on all exposed asXXX getters - Metadata updates for substrate (WithdrawReasons, ContractInfo) + # 0.77.1 - Support Metadata v4, which introduces the use of a custom hasher to hash storage map keys. - Add TresuryProposal (not the same as democracy, type aliassed) + # 0.76.1 - Caching improvements (duplicate queries, no duplicate subscriptions) @@ -75,17 +97,22 @@ - Update @polkadot/keyring to enable Alice's stash account on dev chains - Update @polkadot/util-crypto with smaller footprint + # 0.75.1 - Start journey to 1.0 + # 0.53.1 - Change spelling to US English as per substrate master (1.0-rc1). Breaking changes as a result: - For extrinsic status results, if you have checked the type returns, i.e. `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`) - If using `subscribeFinalisedHeads` update this to `subscribeFinalizedHeads` (likewise `getFinalisedHead` should be updated to `getFinalizedHead` and `derive.bestNumberFinalized`) -- The underlying ss58 addess checksums have changed in the keyring along with the latest specs -- All examples have been updated with sr25519 addresses (with the new checksums) + +- The underlying ss58 addess checksums have changed + - The updated keyring with support for this has been made available + - All examples have been updated with sr25519 addresses (with the new checksums) + # 0.52.1 @@ -96,35 +123,42 @@ - Allow parsing of V3 metadata with DoubleMap support - Check for single instances for api and types as they are loaded (assertSingletonPackage) + # 0.51.1 - Support metadata V2 as per latest substrate master - Update metadata with new types as per lastest substrate master + # 0.50.1 - Lastest util-crypto (usage of WASM with JS fallbacks if not available) - Update upstream @polkadot dependencies (for new crypto) + # 0.49.1 - Fix large message signing on non-known nodes (default is now hashing, there has been enough time between upgrades) + # 0.48.1 - Pull in new sr25519 capable keyring for dev nodes - When using dev mode, it assumes that the node is the latest with derived sr25519 keys + # 0.47.1 - Swap to publishing -beta.x on merge (non-breaking testing) + # 0.46.1 - Extended type registration to now handle internal types as well. Additionally the built-in Extrinsic type can now we overridden with a custom version. - Where `Extrinsic` and `Method` is used as types, considder importing `{ IMethod, IExtrinsic }` from `@polkadot/types/types`, especially in the cases where this is uased from a `SubmittableExtrinsic` - The `typeRegistry` constant is now `getTypeRegistry()` as a function + # 0.45.1 - Storage with option values now correctly return `Option` and is indicated as such in the documentation @@ -141,6 +175,7 @@ const llo = await api.query.session.lastLengthChange(); console.log('llo', llo.unwrapOr('not set') /* Option */) ``` + # 0.44.1 - Split primitives and types into seperate folders. This should not affect external use since the exports remain the same, however does have an impact where classes are referenced directly. e.g. @@ -158,37 +193,45 @@ import Signature from '@polkadot/types/type/Signature'; import { Method, Signature } from '@polkadot/types'; ``` + # 0.43.1 - Intrduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considerred breaking since @polkadot/keyring has interface changes. (Unless needed, don't rush the upgrade) + # 0.42.1 - Support for substrate hash signing with implVersion >= 18 - Changed signatures for Extrinsic signing, this should not have (much) of an impact since it is generally not used directly. SubmittableExtrinsic (as exposed by the API), supports the old-style use. + # 0.41.1 - Support the V1 metadata specification from Substrate in addition to the currently testnet-active V0 version + # 0.40.1 - The API interfaces now require a WS-compatible provider, e.g. subscription support is a must. Previously the HTTPProvider could be use (although it was very limited in the interactions). + # 0.39.1 - The Promise API now returns a `Promise` instead of `UnsubFunction` when making subscriptions. + # 0.38.1 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. + # 0.37.1 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 derivates 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. + # 0.36.1 Api Promise has been updated in the way we deal with subscriptions. Previously a subscription returned `Promise` 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. @@ -199,10 +242,12 @@ const unsubscribe = api.query.balance.freeBalance(Alice, (balance) => {...}); unsubscribe(); // here we destroy the subscription ``` + # 0.35.1 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. + # 0.34.1 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. diff --git a/README.md b/README.md index cb9dc553ba..a58aa90cbc 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ This library provides a clean wrapper around all the methods exposed by a Polkadot/Subtrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/api/). +If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides when changing versions. + ## tutorials Looking for tutorials to get started? Look at [examples](https://polkadot.js.org/api/examples/promise/) for guides on how to use the API to make queries and submit transactions. diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000000..615c7f5eca --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,117 @@ +# Upgrade guide + +This is an upgrade guide for users of the API. It does not attempt to detail each version (the [CHANGELOG](CHANGELOG.md) has all the changes between versions), but rather tries to explain the rationale behind major breaking changes and how users of the API should handle this. + +While we try to keep the user-facing interfaces as stable as possible, sometimes you just need to make additions to move forward and improve things down the road, as painful as they may be. Like you, we are also users of the API, and eat our own dogfood - and as such, feel any pains introduced first. + +## 0.90.0-beta.0 (and newer), from 0.81.1 (and older) + +The 0.90.0-beta.0 release caters for the [Kusama network](https://kusama.network/) and pulls in all the changes to support [Substrate 2.x](https://github.com/paritytech/substrate), all while maintaining backwards compatibility to allow operation on networks such as [Polkadot's Alexander](https://polkadot.network/). + +To support the network and the new transaction formats, a number of changes were made to how extrinsics are handled and signed. In addition, as support for ongoing work where type definitions are to be supplied by the actual node metadata, the foundation has been laid to move to type definitions as opposed to classes for runtime types. + +### Modules + +The first thing to be aware of is breakages when connecting to any new network, here older networks such as Alex are unaffected - the node metadata defines exactly what is available to the chain, so endpoints that worked yesterday still works today. + +There will no doubt be breakages in using calls to now non-existent endpoints (as populated by the metadata) if you are upgrading your nodes to Substrate 2.x. Substrate 2.x has had a number of internal changes, where new modules and features are introduced (such as `babe` and `technicalCommittee`), some modules have been renamed (such as `contract` -> `contracts`) and modules such as `session` has been reworked to a large degree. + +To cater for both 1.x and 2.x support, the [@polkadot/api-derive](packages/api-derive) endpoints, do feature detection for the node type and should continue working as-is. Additionally, a number of new derives have been added, specifically around elections. + +### Type renames + +To better align with the actual types from the metadata, and avoid (too much) context switching, some types from the `@polkadot/types` have been renamed. These include - + +- `Vector` -> `Vec` +- `U{8|16|32|64|128|256}` have been removed, only the lowercase version of these remain, i.e. `u32`. + +### Type usage + +The [@polkadot/api](packages/api) has always handled the conversion of types for parameters when making calls or queries. For example, when making a transfer to `BOB` (address), any of the following is valid - + +- `api.tx.balances.transfer(BOB, 12345)` - value specied as a number +- `api.tx.balances.transfer(BOB, '12345')` - value specied as a string +- `api.tx.balances.transfer(BOB, '0x3039')` - value specied as a hex +- `api.tx.balances.transfer(BOB, new BN(12345))` - value specied as a [BN](https://github.com/indutny/bn.js/) + +Internally the API will take the input and convert the value into a `Balance`, serialize it using the SCALE codec and transfer it to the node. In some cases users would construct the `Balance` type manually, by importing the class and calling `new` on it. This last approach has now been removed, and where classes are still available (limited reach), discouraged. + +First the rationale behind this - in all cases Substrate is very flexible, so while Polkadot (and the Substrate base), define `type Balance = u128`, this can be different between chains. (This also applies to the majority of built-in supported types). As such, type construction should be done via the actual registered types. + +```js +// this is applicable everywhere, import the type creator, using the registry +import { createType } from '@polkadot/types'; + +// construct the Balance, of type Balance (type is inferred and available with TS) +const value = createType('Balance', 12345); + +// use value here as you normally would +... +``` + +The impact of this will be noticeable, if you have been importing the old-style type classes from `@polkadot/types`, those imports are not available anymore. For creation, just pass everything through the `createType`. + +If a TypeScript user, you can find the updated type (it is a type definition only, not a class), under `@polkadot/types/interfaces`. To do type casting, using interfaces - + +```js +// import the TypeScript runtime interfaces we wish to use +import { Balance, Hash } from '@polkadot/types/interfaces'; + +// import the primitives we wish to use +import { createType, Compact, Vec, u32 } from '@polkadot/types'; + +// define an interface we want to use inside our code +interface MyProps { + balance: Compact; + changes: Vec; + counter?: u32; +} + +// assign something to this structure +const props = { + balance: createType('Compact', 12345), + changes: createType('Vec', []) // empty for now +}; +``` + +### Type definitions + +One of the major pain points in working with a custom Substrate node is the definition of types to cater for chains. There are 2 approaches: defining types via a JSON format or extending your own classes in TypeScript (or JS) and injecting these. For the latter category, there are some impacts in the way you define these. + +If using JSON definitions, nothing changes, your types are still defined as - + +```json +{ + "MyStruct": { + "balance": "Compact", + "values": "Vec", + "counter": "u32" + } +} +``` + +For the definition of any structures using the Substrate specific types as classes, some adjustments are needed. Since the base modules types are now not available in classes, however it is needed for definitions, the following approach is encouraged - + +```js +// import the ClassOf, it works the same as `createType` (along with type detection) +// and acts as a replacement for the direct import and use of specific classes +import { ClassOf, Struct, u32 } from '@polkadot/types'; + +export class MyStruct extends Struct { + constructor (value?: any) { + super({ + balance: ClassOf('Compact'), + values: ClassOf('Vec'), + counter: u32 + }, value); + } +} +``` + +Internally the [@polkadot/types](packages/types) package now only defines classes where there are specific encoding logic applied. For all other types, the definitions are done via a JSON-like format and then the TypeScript definitions are generated from these. (In a world where nodes inject types and the type definitions are not needed, this functionality will be useful to allow TS devs to auto-generate type definitions based on what the node defines.) + +### Signing transactions (Signer interface) + +For users of the API signer interfaces (such as extensions and mobile signers), the interfaces have undergone some changes to cater for the extrinsic v2 format as defined by Substrate. If you are only supporting current chains (e.g. Alexander), no changes are required, however the old `sign` interface does not support chains such as Kusama, so all users are encouraged to upgrade to the new `signPayload` interface. + +This has already been implemented in both the [polkadot-js extension](https://github.com/polkadot-js/extension/blob/5f22f67d558655c605eb6f6beecef6826ed6c159/packages/extension/src/page/Signer.ts#L16v) as well as the [simple single signer](https://github.com/polkadot-js/api/blob/d56905d1b566be6f17eb570ac01448378fc91b67/packages/api/test/util/SingleAccountSigner.ts#L37). diff --git a/copy-to-apps.sh b/copy-to-apps.sh new file mode 100755 index 0000000000..026e86f49b --- /dev/null +++ b/copy-to-apps.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +function copy_folder () { + SRC="packages/$1/build" + DST="apps/node_modules/@polkadot/$2" + + echo "** Copying $SRC to apps/$DST" + + rm -rf ../$DST + cp -r $SRC ../$DST +} + +yarn polkadot-dev-build-ts + +copy_folder "api" "api" +copy_folder "api-contract" "api-contract" +copy_folder "api-derive" "api-derive" +copy_folder "api-metadata" "api-metadata" +copy_folder "rpc-core" "rpc-core" +copy_folder "rpc-provider" "rpc-provider" +copy_folder "type-jsonrpc" "jsonrpc" +copy_folder "types" "types" diff --git a/lerna.json b/lerna.json index 032f18273e..a7c0b790db 100644 --- a/lerna.json +++ b/lerna.json @@ -9,5 +9,5 @@ "packages": [ "packages/*" ], - "version": "0.82.0-beta.96" + "version": "0.90.0-beta.0" } diff --git a/packages/api-contract/package.json b/packages/api-contract/package.json index 44f8e0f530..68c2186fe7 100644 --- a/packages/api-contract/package.json +++ b/packages/api-contract/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/api-contract", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Interfaces for interacting with contracts and contract ABIs", "main": "index.js", "keywords": [ @@ -27,6 +27,6 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/types": "^0.82.0-beta.96" + "@polkadot/types": "^0.90.0-beta.0" } } diff --git a/packages/api-derive/package.json b/packages/api-derive/package.json index 2b423ad364..a7c53ec81c 100644 --- a/packages/api-derive/package.json +++ b/packages/api-derive/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/api-derive", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Common functions used across Polkadot, derived from RPC calls and storage queries.", "main": "index.js", "keywords": [ @@ -28,10 +28,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/api": "^0.82.0-beta.96", - "@polkadot/types": "^0.82.0-beta.96" + "@polkadot/api": "^0.90.0-beta.0", + "@polkadot/types": "^0.90.0-beta.0" }, "devDependencies": { - "@polkadot/keyring": "^0.95.0-beta.1" + "@polkadot/keyring": "^0.95.0-beta.2" } } diff --git a/packages/api-derive/src/type/HeaderExtended.ts b/packages/api-derive/src/type/HeaderExtended.ts index b658cb26dc..ff1ad897a1 100644 --- a/packages/api-derive/src/type/HeaderExtended.ts +++ b/packages/api-derive/src/type/HeaderExtended.ts @@ -3,17 +3,20 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { AccountId, Header } from '@polkadot/types/interfaces'; - -import { AnyJsonObject } from '@polkadot/types/types'; +import { AnyJsonObject, Constructor } from '@polkadot/types/types'; import { u64, ClassOf } from '@polkadot/types'; +// This is a bit hacky, but is exactly what it resolves to when compiled - +// and as a bonus is gets the typing right +const _Header: Constructor
= ClassOf('Header'); + /** * @name HeaderExtended * @description * A [[Block]] header with an additional `author` field that indicates the block author */ -export default class HeaderExtended extends ClassOf('Header') { +export default class HeaderExtended extends _Header { private _author?: AccountId; public constructor (header: Header | null = null, sessionValidators: AccountId[] = []) { diff --git a/packages/api-derive/src/type/ReferendumInfoExtended.ts b/packages/api-derive/src/type/ReferendumInfoExtended.ts index ab552d5ebd..dbb6469174 100644 --- a/packages/api-derive/src/type/ReferendumInfoExtended.ts +++ b/packages/api-derive/src/type/ReferendumInfoExtended.ts @@ -3,17 +3,21 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy'; +import { AnyJsonObject, Constructor } from '@polkadot/types/types'; import BN from 'bn.js'; import { ClassOf, createType } from '@polkadot/types'; -import { AnyJsonObject } from '@polkadot/types/types'; + +// This is a bit hacky, but is exactly what it resolves to when compiled - +// and as a bonus is gets the typing right +const _ReferendumInfo: Constructor = ClassOf('ReferendumInfo'); /** * @name ReferendumInfoExtended * @description * A [[ReferendumInfo]] with an additional `index` field */ -export default class ReferendumInfoExtended extends ClassOf('ReferendumInfo') { +export default class ReferendumInfoExtended extends _ReferendumInfo { private _index: ReferendumIndex; public constructor (value: ReferendumInfo | ReferendumInfoExtended, index?: BN | number) { diff --git a/packages/api-metadata/package.json b/packages/api-metadata/package.json index 92e771418d..367130ee79 100644 --- a/packages/api-metadata/package.json +++ b/packages/api-metadata/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/api-metadata", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Helpers to extract information from runtime metadata", "main": "index.js", "publishConfig": { @@ -27,11 +27,11 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/types": "^0.82.0-beta.96", - "@polkadot/util": "^0.95.0-beta.1", - "@polkadot/util-crypto": "^0.95.0-beta.1" + "@polkadot/types": "^0.90.0-beta.0", + "@polkadot/util": "^0.95.0-beta.2", + "@polkadot/util-crypto": "^0.95.0-beta.2" }, "devDependencies": { - "@polkadot/keyring": "^0.95.0-beta.1" + "@polkadot/keyring": "^0.95.0-beta.2" } } diff --git a/packages/api/package.json b/packages/api/package.json index 70c91d0365..94f6b87fb2 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/api", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Promise and RxJS wrappers around the Polkadot JS RPC", "main": "index.js", "keywords": [ @@ -27,14 +27,14 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/api-derive": "^0.82.0-beta.96", - "@polkadot/api-metadata": "^0.82.0-beta.96", - "@polkadot/rpc-core": "^0.82.0-beta.96", - "@polkadot/rpc-provider": "^0.82.0-beta.96", - "@polkadot/types": "^0.82.0-beta.96", - "@polkadot/util-crypto": "^0.95.0-beta.1" + "@polkadot/api-derive": "^0.90.0-beta.0", + "@polkadot/api-metadata": "^0.90.0-beta.0", + "@polkadot/rpc-core": "^0.90.0-beta.0", + "@polkadot/rpc-provider": "^0.90.0-beta.0", + "@polkadot/types": "^0.90.0-beta.0", + "@polkadot/util-crypto": "^0.95.0-beta.2" }, "devDependencies": { - "@polkadot/keyring": "^0.95.0-beta.1" + "@polkadot/keyring": "^0.95.0-beta.2" } } diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index b3838be4bc..0e84806f07 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/rpc-core", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "main": "index.js", "keywords": [ @@ -27,10 +27,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/jsonrpc": "^0.82.0-beta.96", - "@polkadot/rpc-provider": "^0.82.0-beta.96", - "@polkadot/types": "^0.82.0-beta.96", - "@polkadot/util": "^0.95.0-beta.1", + "@polkadot/jsonrpc": "^0.90.0-beta.0", + "@polkadot/rpc-provider": "^0.90.0-beta.0", + "@polkadot/types": "^0.90.0-beta.0", + "@polkadot/util": "^0.95.0-beta.2", "rxjs": "^6.5.2" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 507352d29a..27bff9b3a0 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/rpc-provider", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Transport providers for the API", "main": "index.js", "keywords": [ @@ -27,16 +27,16 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/api-metadata": "^0.82.0-beta.96", - "@polkadot/util": "^0.95.0-beta.1", - "@polkadot/util-crypto": "^0.95.0-beta.1", + "@polkadot/api-metadata": "^0.90.0-beta.0", + "@polkadot/util": "^0.95.0-beta.2", + "@polkadot/util-crypto": "^0.95.0-beta.2", "@types/nock": "^10.0.3", "eventemitter3": "^4.0.0", "isomorphic-fetch": "^2.2.1", "websocket": "^1.0.29" }, "devDependencies": { - "@polkadot/keyring": "^0.95.0-beta.1", + "@polkadot/keyring": "^0.95.0-beta.2", "mock-socket": "^8.0.5", "nock": "^10.0.4" } diff --git a/packages/type-jsonrpc/package.json b/packages/type-jsonrpc/package.json index 5df1df4f42..bf5bbf4e7e 100644 --- a/packages/type-jsonrpc/package.json +++ b/packages/type-jsonrpc/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/jsonrpc", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Method definitions for the Polkadot RPC layer", "main": "index.js", "publishConfig": { diff --git a/packages/types/package.json b/packages/types/package.json index efa4c8cdf8..716edbb6f1 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/types", - "version": "0.82.0-beta.96", + "version": "0.90.0-beta.0", "description": "Implementation of the Parity codec", "main": "index.js", "keywords": [ @@ -27,12 +27,12 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/util": "^0.95.0-beta.1", - "@polkadot/util-crypto": "^0.95.0-beta.1", + "@polkadot/util": "^0.95.0-beta.2", + "@polkadot/util-crypto": "^0.95.0-beta.2", "@types/memoizee": "^0.4.2", "memoizee": "^0.4.14" }, "devDependencies": { - "@polkadot/keyring": "^0.95.0-beta.1" + "@polkadot/keyring": "^0.95.0-beta.2" } } diff --git a/yarn.lock b/yarn.lock index a9923e65c8..be54e2b755 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1853,14 +1853,14 @@ typescript "^3.5.3" vuepress "^1.0.2" -"@polkadot/keyring@^0.95.0-beta.1": - version "0.95.0-beta.1" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.95.0-beta.1.tgz#f117e7dbcb3648d489b08400f72571bb3bc530a4" - integrity sha512-2Y3tdyX8qzEZ5hBuP0okeX9mapx4CtkAWxaJq10j4KlrYgNaaaAEvofzQDkJQnavcy76unwfXLcryJ2WDcKikA== +"@polkadot/keyring@^0.95.0-beta.2": + version "0.95.0-beta.2" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.95.0-beta.2.tgz#fc3dde2bb45fabb0ee992c060c7c692ee27436da" + integrity sha512-EeDIE4XeWGCviRwLBVJ1EvQvwzNvDh9PZrk0Ed0TRERTg+x3tC8s7pkSqKXzElmQqliXMJmpkTKcH/YEnyTN0Q== dependencies: "@babel/runtime" "^7.5.5" - "@polkadot/util" "^0.95.0-beta.1" - "@polkadot/util-crypto" "^0.95.0-beta.1" + "@polkadot/util" "^0.95.0-beta.2" + "@polkadot/util-crypto" "^0.95.0-beta.2" "@polkadot/ts@^0.1.62": version "0.1.62" @@ -1869,13 +1869,13 @@ dependencies: "@types/chrome" "^0.0.86" -"@polkadot/util-crypto@^0.95.0-beta.1": - version "0.95.0-beta.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.95.0-beta.1.tgz#d66fdf9c23aebf89056eaf30463108726d6c1fb7" - integrity sha512-KooBWOeTCAPxfDWnkcmskBArhfqyjMAaQltVGD8DfdOIBN2jji1ERq3tMi3PWzuyP6EUX8tP8CJ/6f43sJzKMg== +"@polkadot/util-crypto@^0.95.0-beta.2": + version "0.95.0-beta.2" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.95.0-beta.2.tgz#74ce062bf9ad6325b7fa0f2bc1bfd6759044036f" + integrity sha512-P7Q0fCwhxJGUfISjUs2C2Cfz6zDjbGWfwOIOTXrvcDkuT+NXrfCxMpm70N5H4Rsu1WNEwlJegDyzg1HFL9cWVQ== dependencies: "@babel/runtime" "^7.5.5" - "@polkadot/util" "^0.95.0-beta.1" + "@polkadot/util" "^0.95.0-beta.2" "@polkadot/wasm-crypto" "^0.13.1" "@types/bip39" "^2.4.2" "@types/bs58" "^4.0.0" @@ -1891,10 +1891,10 @@ tweetnacl "^1.0.1" xxhashjs "^0.2.2" -"@polkadot/util@^0.95.0-beta.1": - version "0.95.0-beta.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.95.0-beta.1.tgz#c36b0ea10e7385e31c89d400ae9cd5cc3ccfd32a" - integrity sha512-awFjVNZKvMWiezSg7PFpeED1NgcjQ3DuC7XjiI6tiUGfmcLAgJiG8zevIuU7dhLUAdMBUp8DfynV7S/r7+epWA== +"@polkadot/util@^0.95.0-beta.2": + version "0.95.0-beta.2" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.95.0-beta.2.tgz#50b56475206e9d1fdb641dd609f5ccbae21b08ab" + integrity sha512-yw4hERjg7O0Rm33MbVrlIyBmpmNuzc+tJ9t8cEUXfZO1Q0AQFVa2zd6KnKDWFJ2BkQJQTRWgYuUvUgGhFGr1nw== dependencies: "@babel/runtime" "^7.5.5" "@types/bn.js" "^4.11.5"