Skip to main content

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

required_mint
string
required
Token mint address that the user must hold
mint_amount
string
required
Minimum amount of tokens required (as string to handle large numbers)
min_hold_duration_days
number
required
Minimum number of days the tokens must have been held
wallet
string
Optional wallet name. If not provided, a modal will appear for wallet selection.
geo_code
string
required
Geolocation code setting
geo_code_locs
string
required
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!");
  }
}