Testnet Faucet · Client@tokenops/sdk/testnet-faucet
TestnetFaucetClient
Testnet-only faucet on Sepolia (11155111) and local Anvil (31337). Open-mint two test tokens: the plain 18-decimal TTT (TokenopsTestToken) and the backed 6-decimal confidential CTTT (ConfidentialTokenopsTestToken, ERC-7984). Mints take public plaintext bigint amounts — no encryptor, no @zama-fhe dependency, no roles, no pause.
Construct
Headless TS — non-React consumers (Node, Vite, server workers). React hosts use the per-hook surface; same method names, wallet/public-client wiring, and no encryptor.
@tokenops/sdk/testnet-faucet
ts
import { TestnetFaucetClient } from "@tokenops/sdk/testnet-faucet";
const client = new TestnetFaucetClient({
publicClient,
walletClient,
// address optional: resolved from publicClient.chain.id
});Methods
Write · 2
- mintUnderlying({ amount: bigint; to?: Address; account? }): Promise<MintUnderlyingResult{ amount, hash, to }>. Open-mints plain 18-decimal TTT to `to` (defaults to the wallet account); the result echoes the validated input. Throws MissingWalletClientError / MissingAccountError when unsigned, and TokenOpsContractError if the tx reverts on chain.
client.mintUnderlying()React:useMintUnderlying - mintConfidential({ amount: bigint; to?: Address; account? }): Promise<MintConfidentialResult{ amount, handle, hash, to, underlyingMinted }>. Backed open-mint of the 6-decimal confidential CTTT; parses the ConfidentialMint event for the euint64 handle + the underlying it minted. amount is plaintext uint64 — NO encryptor. Throws FaucetSupplyExhaustedError when the ERC7984TotalSupplyOverflow revert fires.
client.mintConfidential()React:useMintConfidential
Read · 8
- underlyingBalanceOf(account?): Promise<bigint>. Plain TTT balance (18 decimals) for `account`.
client.underlyingBalanceOf()React:useUnderlyingBalance - decimals(): Promise<number>. CTTT decimals = 6.
client.decimals()React:useFaucetDecimals - underlyingDecimals(): Promise<number>. TTT decimals = 18. Mind the 6-vs-18 mismatch when comparing balances.
client.underlyingDecimals()React:useUnderlyingDecimals - rate(): Promise<bigint>. Backing rate: 1 CTTT 6-decimal unit is backed by `rate` TTT 18-decimal base units (10^(18-6) = 10^12).
client.rate()React:useFaucetRate - inferredTotalSupply(): Promise<bigint>. Underlying held in custody divided by the rate — an upper bound on confidential supply, in CTTT 6-decimal units.
client.inferredTotalSupply()React:useInferredTotalSupply - maxTotalSupply(): Promise<bigint>. Hard cap (type(uint64).max); exceeding it makes mintConfidential throw FaucetSupplyExhaustedError.
client.maxTotalSupply()React:useMaxTotalSupply - underlyingToken(): Promise<Address>. On-chain address of the TTT backing token. Resolution: registry (canonical CTTT only) → the wrapper's own underlying() getter — the backing TTT is always read from the CTTT wrapper, never supplied separately.
client.underlyingToken()React:useUnderlyingTokenAddress - getMetadata(): Promise<FaucetMetadata{ confidential, underlying, maxTotalSupply, rate }>. One call for name/symbol/decimals/address of both tokens plus cap + rate.
client.getMetadata()React:useFaucetMetadata