diff --git a/api/rate-limit.ts b/api/rate-limit.ts index 8a667888..1838954d 100644 --- a/api/rate-limit.ts +++ b/api/rate-limit.ts @@ -84,7 +84,7 @@ async function createAssessment( export default async function handler(request: any, response: any) { // You could alternatively limit based on user ID or similar - const {token, address} = request.body; + const {token, address, network} = request.body; const secretKey = process.env.RECAPTCHA_SECRET_KEY; const verificationUrl = `https://www.google.com/recaptcha/api/siteverify?secret=${secretKey}&response=${token}`; @@ -134,8 +134,8 @@ export default async function handler(request: any, response: any) { const aptos = new Aptos( new AptosConfig({ network: Network.TESTNET, - fullnode: "https://aptos.testnet.suzuka.movementlabs.xyz/v1", - faucet: "https://faucet.testnet.suzuka.movementlabs.xyz", + fullnode: network == "movement" ? "https://testnet.movementnetwork.xyz/v1" : "https://aptos.testnet.suzuka.movementlabs.xyz/v1", + faucet: network == "movement" ? "https://faucet.testnet.movementnetwork.xyz" : "https://faucet.testnet.suzuka.movementlabs.xyz", faucetConfig: {HEADERS: HEADERS}, }), ); diff --git a/src/api/index.ts b/src/api/index.ts index 6cf38ff4..18fc5296 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -324,14 +324,14 @@ export async function requestFaucet( } } -export async function aptosRequestFaucet(address : string, captchaValue: string) { +export async function aptosRequestFaucet(address : string, captchaValue: string, network: string) { try { const response = await fetch('/api/rate-limit', { method: 'POST', headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify({ token: captchaValue, address: address }), + body: JSON.stringify({ token: captchaValue, address: address, network: network }), }); // Check if the response is an HTML page const contentType = response.headers.get('content-type'); diff --git a/src/components/Chain.tsx b/src/components/Chain.tsx index 8bc95244..8f2980cd 100644 --- a/src/components/Chain.tsx +++ b/src/components/Chain.tsx @@ -63,7 +63,7 @@ export default function Chains({ setErrorMessage("Please complete the captcha."); } else { let status = false; - const res = await faucetRequest(address, token); + const res = await faucetRequest(address, token, name); console.log(res); if (res.error) { try { diff --git a/src/pages/LandingPage/Index.tsx b/src/pages/LandingPage/Index.tsx index e065a317..ca25e784 100644 --- a/src/pages/LandingPage/Index.tsx +++ b/src/pages/LandingPage/Index.tsx @@ -21,6 +21,7 @@ const aptosFaucetAddress = '0x275f508689de8756169d1ee02d889c777de1cebda3a7bbcce6 const PACKAGE_ID = "0x8ac626e474c33520a815175649fefcbb272678c8c37a7b024e7171fa45d47711"; const CHAIN = { + movement: {network: 'testnet', url: 'https://testnet.movementnetwork.xyz', faucetUrl: 'https://faucet.testnet.movementnetwork.xyz', language: 'aptos'}, aptos: { network: 'testnet', url: 'https://aptos.testnet.suzuka.movementlabs.xyz/v1', faucetUrl: 'https://faucet.testnet.suzuka.movementlabs.xyz', language: 'aptos' }, m1: { network: 'devnet', url: 'https://aptos.devnet.m1.movementlabs.xyz', language: 'aptos' }, mevmM1: { network: 'devnet', url: 'https://mevm.devnet.m1.movementlabs.xyz', language: 'evm' }, @@ -184,23 +185,24 @@ export default function LandingPage() { setToken(e.target.value); }; - const aptosFaucetRequest = async (address: string, token: string) => { + const aptosFaucetRequest = async (address: string, token: string, network: string) => { return aptosRequestFaucet( address, - token + token, + network ); }; - const suiFaucetRequest = async (address: string, token: string) => { + const suiFaucetRequest = async (address: string, token: string, network: string) => { return suiRequestFaucet( CHAIN.sui.url, address, - token + token, ) }; - const handleM1evmFaucetRequest = async (address: string, token: string) => { + const handleM1evmFaucetRequest = async (address: string, token: string, network: string) => { return mevmRequestFaucet( CHAIN.mevm.url, address, @@ -248,6 +250,7 @@ export default function LandingPage() {

Faucets

+ @@ -259,6 +262,10 @@ export default function LandingPage() { value={network} exclusive onChange={handleNetwork}> + +

{"{Movement}"}

+

{"{Aptos Move}"}