@@ -33,73 +33,73 @@ func (self *WebSocketServer) Serv() {
3333 data := ethutil .NewValue (msg .Args )
3434 bcode , err := ethutil .Compile (data .Get (0 ).Str (), false )
3535 if err != nil {
36- c .Write (args (nil , err .Error ()), msg .Seed )
36+ c .Write (args (nil , err .Error ()), msg .Id )
3737 }
3838
3939 code := ethutil .Bytes2Hex (bcode )
40- c .Write (args (code , nil ), msg .Seed )
41- case "getBlockByNumber " :
40+ c .Write (args (code , nil ), msg .Id )
41+ case "eth_blockByNumber " :
4242 args := msg .Arguments ()
4343
4444 block := pipe .BlockByNumber (int32 (args .Get (0 ).Uint ()))
45- c .Write (block , msg .Seed )
45+ c .Write (block , msg .Id )
4646
47- case "getKey" :
48- c .Write (pipe .Key ().PrivateKey , msg .Seed )
49- case "transact" :
47+ case "eth_blockByHash" :
48+ args := msg .Arguments ()
49+
50+ c .Write (pipe .BlockByHash (args .Get (0 ).Str ()), msg .Id )
51+
52+ case "eth_transact" :
5053 if mp , ok := msg .Args [0 ].(map [string ]interface {}); ok {
5154 object := mapToTxParams (mp )
5255 c .Write (
53- args (pipe .Transact (object [ "from" ] , object ["to" ], object ["value" ], object ["gas" ], object ["gasPrice" ], object ["data" ])),
54- msg .Seed ,
56+ args (pipe .Transact (pipe . Key (). PrivateKey , object ["to" ], object ["value" ], object ["gas" ], object ["gasPrice" ], object ["data" ])),
57+ msg .Id ,
5558 )
5659
5760 }
58- case "getCoinBase" :
59- c .Write (pipe .CoinBase (), msg .Seed )
61+ case "eth_gasPrice" :
62+ c .Write ("10000000000000" , msg .Id )
63+ case "eth_coinbase" :
64+ c .Write (pipe .CoinBase (), msg .Id )
6065
61- case "getIsListening " :
62- c .Write (pipe .IsListening (), msg .Seed )
66+ case "eth_listening " :
67+ c .Write (pipe .IsListening (), msg .Id )
6368
64- case "getIsMining" :
65- c .Write (pipe .IsMining (), msg .Seed )
66-
67- case "getPeerCoint" :
68- c .Write (pipe .PeerCount (), msg .Seed )
69-
70- case "getCountAt" :
71- args := msg .Arguments ()
69+ case "eth_mining" :
70+ c .Write (pipe .IsMining (), msg .Id )
7271
73- c .Write (pipe .TxCountAt (args .Get (0 ).Str ()), msg .Seed )
72+ case "eth_peerCount" :
73+ c .Write (pipe .PeerCount (), msg .Id )
7474
75- case "getCodeAt " :
75+ case "eth_countAt " :
7676 args := msg .Arguments ()
7777
78- c .Write (len ( pipe .CodeAt (args .Get (0 ).Str ())) , msg .Seed )
78+ c .Write (pipe .TxCountAt (args .Get (0 ).Str ()), msg .Id )
7979
80- case "getBlockByHash " :
80+ case "eth_codeAt " :
8181 args := msg .Arguments ()
8282
83- c .Write (pipe .BlockByHash (args .Get (0 ).Str ()), msg .Seed )
83+ c .Write (len ( pipe .CodeAt (args .Get (0 ).Str ())) , msg .Id )
8484
85- case "getStorageAt " :
85+ case "eth_storageAt " :
8686 args := msg .Arguments ()
8787
88- c .Write (pipe .StorageAt (args .Get (0 ).Str (), args .Get (1 ).Str ()), msg .Seed )
88+ c .Write (pipe .StorageAt (args .Get (0 ).Str (), args .Get (1 ).Str ()), msg .Id )
8989
90- case "getBalanceAt " :
90+ case "eth_balanceAt " :
9191 args := msg .Arguments ()
9292
93- c .Write (pipe .BalanceAt (args .Get (0 ).Str ()), msg .Seed )
93+ c .Write (pipe .BalanceAt (args .Get (0 ).Str ()), msg .Id )
9494
95- case "getSecretToAddress " :
95+ case "eth_secretToAddress " :
9696 args := msg .Arguments ()
9797
98- c .Write (pipe .SecretToAddress (args .Get (0 ).Str ()), msg .Seed )
98+ c .Write (pipe .SecretToAddress (args .Get (0 ).Str ()), msg .Id )
9999
100- case "newFilter " :
101- case "newFilterString " :
102- case "messages " :
100+ case "eth_newFilter " :
101+ case "eth_newFilterString " :
102+ case "eth_messages " :
103103 // TODO
104104 }
105105
0 commit comments