Skip to content

Commit

Permalink
fixed some missing methods and events that caused the connection with…
Browse files Browse the repository at this point in the history
… some dapps to break during the approveSession
  • Loading branch information
cgrellard-ledger committed Aug 31, 2023
1 parent 567be5f commit 68786e1
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/hooks/useProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,29 @@ export function useProposal({ proposal }: Props) {
[],
)

return {
[SupportedNamespace.EIP155]: {
chains: [...new Set(dataToSend.map((e) => e.chain))],
methods: Object.values(EIP155_SIGNING_METHODS),
events: [
const requiredNamespaces = proposal.params.requiredNamespaces
const namespace =
requiredNamespaces && Object.keys(requiredNamespaces).length > 0
? requiredNamespaces[SupportedNamespace.EIP155]
: { methods: [] as string[], events: [] as string[] }

const methods = [...new Set(namespace.methods.concat(Object.values(EIP155_SIGNING_METHODS)))]
const events = [
...new Set(
namespace.events.concat([
"session_proposal",
"session_request",
"auth_request",
"session_delete",
"chainChanged",
"accountsChanged",
],
]),
),
]

return {
[SupportedNamespace.EIP155]: {
chains: [...new Set(dataToSend.map((e) => e.chain))],
methods,
events,
accounts: dataToSend.map((e) => e.account),
},
}
Expand Down

0 comments on commit 68786e1

Please sign in to comment.