Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Problem: need to add JSON-RPC endpoint personal_initializeWallet #740

Merged
merged 4 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
fedekunze marked this conversation as resolved.
Show resolved Hide resolved

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")
fedekunze marked this conversation as resolved.
Show resolved Hide resolved

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