Overview
The x404-TimeLock feature verifies that a user has held a specific token for a minimum duration. This is useful for ensuring users are long-term holders rather than short-term traders.
Import
import { X404TimeLock } from "magenx404";
Usage
import { X404TimeLock } from "magenx404";
const result = await X404TimeLock({
required_mint: "TOKEN_MINT_ADDRESS",
mint_amount: "100000", // Minimum amount required
min_hold_duration_days: 30, // Must hold for 30 days
geo_code: "false",
geo_code_locs: "",
coords: { latitude: null, longitude: null },
});
if (result.success) {
console.log("Authenticated! Token:", result.token);
}
Configuration
Token mint address that the user must hold
Minimum amount of tokens required (as string to handle large numbers)
Minimum number of days the tokens must have been held
Optional wallet name. If not provided, a modal will appear for wallet
selection.
Country code for geolocation filtering
coords
{ latitude: number | null, longitude: number | null }
required
User’s coordinates
Error Types
Example
"use client";
import { X404TimeLock } from "magenx404";
export async function verifyLongTermHolder() {
const result = await X404TimeLock({
required_mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC example
mint_amount: "1000000", // 1 USDC (6 decimals)
min_hold_duration_days: 90, // 90 days
geo_code: "false",
geo_code_locs: "",
coords: { latitude: null, longitude: null },
});
if (result.success) {
console.log("User is a long-term holder!");
}
}