Skip to content

Commit

Permalink
fix: wallet connect
Browse files Browse the repository at this point in the history
  • Loading branch information
iGroza committed Jun 26, 2023
1 parent eb1bffb commit f9bab62
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/services/wallet-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {sendNotification} from '@app/services/toast';
import {RemoteConfig} from './remote-config';

export type WalletConnectEventTypes = keyof SignClientTypes.EventArguments;
const EMPTY_NAMESPACE = {
methods: [],
events: [],
chains: [],
};

export class WalletConnect extends EventEmitter {
static instance = new WalletConnect();
Expand Down Expand Up @@ -161,7 +166,11 @@ export class WalletConnect extends EventEmitter {
return;
}

console.log('approveSession', proposalId, JSON.stringify(params, null, 2));
console.log(
'approveSession params',
proposalId,
JSON.stringify(params, null, 2),
);

const {requiredNamespaces, optionalNamespaces, relays} = params;

Expand All @@ -173,9 +182,9 @@ export class WalletConnect extends EventEmitter {
const namespaces: SessionTypes.Namespaces = {};

Object.keys(allowedNamespaces).forEach(namespace => {
const allowed = allowedNamespaces[namespace];
const required = requiredNamespaces[namespace];
const optional = optionalNamespaces[namespace];
const allowed = {...EMPTY_NAMESPACE, ...allowedNamespaces[namespace]};
const required = {...EMPTY_NAMESPACE, ...requiredNamespaces[namespace]};
const optional = {...EMPTY_NAMESPACE, ...optionalNamespaces[namespace]};

const methods: string[] = [];
[...required?.methods, ...optional?.methods].forEach(method => {
Expand Down

0 comments on commit f9bab62

Please sign in to comment.