feat(walletconnect)_: support for eth_signTypedData v3 and v4
This commit is contained in:
parent
4d3a02e504
commit
fd16942b20
|
@ -27,7 +27,9 @@ const (
|
||||||
SignTransactionMethodName = "eth_signTransaction"
|
SignTransactionMethodName = "eth_signTransaction"
|
||||||
|
|
||||||
// SignTypedDataMethodName https://docs.walletconnect.com/advanced/rpc-reference/ethereum-rpc#eth_signtypeddata
|
// 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"
|
WalletSwitchEthereumChainMethodName = "wallet_switchEthereumChain"
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,8 @@ func (s *Service) PairSessionProposal(proposal SessionProposal) (*PairSessionRes
|
||||||
params.SignMethodName,
|
params.SignMethodName,
|
||||||
params.SignTransactionMethodName,
|
params.SignTransactionMethodName,
|
||||||
params.SignTypedDataMethodName,
|
params.SignTypedDataMethodName,
|
||||||
|
params.SignTypedDataV3MethodName,
|
||||||
|
params.SignTypedDataV4MethodName,
|
||||||
params.WalletSwitchEthereumChainMethodName,
|
params.WalletSwitchEthereumChainMethodName,
|
||||||
},
|
},
|
||||||
Events: []string{"accountsChanged", "chainChanged"},
|
Events: []string{"accountsChanged", "chainChanged"},
|
||||||
|
@ -163,7 +165,9 @@ func (s *Service) SessionRequest(request SessionRequest) (response *transfer.TxR
|
||||||
return s.buildMessage(request, 1, 0, false)
|
return s.buildMessage(request, 1, 0, false)
|
||||||
} else if request.Params.Request.Method == params.SignMethodName {
|
} else if request.Params.Request.Method == params.SignMethodName {
|
||||||
return s.buildMessage(request, 0, 1, false)
|
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)
|
return s.buildMessage(request, 0, 1, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue