diff --git a/CHANGELOG.md b/CHANGELOG.md index 987f2207..5fb08d46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (evm) [tharsis#662](https://github.com/tharsis/ethermint/pull/662) Disable basefee for non london blocks * (cmd) [tharsis#712](https://github.com/tharsis/ethermint/pull/712) add tx cli to build evm transaction * (rpc) [tharsis#733](https://github.com/tharsis/ethermint/pull/733) add JSON_RPC endpoint personal_unpair +* (rpc) [tharsis#740](https://github.com/tharsis/ethermint/pull/740) add JSON_RPC endpoint personal_initializeWallet ### Bug Fixes diff --git a/rpc/ethereum/namespaces/personal/api.go b/rpc/ethereum/namespaces/personal/api.go index b5786e59..945e6918 100644 --- a/rpc/ethereum/namespaces/personal/api.go +++ b/rpc/ethereum/namespaces/personal/api.go @@ -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") +} diff --git a/tests/rpc/personal_test.go b/tests/rpc/personal_test.go index b0614ee5..9b9d858c 100644 --- a/tests/rpc/personal_test.go +++ b/tests/rpc/personal_test.go @@ -2,8 +2,6 @@ package rpc import ( "encoding/json" - "errors" - "fmt" "testing" "github.com/stretchr/testify/require" @@ -146,11 +144,11 @@ func TestPersonal_LockAccount(t *testing.T) { } func TestPersonal_Unpair(t *testing.T) { - t.Skip("skipping TestPersonal_Unpair") - - rpcRes := Call(t, "personal_unpair", []interface{}{"", 0}) - - var res error - err := json.Unmarshal(rpcRes.Result, &res) - require.True(t, errors.Is(err, fmt.Errorf("smartcard wallet not supported yet"))) + _, err := CallWithError("personal_unpair", []interface{}{"", ""}) + require.Equal(t, "smartcard wallet not supported yet", err.Error()) +} + +func TestPersonal_InitializeWallet(t *testing.T) { + _, err := CallWithError("personal_initializeWallet", []interface{}{""}) + require.Equal(t, "smartcard wallet not supported yet", err.Error()) }