`Mangrove.connect` fails on local node when given url is `localhost`.
jkrivine opened this issue · 3 comments
jkrivine commented
Describe the bug
Mangrove.connect
fails on local node when given url is localhost:8545
. It succeeds however when given url is 127.0.01:8545
To Reproduce
Steps to reproduce the behavior:
const provider = new ethers.providers.JsonRpcProvider(
"http://localhost:8545"
);
let wallet = new ethers.Wallet(<PRIVATE_KEY>, provider);
let mgv = await Mangrove.connect({ signer: wallet });
That sequence fails with:
Uncaught:
Error: missing response (requestBody="{\"method\":\"net_version\",\"id\":46,\"jsonrpc\":\"2.0\"}", requestMethod="POST", serverError={"errno":-61,"code":"ECONNREFUSED","syscall":"connect","address":"::1","port":8545}, url="http://localhost:8545", code=SERVER_ERROR, version=web/5.6.1)
[..]
requestBody: '{"method":"net_version","id":46,"jsonrpc":"2.0"}',
requestMethod: 'POST',
serverError: [Error],
url: 'http://localhost:8545'
}
jkrivine commented
This is likely due to localhost
being interpreted as "address":"::1" because of IPv6 configuration.
peterMangrove commented
This is still relevant. I recreated the error.
lnist commented
This was a foundry issue: foundry-rs/foundry#4941
And it has been fixed.