From fd16942b205e1f19fd08db4d5b0873cc2fbc921b Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Tue, 12 Dec 2023 09:35:51 +0100 Subject: [PATCH] feat(walletconnect)_: support for eth_signTypedData v3 and v4 --- params/defaults.go | 4 +++- services/wallet/walletconnect/service.go | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/params/defaults.go b/params/defaults.go index 63dafe725..5c1a32ad0 100644 --- a/params/defaults.go +++ b/params/defaults.go @@ -27,7 +27,9 @@ const ( SignTransactionMethodName = "eth_signTransaction" // SignTypedDataMethodName https://docs.walletconnect.com/advanced/rpc-reference/ethereum-rpc#eth_signtypeddata - SignTypedDataMethodName = "eth_signTypedData" + SignTypedDataMethodName = "eth_signTypedData" + SignTypedDataV3MethodName = "eth_signTypedData_v3" + SignTypedDataV4MethodName = "eth_signTypedData_v4" WalletSwitchEthereumChainMethodName = "wallet_switchEthereumChain" diff --git a/services/wallet/walletconnect/service.go b/services/wallet/walletconnect/service.go index 185793e29..79b446e31 100644 --- a/services/wallet/walletconnect/service.go +++ b/services/wallet/walletconnect/service.go @@ -113,6 +113,8 @@ func (s *Service) PairSessionProposal(proposal SessionProposal) (*PairSessionRes params.SignMethodName, params.SignTransactionMethodName, params.SignTypedDataMethodName, + params.SignTypedDataV3MethodName, + params.SignTypedDataV4MethodName, params.WalletSwitchEthereumChainMethodName, }, Events: []string{"accountsChanged", "chainChanged"}, @@ -163,7 +165,9 @@ func (s *Service) SessionRequest(request SessionRequest) (response *transfer.TxR return s.buildMessage(request, 1, 0, false) } else if request.Params.Request.Method == params.SignMethodName { return s.buildMessage(request, 0, 1, false) - } else if request.Params.Request.Method == params.SignTypedDataMethodName { + } else if request.Params.Request.Method == params.SignTypedDataMethodName || + request.Params.Request.Method == params.SignTypedDataV3MethodName || + request.Params.Request.Method == params.SignTypedDataV4MethodName { return s.buildMessage(request, 0, 1, true) }