@@ -32,16 +32,17 @@ import (
32
32
"github.com/ethereum/go-ethereum/common"
33
33
"github.com/ethereum/go-ethereum/common/docserver"
34
34
"github.com/ethereum/go-ethereum/common/natspec"
35
+ "github.com/ethereum/go-ethereum/common/registrar"
35
36
"github.com/ethereum/go-ethereum/eth"
36
37
re "github.com/ethereum/go-ethereum/jsre"
37
38
"github.com/ethereum/go-ethereum/rpc"
38
39
"github.com/ethereum/go-ethereum/rpc/api"
39
40
"github.com/ethereum/go-ethereum/rpc/codec"
40
41
"github.com/ethereum/go-ethereum/rpc/comms"
42
+ "github.com/ethereum/go-ethereum/rpc/shared"
41
43
"github.com/ethereum/go-ethereum/xeth"
42
44
"github.com/peterh/liner"
43
45
"github.com/robertkrimen/otto"
44
- "github.com/ethereum/go-ethereum/rpc/shared"
45
46
)
46
47
47
48
type prompter interface {
@@ -69,6 +70,7 @@ func (r dumbterm) PasswordPrompt(p string) (string, error) {
69
70
func (r dumbterm ) AppendHistory (string ) {}
70
71
71
72
type jsre struct {
73
+ ds * docserver.DocServer
72
74
re * re.JSRE
73
75
ethereum * eth.Ethereum
74
76
xeth * xeth.XEth
@@ -143,6 +145,7 @@ func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive
143
145
js := & jsre {ps1 : "> " }
144
146
js .wait = make (chan * big.Int )
145
147
js .client = client
148
+ js .ds = docserver .New ("/" )
146
149
147
150
if f == nil {
148
151
f = js
@@ -180,6 +183,7 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, client comms.Et
180
183
if f == nil {
181
184
f = js
182
185
}
186
+ js .ds = docserver .New ("/" )
183
187
js .xeth = xeth .New (ethereum , f )
184
188
js .wait = js .xeth .UpdateState ()
185
189
js .client = client
@@ -331,15 +335,13 @@ func (js *jsre) apiBindings(f xeth.Frontend) error {
331
335
utils .Fatalf ("Error setting namespaces: %v" , err )
332
336
}
333
337
334
- js .re .Eval (globalRegistrar + " registrar = GlobalRegistrar.at(\" " + globalRegistrarAddr + " \" );" )
338
+ js .re .Eval (`var GlobalRegistrar = eth.contract(` + registrar . GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar . GlobalRegistrarAddr + `");` )
335
339
return nil
336
340
}
337
341
338
- var ds , _ = docserver .New ("/" )
339
-
340
342
func (self * jsre ) ConfirmTransaction (tx string ) bool {
341
343
if self .ethereum .NatSpec {
342
- notice := natspec .GetNotice (self .xeth , tx , ds )
344
+ notice := natspec .GetNotice (self .xeth , tx , self . ds )
343
345
fmt .Println (notice )
344
346
answer , _ := self .Prompt ("Confirm Transaction [y/n]" )
345
347
return strings .HasPrefix (strings .Trim (answer , " " ), "y" )
0 commit comments