aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/js.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-06-23 22:48:33 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 16:43:31 +0800
commit83ee39448e0f23d42dff27bccde27f828afa3707 (patch)
tree429fa8f20a4bc017a58ffc4c7c0ed8596d1d206f /cmd/geth/js.go
parentd764bd058457cd9eb91d205d1ac187d40c4866d6 (diff)
downloadgo-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.tar
go-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.tar.gz
go-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.tar.bz2
go-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.tar.lz
go-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.tar.xz
go-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.tar.zst
go-tangerine-83ee39448e0f23d42dff27bccde27f828afa3707.zip
Registrar and contractInfo handling
* resolver -> common/registrar * global registrar name registry interface * add Call to resolver backend interface * the hashReg and UrlHing contracts now initialised from global registry * initialization of contracts uniform * improve errors and more econsistent method names * common/registrar/ethreg: versioned registrar * integrate new naming and registrar in natspec * js console api: setGlobalRegistrar, setHashReg, setUrlHint * js test TestContract uses mining - tests fixed all pass * eth/backend: allow PoW test mode (small ethash DAG) * console jsre refers to resolver.abi/addr, * cmd/geth/contracts.go moved to common/registrar
Diffstat (limited to 'cmd/geth/js.go')
-rw-r--r--cmd/geth/js.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 01840ebd9..5a5dd75f3 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -32,16 +32,17 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/docserver"
"github.com/ethereum/go-ethereum/common/natspec"
+ "github.com/ethereum/go-ethereum/common/registrar"
"github.com/ethereum/go-ethereum/eth"
re "github.com/ethereum/go-ethereum/jsre"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
+ "github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/xeth"
"github.com/peterh/liner"
"github.com/robertkrimen/otto"
- "github.com/ethereum/go-ethereum/rpc/shared"
)
type prompter interface {
@@ -69,6 +70,7 @@ func (r dumbterm) PasswordPrompt(p string) (string, error) {
func (r dumbterm) AppendHistory(string) {}
type jsre struct {
+ ds *docserver.DocServer
re *re.JSRE
ethereum *eth.Ethereum
xeth *xeth.XEth
@@ -180,6 +182,7 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, client comms.Et
if f == nil {
f = js
}
+ js.ds = docserver.New("/")
js.xeth = xeth.New(ethereum, f)
js.wait = js.xeth.UpdateState()
js.client = client
@@ -331,15 +334,14 @@ func (js *jsre) apiBindings(f xeth.Frontend) error {
utils.Fatalf("Error setting namespaces: %v", err)
}
- js.re.Eval(globalRegistrar + "registrar = GlobalRegistrar.at(\"" + globalRegistrarAddr + "\");")
+ js.re.Eval(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`)
+
return nil
}
-var ds, _ = docserver.New("/")
-
func (self *jsre) ConfirmTransaction(tx string) bool {
if self.ethereum.NatSpec {
- notice := natspec.GetNotice(self.xeth, tx, ds)
+ notice := natspec.GetNotice(self.xeth, tx, self.ds)
fmt.Println(notice)
answer, _ := self.Prompt("Confirm Transaction [y/n]")
return strings.HasPrefix(strings.Trim(answer, " "), "y")