Bump API, Compact<Index> support (#563)

* Bump API, Compact<Index> support

* Bump for 0.38

* Allow numberFormat to format Compact

* Re-instate new compact API

* Update static Vector display
This commit is contained in:
Jaco Greeff 2019-01-08 19:39:47 +01:00 committed by GitHub
parent c7e90add8b
commit 43a4da151a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 100 additions and 91 deletions

View File

@ -12,7 +12,7 @@
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.30",
"@polkadot/storage": "^0.37.6",
"@polkadot/storage": "^0.38.1",
"@polkadot/ui-react-rx": "^0.21.19"
}
}

View File

@ -11,7 +11,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/types": "^0.37.6",
"@polkadot/types": "^0.38.1",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/util-crypto": "^0.33.30"
}

View File

@ -11,7 +11,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/types": "^0.37.6",
"@polkadot/types": "^0.38.1",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-signer": "^0.21.19"
}

View File

@ -12,7 +12,7 @@
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-keyring": "^0.24.25",
"@polkadot/ui-keyring": "^0.24.27",
"@polkadot/ui-signer": "^0.21.19"
}
}

View File

@ -13,6 +13,6 @@
"@babel/runtime": "^7.2.0",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-react-rx": "^0.21.19",
"@polkadot/ui-settings": "^0.24.25"
"@polkadot/ui-settings": "^0.24.27"
}
}

View File

@ -13,9 +13,9 @@
"@babel/runtime": "^7.2.0",
"@polkadot/app-explorer": "^0.21.19",
"@polkadot/keyring": "^0.33.30",
"@polkadot/storage": "^0.37.6",
"@polkadot/storage": "^0.38.1",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-keyring": "^0.24.25",
"@polkadot/ui-keyring": "^0.24.27",
"@polkadot/ui-react-rx": "^0.21.19"
}
}

View File

@ -12,6 +12,6 @@
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-keyring": "^0.24.25"
"@polkadot/ui-keyring": "^0.24.27"
}
}

View File

@ -12,7 +12,7 @@
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-keyring": "^0.24.25",
"@polkadot/ui-keyring": "^0.24.27",
"@polkadot/ui-react-rx": "^0.21.19"
}
}

View File

@ -26,7 +26,7 @@
"@polkadot/app-transfer": "^0.21.19",
"@polkadot/app-vanitygen": "^0.21.19",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-assets": "^0.24.25",
"@polkadot/ui-assets": "^0.24.27",
"@polkadot/ui-signer": "^0.21.19"
}
}

View File

@ -11,11 +11,11 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/types": "^0.37.6",
"@polkadot/ui-identicon": "^0.24.25",
"@polkadot/ui-keyring": "^0.24.25",
"@polkadot/types": "^0.38.1",
"@polkadot/ui-identicon": "^0.24.27",
"@polkadot/ui-keyring": "^0.24.27",
"@polkadot/ui-react-rx": "^0.21.19",
"@polkadot/ui-settings": "^0.24.25",
"@polkadot/ui-settings": "^0.24.27",
"@types/chart.js": "^2.7.42",
"@types/i18next": "^12.1.0",
"@types/i18next-browser-languagedetector": "^2.0.1",

View File

@ -41,24 +41,27 @@ class Vector extends React.PureComponent<Props, State> {
Component: findComponent(sub as TypeDef),
type,
values: isDisabled || prevState.values.length === 0
? value
? value.map((value: any) =>
!isDisabled || value.isValid
? value
: {
isValid: true,
value
}
)
: prevState.values
};
}
render () {
const { className, defaultValue, isDisabled, style, type, withLabel } = this.props;
const { Component } = this.state;
const { className, isDisabled, style, type, withLabel } = this.props;
const { Component, values } = this.state;
const subType = type.sub as TypeDef;
if (!Component) {
return null;
}
const subType = type.sub as TypeDef;
const values: Array<RawParam> = isDisabled
? defaultValue.value || []
: this.state.values;
return (
<Bare
className={className}

View File

@ -31,8 +31,8 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-react-rx#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/api": "^0.37.6",
"@polkadot/types": "^0.37.6",
"@polkadot/api": "^0.38.1",
"@polkadot/types": "^0.38.1",
"rxjs-compat": "^6.3.2"
}
}

View File

