jito-distributor-sdk
Version:
TypeScript SDK for JITO Merkle Distributor with production-ready versioning and double-hashing support
56 lines (55 loc) • 1.92 kB
TypeScript
import { PublicKey } from '@solana/web3.js';
/**
* Derives the PDA for a MerkleDistributor account
* @param mint The mint public key
* @param version The version number
* @returns [PDA, bump] tuple
*/
export declare function getDistributorPDA(mint: PublicKey, version: bigint): [PublicKey, number];
/**
* Derives the PDA for a ClaimStatus account
* @param claimant The claimant's public key
* @param distributor The distributor's public key
* @returns [PDA, bump] tuple
*/
export declare function getClaimStatusPDA(claimant: PublicKey, distributor: PublicKey): [PublicKey, number];
/**
* Converts a hex string to Uint8Array
* @param hex Hex string (with or without 0x prefix)
* @returns Uint8Array
*/
export declare function hexToUint8Array(hex: string): Uint8Array;
/**
* Converts Uint8Array to hex string
* @param bytes Uint8Array
* @returns Hex string without 0x prefix
*/
export declare function uint8ArrayToHex(bytes: Uint8Array): string;
/**
* Converts bigint to BN (Anchor's Big Number)
* @param value bigint value
* @returns BN
*/
export declare function bigintToBN(value: bigint): any;
/**
* Validates that a merkle proof is properly formatted
* @param proof Array of hex strings or Uint8Arrays
* @returns boolean
*/
export declare function validateMerkleProof(proof: (string | Uint8Array)[]): boolean;
/**
* Gets the current Unix timestamp
* @returns Current timestamp in seconds
*/
export declare function getCurrentTimestamp(): number;
/**
* Validates timestamp parameters for distributor creation
* @param startVestingTs Start vesting timestamp
* @param endVestingTs End vesting timestamp
* @param clawbackStartTs Clawback start timestamp
* @returns Object with validation result and error message if invalid
*/
export declare function validateTimestamps(startVestingTs: bigint, endVestingTs: bigint, clawbackStartTs: bigint): {
valid: boolean;
error?: string;
};