console: add admin.sleep and admin.sleepBlocks

This commit is contained in:
Bas van Kervel
2016-01-19 09:26:17 +01:00
parent 5945a33350
commit cdd34fcb16
2 changed files with 84 additions and 0 deletions

View File

@ -348,6 +348,15 @@ func (js *jsre) apiBindings(f xeth.Frontend) error {
persObj.Set("newAccount", jeth.NewAccount)
}
// The admin.sleep and admin.sleepBlocks are offered by the console and not by the RPC layer.
// Bind these if the admin module is available.
if a, err := js.re.Get("admin"); err == nil {
if adminObj := a.Object(); adminObj != nil {
adminObj.Set("sleepBlocks", jeth.SleepBlocks)
adminObj.Set("sleep", jeth.Sleep)
}
}
return nil
}