Cleanup sanitize boxes (#1805)
* Cleanup sanitize boxes * yarn.lock * Add space before box as allowed
This commit is contained in:
@@ -32,6 +32,6 @@
|
||||
"@polkadot/types": "^1.1.0-beta.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.1.0-beta.0"
|
||||
"@polkadot/keyring": "^2.1.0-beta.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@polkadot/api-derive": "^1.1.0-beta.15",
|
||||
"@polkadot/keyring": "^2.1.0-beta.0",
|
||||
"@polkadot/keyring": "^2.1.0-beta.1",
|
||||
"@polkadot/metadata": "^1.1.0-beta.15",
|
||||
"@polkadot/rpc-core": "^1.1.0-beta.15",
|
||||
"@polkadot/rpc-provider": "^1.1.0-beta.15",
|
||||
"@polkadot/types": "^1.1.0-beta.15",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.0"
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.1.0-beta.0"
|
||||
"@polkadot/keyring": "^2.1.0-beta.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
let dirname = 'node_modules';
|
||||
let dirname;
|
||||
let pkgJson;
|
||||
|
||||
try {
|
||||
@@ -19,7 +19,7 @@ try {
|
||||
pkgJson = require('../package.json');
|
||||
}
|
||||
|
||||
detectPackage(dirname, pkgJson);
|
||||
detectPackage(pkgJson, dirname);
|
||||
|
||||
export { Keyring } from '@polkadot/keyring';
|
||||
export { WsProvider } from '@polkadot/rpc-provider';
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@polkadot/types": "^1.1.0-beta.15",
|
||||
"@polkadot/util": "^2.1.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.0"
|
||||
"@polkadot/util": "^2.1.0-beta.1",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.1.0-beta.0"
|
||||
"@polkadot/keyring": "^2.1.0-beta.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"@polkadot/jsonrpc": "^1.1.0-beta.15",
|
||||
"@polkadot/rpc-provider": "^1.1.0-beta.15",
|
||||
"@polkadot/types": "^1.1.0-beta.15",
|
||||
"@polkadot/util": "^2.1.0-beta.0",
|
||||
"@polkadot/util": "^2.1.0-beta.1",
|
||||
"rxjs": "^6.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@polkadot/metadata": "^1.1.0-beta.15",
|
||||
"@polkadot/util": "^2.1.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.0",
|
||||
"@polkadot/util": "^2.1.0-beta.1",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.1",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.31"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.1.0-beta.0",
|
||||
"@polkadot/keyring": "^2.1.0-beta.1",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^11.7.2"
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@polkadot/metadata": "^1.1.0-beta.15",
|
||||
"@polkadot/util": "^2.1.0-beta.0",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.0",
|
||||
"@polkadot/util": "^2.1.0-beta.1",
|
||||
"@polkadot/util-crypto": "^2.1.0-beta.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"yargs": "^15.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.1.0-beta.0",
|
||||
"@polkadot/keyring": "^2.1.0-beta.1",
|
||||
"@types/memoizee": "^0.4.3",
|
||||
"@types/yargs": "^15.0.2"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
type Mapper = (value: string) => string;
|
||||
|
||||
const ALLOWED_BOXES = ['BTreeMap', 'BTreeSet', 'Compact', 'Linkage', 'Result', 'Option', 'Vec'];
|
||||
const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fixed array, part of struct def or in tuple
|
||||
|
||||
const mappings: Mapper[] = [
|
||||
// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
|
||||
@@ -114,7 +115,10 @@ function _removeGenerics (): Mapper {
|
||||
const box = ALLOWED_BOXES.find((box): boolean => {
|
||||
const start = index - box.length;
|
||||
|
||||
return start >= 0 && value.substr(start, box.length) === box;
|
||||
return (start >= 0 && value.substr(start, box.length) === box) && (
|
||||
// make sure it is stand-alone, i.e. don't catch ElectionResult<...> as Result<...>
|
||||
start === 0 || BOX_PRECEDING.includes(value[start - 1])
|
||||
);
|
||||
});
|
||||
|
||||
// we have not found anything, unwrap generic innards
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
let dirname = 'node_modules';
|
||||
let dirname;
|
||||
let pkgJson;
|
||||
|
||||
try {
|
||||
@@ -22,7 +22,7 @@ try {
|
||||
pkgJson = require('../package.json');
|
||||
}
|
||||
|
||||
detectPackage(dirname, pkgJson);
|
||||
detectPackage(pkgJson, dirname);
|
||||
|
||||
export * from './codec';
|
||||
export * from './index.types';
|
||||
|
||||
@@ -2015,14 +2015,14 @@
|
||||
typescript "^3.7.5"
|
||||
vuepress "^1.2.0"
|
||||
|
||||
"@polkadot/keyring@^2.1.0-beta.0":
|
||||
version "2.1.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-2.1.0-beta.0.tgz#5fe05f715794e84eccb1f1efa2f01f92dd325e98"
|
||||
integrity sha512-Qm9CXzKbb7WfkpaDS35ZaxZQWcwGCKJiCS8ymUnOQhCmd/7nQRu+ueIZpUfyxw5XEDeSA3fOhNmEi7oDxp8EAg==
|
||||
"@polkadot/keyring@^2.1.0-beta.1":
|
||||
version "2.1.0-beta.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-2.1.0-beta.1.tgz#24e20596306ba1b82f3f358f4cba44f264c7b6b4"
|
||||
integrity sha512-017xaPtacX5Xdrova3d7pemI9BpTop7N6lJL4rimksXl2M/9iKNM3UmnZqL35C0kWS8UC1XLpM1VZZJXpAx/RQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.3"
|
||||
"@polkadot/util" "^2.1.0-beta.0"
|
||||
"@polkadot/util-crypto" "^2.1.0-beta.0"
|
||||
"@polkadot/util" "^2.1.0-beta.1"
|
||||
"@polkadot/util-crypto" "^2.1.0-beta.1"
|
||||
|
||||
"@polkadot/ts@^0.2.1":
|
||||
version "0.2.1"
|
||||
@@ -2031,13 +2031,13 @@
|
||||
dependencies:
|
||||
"@types/chrome" "^0.0.92"
|
||||
|
||||
"@polkadot/util-crypto@^2.1.0-beta.0":
|
||||
version "2.1.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-2.1.0-beta.0.tgz#0d27cb897e0d116ce9197b6f566f11a416ef26a7"
|
||||
integrity sha512-NUHLZua94cUcn4NvZOYX8YYmxfbQfhPcbZevJrqvROIVzHkO7IRvIzxNPVQH7KcvQEs+qzJf8VrM0+u1gURpqA==
|
||||
"@polkadot/util-crypto@^2.1.0-beta.1":
|
||||
version "2.1.0-beta.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-2.1.0-beta.1.tgz#bfbd35f676135e85bd82c5bc5e99e2a9bb3012c5"
|
||||
integrity sha512-xQKy5SKnDZhrEjq6d50Oj6A4h8UDOkDxMQ7ofKhx8B43c0V1NCeS4gBWgjkOp7+wlznTlA3Jj/Ry6J0u80AKrw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.3"
|
||||
"@polkadot/util" "^2.1.0-beta.0"
|
||||
"@polkadot/util" "^2.1.0-beta.1"
|
||||
"@polkadot/wasm-crypto" "^0.20.1"
|
||||
"@types/bs58" "^4.0.0"
|
||||
"@types/elliptic" "^6.4.12"
|
||||
@@ -2052,10 +2052,10 @@
|
||||
tweetnacl "^1.0.2"
|
||||
xxhashjs "^0.2.2"
|
||||
|
||||
"@polkadot/util@^2.1.0-beta.0":
|
||||
version "2.1.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-2.1.0-beta.0.tgz#a0e7c891687e771582fe616047e58f96b7e435ff"
|
||||
integrity sha512-ZHJ4vG+AJdltqhqotMu9Fw3Um7Gii61Ve2MQYYCaalLr9AZO3fgAq9St4O8vza49ZxOru8bZaexlToxCIt2b4g==
|
||||
"@polkadot/util@^2.1.0-beta.1":
|
||||
version "2.1.0-beta.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-2.1.0-beta.1.tgz#27c7670d06150c82e9cfa109dbeb06430cddbb5e"
|
||||
integrity sha512-rqxuaM0GXnVfgSDsO0iIpURlwDgJ1vZEXrB8SkUIK1GldL81w17eNKsds6ZXQjwiBBqaYMeQdfr3ENqkTBLgcw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.8.3"
|
||||
"@types/bn.js" "^4.11.6"
|
||||
|
||||
Reference in New Issue
Block a user