Moderato testnet faucet — wraps the non-standard tempo_fundAddress JSON-RPC.
Moderato exposes a custom JSON-RPC method, tempo_fundAddress, that funds an
address with native gas + pathUSD in a single call. This module provides a
thin wrapper plus a convenience helper for spinning up a fresh, funded
keypair — useful for writing integration tests against Moderato without
re-deriving the recipe.
Only Moderato (chain 42_431) supports this RPC. Mainnet (4_217) does not.
Usage
# Fund an existing address.
{:ok, [tx_hash | _]} = Onchain.Tempo.Faucet.fund_address("0xabc...")
# Generate + fund a fresh keypair (waits for settlement before returning).
{:ok, %{private_key: priv, address_hex: hex, address_bin: bin}} =
Onchain.Tempo.Faucet.fresh_funded_wallet()
# Override the endpoint (defaults to https://rpc.moderato.tempo.xyz, or
# the TEMPO_RPC_URL env var if set).
Onchain.Tempo.Faucet.fund_address("0xabc...", rpc_url: "https://my-mirror")Options
Both fund_address/2 and fresh_funded_wallet/1 accept:
:rpc_url— RPC endpoint URL. Defaults torpc_url/0.:req_options— keyword list passed toReq.request/2(timeouts, adapters,Req.Testplug, etc.):settle_ms(fresh_funded_wallet/1only) — milliseconds to sleep after funding before returning. Defaults to2_500. Set0in unit tests.
Summary
Functions
Generate a fresh 32-byte keypair, fund it via tempo_fundAddress, and wait
for settlement.
Fund an existing address via Moderato's tempo_fundAddress RPC.
RPC URL used by the faucet by default — TEMPO_RPC_URL env var if set,
otherwise https://rpc.moderato.tempo.xyz.
Functions
@spec fresh_funded_wallet(keyword()) :: {:ok, %{private_key: binary(), address_hex: String.t(), address_bin: binary()}} | {:error, String.t()}
Generate a fresh 32-byte keypair, fund it via tempo_fundAddress, and wait
for settlement.
Returns the wallet as a map with :private_key (32 bytes), :address_hex
("0x" + 40 hex), and :address_bin (20 bytes).
Fund an existing address via Moderato's tempo_fundAddress RPC.
Returns {:ok, hashes} where hashes is the list of funding transaction
hashes returned by the node.
@spec rpc_url() :: String.t()
RPC URL used by the faucet by default — TEMPO_RPC_URL env var if set,
otherwise https://rpc.moderato.tempo.xyz.