Skip to content

Commit

Permalink
fix: do not proxy web3 provider instance
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Jan 26, 2025
1 parent ea276c1 commit 0d2d736
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions apps/ui/src/composables/useWeb3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,16 @@ export function useWeb3() {
}

async function registerConnector(connector: Connector) {
const _provider = new Web3Provider(connector.provider, 'any');
provider.value = _provider;
const web3 = new Web3Provider(connector.provider, 'any');

provider.value = markRaw(web3);

try {
attachConnectorEvents(connector);
let network, accounts;
try {
if (connector.id === 'gnosis' && _provider.provider.safe) {
const { chainId: safeChainId, safeAddress } = _provider.provider.safe;
if (connector.id === 'gnosis' && web3.provider.safe) {
const { chainId: safeChainId, safeAddress } = web3.provider.safe;
network = { chainId: safeChainId };
accounts = [safeAddress];
} else if (STARKNET_CONNECTORS.includes(connector.type)) {
Expand All @@ -121,8 +122,8 @@ export function useWeb3() {
accounts = [connector.provider.selectedAddress];
} else {
[network, accounts] = await Promise.all([
_provider.getNetwork(),
_provider.listAccounts()
web3.getNetwork(),
web3.listAccounts()
]);
}
} catch (e) {
Expand Down

0 comments on commit 0d2d736

Please sign in to comment.