From 3718bc016022a467d7451e2ef0abdb6c091dd23a Mon Sep 17 00:00:00 2001 From: Edwin Date: Thu, 22 Jun 2017 15:08:07 +0800 Subject: [PATCH] internal/web3ext: add Istanbul JS RPC API --- internal/web3ext/web3ext.go | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 9d6ce8c6c8..d742a4b325 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -30,6 +30,7 @@ var Modules = map[string]string{ "shh": Shh_JS, "swarmfs": SWARMFS_JS, "txpool": TxPool_JS, + "istanbul": Istanbul_JS, } const Chequebook_JS = ` @@ -631,3 +632,51 @@ web3._extend({ ] }); ` + +const Istanbul_JS = ` +web3._extend({ + property: 'istanbul', + methods: + [ + new web3._extend.Method({ + name: 'getSnapshot', + call: 'istanbul_getSnapshot', + params: 1, + inputFormatter: [null] + }), + new web3._extend.Method({ + name: 'getSnapshotAtHash', + call: 'istanbul_getSnapshotAtHash', + params: 1 + }), + new web3._extend.Method({ + name: 'getValidators', + call: 'istanbul_getValidators', + params: 1, + inputFormatter: [null] + }), + new web3._extend.Method({ + name: 'getValidatorsAtHash', + call: 'istanbul_getValidatorsAtHash', + params: 1 + }), + new web3._extend.Method({ + name: 'propose', + call: 'istanbul_propose', + params: 2 + }), + new web3._extend.Method({ + name: 'discard', + call: 'istanbul_discard', + params: 1 + }) + ], + properties: + [ + new web3._extend.Property({ + name: 'candidates', + getter: 'istanbul_candidates' + }), + ] +}); +`