MetaMask / providers

An Ethereum Provider that connects over a stream, as injected into websites by MetaMask
MIT License
217 stars 123 forks source link

Auto inject ethereum to active iframe when injected to top frame #250

Closed rony-arnac closed 1 year ago

rony-arnac commented 1 year ago

Hi,

I noticed that metamask extension injects provider via inpage.js only to the top frame. How then the iframes have window.ethereum if it's only injected in top frame? When I try to, I only have window.ethereum in the top frame.

I'm using manifest v3 and my inpage script runs the same way as metamask's and it does

  const provider = initializeProvider({
    jsonRpcStreamName: RPC_STREAM_NAME,
    connectionStream: myStream as Duplex,
    logger: console,
    shouldShimWeb3: true
  });

Thanks.