Skip to content

Commit

Permalink
fix(bridge-ui): Network change fix (#13549)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Apr 6, 2023
1 parent 8cd5916 commit 1884151
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/bridge-ui/src/components/ChainDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
await switchNetwork({
chainId: chain.id,
});
const provider = new ethers.providers.Web3Provider(window.ethereum);
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
await provider.send('eth_requestAccounts', []);
fromChain.set(chain);
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge-ui/src/components/form/SelectChain.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
await switchNetwork({
chainId: chain.id,
});
const provider = new ethers.providers.Web3Provider(window.ethereum);
const provider = new ethers.providers.Web3Provider(
window.ethereum,
'any',
);
await provider.send('eth_requestAccounts', []);
fromChain.set(chain);
Expand Down
5 changes: 4 additions & 1 deletion packages/bridge-ui/src/utils/switchChainAndSetSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export async function switchChainAndSetSigner(chain: Chain) {

await switchNetwork({ chainId });

const provider = new ethers.providers.Web3Provider(globalThis.ethereum);
const provider = new ethers.providers.Web3Provider(
globalThis.ethereum,
'any',
);
await provider.send('eth_requestAccounts', []);

fromChain.set(chain);
Expand Down
8 changes: 4 additions & 4 deletions packages/starter-dapp/src/components/ChainDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
await switchNetwork({
chainId: chain.id,
});
const provider = new ethers.providers.Web3Provider(window.ethereum);
const provider = new ethers.providers.Web3Provider(window.ethereum, "any");
await provider.send("eth_requestAccounts", []);
fromChain.set(chain);
Expand All @@ -31,13 +31,13 @@
<svelte:component this={$fromChain.icon} />
<span class="ml-2 hidden md:inline-block">{$fromChain.name}</span>
{:else}
<span class="ml-2 flex items-center">
<ExclamationTriangle class='mr-2' size='20' />
<span class="ml-2 flex items-center">
<ExclamationTriangle class="mr-2" size="20" />
<span class="hidden md:block">Invalid Chain</span>
</span>
{/if}
</span>
<ChevronDown size='20' />
<ChevronDown size="20" />
</label>
<ul
tabindex="0"
Expand Down

0 comments on commit 1884151

Please sign in to comment.