v2.0.0-rc.1 release candidate
The API is frozen and later candidates carry fixes only, except the receipt-free and Safe create surface of /fhe-airdrop, which is @beta. Published on the next dist-tag; latest stays on 1.6.0 until 2.0.0.Testnet Faucet 2.0 · Client@tokenops/sdk/testnet-faucet
TestnetFaucetClient
Testnet-only faucet on Sepolia (11155111), plus local Anvil (31337) with an explicit address. Open-mints two test tokens: plain 18-decimal TTT and backed 6-decimal confidential CTTT (ERC-7984). Mints take public plaintext bigint amounts: no encryptor, no Zama peer, no roles, no pause. The config takes publicClient, walletClient?, address?, chainId?, telemetry? and gasHeadroomPercent?; on mainnet or any other chain the constructor throws UnsupportedChainError with a method and a hint.
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, to?, account?, gas? }): Promise<MintUnderlyingResult { hash, to, amount }>. Open-mints plain 18-decimal TTT to `to` (defaults to the signing account). The gas estimate is padded by gasHeadroomPercent; a per-call gas is sent as is. Throws InvalidArgumentError for a zero recipient, an amount outside uint256 or an invalid gas, MissingWalletClientError / MissingAccountError when unsigned, WalletChainMismatchError for a wallet on another chain, ContractRevertError (or a typed class) for a decoded revert on the simulate or send, WalletRejectedError / InsufficientGasFundsError / NetworkError / UnknownWriteFailureError when the send fails, and TokenOpsContractError if the mined tx reverted.
client.mintUnderlying()React:useMintUnderlying - mintConfidential({ amount, to?, account?, gas? }): Promise<MintConfidentialResult { hash, to, amount, underlyingMinted, handle }>. Fully-backed open mint of 6-decimal CTTT; the amount is a public uint64. Decodes the ConfidentialMint event for the minted handle and underlyingMinted (amount * rate). Throws InvalidArgumentError for a zero recipient, an amount outside uint64 or an invalid gas, MissingWalletClientError / MissingAccountError when unsigned, WalletChainMismatchError for a wallet on another chain, FaucetSupplyExhaustedError on ERC7984TotalSupplyOverflow, ContractRevertError (or a typed class) for any other decoded revert on the simulate or send, WalletRejectedError / InsufficientGasFundsError / NetworkError / UnknownWriteFailureError when the send fails, TokenOpsContractError if the mined tx reverted, and ReceiptEventNotFoundError / ReceiptEventAmbiguousError when the receipt has no or more than one ConfidentialMint event from the address.
client.mintConfidential()React:useMintConfidential
Read · 8
- underlyingBalanceOf(account?): Promise<bigint>. Plain TTT balance, in 18-decimal base units.
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>. 1 CTTT 6-decimal unit is backed by `rate` TTT 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>. The cap, type(uint64).max. Reaching it makes mintConfidential throw FaucetSupplyExhaustedError.
client.maxTotalSupply()React:useMaxTotalSupply - underlyingToken(): Promise<Address>. The TTT backing token. Resolution: the registry for the canonical CTTT, otherwise the wrapper's own underlying() getter (read once, cached). The backing token is never supplied separately.
client.underlyingToken()React:useUnderlyingTokenAddress - getMetadata(): Promise<FaucetMetadata { confidential, underlying, rate, maxTotalSupply }>. Name, symbol, decimals and address of both tokens plus rate and cap, in one parallel read.
client.getMetadata()React:useFaucetMetadata