File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
(dashboard)/(chain)/[chain_id]/(chainPage)/components Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export function FaucetButton({
4747 amount,
4848} : {
4949 chain : ChainMetadata ;
50- amount : string ;
50+ amount : number ;
5151} ) {
5252 const client = useThirdwebClient ( ) ;
5353 const address = useActiveAccount ( ) ?. address ;
Original file line number Diff line number Diff line change 11import type { ChainMetadata } from "thirdweb/chains" ;
2+ import { getFaucetClaimAmount } from "../../../../../../api/testnet-faucet/claim/claim-amount" ;
23import { ChainIcon } from "../../../../components/server/chain-icon" ;
34import { FaucetButton } from "../client/FaucetButton" ;
45import { GiftIcon } from "../icons/GiftIcon" ;
56import { SectionTitle } from "./SectionTitle" ;
67
7- const amountToGive = "0.01" ;
8-
98export async function FaucetSection ( props : { chain : ChainMetadata } ) {
109 const { chain } = props ;
1110
1211 // Check eligibilty.
1312 const sanitizedChainName = chain . name . replace ( "Mainnet" , "" ) . trim ( ) ;
13+ const amountToGive = getFaucetClaimAmount ( props . chain . chainId ) ;
1414
1515 return (
1616 < section >
Original file line number Diff line number Diff line change 1+ const customClaimAmounts : Record < number , number > = {
2+ // Aavegotchi Polter
3+ 631571 : 0.1 ,
4+ // Aleph Zero
5+ 2039 : 0.1 ,
6+ } ;
7+
8+ const defaultClaimAmount = 0.01 ;
9+
10+ export function getFaucetClaimAmount ( chainId : number ) {
11+ return customClaimAmounts [ chainId ] || defaultClaimAmount ;
12+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { startOfToday } from "date-fns";
22import { cacheGet , cacheSet } from "lib/redis" ;
33import { type NextRequest , NextResponse } from "next/server" ;
44import { ZERO_ADDRESS } from "thirdweb" ;
5+ import { getFaucetClaimAmount } from "./claim-amount" ;
56
67const THIRDWEB_ENGINE_URL = process . env . THIRDWEB_ENGINE_URL ;
78const NEXT_PUBLIC_THIRDWEB_ENGINE_FAUCET_WALLET =
@@ -109,6 +110,7 @@ export const POST = async (req: NextRequest) => {
109110 ) ;
110111 const todayUTCSeconds = Math . floor ( todayUTC . getTime ( ) / 1000 ) ;
111112 const idempotencyKey = `${ ipCacheKey } :${ todayUTCSeconds } ` ;
113+ const amountToClaim = getFaucetClaimAmount ( chainId ) . toString ( ) ;
112114
113115 try {
114116 // Store the claim request for 24 hours.
@@ -129,7 +131,7 @@ export const POST = async (req: NextRequest) => {
129131 body : JSON . stringify ( {
130132 to : toAddress ,
131133 currencyAddress : ZERO_ADDRESS ,
132- amount : "0.01" ,
134+ amount : amountToClaim ,
133135 } ) ,
134136 } ) ;
135137
@@ -144,5 +146,5 @@ export const POST = async (req: NextRequest) => {
144146 ) ;
145147 }
146148
147- return NextResponse . json ( { amount : "0.01" } , { status : 200 } ) ;
149+ return NextResponse . json ( { amount : amountToClaim } , { status : 200 } ) ;
148150} ;
You can’t perform that action at this time.
0 commit comments