I am trying to connect an Ethereum node which is outside of my organisation. So that's why I need to use a proxy agent to connect external URLs.
I am looking for a way to configure the proxy agent while setting up the ethers.js provider.
Say my ethereum node is: https://ropsten.infura.io/v3/xxxxxx
and proxy is myproxy-network.com:80.
I already did this using web3.js and HttpProvider, which works but have to move with ethers.js due to business needs. The web3.js example is shown below -
const tunnel = require('tunnel')
const Web3 = require('web3')
const options = {
keepAlive: true,
timeout: 20000,
agent: {
https: tunnel.httpsOverHttp({
proxy: {
host: 'myproxy-network.com',
port: 80
}
})
}
}
const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/xxxxxx', options))
Need help to do something similar with ethers.js.