API Reference
Complete API documentation for ExePay packages.
Packages
@exe-pay/core
Core SDK for private payments on Solana. Includes ElGamal encryption, ZK proofs, and transaction building.
View Documentation →@exe-pay/privacy
Privacy primitives including ZK-SNARKs, Pedersen commitments, and nullifier generation.
View Documentation →@exe-pay/react-hooks
React hooks for easy integration into React applications. Includes wallet management and payment hooks.
View Documentation →@exe-pay/utils
Utility functions for address validation, amount formatting, and transaction helpers.
View Documentation →Quick Example
import { ExePayClient } from '@exe-pay/core';
import { useExePay } from '@exe-pay/react-hooks';
import { Connection } from '@solana/web3.js';
// Initialize client
const connection = new Connection('https://api.mainnet-beta.solana.com');
const client = new ExePayClient(connection);
// Send a payment
const result = await client.sendPayment({
recipient: 'RECIPIENT_WALLET_ADDRESS',
amount: 1000000, // lamports
privacyLevel: 'public',
token: undefined // SOL
});
// In React components
function PaymentButton() {
const { sendPayment, loading } = useExePay();
const handlePay = async () => {
await sendPayment({
recipient: 'ADDRESS',
amount: 1000000
});
};
return <button onClick={handlePay} disabled={loading}>Send Payment</button>;
}Core Concepts
ExePayClient
The main client for interacting with ExePay. Handles connection management, transaction building, and privacy features.
Privacy Levels
public- Standard Solana transfersshielded- Hidden amounts (demo)private- Fully private (demo)
Token Support
ExePay supports SOL and SPL tokens including USDC, USDT, BONK, and JUP. Pass the token mint address to send tokens instead of SOL.
TypeScript Support
All ExePay packages are written in TypeScript and include full type definitions. Your IDE will provide autocomplete and type checking out of the box.
import type { PaymentParams, PaymentResult } from '@exe-pay/core';
const params: PaymentParams = {
recipient: 'ADDRESS',
amount: 1000000,
privacyLevel: 'public'
};
const result: PaymentResult = await client.sendPayment(params);Error Handling
ExePay throws descriptive errors that you can catch and handle:
try {
await client.sendPayment(params);
} catch (error) {
if (error.message.includes('Insufficient funds')) {
// Handle insufficient funds
} else if (error.message.includes('Invalid address')) {
// Handle invalid address
} else {
// Handle other errors
}
}Need More Help?
Check out our examples for more code samples, or visit our GitHub repository for the full source code.