Skip to content

Commit 8e3f288

Browse files
committed
feat: change tbtc faucet default, allow user to request more than default
1 parent 35eec3b commit 8e3f288

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/api/routes/faucets.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const FaucetRoutes: FastifyPluginAsync<
7575
schema: {
7676
operationId: 'run_faucet_btc',
7777
summary: 'Add testnet BTC tokens to address',
78-
description: `Add 1 BTC token to the specified testnet BTC address.
78+
description: `Add 0.01 BTC token to the specified testnet BTC address.
7979
8080
The endpoint returns the transaction ID, which you can use to view the transaction in a testnet Bitcoin block
8181
explorer. The tokens are delivered once the transaction has been included in a block.
@@ -89,6 +89,13 @@ export const FaucetRoutes: FastifyPluginAsync<
8989
examples: ['2N4M94S1ZPt8HfxydXzL2P7qyzgVq7MHWts'],
9090
})
9191
),
92+
large: Type.Optional(
93+
Type.Boolean({
94+
description:
95+
'Request a larger amount of testnet BTC than the default',
96+
default: false,
97+
})
98+
),
9299
}),
93100
body: OptionalNullable(
94101
Type.Object({
@@ -125,6 +132,7 @@ export const FaucetRoutes: FastifyPluginAsync<
125132
async (req, reply) => {
126133
await btcFaucetRequestQueue.add(async () => {
127134
const address = req.query.address || req.body?.address;
135+
const tbtcAmount = req.query.large ? 0.5 : 0.01;
128136
if (!address) {
129137
return await reply.status(400).send({
130138
error: 'address required',
@@ -156,7 +164,7 @@ export const FaucetRoutes: FastifyPluginAsync<
156164
});
157165
}
158166

159-
const tx = await makeBtcFaucetPayment(btc.networks.regtest, address, 0.5);
167+
const tx = await makeBtcFaucetPayment(btc.networks.regtest, address, tbtcAmount);
160168
await fastify.writeDb?.insertFaucetRequest({
161169
ip: `${ip}`,
162170
address: address,

0 commit comments

Comments
 (0)