Skip to content

Commit

Permalink
fix: wallet connect (#1133)
Browse files Browse the repository at this point in the history
Co-authored-by: iGroza <[email protected]>
  • Loading branch information
iGroza and iGroza committed Jun 26, 2023
1 parent 8bd9310 commit 2f75550
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 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,8 +166,6 @@ export class WalletConnect extends EventEmitter {
return;
}

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

const {requiredNamespaces, optionalNamespaces, relays} = params;

const allowedNamespaces = RemoteConfig.get('wallet_connect');
Expand All @@ -173,9 +176,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 2f75550

Please sign in to comment.