Add method name & prefix to StorageFunction (#182)

* Add methods & prefix to StorageFunction

* Match method/section to exposed names

* Export method/section on extrinsic & jsonrpc

* PR comment prefix -> section
This commit is contained in:
Jaco Greeff
2018-10-02 11:10:17 +02:00
committed by GitHub
parent 92d72d0007
commit 2f60ba0e1c
12 changed files with 38 additions and 26 deletions
+2 -2
View File
@@ -55,12 +55,12 @@ export default class Api implements ApiInterface {
*
* Api.signature({ name: 'test_method', params: [ { name: 'dest', type: 'Address' } ], type: 'Address' }); // => test_method (dest: Address): Address
*/
static signature ({ name, params, type }: Method): string {
static signature ({ method, params, type }: Method): string {
const inputs = params.map(({ name, type }) =>
`${name}: ${type}`
).join(', ');
return `${name} (${inputs}): ${type}`;
return `${method} (${inputs}): ${type}`;
}
private createInterface ({ methods, name }: Section<any>): ApiInterface$Section {
+2 -2
View File
@@ -12,14 +12,14 @@ describe('methodSend', () => {
beforeEach(() => {
methods = {
blah: {
name: 'blah',
method: 'blah',
params: [
{ name: 'foo', type: 'Bytes' }
],
type: 'Bytes'
},
bleh: {
name: 'bleh',
method: 'bleh',
params: [],
type: 'Bytes'
}