parent
c0c133c615
commit
4897196262
24
package.json
24
package.json
@ -1,10 +1,8 @@
|
||||
{
|
||||
"version": "0.40.0-beta.53",
|
||||
"repository": "https://github.com/polkadot-js/apps",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=10.13.0",
|
||||
"yarn": "^1.10.1"
|
||||
},
|
||||
"homepage": ".",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
@ -36,24 +34,24 @@
|
||||
"start": "cd packages/apps && webpack --config webpack.config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/register": "^7.8.3",
|
||||
"@babel/core": "^7.8.6",
|
||||
"@babel/register": "^7.8.6",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/dev": "^0.50.9",
|
||||
"@polkadot/ts": "^0.3.1",
|
||||
"@polkadot/ts": "^0.3.2",
|
||||
"@polkadot/typegen": "^1.5.0-beta.12",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.11",
|
||||
"@types/file-saver": "^2.0.0",
|
||||
"@types/chart.js": "^2.9.14",
|
||||
"@types/file-saver": "^2.0.1",
|
||||
"@types/i18next": "^13.0.0",
|
||||
"@types/react-copy-to-clipboard": "^4.3.0",
|
||||
"@types/react-dom": "^16.9.5",
|
||||
"@types/react-router-dom": "^5.1.3",
|
||||
"@types/react-tooltip": "^3.11.0",
|
||||
"@types/store": "^2.0.2",
|
||||
"@types/styled-components": "^4.4.2",
|
||||
"@types/styled-components": "^5.0.1",
|
||||
"@types/styled-theming": "^2.2.2",
|
||||
"@types/yargs": "^15.0.2",
|
||||
"@types/yargs": "^15.0.4",
|
||||
"empty": "^0.10.1",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
@ -61,7 +59,7 @@
|
||||
"markdown-loader": "^5.1.0",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"source-map-explorer": "^2.2.2",
|
||||
"source-map-explorer": "^2.3.1",
|
||||
"style-loader": "^1.1.3",
|
||||
"thread-loader": "^2.1.3",
|
||||
"url-loader": "^3.0.0",
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
"@polkadot/react-components": "0.40.0-beta.57",
|
||||
"@polkadot/react-qr": "^0.52.0-beta.3",
|
||||
"detect-browser": "^4.8.0",
|
||||
"file-saver": "^2.0.0",
|
||||
"yargs": "^15.0.2"
|
||||
"file-saver": "^2.0.2",
|
||||
"yargs": "^15.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,6 @@
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/react-components": "0.40.0-beta.57",
|
||||
"@polkadot/react-query": "0.40.0-beta.57",
|
||||
"query-string": "^6.10.1"
|
||||
"query-string": "^6.11.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,6 @@
|
||||
"@polkadot/react-components": "0.40.0-beta.57",
|
||||
"@polkadot/react-signer": "0.40.0-beta.57",
|
||||
"@polkadot/ui-assets": "^0.52.0-beta.3",
|
||||
"query-string": "^6.10.1"
|
||||
"query-string": "^6.11.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/api": "^1.5.0-beta.12",
|
||||
"@polkadot/extension-dapp": "^0.22.0-beta.8",
|
||||
"edgeware-node-types": "^1.1.0",
|
||||
"rxjs-compat": "^6.5.3"
|
||||
"edgeware-node-types": "^1.2.0",
|
||||
"rxjs-compat": "^6.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,24 +17,24 @@
|
||||
"@polkadot/react-query": "0.40.0-beta.57",
|
||||
"@polkadot/ui-keyring": "^0.52.0-beta.3",
|
||||
"@polkadot/ui-settings": "^0.52.0-beta.3",
|
||||
"chart.js": "^2.9.2",
|
||||
"codeflask": "^1.4.0",
|
||||
"i18next": "^19.1.0",
|
||||
"i18next-browser-languagedetector": "^4.0.1",
|
||||
"chart.js": "^2.9.3",
|
||||
"codeflask": "^1.4.1",
|
||||
"i18next": "^19.3.2",
|
||||
"i18next-browser-languagedetector": "^4.0.2",
|
||||
"i18next-xhr-backend": "^3.2.2",
|
||||
"react": "^16.12.0",
|
||||
"react-chartjs-2": "^2.8.0",
|
||||
"react-copy-to-clipboard": "^5.0.1",
|
||||
"react-chartjs-2": "^2.9.0",
|
||||
"react-copy-to-clipboard": "^5.0.2",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-dropzone": "^10.2.1",
|
||||
"react-i18next": "^11.3.1",
|
||||
"react-i18next": "^11.3.3",
|
||||
"react-is": "^16.12.0",
|
||||
"react-markdown": "^4.3.1",
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"react-tooltip": "^3.11.2",
|
||||
"semantic-ui-css": "^2.3.1",
|
||||
"semantic-ui-react": "^0.88.1",
|
||||
"react-tooltip": "^3.11.6",
|
||||
"semantic-ui-css": "^2.4.1",
|
||||
"semantic-ui-react": "^0.88.2",
|
||||
"store": "^2.0.12",
|
||||
"styled-theming": "^2.2.0"
|
||||
}
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
import { TypeDef, TypeDefInfo } from '@polkadot/types/types';
|
||||
import { Props, ComponentMap } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import { createType, getTypeDef, SPECIAL_TYPES } from '@polkadot/types';
|
||||
import { isBn } from '@polkadot/util';
|
||||
|
||||
import Account from './Account';
|
||||
import Amount from './Amount';
|
||||
@ -128,7 +128,7 @@ export default function findComponent (def: TypeDef, overrides: ComponentMap = {
|
||||
|
||||
if (Component) {
|
||||
return Component;
|
||||
} else if (instance instanceof BN) {
|
||||
} else if (isBn(instance)) {
|
||||
return Amount;
|
||||
} else if ([TypeDefInfo.Enum, TypeDefInfo.Struct].includes(raw.info)) {
|
||||
return findComponent(raw, overrides);
|
||||
@ -140,7 +140,7 @@ export default function findComponent (def: TypeDef, overrides: ComponentMap = {
|
||||
// we only want to want once, not spam
|
||||
if (!warnList.includes(type)) {
|
||||
warnList.push(type);
|
||||
console.warn(`Cannot find component for ${type}, defaulting to Unknown`);
|
||||
console.info(`params: No pre-defined component for type ${type} from ${JSON.stringify(def)}, using defaults`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,9 @@ import { RawParamValue } from './types';
|
||||
import BN from 'bn.js';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import { Bytes, Raw, createType, getTypeDef } from '@polkadot/types';
|
||||
import { isBn } from '@polkadot/util';
|
||||
|
||||
const warnList: string[] = [];
|
||||
|
||||
export default function getInitValue (def: TypeDef): RawParamValue | RawParamValue[] {
|
||||
if (def.info === TypeDefInfo.Vec) {
|
||||
@ -119,7 +122,7 @@ export default function getInitValue (def: TypeDef): RawParamValue | RawParamVal
|
||||
const instance = createType(registry, type as any);
|
||||
const raw = getTypeDef(instance.toRawType());
|
||||
|
||||
if (instance instanceof BN) {
|
||||
if (isBn(instance)) {
|
||||
return new BN(0);
|
||||
} else if ([TypeDefInfo.Enum, TypeDefInfo.Struct].includes(raw.info)) {
|
||||
return getInitValue(raw);
|
||||
@ -128,7 +131,11 @@ export default function getInitValue (def: TypeDef): RawParamValue | RawParamVal
|
||||
// console.error(error.message);
|
||||
}
|
||||
|
||||
console.warn(`Unable to determine default type for ${JSON.stringify(def)}`);
|
||||
// we only want to want once, not spam
|
||||
if (!warnList.includes(type)) {
|
||||
warnList.push(type);
|
||||
console.info(`params: No default value for type ${type} from ${JSON.stringify(def)}, using defaults`);
|
||||
}
|
||||
|
||||
return '0x';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user