Detect nonce === null, set as new BN(0) (#213)

* Detect nonce === null, set as new BN(0)

* Cleanup previous hacks for null

* Bump common & api

* Bump dependencies

* Bump dependencies
This commit is contained in:
Jaco Greeff 2018-08-10 15:15:18 +02:00 committed by GitHub
parent 10358ff4be
commit 391557dfc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 107 additions and 105 deletions

View File

@ -11,9 +11,9 @@
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/storage": "^0.27.9",
"@polkadot/storage": "^0.27.12",
"@polkadot/ui-react": "^0.19.27",
"@polkadot/ui-react-rx": "^0.19.27",
"@polkadot/util-keyring": "^0.27.9"
"@polkadot/util-keyring": "^0.27.12"
}
}

View File

@ -16,8 +16,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/primitives": "^0.27.9",
"@polkadot/primitives": "^0.27.12",
"@polkadot/ui-app": "^0.19.27",
"@polkadot/util-crypto": "^0.27.9"
"@polkadot/util-crypto": "^0.27.12"
}
}

View File

@ -16,7 +16,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics": "^0.27.9",
"@polkadot/extrinsics": "^0.27.12",
"@polkadot/ui-app": "^0.19.27",
"@polkadot/ui-signer": "^0.19.27",
"react-dropzone": "^4.2.9"

View File

