Skip to main content

Overview

The x404-MultiToken feature verifies that a user holds multiple tokens in their portfolio. You can require ALL tokens or ANY token from a list.

Import

import { X404MultiToken } from "magenx404";

Usage

import { X404MultiToken } from "magenx404";

const result = await X404MultiToken({
  required_tokens: [
    { mint: "TOKEN_A", amount: "10000" },
    { mint: "TOKEN_B", amount: "5000" },
    { mint: "TOKEN_C", amount: "1000" },
  ],
  verification_mode: "ALL", // Must have ALL tokens (or "ANY" for any)
  geo_code: "false",
  geo_code_locs: "",
  coords: { latitude: null, longitude: null },
});

if (result.success) {
  console.log("Authenticated! Token:", result.token);
}

Configuration

required_tokens
Array<{ mint: string, amount: string }>
required
Array of tokens the user must hold. Each token has a mint address and minimum amount.
verification_mode
'ALL' | 'ANY'
required
  • "ALL": User must hold ALL tokens in the list - "ANY": User must hold at least ONE token from the list

Error Types

Example: ALL Mode

// User must hold ALL three tokens
const result = await X404MultiToken({
  required_tokens: [
    { mint: "TOKEN_A", amount: "10000" },
    { mint: "TOKEN_B", amount: "5000" },
    { mint: "TOKEN_C", amount: "1000" },
  ],
  verification_mode: "ALL",
  // ... other config
});

Example: ANY Mode

// User must hold at least ONE of these tokens
const result = await X404MultiToken({
  required_tokens: [
    { mint: "TOKEN_A", amount: "10000" },
    { mint: "TOKEN_B", amount: "5000" },
  ],
  verification_mode: "ANY",
  // ... other config
});