FetchErrors
Set of errors while fetching from a json rpc http endpoint.
Allocator.Error || Client.RequestError || Client.Request.WaitError ||
Client.Request.FinishError || Client.Request.ReadError || std.Uri.ParseError || error{ StreamTooLong, InvalidRequest }Forking
Values needed for the hardhat_reset request.
Properties
struct {
jsonRpcUrl: []const u8
blockNumber: ?u64 = null
}Reset
Struct representation of a hardhat_reset request.
Properties
struct {
forking: Forking
}HardhatRequest
Signature
pub fn HardhatRequest(comptime T: type) typeHardhatMethods
Properties
enum {
hardhat_setBalance
hardhat_setCode
hardhat_setChainId
hardhat_setCoinbase
hardhat_setNonce
hardhat_setNextBlockBaseFeePerGas
hardhat_setMinGasPrice
hardhat_dropTransaction
hardhat_mine
hardhat_reset
hardhat_impersonateAccount
hardhat_stopImpersonatingAccount
hardhat_setRpcUrl
hardhat_setLoggingEnabled
}StartUpOptions
Properties
struct {
/// Allocator to use to create the ChildProcess and other allocations
allocator: Allocator
/// The localhost address.
localhost: []const u8 = "http://127.0.0.1:8545/"
}InitClient
Signature
pub fn initClient(
self: *Hardhat,
opts: StartUpOptions,
) FetchErrors!voidDeinit
Cleans up the http client
Signature
pub fn deinit(self: *Hardhat) voidSetBalance
Sets the balance of a hardhat account
Signature
pub fn setBalance(
self: *Hardhat,
address: Address,
balance: u256,
) FetchErrors!voidSetCode
Changes the contract code of a address.
Signature
pub fn setCode(
self: *Hardhat,
address: Address,
code: Hex,
) FetchErrors!voidSetRpcUrl
Changes the rpc of the hardhat connection
Signature
pub fn setRpcUrl(
self: *Hardhat,
rpc_url: []const u8,
) FetchErrors!voidSetCoinbase
Changes the coinbase address
Signature
pub fn setCoinbase(
self: *Hardhat,
address: Address,
) FetchErrors!voidSetLoggingEnable
Enable hardhat verbose logging for hardhat.
Signature
pub fn setLoggingEnable(self: *Hardhat) FetchErrors!voidSetMinGasPrice
Changes the min gasprice from the hardhat fork
Signature
pub fn setMinGasPrice(
self: *Hardhat,
new_price: u64,
) FetchErrors!voidSetNextBlockBaseFeePerGas
Changes the next blocks base fee.
Signature
pub fn setNextBlockBaseFeePerGas(
self: *Hardhat,
new_price: u64,
) FetchErrors!voidSetChainId
Changes the networks chainId
Signature
pub fn setChainId(
self: *Hardhat,
new_id: u64,
) FetchErrors!voidSetNonce
Changes the nonce of a account
Signature
pub fn setNonce(
self: *Hardhat,
address: Address,
new_nonce: u64,
) FetchErrors!voidDropTransaction
Drops a pending transaction from the mempool
Signature
pub fn dropTransaction(
self: *Hardhat,
tx_hash: Hash,
) FetchErrors!voidMine
Mine a pending transaction
Signature
pub fn mine(
self: *Hardhat,
amount: u64,
time_in_seconds: ?u64,
) FetchErrors!voidReset
Reset the fork
Signature
pub fn reset(
self: *Hardhat,
reset_config: ?Reset,
) FetchErrors!voidImpersonateAccount
Impersonate a EOA or contract. Call stopImpersonatingAccount after.
Signature
pub fn impersonateAccount(
self: *Hardhat,
address: Address,
) FetchErrors!voidStopImpersonatingAccount
Stops impersonating a EOA or contract.
Signature
pub fn stopImpersonatingAccount(
self: *Hardhat,
address: Address,
) FetchErrors!voidSendRpcRequest
Internal fetch functions. Body is discarded.
Signature
pub fn sendRpcRequest(
self: *Hardhat,
req_body: []u8,
) FetchErrors!void