Skip to content

Commit

Permalink
chore: approves only the active & required chain without optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Gancho Radkov committed Apr 30, 2024
1 parent 1fe717d commit d2cb01b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/controllers/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ export class Engine extends ISingleEthereumEngine {
const parsed = parseChain(chain);
return parseInt(parsed);
});
const optionalChains = (normalizedOptional[EVM_IDENTIFIER]?.chains || []).map((chain) => {
const parsed = parseChain(chain);
return parseInt(parsed);
});

const approvedChains = [...new Set([chainId, ...requiredChains, ...optionalChains])];
const approvedChains = [...new Set([chainId, ...requiredChains])];
const approveParams = {
id,
namespaces: {
Expand All @@ -72,7 +68,7 @@ export class Engine extends ISingleEthereumEngine {
chains: approvedChains.map((chain) => prefixChainWithNamespace(chain)),
methods: normalizedRequired[EVM_IDENTIFIER]?.methods?.length
? normalizedRequired[EVM_IDENTIFIER].methods
: ["eth_sendTransaction", "personal_sign"],
: ["eth_sendTransaction", "personal_sign", "wallet_switchEthereumChain"],
events: normalizedRequired[EVM_IDENTIFIER]?.events?.length
? normalizedRequired[EVM_IDENTIFIER].events
: ["chainChanged", "accountsChanged"],
Expand Down

0 comments on commit d2cb01b

Please sign in to comment.