aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2019-02-13 00:38:46 +0800
committerGitHub <noreply@github.com>2019-02-13 00:38:46 +0800
commitb5d471a73905247406dcbe5ffac6087f80896374 (patch)
tree4ab7f61bfbf3cacb183ddeb95465f19dd13bba7c /cmd
parent75d292bcf673e1b10ac883f8767d092d2f45fd9a (diff)
downloadgo-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.tar
go-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.tar.gz
go-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.tar.bz2
go-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.tar.lz
go-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.tar.xz
go-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.tar.zst
go-tangerine-b5d471a73905247406dcbe5ffac6087f80896374.zip
clef: bidirectional communication with UI (#19018)
* clef: initial implementation of bidirectional RPC communication for the UI * signer: fix tests to pass + formatting * clef: fix unused import + formatting * signer: gosimple nitpicks
Diffstat (limited to 'cmd')
-rw-r--r--cmd/clef/extapi_changelog.md5
-rw-r--r--cmd/clef/intapi_changelog.md24
-rw-r--r--cmd/clef/main.go35
3 files changed, 46 insertions, 18 deletions
diff --git a/cmd/clef/extapi_changelog.md b/cmd/clef/extapi_changelog.md
index 25f819bdd..dc7e65c01 100644
--- a/cmd/clef/extapi_changelog.md
+++ b/cmd/clef/extapi_changelog.md
@@ -1,5 +1,10 @@
### Changelog for external API
+### 6.0.0
+
+* `New` was changed to deliver only an address, not the full `Account` data
+* `Export` was moved from External API to the UI Server API
+
#### 5.0.0
* The external `account_EcRecover`-method was reimplemented.
diff --git a/cmd/clef/intapi_changelog.md b/cmd/clef/intapi_changelog.md
index 205aa1a27..db3353bb7 100644
--- a/cmd/clef/intapi_changelog.md
+++ b/cmd/clef/intapi_changelog.md
@@ -1,5 +1,29 @@
### Changelog for internal API (ui-api)
+### 4.0.0
+
+* Bidirectional communication implemented, so the UI can query `clef` via the stdin/stdout RPC channel. Methods implemented are:
+ - `clef_listWallets`
+ - `clef_listAccounts`
+ - `clef_listWallets`
+ - `clef_deriveAccount`
+ - `clef_importRawKey`
+ - `clef_openWallet`
+ - `clef_chainId`
+ - `clef_setChainId`
+ - `clef_export`
+ - `clef_import`
+
+* The type `Account` was modified (the json-field `type` was removed), to consist of
+
+```golang
+type Account struct {
+ Address common.Address `json:"address"` // Ethereum account address derived from the key
+ URL URL `json:"url"` // Optional resource locator within a backend
+}
+```
+
+
### 3.2.0
* Make `ShowError`, `OnApprovedTx`, `OnSignerStartup` be json-rpc [notifications](https://www.jsonrpc.org/specification#notification):
diff --git a/cmd/clef/main.go b/cmd/clef/main.go
index 279b28d75..e1a44835a 100644
--- a/cmd/clef/main.go
+++ b/cmd/clef/main.go
@@ -344,7 +344,7 @@ func signer(c *cli.Context) error {
return err
}
var (
- ui core.SignerUI
+ ui core.UIClientAPI
)
if c.GlobalBool(stdiouiFlag.Name) {
log.Info("Using stdin/stdout as UI-channel")
@@ -408,18 +408,21 @@ func signer(c *cli.Context) error {
}
}
}
- log.Info("Starting signer", "chainid", c.GlobalInt64(chainIdFlag.Name),
- "keystore", c.GlobalString(keystoreFlag.Name),
- "light-kdf", c.GlobalBool(utils.LightKDFFlag.Name),
- "advanced", c.GlobalBool(advancedMode.Name))
-
- apiImpl := core.NewSignerAPI(
- c.GlobalInt64(chainIdFlag.Name),
- c.GlobalString(keystoreFlag.Name),
- c.GlobalBool(utils.NoUSBFlag.Name),
- ui, db,
- c.GlobalBool(utils.LightKDFFlag.Name),
- c.GlobalBool(advancedMode.Name))
+ var (
+ chainId = c.GlobalInt64(chainIdFlag.Name)
+ ksLoc = c.GlobalString(keystoreFlag.Name)
+ lightKdf = c.GlobalBool(utils.LightKDFFlag.Name)
+ advanced = c.GlobalBool(advancedMode.Name)
+ nousb = c.GlobalBool(utils.NoUSBFlag.Name)
+ )
+ log.Info("Starting signer", "chainid", chainId, "keystore", ksLoc,
+ "light-kdf", lightKdf, "advanced", advanced)
+ am := core.StartClefAccountManager(ksLoc, nousb, lightKdf)
+ apiImpl := core.NewSignerAPI(am, chainId, nousb, ui, db, advanced)
+
+ // Establish the bidirectional communication, by creating a new UI backend and registering
+ // it with the UI.
+ ui.RegisterUIServer(core.NewUIServerAPI(apiImpl))
api = apiImpl
// Audit logging
if logfile := c.GlobalString(auditLogFlag.Name); logfile != "" {
@@ -539,7 +542,7 @@ func homeDir() string {
}
return ""
}
-func readMasterKey(ctx *cli.Context, ui core.SignerUI) ([]byte, error) {
+func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) {
var (
file string
configDir = ctx.GlobalString(configdirFlag.Name)
@@ -674,10 +677,6 @@ func testExternalUI(api *core.SignerAPI) {
checkErr("List", err)
_, err = api.New(ctx)
checkErr("New", err)
- _, err = api.Export(ctx, common.Address{})
- checkErr("Export", err)
- _, err = api.Import(ctx, json.RawMessage{})
- checkErr("Import", err)
api.UI.ShowInfo("Tests completed")