Skip to content

Commit

Permalink
Approve only supported WalletConnect methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Nov 15, 2023
1 parent 4b9f4b3 commit 48667dd
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,18 @@ class WC2Service(
}

fun approve(proposal: Sign.Model.SessionProposal, blockchains: List<WCBlockchain>) {
val supportedMethods = listOf(
"personal_sign",
"eth_signTypedData",
"eth_sendTransaction",
"eth_sign",
)

val namespaces = proposal.requiredNamespaces + proposal.optionalNamespaces
val methods = namespaces.values.flatMap { it.methods }.distinct()
val methods = namespaces.values
.flatMap { it.methods }
.distinct()
.filter { supportedMethods.contains(it) }
val events = namespaces.values.flatMap { it.events }.distinct()

val sessionNamespaces = blockchains
Expand Down

0 comments on commit 48667dd

Please sign in to comment.