@ -3,13 +3,19 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
import { Compact } from '@polkadot/types/codec';
import { bnToBn } from '@polkadot/util';
import decimalFormat from './decimalFormat';
export default function numberFormat (value?: BN | number | null): string {
if (!value) {
export default function numberFormat (_value?: Compact | BN | number | null): string {
if (!_value) {
return '0';
}
return decimalFormat((value as number).toString());
const value = _value instanceof Compact
? _value.toBn()
: bnToBn(_value);
return decimalFormat(value.toString());
}

View File

@ -12,6 +12,6 @@
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/ui-app": "^0.21.19",
"@polkadot/ui-keyring": "^0.24.25"
"@polkadot/ui-keyring": "^0.24.27"
}
}

126
yarn.lock
View File

@ -1369,17 +1369,17 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
"@polkadot/api@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.37.6.tgz#ac0fcdbaedc0fd58abfad754ecd92f4937749618"
integrity sha512-n6jo7BFzz8q4Dn/3++yTji9TjkyDxJ8Kvr+l5e55wzAAI+m0zQmGJ2JrzdqsXVqaD7fjZlR4fC61VS2YxLfeow==
"@polkadot/api@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.38.1.tgz#52f578b55d8e5e807d453fd1613d82bec3b9a668"
integrity sha512-es9zAdeMZ5Vmn8nHs0i4EH4leVbuRlkqHdqnuXkkJAU1QSQYXvE39FCQDoEX6dPSThq62PxbdZ+4+BNU7V94mQ==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/extrinsics" "^0.37.6"
"@polkadot/rpc-provider" "^0.37.6"
"@polkadot/rpc-rx" "^0.37.6"
"@polkadot/storage" "^0.37.6"
"@polkadot/types" "^0.37.6"
"@polkadot/extrinsics" "^0.38.1"
"@polkadot/rpc-provider" "^0.38.1"
"@polkadot/rpc-rx" "^0.38.1"
"@polkadot/storage" "^0.38.1"
"@polkadot/types" "^0.38.1"
"@types/rx" "^4.1.1"
rxjs "^6.3.3"
@ -1459,19 +1459,19 @@
typedoc-plugin-no-inherit "^1.1.1"
typescript "^3.2.2"
"@polkadot/extrinsics@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.37.6.tgz#114e46922c550449c10f60463c62af5d8663e0e3"
integrity sha512-lycUEEhLaQ1v0VQbidLixuO8G212yb8s9SmgMkGRZxk+GFBRXHir1/2pY253IMgWYfcjXBhCkUooBBPPNC0YSg==
"@polkadot/extrinsics@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.38.1.tgz#bdb5b9dc53da484523c046ff900616bef9f62e87"
integrity sha512-2jqoTlRUEAuah+etYh4kvUN9cqwR7Wuln+2/8SITwM3z61ZUH0elvEAEJD57JZhgbDDYCxh58BsEyB1adr+vKw==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/types" "^0.37.6"
"@polkadot/types" "^0.38.1"
"@polkadot/util" "^0.33.30"
"@polkadot/jsonrpc@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.37.6.tgz#9ec737f7dff710a54c9964f7f945a9b9ab40e5c2"
integrity sha512-n34Wh6ZWiTHgjuxMmYtmzaVTIFXRJGtujiJehhKQb95IF0KXP4irG132PBU0dW4X29STHV7UbxY63P2McHHAtg==
"@polkadot/jsonrpc@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.38.1.tgz#8e44f9e5be464cded5bd0f6e451d62f70ac2b84a"
integrity sha512-pRkOcZqKafjSnQ7qPqE6TejiDz+FFMgU8hTTJY7WzJ0W2Js1q9cV5eMSvW21rCTwlk3U1wbJqzj2Z2Ck0WQ3Sg==
dependencies:
"@babel/runtime" "^7.2.0"
@ -1486,25 +1486,25 @@
"@types/bs58" "^4.0.0"
bs58 "^4.0.1"
"@polkadot/rpc-core@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.37.6.tgz#4b34d64cbafc6a12e8dca8d47ad680bbca95f855"
integrity sha512-C9sFNO+v5o7hCK1hlNMrDYvWUujziQP2x4tQg4J/FGgnAcPGZ8n+8htPkPaLrNiYWtgRFV5zmDXhGOy43s0SBw==
"@polkadot/rpc-core@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.38.1.tgz#629fc427d107537254834e996dc43190a2b3b710"
integrity sha512-aE8367GMmztiRWAXRccwdcmFDdiSrx7xl7WxllQtBB8Oyi3G448H/E0wgBSe2YQ2xS+GGKvYYEAvhK0yYq0Olw==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/jsonrpc" "^0.37.6"
"@polkadot/rpc-provider" "^0.37.6"
"@polkadot/types" "^0.37.6"
"@polkadot/jsonrpc" "^0.38.1"
"@polkadot/rpc-provider" "^0.38.1"
"@polkadot/types" "^0.38.1"
"@polkadot/util" "^0.33.30"
"@polkadot/rpc-provider@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.37.6.tgz#d23a133fa30c1a3937d83abe9d21417aac44f331"
integrity sha512-R4zc11oDqG66TlTswcKmj6ayb0W6ejjFixihh2XjtPirNSbaoQO0Hzs4ZJyeqYu802aX1LuyL4BrtbTAYaGDKw==
"@polkadot/rpc-provider@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.38.1.tgz#0c2f82dad484557993d27c39d1d0470212ade1cd"
integrity sha512-fv4dbgnBCy9l4W2zIHfaa8JSppvogxYwdZdOsREZSg1Sg1V4PLHtxeZRh6SUKFCefhYPAEB1VTFxobFg8xYvig==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.30"
"@polkadot/storage" "^0.37.6"
"@polkadot/storage" "^0.38.1"
"@polkadot/util" "^0.33.30"
"@polkadot/util-crypto" "^0.33.30"
"@types/nock" "^9.3.0"
@ -1512,25 +1512,25 @@
isomorphic-fetch "^2.2.1"
websocket "^1.0.28"
"@polkadot/rpc-rx@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.37.6.tgz#231326992eff3799fca4a113e10245d6aa335111"
integrity sha512-40NtFiSpnlIIS3gJJAvvdRkXDwCO/s9sDTam2xEVOo2RwKtfb9pnRdNSkdxzpNXM1tkru++2UMYE9dkQdSe7aw==
"@polkadot/rpc-rx@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.38.1.tgz#06967a9319e8b4b194490e62bb899c682840ac8d"
integrity sha512-jiSNpD4jsfmrege8BtXcJyvj7br8FlHEyjJE6Yf0un56RcQEkw0kNaUiu/WX8tq5aZdnxGq2dy3qo8I+IIGWrA==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/rpc-core" "^0.37.6"
"@polkadot/rpc-provider" "^0.37.6"
"@polkadot/rpc-core" "^0.38.1"
"@polkadot/rpc-provider" "^0.38.1"
"@types/rx" "^4.1.1"
rxjs "^6.3.3"
"@polkadot/storage@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.37.6.tgz#ef9e7ed7082760faf92797f31b3854594914d011"
integrity sha512-4C8CzXhUdoyN4KeGLUOqkqRF0hphR7ZZZCX0c2SiQkfMhJOSkifi7vX9MzxaENt4oFcoSWE2V56K3fBZHFopzw==
"@polkadot/storage@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.38.1.tgz#2c0c5e1abd0c10a43d80fb7b0d908f6223972cde"
integrity sha512-N3wcAi/u7bFLnx3XRYWPZn7tQ1pJPivMvwr4hYGkgR0/Xsxkzju3ovGR5So8uTEe7tteqUyS7YCyurrlwTPR1g==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.30"
"@polkadot/types" "^0.37.6"
"@polkadot/types" "^0.38.1"
"@polkadot/util" "^0.33.30"
"@polkadot/util-crypto" "^0.33.30"
@ -1539,52 +1539,52 @@
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.47.tgz#89a7e44ce3274feb446e8102f16499ec6a5b5720"
integrity sha512-UE8Wru0BOk+h0RiDAxo1P5dpk9mZyK1VIJiKKM2vfzQqMCPfKnSuQXXXkNzJ/4dqjRJ6ilYwFkzXQwemJWF0+w==
"@polkadot/types@^0.37.6":
version "0.37.6"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.37.6.tgz#14da5f675f47e05bfdacd3add4f65eecf726d654"
integrity sha512-EOsbIydY9LfnCvW/BABN0ENDmlnEpVRlmlcHarM+VqUkGp9MpLBJWA/PirdPHB6h3x86QOqEtd03JUrHhzhu2g==
"@polkadot/types@^0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.38.1.tgz#427f86d7d59bb735d9bf24a666620c726ddddf14"
integrity sha512-fTLFLovA1d43gnWis9qaBWN/zbQumQBu4CThoh9Ms3bjfXQcWkHPXgGmiT5RkeWaazEEAyAXHytofQ53uQbZ2Q==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.30"
"@polkadot/util" "^0.33.30"
core-js "^2.6.1"
"@polkadot/ui-assets@^0.24.25":
version "0.24.25"
resolved "https://registry.yarnpkg.com/@polkadot/ui-assets/-/ui-assets-0.24.25.tgz#bc65bf5ae64f5b9056d0997351b62ebfd592670c"
integrity sha512-ZWcuWPwnDcdwGyd/q8pqTxczZSe7MKByNRDsMq5aOFAdUiF40AXKlvAVjhTf29ryEEXbOq4D6A9NKuH/mrHAMw==
"@polkadot/ui-assets@^0.24.27":
version "0.24.27"
resolved "https://registry.yarnpkg.com/@polkadot/ui-assets/-/ui-assets-0.24.27.tgz#d896353169c7ee55facf32997414fcb47fbb30b1"
integrity sha512-LT6jK45f+u/djpH6TH4WuI1BZg/uFfjdbiOvYFQwEv71BOnKQnfSog5KBxDC9TRU29dorup7cwlzvwyf5c5/xA==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/ui-identicon@^0.24.25":
version "0.24.25"
resolved "https://registry.yarnpkg.com/@polkadot/ui-identicon/-/ui-identicon-0.24.25.tgz#d65170a56965288cb09af6f407e4fe1b6d1d2d70"
integrity sha512-TbIIeyK/MaRsEidLn/VSN2YvfkNkbxWnSEW9l2Y3DiPmvNOYgqmhja1jLbYv8Knt39kj0DeXQxiCvfOXyXEWbQ==
"@polkadot/ui-identicon@^0.24.27":
version "0.24.27"
resolved "https://registry.yarnpkg.com/@polkadot/ui-identicon/-/ui-identicon-0.24.27.tgz#6c9eaf78937bd7adac5e622333471550e0bc7a9b"
integrity sha512-bj9UA9G4x9Qlb5QC6ScpO3EsiCUoTFAze0jIrnOHdZYaDfZ3ZKAV5mNojDmRFNO8uRCCB0JH77TBW0Hk+xljdg==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.30"
"@polkadot/ui-settings" "^0.24.25"
"@polkadot/ui-settings" "^0.24.27"
"@polkadot/util-crypto" "^0.33.30"
"@types/color" "^3.0.0"
"@types/react-copy-to-clipboard" "^4.2.6"
color "^3.0.0"
react-copy-to-clipboard "^5.0.1"
"@polkadot/ui-keyring@^0.24.25":
version "0.24.25"
resolved "https://registry.yarnpkg.com/@polkadot/ui-keyring/-/ui-keyring-0.24.25.tgz#19fbb2cdff5d27cfa84016df9bffd0fefceb694b"
integrity sha512-PAz/8tPn81/7BSQKG5L5e2/3FsntBS+vB23avpf28TKBx/v3w/8q+DvdDUpmZUYngt78i76EvEog1Y3SKwVMIg==
"@polkadot/ui-keyring@^0.24.27":
version "0.24.27"
resolved "https://registry.yarnpkg.com/@polkadot/ui-keyring/-/ui-keyring-0.24.27.tgz#ceff451ee0c42bb35b75f73c08038844767eaf24"
integrity sha512-1h/qtJAm88ZngosXCxLrGLEGmMGULiy1dB10wTGZyCfkLklsloamMhNRb34LaQHV7ohnGDv9HAxV0qLGzdeOHw==
dependencies:
"@babel/runtime" "^7.2.0"
"@polkadot/keyring" "^0.33.30"
"@polkadot/types" "^0.37.6"
"@polkadot/types" "^0.38.1"
"@types/store" "^2.0.1"
store "^2.0.12"
"@polkadot/ui-settings@^0.24.25":
version "0.24.25"
resolved "https://registry.yarnpkg.com/@polkadot/ui-settings/-/ui-settings-0.24.25.tgz#dbc93cc32c4237552c2c8ea33f97ff6ce134e5ac"
integrity sha512-Mt7FjRz/OZmjFMrVyPgMnMiZ/XAuQgeynaLNqtY7MAF/Zm69FbelcEKQHtJyiW7OB0sn7yvH8P/yJmJ+pKgxZA==
"@polkadot/ui-settings@^0.24.27":
version "0.24.27"
resolved "https://registry.yarnpkg.com/@polkadot/ui-settings/-/ui-settings-0.24.27.tgz#2f04a0b3bb328a8cc37d03ae4dc843d5760088eb"
integrity sha512-J1IZPsiN8jfvqhM7vSoUFdNrUsbGVcKD1xYabywH5HsEBq3UsvG3C081ncwiKoLZO5lYNEb+nWEbfm5TzhWdOw==
dependencies:
"@babel/runtime" "^7.2.0"
"@types/store" "^2.0.1"