0xsequence / sequence.js

Sequence: a modular web3 stack and smart wallet for Ethereum chains
https://docs.sequence.xyz
Other
300 stars 57 forks source link

Events are not triggering #326

Open Quicksaver opened 1 year ago

Quicksaver commented 1 year ago

Listening to events (https://docs.metamask.io/guide/ethereum-provider.html#events), via sequenceProvider.transport.provider.on(eventName, eventHandler) does not seem to work.

For example, sending a successful wallet_switchEthereumChain request to the web3 provider object does not trigger a chainChanged event (or even the depcreated networkChanged one).

If I disconnect (sign out) of the sequence wallet, I also don't get a disconnected event, although I'm not sure that's by design as the client in the page may still be connected?

tolgahan-arikan commented 1 year ago

Can you try following:

const wallet = sequence.getWallet()
wallet.on('eventName', event => {
    ....
})
Quicksaver commented 1 year ago

Ditto from https://github.com/0xsequence/sequence.js/issues/324#issuecomment-1425907022, we've had to rewrite our code to not follow blindly web3js events and be able to listen from other sources, aka Sequence's methods. Could be a blocker for projects looking to integrate Sequence into their already existing ethers/web3js-compatible code.