Adjust call-only metadata output (#2321)

This commit is contained in:
Jaco Greeff
2020-06-02 11:03:34 +02:00
committed by GitHub
parent 1545bbf7c5
commit 6e83e6aaef
12 changed files with 69 additions and 57 deletions
+1 -1
View File
@@ -30,7 +30,7 @@
"@polkadot/api": "1.17.0-beta.6",
"@polkadot/rpc-core": "1.17.0-beta.6",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util": "^2.12.2",
"bn.js": "^5.1.2",
"rxjs": "^6.5.5"
}
+3 -3
View File
@@ -32,13 +32,13 @@
"@polkadot/rpc-core": "1.17.0-beta.6",
"@polkadot/rpc-provider": "1.17.0-beta.6",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util-crypto": "^2.11.1",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.11.1"
"@polkadot/keyring": "^2.12.2"
}
}
+4 -4
View File
@@ -28,19 +28,19 @@
"dependencies": {
"@babel/runtime": "^7.10.1",
"@polkadot/api-derive": "1.17.0-beta.6",
"@polkadot/keyring": "^2.11.1",
"@polkadot/keyring": "^2.12.2",
"@polkadot/metadata": "1.17.0-beta.6",
"@polkadot/rpc-core": "1.17.0-beta.6",
"@polkadot/rpc-provider": "1.17.0-beta.6",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/types-known": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util-crypto": "^2.11.1",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.11.1"
"@polkadot/keyring": "^2.12.2"
}
}
+3 -3
View File
@@ -29,11 +29,11 @@
"@babel/runtime": "^7.10.1",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/types-known": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util-crypto": "^2.11.1",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.11.1"
"@polkadot/keyring": "^2.12.2"
}
}
@@ -12,6 +12,15 @@ interface ModuleMetadataTrimmed {
calls: Option<Vec<FunctionMetadataLatest>>;
}
function trimDocs (documentation: Vec<Text>): string[] {
const strings = documentation.map((doc) => doc.toString().trim());
const firstEmpty = strings.findIndex((doc) => !doc.length);
return firstEmpty === -1
? strings
: strings.slice(0, firstEmpty);
}
function mapCalls (registry: Registry, _calls: Option<Vec<FunctionMetadataLatest>>): Option<Vec<FunctionMetadataLatest>> {
const calls = _calls.unwrapOr(null);
@@ -21,7 +30,7 @@ function mapCalls (registry: Registry, _calls: Option<Vec<FunctionMetadataLatest
? calls.map(({ args, documentation, name }) =>
registry.createType('FunctionMetadataLatest', {
args,
documentation: documentation.map((doc) => doc.toString().trim()),
documentation: trimDocs(documentation),
name
})
)
+2 -2
View File
@@ -30,11 +30,11 @@
"@polkadot/metadata": "1.17.0-beta.6",
"@polkadot/rpc-provider": "1.17.0-beta.6",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util": "^2.12.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.11.1"
"@polkadot/keyring": "^2.12.2"
}
}
+3 -3
View File
@@ -29,15 +29,15 @@
"@babel/runtime": "^7.10.1",
"@polkadot/metadata": "1.17.0-beta.6",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util-crypto": "^2.11.1",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.11.1",
"@polkadot/keyring": "^2.12.2",
"mock-socket": "^9.0.3",
"nock": "^12.0.3"
}
+1 -1
View File
@@ -40,7 +40,7 @@
"@polkadot/metadata": "1.17.0-beta.6",
"@polkadot/rpc-provider": "1.17.0-beta.6",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util": "^2.12.2",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
"yargs": "^15.3.1"
+1 -1
View File
@@ -28,7 +28,7 @@
"dependencies": {
"@babel/runtime": "^7.10.1",
"@polkadot/types": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util": "^2.12.2",
"bn.js": "^5.1.2"
},
"devDependencies": {
+3 -3
View File
@@ -28,15 +28,15 @@
"dependencies": {
"@babel/runtime": "^7.10.1",
"@polkadot/metadata": "1.17.0-beta.6",
"@polkadot/util": "^2.11.1",
"@polkadot/util-crypto": "^2.11.1",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@types/bn.js": "^4.11.6",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^2.11.1",
"@polkadot/keyring": "^2.12.2",
"@types/memoizee": "^0.4.4"
}
}