Conversation
@@ -48,24 +43,26 @@ function error (log) { | |||
} | |||
|
|||
function printType (type) { | |||
return type2print.get(type) || type.name; | |||
return type.print || `\`${type.name}\``; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to decide on wether we want template string even if they require escaping `
.
I know this PR didn't introduce it, but I can see |
const sectionA = spec[a].section || ''; | ||
const sectionB = spec[b].section || ''; | ||
|
||
if (sectionA === sectionB) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will produce unexpected results if sectionA.localeCompare(sectionB) === 0
.
const flatlist = {}; | ||
const allowedTypes = [Array, Boolean, Object, String]; | ||
|
||
Object.keys(customTypes).map((key) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowedTypes.concat(Object.values(customTypes))
obj.type === Integer || | ||
obj.type === Quantity; | ||
}); | ||
expect(obj).to.satisfy(() => allowedTypes.indexOf(obj.type) >= 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowedTypes.includes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comments
obj.type === Integer || | ||
obj.type === Quantity; | ||
}); | ||
expect(obj).to.satisfy(() => allowedTypes.indexOf(obj.type) >= 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use Array::includes
method
@@ -76,6 +76,11 @@ export default class Parity { | |||
.execute('parity_dappsInterface'); | |||
} | |||
|
|||
decryptMessage (address, data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to add a quick test for this one.
@@ -292,6 +297,11 @@ export default class Parity { | |||
.then(outAddress); | |||
} | |||
|
|||
postSign (address, hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to add a quick test for this one too.
'signer', | ||
'traces', | ||
'web3' | ||
].map((name) => fs.readFileSync(path.join(traitsDir, `${name}.rs`))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use a glob like pattern here ? Ie. reading all the Rust files in the traits
directoy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I had done initially, but some of the traits are either unimplemented or deprecated. That was before I started parsing comments for @deprecated
and @unimplemented
tags though, can revisit the original idea with that in mind.
rustMethods[group][name] = true; | ||
}); | ||
|
||
describe('Rust defined JSON-RPC methods', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to follow the test names convention with jsonrpc/interfaces
as the top test.
@@ -18,6 +18,7 @@ import { Data } from '../types'; | |||
|
|||
export default { | |||
getHex: { | |||
nodoc: 'Not present in Rust code', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we need to make a call to remove these or move out of the way. (DB is deprecated anyway.) Should just log it, no need to clutter this one.
(Same probably goes for future work, e.g. shh
- which we may have soon anyway)
@@ -180,10 +149,10 @@ The following options are possible for the \`defaultBlock\` parameter: | |||
desc: 'Makes a call or transaction, which won\'t be added to the blockchain and returns the used gas, which can be used for estimating the used gas.', | |||
params: [ | |||
{ | |||
type: Object, | |||
desc: 'See [eth_call](#eth_call) parameters, expect that all properties are optional.', | |||
type: CallRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Great, definately helps. When we have these we are actually moving closer to being able to just auto-detect the input/output formatters, i.e. we are one step closer to having the JS auto-generated.
Closes #1905.
No docs from Rust code yet, but this PR adds a JS test that checks if all RPC methods defined in traits are added to
interfaces/*.js
files (from which markdown is generated), and all methods listed ininterfaces/*.js
exist in Rust source.Can continue on moving the source of truth away from JS to Rust in #2646.