@nexuspay/sdk
Version:
🚀 Ultra-simple cross-chain wallet SDK - Initialize with just projectName + apiKey. Bulletproof gasless transactions across EVM/SVM chains with ANY social identifier support
134 lines (133 loc) • 3.51 kB
TypeScript
/**
* NexusSDK - Ultimate Cross-Chain Wallet Infrastructure
* SIMPLE & POWERFUL: Initialize with just projectName + apiKey
*/
import { Wallet, TransactionResult, PaymasterBalance, AnalyticsOverview, WalletBalances, BridgeResult, SupportedChain } from '../types/index.js';
/**
* Ultra-Simple SDK Configuration
* Only 2 required parameters: projectName + apiKey
*/
export interface SimpleNexusConfig {
projectName: string;
apiKey: string;
baseURL?: string;
timeout?: number;
enableBridging?: boolean;
enableGasless?: boolean;
}
export declare class NexusSDK {
private config;
private projectId;
private baseURL;
private defaultTimeout;
private initialized;
constructor(config: SimpleNexusConfig);
/**
* Auto-extract project ID from API key with enhanced validation
*/
private extractProjectId;
/**
* Enhanced API request with bulletproof error handling
*/
private makeRequest;
/**
* Validate project name against API key (called automatically)
*/
private validateProjectConnection;
/**
* Create wallet with just socialId and socialType
* Everything else is auto-configured
*/
createWallet(data: {
socialId: string;
socialType: string;
chains?: SupportedChain[];
enableGasless?: boolean;
}): Promise<Wallet>;
/**
* Get wallet by social ID (simplified)
*/
getWallet(socialId: string, socialType: string): Promise<Wallet>;
/**
* Get wallet balances across all chains
*/
getWalletBalances(socialId: string, socialType: string): Promise<WalletBalances>;
/**
* Execute gasless transaction (simplified)
*/
sendTransaction(data: {
socialId: string;
socialType: string;
chain: SupportedChain;
to: string;
value?: string;
data?: string;
usePaymaster?: boolean;
}): Promise<TransactionResult>;
/**
* Transfer tokens (simplified)
*/
transferTokens(data: {
socialId: string;
socialType: string;
chain: SupportedChain;
to: string;
amount: string;
token?: string;
usePaymaster?: boolean;
}): Promise<TransactionResult>;
/**
* Bridge tokens across chains (simplified)
*/
bridgeTokens(data: {
socialId: string;
socialType: string;
fromChain: SupportedChain;
toChain: SupportedChain;
amount: string;
token?: string;
}): Promise<BridgeResult>;
/**
* Get project analytics
*/
getAnalytics(days?: number): Promise<AnalyticsOverview>;
/**
* Get paymaster balances
*/
getPaymasterBalances(): Promise<PaymasterBalance[]>;
/**
* Health check for all systems
*/
healthCheck(): Promise<{
status: string;
projectName: string;
chains: string[];
}>;
/**
* Encode ERC-20 token transfer
*/
private encodeTokenTransfer;
/**
* Get project configuration
*/
getProjectInfo(): {
projectName: string;
projectId: string;
chains: string[];
};
/**
* Check if gasless transactions are enabled
*/
isGaslessEnabled(): boolean;
/**
* Check if bridging is enabled
*/
isBridgingEnabled(): boolean;
/**
* Get SDK version and configuration
*/
getSDKInfo(): {
version: string;
config: SimpleNexusConfig;
};
}