ethers.js backed by portal.provider.
portal.updateChain is used to bind portal.provider to a specific EVM chain. It takes the numeric chain ID as a string, for example '11155111' for Sepolia or '1' for Ethereum Mainnet.
The
chainId option on the Portal constructor is deprecated. portal.updateChain() remains the supported way to configure a global fallback chain for EIP-1193 libraries, and uses the numeric chain reference format shown above. Requests that supply their own chain should pass a CAIP-2 chainId instead — portal.request({ chainId: 'eip155:11155111', ... }).portal.provider is then supplied to ethers.js BrowserProvider. The returned object is an ethers.js Provider and supports read-only requests to the chain. To be able to send a transaction we need a Signer which ethersProvider.getSigner returns.
The next bit of code is ethers.js specific and uses ethersSigner.sendTransaction to send 0.001 ETH to the address specified. The code also waits for the transaction to be mined.
That’s all! We’ve successfully used portal.provider and ethers.js to send a transaction!