aboutsummaryrefslogtreecommitdiffstats
path: root/console
diff options
context:
space:
mode:
Diffstat (limited to 'console')
-rw-r--r--console/console.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/console/console.go b/console/console.go
index 9bb3df926..389d52858 100644
--- a/console/console.go
+++ b/console/console.go
@@ -137,10 +137,14 @@ func (c *Console) init(preload []string) error {
continue // manually mapped or ignore
}
if file, ok := web3ext.Modules[api]; ok {
+ // Load our extension for the module.
if err = c.jsre.Compile(fmt.Sprintf("%s.js", api), file); err != nil {
return fmt.Errorf("%s.js: %v", api, err)
}
flatten += fmt.Sprintf("var %s = web3.%s; ", api, api)
+ } else if obj, err := c.jsre.Run("web3." + api); err == nil && obj.IsObject() {
+ // Enable web3.js built-in extension if available.
+ flatten += fmt.Sprintf("var %s = web3.%s; ", api, api)
}
}
if _, err = c.jsre.Run(flatten); err != nil {