feat(walletconnect): support for eth_signTypedData v3 and v4

Closes: #12961
This commit is contained in:
Sale Djenic 2023-12-12 09:38:17 +01:00 committed by saledjenic
parent a8fb355a8d
commit bf8b87f034
5 changed files with 16 additions and 3 deletions

View File

@ -164,8 +164,10 @@ QtObject:
self.respondSessionRequest($self.sessionRequestJson, signature, false)
elif requestMethod == RequestMethod.EthSign:
self.respondSessionRequest($self.sessionRequestJson, signature, false)
elif requestMethod == RequestMethod.SignTypedData:
self.respondSessionRequest($self.sessionRequestJson, signature, false)
elif requestMethod == RequestMethod.SignTypedData or
requestMethod == RequestMethod.SignTypedDataV3 or
requestMethod == RequestMethod.SignTypedDataV4:
self.respondSessionRequest($self.sessionRequestJson, signature, false)
else:
error "Unknown request method"
self.respondSessionRequest($self.sessionRequestJson, "", true)

View File

@ -11,6 +11,8 @@ type
PersonalSign = "personal_sign"
EthSign = "eth_sign"
SignTypedData = "eth_signTypedData"
SignTypedDataV3 = "eth_signTypedData_v3"
SignTypedDataV4 = "eth_signTypedData_v4"
## provided json represents a `SessionRequest`
proc getRequestMethod*(jsonObj: JsonNode): RequestMethod =

View File

@ -292,6 +292,13 @@ Popup {
root.controller.sessionProposal(JSON.stringify(sessionProposal))
}
function onSessionRequestEvent(sessionRequest) {
d.setStatusText("Approve session request")
d.setDetailsText(JSON.stringify(sessionRequest, null, 2))
d.sessionRequest = sessionRequest
root.state = d.waitingUserResponseToSessionRequest
}
function onApproveSessionResult(sessionProposal, error) {
d.setDetailsText("")
if (!error) {

View File

@ -172,6 +172,7 @@ Item {
console.debug(`WC WalletConnectSDK.wcCall.getPairings;`)
d.engine.runJavaScript(`wc.getPairings()`, function(result) {
console.debug(`WC WalletConnectSDK.wcCall.getPairings; result: ${JSON.stringify(result, null, 2)}`)
if (callback && result) {
callback(result)
@ -183,6 +184,7 @@ Item {
console.debug(`WC WalletConnectSDK.wcCall.getActiveSessions;`)
d.engine.runJavaScript(`wc.getActiveSessions()`, function(result) {
console.debug(`WC WalletConnectSDK.wcCall.getActiveSessions; result: ${JSON.stringify(result, null, 2)}`)
if (callback && result) {
callback(result)

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 271778a1e07e585a12790b4e2226f13e36ea89f4
Subproject commit fd16942b205e1f19fd08db4d5b0873cc2fbc921b