From c3f6c322c07a96d3930c75d05ed3859e7d80ddbc Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Tue, 16 Jun 2015 14:59:39 +0200 Subject: added DB api --- rpc/api/utils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rpc/api/utils.go') diff --git a/rpc/api/utils.go b/rpc/api/utils.go index 40bcae52f..a4ce6409a 100644 --- a/rpc/api/utils.go +++ b/rpc/api/utils.go @@ -24,6 +24,12 @@ var ( "setSolc", "datadir", }, + "db": []string{ + "getString", + "putString", + "getHex", + "putHex", + }, "debug": []string{ "dumpBlock", "getBlockRlp", @@ -137,6 +143,8 @@ func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth. apis[i] = NewAdminApi(xeth, eth, codec) case DebugApiName: apis[i] = NewDebugApi(xeth, eth, codec) + case DbApiName: + apis[i] = NewDbApi(xeth, eth, codec) case EthApiName: apis[i] = NewEthApi(xeth, codec) case MinerApiName: @@ -165,6 +173,8 @@ func Javascript(name string) string { return Admin_JS case DebugApiName: return Debug_JS + case DbApiName: + return Db_JS case MinerApiName: return Miner_JS case NetApiName: -- cgit v1.2.3 From 2e0b56a72b3eafc89938003da29c06496ac9ad4e Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Mon, 22 Jun 2015 12:47:32 +0200 Subject: added RPC start/stop support --- rpc/api/utils.go | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'rpc/api/utils.go') diff --git a/rpc/api/utils.go b/rpc/api/utils.go index a4ce6409a..9995e1f7c 100644 --- a/rpc/api/utils.go +++ b/rpc/api/utils.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/rpc/codec" + "github.com/ethereum/go-ethereum/rpc/shared" "github.com/ethereum/go-ethereum/xeth" ) @@ -23,6 +24,8 @@ var ( "chainSyncStatus", "setSolc", "datadir", + "startRPC", + "stopRPC", }, "db": []string{ "getString", @@ -129,35 +132,35 @@ var ( ) // Parse a comma separated API string to individual api's -func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth.Ethereum) ([]EthereumApi, error) { +func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth.Ethereum) ([]shared.EthereumApi, error) { if len(strings.TrimSpace(apistr)) == 0 { return nil, fmt.Errorf("Empty apistr provided") } names := strings.Split(apistr, ",") - apis := make([]EthereumApi, len(names)) + apis := make([]shared.EthereumApi, len(names)) for i, name := range names { switch strings.ToLower(strings.TrimSpace(name)) { - case AdminApiName: + case shared.AdminApiName: apis[i] = NewAdminApi(xeth, eth, codec) - case DebugApiName: + case shared.DebugApiName: apis[i] = NewDebugApi(xeth, eth, codec) - case DbApiName: + case shared.DbApiName: apis[i] = NewDbApi(xeth, eth, codec) - case EthApiName: + case shared.EthApiName: apis[i] = NewEthApi(xeth, codec) - case MinerApiName: + case shared.MinerApiName: apis[i] = NewMinerApi(eth, codec) - case NetApiName: + case shared.NetApiName: apis[i] = NewNetApi(xeth, eth, codec) - case ShhApiName: + case shared.ShhApiName: apis[i] = NewShhApi(xeth, eth, codec) - case TxPoolApiName: + case shared.TxPoolApiName: apis[i] = NewTxPoolApi(xeth, eth, codec) - case PersonalApiName: + case shared.PersonalApiName: apis[i] = NewPersonalApi(xeth, eth, codec) - case Web3ApiName: + case shared.Web3ApiName: apis[i] = NewWeb3Api(xeth, codec) default: return nil, fmt.Errorf("Unknown API '%s'", name) @@ -169,21 +172,21 @@ func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth. func Javascript(name string) string { switch strings.ToLower(strings.TrimSpace(name)) { - case AdminApiName: + case shared.AdminApiName: return Admin_JS - case DebugApiName: + case shared.DebugApiName: return Debug_JS - case DbApiName: + case shared.DbApiName: return Db_JS - case MinerApiName: + case shared.MinerApiName: return Miner_JS - case NetApiName: + case shared.NetApiName: return Net_JS - case ShhApiName: + case shared.ShhApiName: return Shh_JS - case TxPoolApiName: + case shared.TxPoolApiName: return TxPool_JS - case PersonalApiName: + case shared.PersonalApiName: return Personal_JS } -- cgit v1.2.3 From 6d596b1ad106db964d4b6a60d35948b588e32b58 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Mon, 22 Jun 2015 13:19:59 +0200 Subject: fixed eth sign unittest --- rpc/api/utils.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rpc/api/utils.go') diff --git a/rpc/api/utils.go b/rpc/api/utils.go index 9995e1f7c..6e4835de6 100644 --- a/rpc/api/utils.go +++ b/rpc/api/utils.go @@ -178,6 +178,8 @@ func Javascript(name string) string { return Debug_JS case shared.DbApiName: return Db_JS + case shared.EthApiName: + return Eth_JS case shared.MinerApiName: return Miner_JS case shared.NetApiName: -- cgit v1.2.3