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

Problem: need to add rpc endpoint personal_unpair #733

Merged
merged 4 commits into from
Nov 10, 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 @@ -222,3 +222,11 @@ func (api *PrivateAccountAPI) EcRecover(_ context.Context, data, sig hexutil.Byt

return crypto.PubkeyToAddress(*pubkey), nil
}

// Unpair deletes a pairing between wallet and ethermint.
func (api *PrivateAccountAPI) Unpair(_ context.Context, url string, pin string) error {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
api.logger.Debug("personal_unpair", "url", url, "pin", pin)
api.logger.Info("personal_unpair 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")
}
11 changes: 11 additions & 0 deletions tests/rpc/personal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rpc

import (
"encoding/json"
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -142,3 +143,13 @@ func TestPersonal_LockAccount(t *testing.T) {
_, err = CallWithError("personal_sign", []interface{}{hexutil.Bytes{0x88}, addr, ""})
require.Error(t, err)
}

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.Equal(t, fmt.Errorf("smartcard wallet not supported yet"), err)
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
}