From 45e524371e5c3ac4b1bdc15ddbfe598d684c95f1 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 27 Mar 2019 10:25:07 +0100 Subject: [PATCH] Add Key to types, bump util for assert typeof fix (#800) * Add Key to types, bump util for assert typeof fix * Export default * docs --- CHANGELOG.md | 1 + packages/api/package.json | 2 +- packages/rpc-core/package.json | 2 +- packages/rpc-provider/package.json | 6 +++--- packages/type-extrinsics/package.json | 2 +- packages/type-storage/package.json | 6 +++--- packages/types/README.md | 2 +- packages/types/package.json | 4 ++-- packages/types/src/type/Key.ts | 14 +++++++++++++ packages/types/src/type/index.ts | 1 + yarn.lock | 30 +++++++++++++-------------- 11 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 packages/types/src/type/Key.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 167260a267..5d41cd12b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 0.52.1 - Check for single instances for api and types as they are loaded (assertSingletonPackage) +- Add Key type as per latest substrate master # 0.51.1 diff --git a/packages/api/package.json b/packages/api/package.json index ec284e17c5..7a6387d308 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -36,6 +36,6 @@ "@polkadot/rpc-rx": "^0.52.0-beta.0", "@polkadot/storage": "^0.52.0-beta.0", "@polkadot/types": "^0.52.0-beta.0", - "@polkadot/util-crypto": "^0.42.0-beta.0" + "@polkadot/util-crypto": "^0.42.0-beta.1" } } diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index 71a78db7a9..0d2f8d886a 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -33,6 +33,6 @@ "@polkadot/jsonrpc": "^0.52.0-beta.0", "@polkadot/rpc-provider": "^0.52.0-beta.0", "@polkadot/types": "^0.52.0-beta.0", - "@polkadot/util": "^0.42.0-beta.0" + "@polkadot/util": "^0.42.0-beta.1" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 27b0f02868..335dad86fe 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.4.0", - "@polkadot/keyring": "^0.42.0-beta.0", + "@polkadot/keyring": "^0.42.0-beta.1", "@polkadot/storage": "^0.52.0-beta.0", - "@polkadot/util": "^0.42.0-beta.0", - "@polkadot/util-crypto": "^0.42.0-beta.0", + "@polkadot/util": "^0.42.0-beta.1", + "@polkadot/util-crypto": "^0.42.0-beta.1", "@types/nock": "^9.3.1", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/type-extrinsics/package.json b/packages/type-extrinsics/package.json index 79a9e6eea9..ede4a942bb 100644 --- a/packages/type-extrinsics/package.json +++ b/packages/type-extrinsics/package.json @@ -12,6 +12,6 @@ "dependencies": { "@babel/runtime": "^7.4.0", "@polkadot/types": "^0.52.0-beta.0", - "@polkadot/util": "^0.42.0-beta.0" + "@polkadot/util": "^0.42.0-beta.1" } } diff --git a/packages/type-storage/package.json b/packages/type-storage/package.json index 7b6efa531c..b417dd2d80 100644 --- a/packages/type-storage/package.json +++ b/packages/type-storage/package.json @@ -30,9 +30,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme", "dependencies": { "@babel/runtime": "^7.4.0", - "@polkadot/keyring": "^0.42.0-beta.0", + "@polkadot/keyring": "^0.42.0-beta.1", "@polkadot/types": "^0.52.0-beta.0", - "@polkadot/util": "^0.42.0-beta.0", - "@polkadot/util-crypto": "^0.42.0-beta.0" + "@polkadot/util": "^0.42.0-beta.1", + "@polkadot/util-crypto": "^0.42.0-beta.1" } } diff --git a/packages/types/README.md b/packages/types/README.md index 6521d21920..94a93b42c5 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -8,7 +8,7 @@ There primitive types are available: [[Bool]], [[Bytes]], [[Data]], [[H160]], [[ ## Substrate types -These types implement specific types that are found as part of the Substrate base: [[AccountId]], [[AccountIndex]], [[Address]], [[Amount]], [[AssetOf]], [[AttestedCandidate]], [[AuthorityId]], [[Balance]], [[BalanceLock]], [[BalanceOf]], [[Block]], [[BlockNumber]], [[CodeHash]], [[Digest]], [[Event]], [[EventRecord]], [[Exposure]], [[Extrinsic]], [[ExtrinsicEra]], [[ExtrinsicSignature]], [[Gas]], [[Hash]], [[Header]], [[IndividualExposure]], [[InherentOfflineReport]], [[Justification]], [[KeyValue]], [[LockIdentifier]], [[MisbehaviorReport]], [[NewAccountOutcome]], [[Nonce]], [[Origin]], [[ParaId]], [[Perbill]], [[Permill]], [[PrefabWasmModule]], [[PropIndex]], [[Proposal]], [[ProposalIndex]], [[ReferendumIndex]], [[ReferendumInfo]], [[RewardDestination]], [[Schedule]], [[SeedOf]], [[SessionKey]], [[Signature]], [[SignaturePayload]], [[StakingLedger]], [[StoredPendingChange]], [[UnlockChunk]], [[ValidatorPrefs]], [[VestingSchedule]], [[Vote]], [[VoteIndex]], [[VoteThreshold]], [[WithdrawReasons]] +These types implement specific types that are found as part of the Substrate base: [[AccountId]], [[AccountIndex]], [[Address]], [[Amount]], [[AssetOf]], [[AttestedCandidate]], [[AuthorityId]], [[Balance]], [[BalanceLock]], [[BalanceOf]], [[Block]], [[BlockNumber]], [[CodeHash]], [[Digest]], [[Event]], [[EventRecord]], [[Exposure]], [[Extrinsic]], [[ExtrinsicEra]], [[ExtrinsicSignature]], [[Gas]], [[Hash]], [[Header]], [[IndividualExposure]], [[InherentOfflineReport]], [[Justification]], [[Key]], [[KeyValue]], [[LockIdentifier]], [[MisbehaviorReport]], [[NewAccountOutcome]], [[Nonce]], [[Origin]], [[ParaId]], [[Perbill]], [[Permill]], [[PrefabWasmModule]], [[PropIndex]], [[Proposal]], [[ProposalIndex]], [[ReferendumIndex]], [[ReferendumInfo]], [[RewardDestination]], [[Schedule]], [[SeedOf]], [[SessionKey]], [[Signature]], [[SignaturePayload]], [[StakingLedger]], [[StoredPendingChange]], [[UnlockChunk]], [[ValidatorPrefs]], [[VestingSchedule]], [[Vote]], [[VoteIndex]], [[VoteThreshold]], [[WithdrawReasons]] ## Codec types diff --git a/packages/types/package.json b/packages/types/package.json index 70971d0dc6..6b8faf6ea2 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -30,7 +30,7 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "dependencies": { "@babel/runtime": "^7.4.0", - "@polkadot/keyring": "^0.42.0-beta.0", - "@polkadot/util": "^0.42.0-beta.0" + "@polkadot/keyring": "^0.42.0-beta.1", + "@polkadot/util": "^0.42.0-beta.1" } } diff --git a/packages/types/src/type/Key.ts b/packages/types/src/type/Key.ts new file mode 100644 index 0000000000..f6f7bbd274 --- /dev/null +++ b/packages/types/src/type/Key.ts @@ -0,0 +1,14 @@ +// Copyright 2017-2019 @polkadot/types authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +import Bytes from '../primitive/Bytes'; + +/** + * @name Key + * @description + * The Substrate Key representation as a [[Bytes]] (`vec`). + */ + +export default class Key extends Bytes { +} diff --git a/packages/types/src/type/index.ts b/packages/types/src/type/index.ts index 93e4aa6dde..4823e7ae60 100644 --- a/packages/types/src/type/index.ts +++ b/packages/types/src/type/index.ts @@ -37,6 +37,7 @@ export { default as Hash } from './Hash'; export { default as Header, HeaderExtended } from './Header'; export { default as IndividualExposure } from './IndividualExposure'; export { default as InherentOfflineReport } from './InherentOfflineReport'; +export { default as Key } from './Key'; export { default as KeyValue } from './KeyValue'; export { default as LockIdentifier } from './LockIdentifier'; export { default as LockPeriods } from './LockPeriods'; diff --git a/yarn.lock b/yarn.lock index 54ee732087..dc79ac313d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1579,14 +1579,14 @@ typescript "^3.3.4000" vuepress "^1.0.0-alpha.44" -"@polkadot/keyring@^0.42.0-beta.0": - version "0.42.0-beta.0" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.42.0-beta.0.tgz#f43af8a7b0dffc339f0f38517897663f08550660" - integrity sha512-wIL42FRknPMdVZhmEvuAm/A1nmIjyF7ZbJnaTFcpMUByww9CnLtsAJRJutclb8YQ+8yr8QDMeLNPxxcAkkY5pQ== +"@polkadot/keyring@^0.42.0-beta.1": + version "0.42.0-beta.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.42.0-beta.1.tgz#3620097d48dd53527164d00d7e2374447b094fa5" + integrity sha512-tfGCbF3Ey9zcRjnmwfToAmai67F3wsuXsZoCSeHUodhBbbJTUrYKz278F11+W4nslCJ7ZWzpfY1FchfWo74Vkw== dependencies: "@babel/runtime" "^7.4.0" - "@polkadot/util" "^0.42.0-beta.0" - "@polkadot/util-crypto" "^0.42.0-beta.0" + "@polkadot/util" "^0.42.0-beta.1" + "@polkadot/util-crypto" "^0.42.0-beta.1" "@types/bs58" "^4.0.0" bs58 "^4.0.1" @@ -1595,13 +1595,13 @@ resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.56.tgz#ffd6e9c95704a7fb90b918193b9dc5c440114b27" integrity sha512-wnt4zXxZXyz6WaubTO/I+nUElwV2DogFzdl6CrKfVn2PTWp8uHN06W9s40FH57ORtmQfDr9rLRP8Nq+oIyElbg== -"@polkadot/util-crypto@^0.42.0-beta.0": - version "0.42.0-beta.0" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.42.0-beta.0.tgz#28474139cb2f974d6b0d645f17aa0a93bd4ac707" - integrity sha512-9XQVrZcmFkc60tggec/WqArgg04w+xPmEK9icPU4TGLdevnfAP10bTRo7k4o2cEkE/yMRUxdNYuT4U9x29K+PQ== +"@polkadot/util-crypto@^0.42.0-beta.1": + version "0.42.0-beta.1" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.42.0-beta.1.tgz#10832842db802037592436eb50343e7345df9638" + integrity sha512-uvP64cOaBKSmL/pnpYBfVRakQrwvypVtmj4fKVDgs3P7d38h9Kpg9cCcsYoT9jscx0a912QL1xmNJPKNakYWMQ== dependencies: "@babel/runtime" "^7.4.0" - "@polkadot/util" "^0.42.0-beta.0" + "@polkadot/util" "^0.42.0-beta.1" "@polkadot/wasm-crypto" "^0.5.1" "@polkadot/wasm-dalek-ed25519" "^0.5.1" "@polkadot/wasm-schnorrkel" "^0.5.1" @@ -1617,10 +1617,10 @@ tweetnacl "^1.0.1" xxhashjs "^0.2.2" -"@polkadot/util@^0.42.0-beta.0": - version "0.42.0-beta.0" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.42.0-beta.0.tgz#0b6d38c675c463ab2b438bbefaa85e6ba0d34f53" - integrity sha512-1pNTyastJwJX7slWj0pLHs/h7rXujgrkJMu7qQoHkaKKGTsU27gbmF9/Kyg8aP9QrVlTUKBlo1ROPTMEcNN+dQ== +"@polkadot/util@^0.42.0-beta.1": + version "0.42.0-beta.1" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.42.0-beta.1.tgz#93baa0fc129467237b7eb226e14fafffd160f4e9" + integrity sha512-PZC/yArV5D4J//IkqYwPo1rmlLzwf1SDWE4COOSDZJfU1hGjrwucDre/jwtQFQjZAUv458BXiFUHxgEd5dHX2w== dependencies: "@babel/runtime" "^7.4.0" "@types/bn.js" "^4.11.4"