You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: hre.viem.getPublicClient() fails without explicit transport parameter
Description
When using the hardhat-viem plugin, calling hre.viem.getPublicClient() without parameters fails, but works correctly when explicitly providing a transport with hre.viem.getPublicClient({transport: http()}).
Expected Behavior
hre.viem.getPublicClient() should work properly without requiring an explicit transport, as the plugin should configure the transport automatically when connecting to the Hardhat Network.
Actual Behavior
Without an explicit transport, the function fails. With {transport: http()}, it works correctly.
Workaround
Use either:
// Working solution with hardhat-viemconstpublicClient=awaithre.viem.getPublicClient({transport: http()})// OR use viem directlyconstpublicClient=createPublicClient({chain: hardhat,transport: http()});
### Minimalreproductionsteps
### StepstoReproduce1.SetupaHardhatprojectwiththehardhat-viemplugin2.Trytogetapublicclientwith: `const publicClient = await hre.viem.getPublicClient()`3.Observethatthisfails4.Change to: `const publicClient = await hre.viem.getPublicClient({transport: http()})`5.Observethatthisworkscorrectly
### Searchterms_Noresponse_
The text was updated successfully, but these errors were encountered:
Version of Hardhat
2.22.19
What happened?
Bug: hre.viem.getPublicClient() fails without explicit transport parameter
Description
When using the hardhat-viem plugin, calling
hre.viem.getPublicClient()
without parameters fails, but works correctly when explicitly providing a transport withhre.viem.getPublicClient({transport: http()})
.Expected Behavior
hre.viem.getPublicClient()
should work properly without requiring an explicit transport, as the plugin should configure the transport automatically when connecting to the Hardhat Network.Actual Behavior
Without an explicit transport, the function fails. With
{transport: http()}
, it works correctly.Workaround
Use either:
The text was updated successfully, but these errors were encountered: