Skip to content

Commit

Permalink
Problem: need to add JSON-RPC endpoint personal_initializeWallet
Browse files Browse the repository at this point in the history
* Closes evmos#738

* will simply return error since smartcard wallet is not supported yet.
  • Loading branch information
adu-web3 committed Nov 10, 2021
1 parent 658d6e7 commit fe0f373
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions rpc/ethereum/namespaces/personal/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,11 @@ func (api *PrivateAccountAPI) Unpair(_ context.Context, url, pin string) error {
// TODO: Smartcard wallet not supported yet, refer to: https://github.com/ethereum/go-ethereum/blob/master/accounts/scwallet/README.md
return fmt.Errorf("smartcard wallet not supported yet")
}

// InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key.
func (api *PrivateAccountAPI) InitializeWallet(_ context.Context, url string) (string, error) {
api.logger.Debug("personal_initializeWallet", "url", url)
api.logger.Info("personal_initializeWallet for smartcard wallet not supported")
// TODO: Smartcard wallet not supported yet, refer to: https://github.com/ethereum/go-ethereum/blob/master/accounts/scwallet/README.md
return "", fmt.Errorf("smartcard wallet not supported yet")
}
10 changes: 7 additions & 3 deletions tests/rpc/personal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ func TestPersonal_LockAccount(t *testing.T) {
func TestPersonal_Unpair(t *testing.T) {
t.Skip("skipping TestPersonal_Unpair")

rpcRes := Call(t, "personal_unpair", []interface{}{"", 0})
_, err := CallWithError(t, "personal_unpair", []interface{}{"", 0})
require.True(t, errors.Is(err, fmt.Errorf("smartcard wallet not supported yet")))
}

var res error
err := json.Unmarshal(rpcRes.Result, &res)
func TestPersonal_InitializeWallet(t *testing.T) {
t.Skip("skipping TestPersonal_InitializeWallet")

_, err := CallWithError(t, "personal_initializeWallet", []interface{}{""})
require.True(t, errors.Is(err, fmt.Errorf("smartcard wallet not supported yet")))
}

0 comments on commit fe0f373

Please sign in to comment.