Testnet Faucet Integration
API Endpoint
Request Body
{
"address": "titan1..."
}Example Implementation
// Using fetch
const requestFaucet = async (address: string) => {
try {
const response = await fetch(
"https://titan-testnet-faucet.titanlab.io/api/v1",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ address }),
}
);
if (response.ok) {
alert("Success! Your address has been added to the queue");
} else {
throw new Error(`HTTP error! status: ${response.status}`);
}
} catch (error) {
alert("Something went wrong - " + error.message);
}
};
// Usage
requestFaucet("titan1....");