Skip to main content

Faucet

Faucet is a React component that provides a button to fund the user's current address with test SUI tokens on supported test networks.

Usage

import { Faucet } from '@suiware/kit';

function MyComponent() {
return (
<Faucet
onSuccess={(message) => console.log(message)}
onError={(error) => console.error(error)}
/>
);
}

Props

PropTypeDescriptionDefault
onSuccess(message: string) => voidCallback function when funding succeedsOptional
onError(error: Error | null, errorMessage?: string) => voidCallback function when funding failsOptional

Features

  • Provides test SUI tokens on supported networks

  • Visual button with faucet icon

  • Error handling via callback

  • Success confirmation via callback

  • Uses Radix UI Button component

  • Styled with customizable CSS class

Network Support

The component supports the following test networks with different token amounts:

NetworkAmount
localnet100 SUI
devnet10 SUI
testnet1 SUI

Usage Limits

  • Devnet and testnet have daily request quotas

  • When quota is reached, users should wait 24 hours

  • Alternative funding available through Discord channels:

#devnet-faucet

#testnet-faucet

Discord: https://discord.gg/sui

Example with Error Handling

import { Faucet } from '@suiware/kit';

function MyComponent() {
const handleSuccess = (message: string) => {
console.log('Funding successful:', message);
};

const handleError = (error: Error | null, errorMessage?: string) => {
console.error('Funding failed:', errorMessage || error?.message);
};

return (
<Faucet
onSuccess={handleSuccess}
onError={handleError}
/>
);
}