import { ActionPayload, TransferAction, BridgeAction, ExecuteAction } from './types.mjs'; /** * Veridex Protocol SDK - Payload Encoding/Decoding Utilities */ /** * Encode a transfer action payload * Format: [actionType(1)] [token(32)] [recipient(32)] [amount(32)] */ declare function encodeTransferAction(token: string, recipient: string, amount: bigint): string; /** * Encode a bridge action payload * Format: [actionType(1)] [token(32)] [amount(32)] [targetChain(2)] [recipient(32)] */ declare function encodeBridgeAction(token: string, amount: bigint, targetChain: number, recipient: string): string; /** * Encode an execute action payload (arbitrary contract call) * Format: [actionType(1)] [target(32)] [value(32)] [dataLength(2)] [data(variable)] */ declare function encodeExecuteAction(target: string, value: bigint, data: string): string; /** * Encode a config action payload * Format: [actionType(1)] [configType(1)] [configData(variable)] */ declare function encodeConfigAction(configType: number, configData: string): string; /** * Encode the full Veridex message payload that gets published via Wormhole * Format: [version(1)] [userKeyHash(32)] [targetChain(2)] [nonce(32)] [pubKeyX(32)] [pubKeyY(32)] [actionPayload] */ declare function encodeVeridexPayload(userKeyHash: string, targetChain: number, nonce: bigint, publicKeyX: bigint, publicKeyY: bigint, actionPayload: string): string; /** * Decode an action payload to determine its type and contents */ declare function decodeActionPayload(payload: string): ActionPayload; /** * Decode a transfer action payload */ declare function decodeTransferAction(payload: string): TransferAction; /** * Decode a bridge action payload */ declare function decodeBridgeAction(payload: string): BridgeAction; /** * Decode an execute action payload */ declare function decodeExecuteAction(payload: string): ExecuteAction; /** * Encode a Solana-compatible transfer action * Solana uses: [actionType(1)] [amount(8 LE)] [recipient(32)] */ declare function encodeSolanaTransferAction(amount: bigint, recipient: string): string; /** * Encode an Aptos-compatible transfer action * Aptos uses: [actionType(1)] [amount(8 LE)] [recipient(32)] */ declare function encodeAptosTransferAction(amount: bigint, recipient: string): string; /** * Encode a Sui-compatible transfer action * Sui uses: [actionType(1)] [amount(8 LE)] [recipient(32)] */ declare function encodeSuiTransferAction(amount: bigint, recipient: string): string; /** * Pad an address to 32 bytes (Wormhole standard) * Supports both EVM addresses (0x...) and Solana addresses (base58) */ declare function padTo32Bytes(address: string): string; /** * Trim a 32-byte hex to a 20-byte EVM address */ declare function trimTo20Bytes(hex32: string): string; /** * Convert a Solana public key (base58) to bytes32 * @deprecated Use padTo32Bytes instead, which now handles both EVM and Solana addresses */ declare function solanaAddressToBytes32(base58Address: string): string; /** * Format an amount with decimals for display */ declare function formatAmount(amount: bigint, decimals?: number): string; /** * Parse an amount string with decimals to bigint */ declare function parseAmount(amountStr: string, decimals?: number): bigint; /** * Generate a unique nonce for a transaction */ declare function generateNonce(): bigint; /** * Create a message hash for signing (used in authenticateRawAndDispatch) */ declare function createMessageHash(targetChain: number, actionPayload: string, nonce: bigint): string; /** * Create the challenge bytes for gasless dispatch (matches Hub's authenticateAndDispatch) * * The Hub contract passes raw packed bytes to WebAuthn.verify(): * abi.encodePacked(targetChain, actionPayload, userNonce, hubChainId) * * The WebAuthn library then base64url-encodes these bytes to match against clientDataJSON. * We do NOT hash here - the challenge is the raw packed bytes. * * @param targetChain - Wormhole chain ID of the destination * @param actionPayload - The action payload (hex string) * @param nonce - User's current nonce * @param hubChainId - Wormhole chain ID of the Hub (e.g., 30 for Base) * @returns The packed bytes as hex string (NOT hashed) */ declare function createGaslessMessageHash(targetChain: number, actionPayload: string, nonce: bigint, hubChainId: number): string; /** * Build the challenge bytes for WebAuthn signing (gasless flow) * Returns raw packed bytes that match what the Hub contract expects * * @param targetChain - Wormhole chain ID of the destination * @param actionPayload - The action payload (hex string) * @param nonce - User's current nonce * @param hubChainId - Wormhole chain ID of the Hub * @returns Challenge bytes for WebAuthn signing (raw packed, not hashed) */ declare function buildGaslessChallenge(targetChain: number, actionPayload: string, nonce: bigint, hubChainId: number): Uint8Array; /** * Build the challenge bytes for WebAuthn signing */ declare function buildChallenge(userKeyHash: string, targetChain: number, nonce: bigint, actionPayload: string): Uint8Array; export { buildChallenge, buildGaslessChallenge, createGaslessMessageHash, createMessageHash, decodeActionPayload, decodeBridgeAction, decodeExecuteAction, decodeTransferAction, encodeAptosTransferAction, encodeBridgeAction, encodeConfigAction, encodeExecuteAction, encodeSolanaTransferAction, encodeSuiTransferAction, encodeTransferAction, encodeVeridexPayload, formatAmount, generateNonce, padTo32Bytes, parseAmount, solanaAddressToBytes32, trimTo20Bytes };