Skip to main content

X404AuthResult

All authentication features return an X404AuthResult:
interface X404AuthResult {
  success: boolean;
  alreadyAuthenticated?: boolean;
  token?: string;
  data?: unknown;
  error?:
    | "NONCE_ERROR"
    | "SIGNING_ERROR"
    | "LOCATION_ERROR"
    | "LOCATION_DENIED"
    | "HOLDS_BANNED_TOKEN"
    | "EXCEEDS_MAX_HOLDING"
    | "INSUFFICIENT_HOLD_DURATION"
    | "INSUFFICIENT_TOKENS"
    | "INSUFFICIENT_ACTIVITY"
    | "HAS_DEBT"
    | "WALLET_TOO_NEW"
    | "WALLET_CANCELLED"
    | "UNKNOWN_ERROR";
  message?: string;
  tier?: "bronze" | "silver" | "gold";
}

Field Descriptions

success
boolean
required
Whether authentication was successful
alreadyAuthenticated
boolean
Whether user was already authenticated (token exists in localStorage)
token
string
JWT token (if successful). Automatically stored in localStorage
data
unknown
Additional data returned from the server
error
string
Error type if authentication failed
message
string
Human-readable error message
tier
'bronze' | 'silver' | 'gold'
User’s tier (only for X404Tier feature)

Success Example

{
  success: true,
  token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  alreadyAuthenticated: false
}

Error Example

{
  success: false,
  error: "HOLDS_BANNED_TOKEN",
  message: "Wallet holds excluded token: token_address"
}

Usage

import { X404Blacklist } from "magenx404";

const result = await X404Blacklist({
  excluded_mints: ["token_address"],
  max_holdings: {},
  geo_code: "false",
  geo_code_locs: "",
  coords: { latitude: null, longitude: null },
});

if (result.success) {
  console.log("Token:", result.token);
} else {
  console.error("Error:", result.error, result.message);
}

Error Types

All authentication functions can return the following error types:

Token Storage

Each feature automatically stores its JWT token in localStorage with the following keys:
  • sjwt404_timelock - Timelock feature
  • sjwt404_blacklist - Blacklist feature
  • sjwt404_multitoken - MultiToken feature
  • sjwt404_activity - Activity feature
  • sjwt404_tier - Tier feature
  • sjwt404_nodebt - NoDebt feature
  • sjwt404_age - Age feature
Tokens persist across sessions and are automatically checked on subsequent authentication attempts.