rpc: personal_initializeWallet (#740)
* Problem: need to add JSON-RPC endpoint personal_initializeWallet Closes #738 * this is aimed at smartcard wallet which is not supported yet. * changelog and not skip for expecting error * fix personal_test error message assertion * Apply suggestions from code review Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
parent
a3f1d8d89d
commit
a874c1e1ca
@ -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
|
* (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
|
* (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#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
|
### Bug Fixes
|
||||||
|
|
||||||
|
@ -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
|
// 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")
|
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")
|
||||||
|
}
|
||||||
|
@ -2,8 +2,6 @@ package rpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -146,11 +144,11 @@ func TestPersonal_LockAccount(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPersonal_Unpair(t *testing.T) {
|
func TestPersonal_Unpair(t *testing.T) {
|
||||||
t.Skip("skipping TestPersonal_Unpair")
|
_, err := CallWithError("personal_unpair", []interface{}{"", ""})
|
||||||
|
require.Equal(t, "smartcard wallet not supported yet", err.Error())
|
||||||
rpcRes := Call(t, "personal_unpair", []interface{}{"", 0})
|
}
|
||||||
|
|
||||||
var res error
|
func TestPersonal_InitializeWallet(t *testing.T) {
|
||||||
err := json.Unmarshal(rpcRes.Result, &res)
|
_, err := CallWithError("personal_initializeWallet", []interface{}{""})
|
||||||
require.True(t, errors.Is(err, fmt.Errorf("smartcard wallet not supported yet")))
|
require.Equal(t, "smartcard wallet not supported yet", err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user