diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..65eb893acb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# 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 `toString` checks are used, i.e. `status.toString() === 'Finalised'` this should not be a breaking change. Deep inspection of the status object however will need to adapt. diff --git a/lerna.json b/lerna.json index 2c4edfcfa4..3b7fadb382 100644 --- a/lerna.json +++ b/lerna.json @@ -9,5 +9,5 @@ "packages": [ "packages/*" ], - "version": "0.33.26" + "version": "0.34.0" } diff --git a/packages/api-observable/package.json b/packages/api-observable/package.json index 05b71e1c69..fc1d8fc0bf 100644 --- a/packages/api-observable/package.json +++ b/packages/api-observable/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/api-observable", - "version": "0.33.26", + "version": "0.34.0", "description": "An Observable wrapper around the Polkadot JS API", "main": "index.js", "keywords": [ @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/extrinsics": "^0.33.26", - "@polkadot/rpc-core": "^0.33.26", - "@polkadot/rpc-provider": "^0.33.26", - "@polkadot/storage": "^0.33.26", + "@polkadot/extrinsics": "^0.34.0", + "@polkadot/rpc-core": "^0.34.0", + "@polkadot/rpc-provider": "^0.34.0", + "@polkadot/storage": "^0.34.0", "@types/rx": "^4.1.1", "rxjs": "^6.3.3" } diff --git a/packages/api/package.json b/packages/api/package.json index 25e5cc7906..fa3b669d3e 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/api", - "version": "0.33.26", + "version": "0.34.0", "description": "An RxJS wrapper around the Polkadot JS RPC", "main": "index.js", "keywords": [ @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/extrinsics": "^0.33.26", - "@polkadot/rpc-provider": "^0.33.26", - "@polkadot/rpc-rx": "^0.33.26", - "@polkadot/storage": "^0.33.26", + "@polkadot/extrinsics": "^0.34.0", + "@polkadot/rpc-provider": "^0.34.0", + "@polkadot/rpc-rx": "^0.34.0", + "@polkadot/storage": "^0.34.0", "@types/rx": "^4.1.1", "core-js": "^2.5.7", "rxjs": "^6.3.3" diff --git a/packages/api/src/promise/SubmittableExtrinsic.ts b/packages/api/src/promise/SubmittableExtrinsic.ts index 9d5ecb0c4e..4b9d9b9952 100644 --- a/packages/api/src/promise/SubmittableExtrinsic.ts +++ b/packages/api/src/promise/SubmittableExtrinsic.ts @@ -8,6 +8,12 @@ import { ApiPromiseInterface } from './types'; import { Extrinsic, ExtrinsicStatus, Hash } from '@polkadot/types/index'; +type SendResult = { + status: ExtrinsicStatus, + // toString for backwards compat, i.e. result.toString() === 'finalised' + toString (): string +}; + export default class SubmittableExtrinsic extends Extrinsic { private _api: ApiPromiseInterface; @@ -17,12 +23,17 @@ export default class SubmittableExtrinsic extends Extrinsic { this._api = api; } - send (statusCb?: (status: ExtrinsicStatus) => any): Promise { + send (statusCb?: (result: SendResult) => any): Promise { if (!statusCb || !this._api.hasSubscriptions) { return this._api.rpc.author.submitExtrinsic(this); } - return this._api.rpc.author.submitAndWatchExtrinsic(this, statusCb); + return this._api.rpc.author.submitAndWatchExtrinsic(this, (status: ExtrinsicStatus) => + statusCb({ + status, + toString: status.toString + }) + ); } sign (signerPair: KeyringPair, nonce: AnyNumber, blockHash?: AnyU8a): SubmittableExtrinsic { diff --git a/packages/api/src/rx/SubmittableExtrinsic.ts b/packages/api/src/rx/SubmittableExtrinsic.ts index 3b0103a8fb..8804f61009 100644 --- a/packages/api/src/rx/SubmittableExtrinsic.ts +++ b/packages/api/src/rx/SubmittableExtrinsic.ts @@ -7,8 +7,15 @@ import { AnyNumber, AnyU8a } from '@polkadot/types/types'; import { ApiRxInterface } from './types'; import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { Extrinsic, ExtrinsicStatus } from '@polkadot/types/index'; +type SendResult = { + status: ExtrinsicStatus, + // toString for backwards compat, i.e. result.toString() === 'finalised' + toString (): string +}; + export default class SubmittableExtrinsic extends Extrinsic { private _api: ApiRxInterface; @@ -18,8 +25,15 @@ export default class SubmittableExtrinsic extends Extrinsic { this._api = api; } - send (): Observable { - return this._api.rpc.author.submitAndWatchExtrinsic(this); + send (): Observable { + return this._api.rpc.author + .submitAndWatchExtrinsic(this) + .pipe( + map((status: ExtrinsicStatus) => ({ + status, + toString: status.toString + })) + ); } sign (signerPair: KeyringPair, nonce: AnyNumber, blockHash?: AnyU8a): SubmittableExtrinsic { diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index dcc11251f7..37cdd106a6 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/rpc-core", - "version": "0.33.26", + "version": "0.34.0", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "main": "index.js", "keywords": [ @@ -30,9 +30,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/jsonrpc": "^0.33.26", - "@polkadot/rpc-provider": "^0.33.26", - "@polkadot/types": "^0.33.26", - "@polkadot/util": "^0.33.17" + "@polkadot/jsonrpc": "^0.34.0", + "@polkadot/rpc-provider": "^0.34.0", + "@polkadot/types": "^0.34.0", + "@polkadot/util": "^0.33.18" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index b0c573f87e..5aaab5f2c3 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/rpc-provider", - "version": "0.33.26", + "version": "0.34.0", "description": "Transport providers for the API", "main": "index.js", "keywords": [ @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/keyring": "^0.33.17", - "@polkadot/storage": "^0.33.26", - "@polkadot/util": "^0.33.17", - "@polkadot/util-crypto": "^0.33.17", + "@polkadot/keyring": "^0.33.18", + "@polkadot/storage": "^0.34.0", + "@polkadot/util": "^0.33.18", + "@polkadot/util-crypto": "^0.33.18", "@types/nock": "^9.3.0", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/rpc-rx/package.json b/packages/rpc-rx/package.json index da366828de..5c3ac1c3ef 100644 --- a/packages/rpc-rx/package.json +++ b/packages/rpc-rx/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/rpc-rx", - "version": "0.33.26", + "version": "0.34.0", "description": "An RxJs wrapper around the Polkadot JS API", "main": "index.js", "keywords": [ @@ -30,8 +30,8 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/rpc-core": "^0.33.26", - "@polkadot/rpc-provider": "^0.33.26", + "@polkadot/rpc-core": "^0.34.0", + "@polkadot/rpc-provider": "^0.34.0", "@types/rx": "^4.1.1", "rxjs": "^6.3.3" } diff --git a/packages/type-extrinsics/package.json b/packages/type-extrinsics/package.json index 4f49f14726..20fb3a0b32 100644 --- a/packages/type-extrinsics/package.json +++ b/packages/type-extrinsics/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/extrinsics", - "version": "0.33.26", + "version": "0.34.0", "main": "index.js", "repository": "https://github.com/polkadot-js/api.git", "author": "Jaco Greeff ", @@ -11,7 +11,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/types": "^0.33.26", - "@polkadot/util": "^0.33.17" + "@polkadot/types": "^0.34.0", + "@polkadot/util": "^0.33.18" } } diff --git a/packages/type-jsonrpc/package.json b/packages/type-jsonrpc/package.json index 1873a2f132..930258393e 100644 --- a/packages/type-jsonrpc/package.json +++ b/packages/type-jsonrpc/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/jsonrpc", - "version": "0.33.26", + "version": "0.34.0", "description": "Method definitions for the Polkadot RPC layer", "main": "index.js", "engines": { diff --git a/packages/type-storage/package.json b/packages/type-storage/package.json index a4fc137a30..b703d7dcc7 100644 --- a/packages/type-storage/package.json +++ b/packages/type-storage/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/storage", - "version": "0.33.26", + "version": "0.34.0", "description": "Generic wrapper wrapper around state storage", "main": "index.js", "engines": { @@ -30,9 +30,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/keyring": "^0.33.17", - "@polkadot/types": "^0.33.26", - "@polkadot/util": "^0.33.17", - "@polkadot/util-crypto": "^0.33.17" + "@polkadot/keyring": "^0.33.18", + "@polkadot/types": "^0.34.0", + "@polkadot/util": "^0.33.18", + "@polkadot/util-crypto": "^0.33.18" } } diff --git a/packages/types/package.json b/packages/types/package.json index 6f6e17ae8c..a9b063041e 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/types", - "version": "0.33.26", + "version": "0.34.0", "description": "Implementation of the Parity codec", "main": "index.js", "keywords": [ @@ -30,7 +30,7 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "dependencies": { "@babel/runtime": "^7.2.0", - "@polkadot/keyring": "^0.33.17", - "@polkadot/util": "^0.33.17" + "@polkadot/keyring": "^0.33.18", + "@polkadot/util": "^0.33.18" } } diff --git a/yarn.lock b/yarn.lock index 3fc0eef393..e4181d8ab5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1369,14 +1369,14 @@ typedoc-plugin-no-inherit "^1.0.2" typescript "^3.2.2" -"@polkadot/keyring@^0.33.17": - version "0.33.17" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.33.17.tgz#8562d782ca0cba837335d5c0788395da13375541" - integrity sha512-FFyiPLwXmHrB4wHHWYKrZpP+QphL09j/HPjwksrI8WgrGkoYR5worNjL8qyDOdqdoKkaR1wWFSRP08bA3zbKPA== +"@polkadot/keyring@^0.33.18": + version "0.33.18" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.33.18.tgz#8fd0a4b6fc23d568ec5799ab333993aa4acf38ce" + integrity sha512-p4LtenOPSH3CuwgKuu6pql4b+WiRSDXaYg0Y9+PznQtAlRwGFqGm7KSyVs0ak7EBNBq6DvRLp3E1AEcDpc3dWg== dependencies: "@babel/runtime" "^7.2.0" - "@polkadot/util" "^0.33.17" - "@polkadot/util-crypto" "^0.33.17" + "@polkadot/util" "^0.33.18" + "@polkadot/util-crypto" "^0.33.18" "@types/bs58" "^3.0.30" bs58 "^4.0.1" @@ -1385,13 +1385,13 @@ resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.43.tgz#e59d86cf6bed833010315c5b301bfea6c05fd4a8" integrity sha512-B7mSH+yrc7PBHMWUfpTFAK0OLgOesWlzkhse0/O8Itu2Rf6YrixEnhUYKEDp7mDO3h2SlBwn6BfVkvY4qvtwgg== -"@polkadot/util-crypto@^0.33.17": - version "0.33.17" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.33.17.tgz#c3b118bb763e45bafc71897cb2f8aacfdce6b7c7" - integrity sha512-jSGmtJjMuXYPrTcaxdnspKwGqFvRZ/9X5TzdPdKl/YW1uTKE/0Uox8WRHEtTZ6R1fmNI6Yb9hptMnV4KcdWiOw== +"@polkadot/util-crypto@^0.33.18": + version "0.33.18" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.33.18.tgz#7fb937794c4130b67a847784578a5def1fce61c2" + integrity sha512-gr/xi3Jl3rX0CXyzfFCIJ02r+s+tKxrP/CiZ80boHeSEvSH9LoFvkrVaHjBaejD3ouAVXLbr2uFq9SdLACY0gg== dependencies: "@babel/runtime" "^7.2.0" - "@polkadot/util" "^0.33.17" + "@polkadot/util" "^0.33.18" "@types/bip39" "^2.4.1" bip39 "^2.5.0" blakejs "^1.1.0" @@ -1399,10 +1399,10 @@ tweetnacl "^1.0.0" xxhashjs "^0.2.2" -"@polkadot/util@^0.33.17": - version "0.33.17" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.33.17.tgz#c7fd79016fdd7b5f71cc7eed990a0c8edca25802" - integrity sha512-eQHt6YrVa578/fXEkrsw5bePGEZPHK4uQ6MYrsBZ7ajgE5iBJOXiMhgh3uopLzG+OtxEWfzk3Oj28/YzRpLdVA== +"@polkadot/util@^0.33.18": + version "0.33.18" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.33.18.tgz#2d0fa95d72de462f389516b5b0c61824099bbff7" + integrity sha512-bvC7/ucrY8Ws2ckRhU0cvI0TNylmcFEEaw97p96w/sHQcMuQH+yBu1VLyUnxIvyV1nX0lrmSqR+s4a9I6R1mMA== dependencies: "@babel/runtime" "^7.2.0" "@types/bn.js" "^4.11.3"