I am trying to use wallet connect v2 in react-native. When a connection request is made for 5 chains, I want to connect only 3 chains. Is there a way? If I put only 3 accounts in nameSpace, I get an error. Is there any way to connect only some chains when the wallet connect v2 connection request comes to the react-native wallet?
const { id, params } = this.proposal;
const { requiredNamespaces, relays } = params;
const namespaces: SessionTypes.Namespaces = {};
Object.keys(requiredNamespaces).forEach(key => {
const accounts: string[] = [];
requiredNamespaces[key].chains?.map(chain => {
const availableNetwork = availableNetworkList.find(
({ chainId }) => chainId === this.getEIP155ChainId(chain),
);
console.log('requiredNamespaces', requiredNamespaces[key]);
availableNetwork?.isConnect
? accounts.push(`${chain}:${this.currentETHAddress}`)
: accounts.push(`${chain}:`);
});
namespaces[key] = {
accounts,
methods: requiredNamespaces[key].methods,
events: requiredNamespaces[key].events,
};
console.log('namespaces', namespaces);
});
await this.web3wallet.approveSession({
id,
relayProtocol: relays[0].protocol,
namespaces,
});
When a connection request was received for 5 chains, the addresses for only 3 chains were added and passed to the namespace of the approve session.