@ -94,8 +94,9 @@ class Account extends React.PureComponent<Props, State> {
);
}
onChangeNonce = (nonce: BN): void => {
onChangeNonce = (_nonce: BN): void => {
const { onChange } = this.props;
const nonce = _nonce || new BN(0);
this.setState({ nonce }, () =>
onChange(this.state.publicKey, nonce)

View File

@ -104,7 +104,7 @@ class Selection extends React.PureComponent<Props, State> {
return {
isValid,
rpc,
nonce,
nonce: nonce || new BN(0),
publicKey,
values
};

View File

@ -12,11 +12,11 @@
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/app-extrinsics": "^0.19.27",
"@polkadot/storage": "^0.27.9",
"@polkadot/storage": "^0.27.12",
"@polkadot/ui-app": "^0.19.27",
"@polkadot/ui-keyring": "^0.19.27",
"@polkadot/ui-react": "^0.19.27",
"@polkadot/ui-react-rx": "^0.19.27",
"@polkadot/util-keyring": "^0.27.9"
"@polkadot/util-keyring": "^0.27.12"
}
}

View File

@ -188,12 +188,12 @@ class Account extends React.PureComponent<Props, State> {
}
private send (extrinsic: SectionItem<Extrinsics>, values: Array<RawParam$Value>) {
const { accountIndex = new BN(0), address, queueExtrinsic } = this.props;
const { accountIndex, address, queueExtrinsic } = this.props;
const publicKey = decodeAddress(address);
queueExtrinsic({
extrinsic,
nonce: accountIndex,
nonce: accountIndex || new BN(0),
publicKey,
values
});

View File

@ -16,8 +16,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics": "^0.27.9",
"@polkadot/storage": "^0.27.9",
"@polkadot/extrinsics": "^0.27.12",
"@polkadot/storage": "^0.27.12",
"@polkadot/ui-keyring": "^0.19.27",
"@polkadot/ui-react": "^0.19.27",
"@polkadot/ui-react-rx": "^0.19.27",

View File

@ -22,7 +22,7 @@
"color": "^3.0.0"
},
"devDependencies": {
"@polkadot/util-crypto": "^0.27.9",
"@polkadot/util-crypto": "^0.27.12",
"xmlserializer": "^0.6.1"
}
}

View File

@ -17,7 +17,7 @@
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/ui-react": "^0.19.27",
"@polkadot/util-keyring": "^0.27.9",
"@polkadot/util-keyring": "^0.27.12",
"store": "^2.0.12"
},
"peerDependencies": {

View File

@ -36,9 +36,9 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/api-rx": "^0.15.6",
"@polkadot/extrinsics": "^0.27.9",
"@polkadot/storage": "^0.27.9",
"@polkadot/api-rx": "^0.15.9",
"@polkadot/extrinsics": "^0.27.12",
"@polkadot/storage": "^0.27.12",
"rxjs-compat": "^6.2.2"
},
"devDependencies": {

View File

@ -7,7 +7,7 @@ import isUndefined from '@polkadot/util/is/undefined';
const re = new RegExp('(dev|loc)', 'i');
export default function isTestChain (chain?: string): boolean {
if (isUndefined(chain) || chain === null) {
if (isUndefined(chain)) {
return false;
}

View File

@ -6,7 +6,7 @@ import BN from 'bn.js';
const NUMBER_REGEX = new RegExp('(\\d+?)(?=(\\d{3})+(?!\\d)|$)', 'g');
export default function numberFormat (value?: BN | number): string {
export default function numberFormat (value?: BN | number | null): string {
if (value === undefined || value === null) {
return '0';
}

View File

@ -7,7 +7,7 @@ import isUndefined from '@polkadot/util/is/undefined';
const re = new RegExp('(poc-1)', 'i');
export default function shouldUseLatestChain (chain?: string): boolean {
if (isUndefined(chain) || chain === null) {
if (isUndefined(chain)) {
return false;
}

View File

@ -17,10 +17,10 @@
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/ui-identicon": "^0.19.27",
"polkadot-identicon": "^1.0.5"
"polkadot-identicon": "^1.0.2"
},
"devDependencies": {
"@polkadot/util-keyring": "^0.27.9",
"@polkadot/util-keyring": "^0.27.12",
"babel-loader": "^8.0.0-beta.2",
"css-loader": "0.28.9",
"empty": "^0.10.1",

View File

@ -16,7 +16,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics": "^0.27.9",
"@polkadot/extrinsics": "^0.27.12",
"@polkadot/ui-app": "^0.19.27",
"@polkadot/ui-keyring": "^0.19.27"
},

View File

@ -6,8 +6,8 @@ import { ApiProps } from '@polkadot/ui-react-rx/types';
import { I18nProps, BareProps } from '@polkadot/ui-app/types';
import { QueueTx, QueueTx$MessageSetStatus } from './types';
import BN from 'bn.js';
import React from 'react';
import Button from '@polkadot/ui-app/Button';
import Modal from '@polkadot/ui-app/Modal';
import classes from '@polkadot/ui-app/util/classes';

View File

@ -6,6 +6,7 @@ import { BareProps } from '@polkadot/ui-app/types';
import { ApiProps } from '@polkadot/ui-react-rx/types';
import { QueueProps, QueueTx, QueueTx$Extrinsic, QueueTx$Base, QueueTx$Id, QueueTx$Status } from './types';
import BN from 'bn.js';
import React from 'react';
import rpcs from '@polkadot/jsonrpc';
import withApi from '@polkadot/ui-react-rx/with/api';
@ -107,7 +108,7 @@ class Queue extends React.Component<Props, State> {
return this.queueAdd({
isValid,
nonce,
nonce: nonce || new BN(0),
publicKey,
rpc,
values: [encoded]

158
yarn.lock
View File

@ -765,50 +765,50 @@
version "1.1.0"
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.0.tgz#50c1e2260ac0ed9439a181de3725a0168d59c48a"
"@polkadot/api-format@^0.15.6":
version "0.15.6"
resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.15.6.tgz#9d50258df3fcd9e11ad591d43a3f25db3647ff7a"
"@polkadot/api-format@^0.15.9":
version "0.15.9"
resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.15.9.tgz#4433ea678980c4912aa1b96369667044a7f8e882"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/jsonrpc" "^0.27.9"
"@polkadot/primitives" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/util-keyring" "^0.27.9"
"@polkadot/jsonrpc" "^0.27.12"
"@polkadot/primitives" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/util-keyring" "^0.27.12"
"@polkadot/api-provider@^0.15.6":
version "0.15.6"
resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.15.6.tgz#e3c664687d9d82d59d16e9b5a8e3d10fd285a7a0"
"@polkadot/api-provider@^0.15.9":
version "0.15.9"
resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.15.9.tgz#82d2fd835456d247d4dca2d5962493cfe292d73f"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/storage" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/util-crypto" "^0.27.9"
"@polkadot/util-keyring" "^0.27.9"
"@polkadot/storage" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/util-crypto" "^0.27.12"
"@polkadot/util-keyring" "^0.27.12"
"@types/nock" "^9.1.3"
eventemitter3 "^2.0.3"
isomorphic-fetch "^2.2.1"
websocket "^1.0.25"
"@polkadot/api-rx@^0.15.6":
version "0.15.6"
resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.15.6.tgz#849adc73d129d87eaf3c9463f9eb7201b8d6bfa7"
"@polkadot/api-rx@^0.15.9":
version "0.15.9"
resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.15.9.tgz#9f3997a837d3635f56823a1b5d3acc68b3c20bfa"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/api" "^0.15.6"
"@polkadot/api-provider" "^0.15.6"
"@polkadot/api" "^0.15.9"
"@polkadot/api-provider" "^0.15.9"
"@types/rx" "^4.1.1"
rxjs "^6.2.2"
"@polkadot/api@^0.15.6":
version "0.15.6"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.15.6.tgz#6bf02708c5ef77d71ca0b00bdbbf6154abe80f6f"
"@polkadot/api@^0.15.9":
version "0.15.9"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.15.9.tgz#fcf041f612a44c956080c6b3b0dd3f26d9133a6e"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/api-format" "^0.15.6"
"@polkadot/api-provider" "^0.15.6"
"@polkadot/jsonrpc" "^0.27.9"
"@polkadot/params" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/api-format" "^0.15.9"
"@polkadot/api-provider" "^0.15.9"
"@polkadot/jsonrpc" "^0.27.12"
"@polkadot/params" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/dev-react@^0.20.12":
version "0.20.12"
@ -877,94 +877,94 @@
typedoc "^0.11.1"
typescript "^2.9.2"
"@polkadot/extrinsics@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.27.9.tgz#85e1070fcaa0e8d801b10bb71d19bd6ecfd69520"
"@polkadot/extrinsics@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.27.12.tgz#0fab6c4015f6617da6c9305c22e24e4456b0399e"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/params" "^0.27.9"
"@polkadot/primitives" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/params" "^0.27.12"
"@polkadot/primitives" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/jsonrpc@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.27.9.tgz#d40a18df93e5a1970bb879c4aa3f35beb9858686"
"@polkadot/jsonrpc@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.27.12.tgz#717f15fe9386cd3660755b936773a29d9c82ceaf"
dependencies:
"@polkadot/params" "^0.27.9"
"@polkadot/params" "^0.27.12"
babel-runtime "^6.26.0"
"@polkadot/params@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.27.9.tgz#b18dedd1dd6b33539045d9414e966c607fc0bd94"
"@polkadot/params@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.27.12.tgz#446e7a9c23ebaf13da9ccd4d78bcaac287426ff0"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/extrinsics" "^0.27.9"
"@polkadot/primitives" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/extrinsics" "^0.27.12"
"@polkadot/primitives" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/primitives@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.27.9.tgz#74006cce2b1198f2b7a56285aecb2582decbff58"
"@polkadot/primitives@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.27.12.tgz#e4dba94c1b05567131b80ebb42a95923dc5e62fd"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/trie-hash" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/trie-hash" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/storage@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.27.9.tgz#2edb322e81296ebe738af933938fb096b05825a4"
"@polkadot/storage@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.27.12.tgz#2994dc47bf444d93615604e6ab924aeef4723873"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/params" "^0.27.9"
"@polkadot/primitives" "^0.27.9"
"@polkadot/util" "^0.27.9"
"@polkadot/util-crypto" "^0.27.9"
"@polkadot/util-keyring" "^0.27.9"
"@polkadot/params" "^0.27.12"
"@polkadot/primitives" "^0.27.12"
"@polkadot/util" "^0.27.12"
"@polkadot/util-crypto" "^0.27.12"
"@polkadot/util-keyring" "^0.27.12"
"@polkadot/trie-hash@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/trie-hash/-/trie-hash-0.27.9.tgz#25aa08e9df39b5ad6ce0507d1deac14b06066660"
"@polkadot/trie-hash@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/trie-hash/-/trie-hash-0.27.12.tgz#01f73e2dd4967237a581d2a118b14b754e1b8d03"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.27.9"
"@polkadot/util-crypto" "^0.27.9"
"@polkadot/util-rlp" "^0.27.9"
"@polkadot/util" "^0.27.12"
"@polkadot/util-crypto" "^0.27.12"
"@polkadot/util-rlp" "^0.27.12"
"@polkadot/ts@^0.1.10":
version "0.1.10"
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.10.tgz#784d460cf4b2e9b38bb1c77f9366dd01425f220d"
"@polkadot/util-crypto@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.27.9.tgz#d01f641a17755ab979c0c16dfb83259cb734f638"
"@polkadot/util-crypto@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.27.12.tgz#a58fc4668d0fef05cae3760bd47ac9bdf042f09c"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.27.9"
"@polkadot/util" "^0.27.12"
blakejs "^1.1.0"
js-sha3 "^0.7.0"
tweetnacl "^1.0.0"
xxhashjs "^0.2.2"
"@polkadot/util-keyring@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-keyring/-/util-keyring-0.27.9.tgz#9dc109588f87a2d8b0c01165dca8b14316486788"
"@polkadot/util-keyring@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/util-keyring/-/util-keyring-0.27.12.tgz#849fcb46987ed733b94c014b65ff4c42772fddd2"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.27.9"
"@polkadot/util-crypto" "^0.27.9"
"@polkadot/util" "^0.27.12"
"@polkadot/util-crypto" "^0.27.12"
"@types/bs58" "^3.0.30"
bs58 "^4.0.1"
"@polkadot/util-rlp@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-rlp/-/util-rlp-0.27.9.tgz#596737519b630aeaf0c6b50738d729211b8ee934"
"@polkadot/util-rlp@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/util-rlp/-/util-rlp-0.27.12.tgz#6c2d33051a4d54b714872a88bb5ef92754d6b9cd"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.27.9"
"@polkadot/util" "^0.27.12"
"@polkadot/util@^0.27.9":
version "0.27.9"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.27.9.tgz#4c3328aa3d2e51f409d77459005c0d47a9a0341b"
"@polkadot/util@^0.27.12":
version "0.27.12"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.27.12.tgz#fc1155e8099a5fea93d978307531ca48094e8565"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@types/bn.js" "^4.11.1"
@ -8358,7 +8358,7 @@ pn@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"
polkadot-identicon@^1.0.5:
polkadot-identicon@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/polkadot-identicon/-/polkadot-identicon-1.0.5.tgz#8f8bc255845918a298369380493fef054493b469"
dependencies: