Skip to main content
Use the faucet helpers to fund test accounts during onboarding, demos, and QA. Faucets are per-environment and testnet-only. There are two different flows:
  • requestTestTokens() mints ERC-20 test tokens to an EVM wallet outside the unlink contract
  • requestPrivateTokens() transfers shielded test tokens directly into an Unlink account inside the unlink contract

Token

Use a test token configured for the environment you selected. In hosted projects, this comes from your project or environment config. In the Unlink dashboard, the faucet token cards show each hosted mock token’s truncated address. Use the copy button on the token card to copy the full address for SDK or API calls.

Mint to an EVM wallet

const result = await client.faucet.requestTestTokens({
  token: testToken,
});

console.log(result.tx_hash);
If you omit evmAddress, the SDK uses the connected EVM provider address.
const result = await client.faucet.requestTestTokens({
  token: testToken,
  evmAddress: "0xRecipient",
});
Omitting evmAddress requires an EVM provider on the client.
By default the faucet sends its configured amount. Pass amount (in wei, as a decimal string) to request a specific amount, up to the faucet’s configured maximum. Requests above the maximum, or for 0, are rejected.
const result = await client.faucet.requestTestTokens({
  token: testToken,
  amount: "1000000000000000000", // 1 token (18 decimals), in wei
});
const result = await client.faucet.requestPrivateTokens({
  token: testToken,
});

console.log(result.tx_id, result.status);
If you omit unlinkAddress, the SDK automatically registers the caller if needed and uses the caller’s own Unlink address. You can also target another Unlink account explicitly:
const result = await client.faucet.requestPrivateTokens({
  token: testToken,
  unlinkAddress: "unlink1recipient...",
});
amount works the same way here — wei as a decimal string, capped by the faucet’s configured maximum:
const result = await client.faucet.requestPrivateTokens({
  token: testToken,
  amount: "1000000000000000000",
});

When to use which

  • Use requestTestTokens() when the user needs public ERC-20 balance for an approval or public wallet flow
  • Use requestPrivateTokens() when the user should start with funds already inside the unlink contract

Responses

The requestTestTokens() method returns an on-chain transaction hash:
type FaucetMintResponse = {
  tx_hash: string;
};
The requestPrivateTokens() method returns an internal transfer result:
type FaucetTransferResponse = {
  tx_id: string;
  status: TransactionStatus;
};
TransactionStatus is "accepted" | "prepared" | "proving" | "proved" | "broadcasting" | "relayed" | "processed" | "failed" (see Transaction status).
The faucet tx_id is scoped to the faucet and cannot be polled via pollTransactionStatus(). It is not the same as transaction IDs returned by deposit(), transfer(), or withdraw(). To confirm private tokens have arrived, use getBalances() (see Reading data).