@vaultum/sdk
Version:
TypeScript SDK for Vaultum smart account - ERC-4337 account abstraction wallet
1,074 lines (1,059 loc) • 34.5 kB
text/typescript
import { Provider, Signer, Contract, ethers } from 'ethers';
import { ContractName } from '@vaultum/abi';
export { ContractName, ABIS as V2_ABIS, ADDRESSES as V2_ADDRESSES } from '@vaultum/abi';
type OperationState = 'queued' | 'sent' | 'success' | 'failed';
interface UserOperation$1 {
sender: string;
nonce: string;
initCode: string;
callData: string;
callGasLimit: string;
verificationGasLimit: string;
preVerificationGas: string;
maxFeePerGas: string;
maxPriorityFeePerGas: string;
paymasterAndData: string;
signature: string;
}
interface SubmitResponse {
id: string;
state: OperationState;
}
interface OperationStatus {
id: string;
state: OperationState;
chain: string;
userOp: UserOperation$1;
txHash?: string | null;
error?: string | null;
createdAt?: string;
updatedAt?: string;
}
declare class VaultumAPIClient {
private client;
constructor(baseUrl: string, apiKey?: string);
submitOperation(chain: string, userOp: UserOperation$1): Promise<SubmitResponse>;
getOperationStatus(id: string): Promise<OperationStatus>;
waitForOperation(id: string, options?: {
timeout?: number;
}): Promise<OperationStatus>;
deployAccount(owner: string, chain: string, modules?: string[], salt?: string): Promise<{
account: string;
txHash: string;
modules?: {
name?: string;
address?: string;
}[];
}>;
initiateRecovery(account: string, newOwner: string, guardian: string, signature: string): Promise<{
nonce: number;
approvals: number;
threshold: number;
timelock: string;
}>;
getRecoveryStatus(account: string): Promise<{
active: boolean;
newOwner?: string | null;
approvals?: number;
threshold?: number;
timelock?: string | null;
executable: boolean;
}>;
}
/**
* Registry Types
*
* Type definitions for VaultumRegistry API responses and resolver functionality
*/
interface RegistryCapabilities {
registry: {
enabled: boolean;
address: string;
version: string;
features: {
address_discovery: boolean;
version_history: boolean;
batch_lookup: boolean;
code_verification: boolean;
cross_chain_support: boolean;
};
health: {
status: 'healthy' | 'unhealthy' | 'unavailable';
message: string;
last_check?: string;
};
};
supported_chains: number[];
contract_types: string[];
cache: {
enabled: boolean;
ttl_seconds: number;
};
}
interface ContractInfo {
address: string;
version: number;
chain_id: number;
contract_name: string;
code_hash?: string;
last_updated: string;
version_history?: VersionInfo[];
}
interface VersionInfo {
version: number;
address: string;
code_hash?: string;
deployed_at?: string;
}
interface AddressMapping {
registry_address: string;
last_updated: string;
chains: {
[chainId: string]: {
name: string;
contracts: {
[contractName: string]: ContractInfo | {
error: string;
};
};
};
};
}
interface AddressPrediction {
predicted: string | false;
salt: string;
chain_id: number;
contract_name: string;
version: number;
deployer: string;
method: 'CREATE2';
note?: string;
}
interface ResolverConfig {
/** API base URL */
apiBaseUrl: string;
/** Enable address caching */
enableCache?: boolean;
/** Cache TTL in seconds */
cacheTtl?: number;
/** Request timeout in milliseconds */
timeout?: number;
/** Enable fallback to hardcoded addresses */
enableFallback?: boolean;
/** Fallback address mapping */
fallbackAddresses?: FallbackAddressMap;
/** Retry configuration */
retry?: {
attempts: number;
delay: number;
};
}
interface FallbackAddressMap {
[chainId: number]: {
[contractName: string]: string;
};
}
interface CacheEntry<T = any> {
data: T;
timestamp: number;
ttl: number;
}
interface AddressCacheKey {
chainId: number;
contractName: string;
}
interface AddressResolver {
/** Get contract address for specific chain */
getAddress(chainId: number, contractName: string, options?: ResolverOptions): Promise<string>;
/** Get multiple addresses for a chain */
getAddresses(chainId: number, contractNames?: string[], options?: ResolverOptions): Promise<Record<string, string>>;
/** Get addresses across multiple chains */
getMultiChainAddresses(chainIds: number[], contractNames?: string[], options?: ResolverOptions): Promise<MultiChainAddresses>;
/** Predict contract address using CREATE2 */
predictAddress(chainId: number, contractName: string, version: number, deployerAddress: string): Promise<AddressPrediction>;
/** Get registry capabilities */
getCapabilities(): Promise<RegistryCapabilities>;
/** Clear resolver cache */
clearCache(chainId?: number, contractName?: string): void;
/** Check if registry is available */
isAvailable(): Promise<boolean>;
}
interface ResolverOptions {
/** Include version history */
includeVersions?: boolean;
/** Force refresh from API (skip cache) */
forceRefresh?: boolean;
/** Use fallback if registry fails */
allowFallback?: boolean;
/** Custom timeout for this request */
timeout?: number;
}
interface MultiChainAddresses {
[chainId: number]: {
[contractName: string]: string;
};
}
declare class RegistryError extends Error {
code: string;
chainId?: number | undefined;
contractName?: string | undefined;
cause?: Error | undefined;
constructor(message: string, code: string, chainId?: number | undefined, contractName?: string | undefined, cause?: Error | undefined);
}
declare class AddressNotFoundError extends RegistryError {
constructor(chainId: number, contractName: string);
}
declare class RegistryUnavailableError extends RegistryError {
constructor(message: string, cause?: Error);
}
declare const STANDARD_CONTRACTS$1: readonly ["SmartAccountFactory", "SmartAccount", "SocialRecoveryModule", "SessionKeyModule", "SpendingLimitModule", "EmergencyFreezeModule", "RiskAlertModule", "PolicyPaymaster", "VaultumRegistry", "SessionKeyValidator", "ValidatorManager", "ModuleManager"];
type StandardContract = typeof STANDARD_CONTRACTS$1[number];
declare const SUPPORTED_CHAINS$1: {
readonly 1: "ethereum";
readonly 11155111: "sepolia";
readonly 8453: "base";
readonly 137: "polygon";
readonly 42161: "arbitrum";
readonly 10: "optimism";
};
type SupportedChainId = keyof typeof SUPPORTED_CHAINS$1;
type SupportedChainName = typeof SUPPORTED_CHAINS$1[SupportedChainId];
interface ResolverStats {
cacheHits: number;
cacheMisses: number;
apiCalls: number;
errors: number;
fallbackUses: number;
lastUpdate: number;
}
interface VersionDrift {
chainId: number;
contractName: string;
currentVersion: number;
latestVersion: number;
outdated: boolean;
address: string;
}
interface UseAddressOptions extends ResolverOptions {
/** Auto-refresh interval in seconds */
refreshInterval?: number;
/** Enabled state for the hook */
enabled?: boolean;
}
interface UseAddressResult {
address: string | null;
isLoading: boolean;
error: Error | null;
refresh: () => Promise<void>;
isStale: boolean;
}
interface VaultumConfig {
baseURL: string;
apiKey?: string;
bearer?: string;
defaultChainId?: number;
fetch?: typeof fetch;
provider?: Provider;
signer?: Signer;
/** Address resolver configuration */
resolver?: {
/** Enable dynamic address resolution */
enabled?: boolean;
/** Cache TTL in seconds */
cacheTtl?: number;
/** Request timeout in milliseconds */
timeout?: number;
/** Enable fallback to hardcoded addresses */
enableFallback?: boolean;
/** Fallback address mapping */
fallbackAddresses?: {
[chainId: number]: {
[contractName: string]: string;
};
};
};
}
interface DeployAccountOptions {
owner: string;
salt?: string;
modules?: ('socialRecovery' | 'sessionKeys' | 'spendingLimits')[];
}
interface SessionKeyOptions {
address: string;
expiry: number;
allowedSelectors?: string[];
}
interface RecoveryOptions {
newOwner: string;
guardian: string;
signature: string;
}
interface Capabilities {
sponsored: boolean;
chainId: number;
rateLimitPerMin?: number;
dailyQuotaPerAccount?: number;
}
interface OperationId {
id: string;
userOpHash?: `0x${string}`;
}
interface WaitResult {
state: 'pending' | 'success' | 'failed';
txHash?: `0x${string}`;
address?: `0x${string}`;
}
interface EstimateResult {
callGasLimit: string;
verificationGasLimit: string;
preVerificationGas: string;
maxFeePerGas?: string;
}
interface AccountState {
address: string;
owner: `0x${string}`;
modules: Array<{
address: `0x${string}`;
type?: string;
}>;
guardianCount?: number;
threshold?: number;
}
interface Quota {
used: number;
remaining: number;
ttl: number;
}
type SupportedChain = 'ethereum' | 'arbitrum' | 'optimism' | 'polygon' | 'base' | 'sepolia';
type OperationType = 'guardian_sync' | 'session_key_sync' | 'recovery' | 'freeze';
type JobStatus = 'pending' | 'partial' | 'success' | 'failed';
type ChainOperationStatus = 'pending' | 'processing' | 'success' | 'failed';
type LogStatus = 'pending' | 'processing' | 'success' | 'failed' | 'cancelled';
interface OrchestrationJob {
jobId: string;
identity: string;
operation: OperationType;
status: JobStatus;
chains: Record<SupportedChain, ChainOperationResult>;
createdAt: string;
updatedAt: string;
estimatedCompletion?: string;
}
interface ChainOperationResult {
status: ChainOperationStatus;
txHash?: `0x${string}`;
error?: string;
retries?: number;
}
interface JobInsights {
jobId: string;
identity: string;
operation: OperationType;
overall_status: JobStatus;
progress: {
total_chains: number;
successful: number;
failed: number;
pending: number;
success_rate: number;
completion_percentage: number;
};
state_analysis: {
is_complete: boolean;
is_partial_success: boolean;
can_retry: boolean;
needs_attention: boolean;
};
failed_chains: Array<{
chain: SupportedChain;
error?: string;
retries: number;
}>;
successful_chains: Array<{
chain: SupportedChain;
txHash?: `0x${string}`;
retries: number;
}>;
recommendations: string[];
}
interface SignatureTemplate {
message: string;
timestamp: number;
nonce: string;
instructions: string;
}
interface OwnershipProof {
signature: `0x${string}`;
timestamp: number;
nonce: string;
}
interface OperationLogs {
logs: OperationLog[];
pagination: {
total: number;
limit: number;
offset: number;
hasMore: boolean;
};
}
interface OperationLog {
id: string;
identity: string;
operation: OperationType | 'deploy' | 'execute';
chain: SupportedChain;
status: LogStatus;
timestamp: string;
txHash?: `0x${string}`;
gasUsed?: string;
error?: string;
metadata?: Record<string, any>;
}
type SDKErrorCode = 'INVALID_USEROP' | 'BUNDLER_ERROR' | 'INSUFFICIENT_FUNDS' | 'POLICY_REJECTED' | 'RATE_LIMITED' | 'QUOTA_EXCEEDED' | 'IDEMPOTENCY_KEY_REUSED_DIFFERENT_BODY' | 'NO_PROVIDER' | 'NO_ACCOUNT';
declare class VaultumClient {
private base;
private headers;
private f;
private defaultChainId?;
private api;
private provider?;
private signer?;
private addressResolver?;
private timeout;
constructor(config: VaultumConfig | any);
private http;
quoteOp(request: any): Promise<any>;
submitOp(request: any): Promise<any>;
getOpStatus(id: string): Promise<any>;
waitForOperation(id: string, opts?: {
pollingInterval?: number;
maxAttempts?: number;
onStatusChange?: (s: any) => void;
}): Promise<any>;
private idem;
private handleResponse;
/**
* Get relayer capabilities (sponsored, chainId, limits)
*/
getCapabilities(): Promise<Capabilities>;
/**
* Create/deploy smart account via relayer factory
*/
createVault(input: {
sessionKeyAddress: `0x${string}`;
chainId?: number;
modules?: `0x${string}`[];
salt?: `0x${string}`;
}, opts?: {
idempotencyKey?: string;
}): Promise<{
opId?: string;
address?: `0x${string}`;
}>;
/**
* Enhanced waitForOp with exponential backoff and jitter
*/
waitForOp(id: string, opts?: {
timeoutMs?: number;
maxWaitMs?: number;
onProgress?: (w: WaitResult) => void;
}): Promise<WaitResult>;
/**
* Submit UserOperation with idempotency
*/
submitUserOp(userOp: any, opts?: {
chainId?: number;
chain?: SupportedChain;
idempotencyKey?: string;
}): Promise<OperationId>;
/**
* Estimate UserOperation gas
*/
estimateUserOpGas(userOp: any, opts?: {
chainId?: number;
}): Promise<EstimateResult>;
/**
* Get account state (owner/modules/guardians)
*/
getAccountState(address: `0x${string}`): Promise<AccountState>;
/**
* Get sponsorship quota for account
*/
getQuota(address: `0x${string}`): Promise<Quota>;
/**
* Get paymaster deposit information
*/
getPaymasterDeposit(): Promise<{
depositWei: string;
}>;
/**
* Get account operations history
*/
getAccountOperations(address: `0x${string}`, limit?: number): Promise<{
operations: any[];
total: number;
}>;
deployAccount(options: DeployAccountOptions): Promise<{
account: string;
txHash: string;
modules?: {
name?: string;
address?: string;
}[];
}>;
getAccountContract(address: string): Promise<Contract>;
getOpStatusApi(id: string): Promise<OperationStatus>;
addGuardian(account: string, guardian: string): Promise<void>;
initiateRecovery(account: string, options: RecoveryOptions): Promise<{
nonce: number;
approvals: number;
threshold: number;
timelock: string;
}>;
getRecoveryStatus(account: string): Promise<{
active: boolean;
newOwner?: string | null;
approvals?: number;
threshold?: number;
timelock?: string | null;
executable: boolean;
}>;
grantSessionKey(account: string, options: SessionKeyOptions): Promise<void>;
revokeSessionKey(account: string, key: string): Promise<void>;
setSpendingLimit(account: string, token: string, limit: string): Promise<void>;
private getChainName;
getAccountAddress(owner: string, salt?: string): Promise<string>;
/**
* Create identity handle for cross-chain operations
*/
identity(id: string): IdentityHandle;
/**
* Get contract address for specific chain using dynamic resolution
*/
getAddress(chainId: number, contractName: string, options?: ResolverOptions): Promise<string>;
/**
* Get multiple addresses for a chain
*/
getAddresses(chainId: number, contractNames?: string[], options?: ResolverOptions): Promise<Record<string, string>>;
/**
* Get addresses across multiple chains
*/
getMultiChainAddresses(chainIds: number[], contractNames?: string[], options?: ResolverOptions): Promise<{
[chainId: number]: {
[contractName: string]: string;
};
}>;
/**
* Predict contract address using CREATE2
*/
predictAddress(chainId: number, contractName: string, version: number, deployerAddress: string): Promise<{
predicted: string | false;
salt: string;
chain_id: number;
contract_name: string;
version: number;
deployer: string;
method: string;
}>;
/**
* Get registry capabilities and health status
*/
getRegistryCapabilities(): Promise<RegistryCapabilities>;
/**
* Check if registry is available and healthy
*/
isRegistryAvailable(): Promise<boolean>;
/**
* Clear address resolver cache
*/
clearAddressCache(chainId?: number, contractName?: string): void;
/**
* Check for version drift across contracts on a chain
*/
checkVersionDrift(chainId: number): Promise<VersionDrift[]>;
/**
* Preload addresses for better performance
*/
preloadAddresses(chainIds: number[], contractNames?: string[]): Promise<void>;
/**
* Get address resolver statistics
*/
getAddressResolverStats(): any;
/**
* Get default fallback addresses for supported chains
*/
private getDefaultFallbackAddresses;
/**
* Sync guardians across chains for an identity
*/
syncGuardians(identity: string, homeChain: string, targetChains: string[], options?: {
guardians?: string[];
threshold?: number;
forceSync?: boolean;
maxRetries?: number;
idempotencyKey?: string;
}): Promise<OrchestrationJob>;
/**
* Sync session key across chains for an identity
*/
syncSessionKey(identity: string, homeChain: string, targetChains: string[], sessionKey: string, options?: {
expiry?: number;
selectors?: string[];
forceSync?: boolean;
maxRetries?: number;
idempotencyKey?: string;
}): Promise<OrchestrationJob>;
/**
* Get operation logs with filtering and pagination
*/
getLogs(filters?: {
identity?: string;
operation?: 'guardian_sync' | 'session_key_sync' | 'recovery' | 'freeze';
chain?: string;
status?: 'pending' | 'partial' | 'success' | 'failed';
limit?: number;
offset?: number;
}): Promise<OperationLogs>;
/**
* Wait for orchestration job completion with progress tracking
*/
waitForJob(jobId: string, opts?: {
timeoutMs?: number;
onProgress?: (job: OrchestrationJob) => void;
pollIntervalMs?: number;
}): Promise<OrchestrationJob>;
/**
* Get orchestration capabilities including quotas
*/
getOrchestrationCapabilities(identity?: string): Promise<any>;
/**
* Get signature template for wallet signing
* Generates the message template that users need to sign to prove ownership
*/
getSignatureTemplate(identityId: string, operation: OperationType, homeChain: SupportedChain, payload: any): Promise<SignatureTemplate>;
/**
* Sign ownership proof for identity operations (recommended method)
* Alias for signWithBrowser with clearer naming for ownership verification
*/
signOwnershipProof(provider: any, // ethereum provider (window.ethereum, etc.)
identityId: string, operation: OperationType, homeChain: SupportedChain, payload: any, accountAddress?: string): Promise<OwnershipProof>;
/**
* Browser-compatible signature generation helper
* Uses Web3 provider to sign the message template
*/
signWithBrowser(provider: any, // ethereum provider (window.ethereum, etc.)
identityId: string, operation: OperationType, homeChain: SupportedChain, payload: any, accountAddress?: string): Promise<OwnershipProof>;
/**
* Validate signature proof format
*/
validateOwnershipProof(proof: OwnershipProof): {
valid: boolean;
error?: string;
};
/**
* Analyze orchestration job and provide detailed insights
*/
getJobInsights(job: OrchestrationJob): JobInsights;
/**
* Generate recommendations based on job state
*/
private generateJobRecommendations;
}
/**
* IdentityHandle - Chainable interface for identity operations
*/
declare class IdentityHandle {
private client;
private id;
constructor(client: VaultumClient, id: string);
/**
* Get smart account address for a specific chain
*/
getAccount(chain: string): Promise<string>;
/**
* Sync guardians from home chain to target chains
*/
syncGuardians(homeChain: string, targetChains: string[], options?: {
guardians?: string[];
threshold?: number;
forceSync?: boolean;
maxRetries?: number;
idempotencyKey?: string;
}): Promise<OrchestrationJob>;
/**
* Sync session key from home chain to target chains
*/
syncSessionKey(homeChain: string, targetChains: string[], sessionKey: string, options?: {
expiry?: number;
selectors?: string[];
forceSync?: boolean;
maxRetries?: number;
idempotencyKey?: string;
}): Promise<OrchestrationJob>;
/**
* Get logs filtered to this identity
*/
getLogs(filters?: {
operation?: 'guardian_sync' | 'session_key_sync' | 'recovery' | 'freeze';
chain?: string;
status?: 'pending' | 'partial' | 'success' | 'failed';
limit?: number;
offset?: number;
}): Promise<OperationLogs>;
/**
* Wait for job completion with progress tracking (SDK POLISH)
*/
waitForJob(jobId: string, opts?: {
timeoutMs?: number;
onProgress?: (job: OrchestrationJob) => void;
pollIntervalMs?: number;
}): Promise<OrchestrationJob>;
/**
* Get orchestration capabilities for this identity
*/
getCapabilities(): Promise<any>;
/**
* Get signature template for this identity
*/
getSignatureTemplate(operation: OperationType, homeChain: SupportedChain, payload: any): Promise<SignatureTemplate>;
/**
* Sign ownership proof for this identity (recommended method)
*/
signOwnershipProof(provider: any, operation: OperationType, homeChain: SupportedChain, payload: any, accountAddress?: string): Promise<OwnershipProof>;
/**
* Sign with browser wallet for this identity
*/
signWithBrowser(provider: any, operation: OperationType, homeChain: SupportedChain, payload: any, accountAddress?: string): Promise<OwnershipProof>;
}
declare class VaultumError extends Error {
statusCode?: number | undefined;
errors?: Record<string, string[]> | undefined;
code?: SDKErrorCode;
details?: any;
constructor(message: string, statusCode?: number | undefined, errors?: Record<string, string[]> | undefined);
}
/**
* VaultumAddressResolver
*
* Dynamic address resolution using VaultumRegistry API with caching and fallback support
*/
declare class VaultumAddressResolver implements AddressResolver {
private config;
private cache;
private stats;
constructor(config: ResolverConfig);
/**
* Get contract address for specific chain
*/
getAddress(chainId: number, contractName: string, options?: ResolverOptions): Promise<string>;
/**
* Get multiple addresses for a chain
*/
getAddresses(chainId: number, contractNames?: string[], options?: ResolverOptions): Promise<Record<string, string>>;
/**
* Get addresses across multiple chains
*/
getMultiChainAddresses(chainIds: number[], contractNames?: string[], options?: ResolverOptions): Promise<MultiChainAddresses>;
/**
* Predict contract address using CREATE2
*/
predictAddress(chainId: number, contractName: string, version: number, deployerAddress: string): Promise<AddressPrediction>;
/**
* Get registry capabilities
*/
getCapabilities(): Promise<RegistryCapabilities>;
/**
* Check if registry is available
*/
isAvailable(): Promise<boolean>;
/**
* Clear resolver cache
*/
clearCache(chainId?: number, contractName?: string): void;
/**
* Preload addresses for better performance
*/
preloadAddresses(chainIds: number[], contractNames?: string[]): Promise<void>;
/**
* Get resolver statistics
*/
getStats(): ResolverStats & {
cacheStats: any;
};
/**
* Check for version drift across contracts
*/
checkVersionDrift(chainId: number): Promise<VersionDrift[]>;
/**
* Refresh all cached addresses
*/
refreshCache(): Promise<void>;
private fetchContractInfo;
private fetchAddressMapping;
private makeRequest;
private getFallbackAddress;
private validateConfig;
}
/**
* AddressCache
*
* Intelligent caching system for contract addresses with TTL and storage persistence
*/
declare class AddressCache {
private defaultTtl;
private maxSize;
private enablePersistence;
private memoryCache;
private stats;
constructor(defaultTtl?: number, // 5 minutes
maxSize?: number, enablePersistence?: boolean);
/**
* Get cached address
*/
getAddress(chainId: number, contractName: string): string | null;
/**
* Set cached address
*/
setAddress(chainId: number, contractName: string, address: string, ttl?: number): void;
/**
* Get cached contract info
*/
getContractInfo(chainId: number, contractName: string): ContractInfo | null;
/**
* Set cached contract info
*/
setContractInfo(chainId: number, contractName: string, info: ContractInfo, ttl?: number): void;
/**
* Get cached capabilities
*/
getCapabilities(): RegistryCapabilities | null;
/**
* Set cached capabilities
*/
setCapabilities(capabilities: RegistryCapabilities, ttl?: number): void;
/**
* Clear cache entries
*/
clear(chainId?: number, contractName?: string): void;
/**
* Get cache statistics
*/
getStats(): {
size: number;
hitRate: number;
hits: number;
misses: number;
sets: number;
evictions: number;
};
/**
* Check if address is cached and not expired
*/
has(chainId: number, contractName: string): boolean;
/**
* Preload addresses for multiple contracts
*/
preload(addresses: Array<{
chainId: number;
contractName: string;
address: string;
ttl?: number;
}>): void;
/**
* Get all cached addresses for a chain
*/
getChainAddresses(chainId: number): Record<string, string>;
private get;
private set;
private isExpired;
private evictExpired;
private evictOldest;
private createKey;
private createInfoKey;
private saveToStorageTimeoutId;
private debouncedSaveToStorage;
private saveToStorage;
private loadFromStorage;
/**
* Export cache for debugging
*/
export(): Record<string, any>;
/**
* Import cache from export
*/
import(data: any): void;
}
/**
* UserOpBuilder - MINIMAL USEROP BUILDER STUBS
* Provides safe starting points for developers to wire real on-chain calls
*
* TODO: Wire these stubs to actual @vaultum/abi functions for production use
*/
interface UserOperation {
sender: string;
nonce: string;
initCode: string;
callData: string;
callGasLimit: string;
verificationGasLimit: string;
preVerificationGas: string;
maxFeePerGas: string;
maxPriorityFeePerGas: string;
paymasterAndData: string;
signature: string;
}
interface UserOpBuilderConfig {
chainId: number;
entryPointAddress?: string;
paymasterAddress?: string;
smartAccountAddress: string;
sessionKeyAddress?: string;
}
/**
* UserOp Builder for Smart Account Operations
*
* DEVELOPMENT STATUS: STUB IMPLEMENTATION
* TODO: Replace all placeholder values with real ABI function calls
*/
declare class UserOpBuilder {
private config;
constructor(config: UserOpBuilderConfig);
/**
* Build UserOp for guardian configuration update
*
* TODO: Wire to SocialRecoveryModule ABI functions:
* - Use ABIS.SocialRecoveryModule.addGuardian()
* - Use ABIS.SocialRecoveryModule.setThreshold()
* - Call getAddress('SocialRecoveryModule', chainId) for module address
*/
buildGuardianUpdateOp(guardians: string[], threshold: number): Promise<UserOperation>;
/**
* Build UserOp for session key grant
*
* TODO: Wire to SessionKeyModule ABI functions:
* - Use ABIS.SessionKeyModule.grantSessionKey()
* - Use getAddress('SessionKeyModule', chainId) for module address
* - Encode permissions and selectors properly
*/
buildSessionKeyGrantOp(sessionKey: string, permissions: any[], selectors: string[]): Promise<UserOperation>;
/**
* Build UserOp for spending limit configuration
*
* TODO: Wire to SpendingLimitModule ABI functions:
* - Use ABIS.SpendingLimitModule.setSpendingLimit()
* - Use getAddress('SpendingLimitModule', chainId) for module address
*/
buildSpendingLimitOp(token: string, amount: string, period: number): Promise<UserOperation>;
/**
* Build UserOp for emergency freeze/unfreeze
*
* TODO: Wire to EmergencyFreezeModule ABI functions:
* - Use ABIS.EmergencyFreezeModule.freeze() / unfreeze()
* - Use getAddress('EmergencyFreezeModule', chainId) for module address
*/
buildEmergencyFreezeOp(freeze: boolean): Promise<UserOperation>;
/**
* TODO: Replace with actual guardian update encoding
* Use ABIS.SocialRecoveryModule and proper function encoding
*/
private encodeGuardianUpdate;
/**
* TODO: Replace with actual session key grant encoding
* Use ABIS.SessionKeyModule and proper function encoding
*/
private encodeSessionKeyGrant;
/**
* TODO: Replace with actual spending limit encoding
* Use ABIS.SpendingLimitModule and proper function encoding
*/
private encodeSpendingLimit;
/**
* TODO: Replace with actual emergency freeze encoding
* Use ABIS.EmergencyFreezeModule and proper function encoding
*/
private encodeEmergencyFreeze;
/**
* TODO: Get actual nonce from SmartAccount contract
* Use ABIS.SmartAccount.getNonce() function
*/
private getNonce;
/**
* TODO: Get real gas price from chain
* Use eth_gasPrice or gas price oracle
*/
private getGasPrice;
/**
* TODO: Get paymaster data from PolicyPaymaster
* Use ABIS.PolicyPaymaster and proper policy encoding
*/
private getPaymasterData;
}
/**
* UserOp Builder Factory
*
* TODO: Add proper chain detection and configuration
*/
declare function createUserOpBuilder(config: UserOpBuilderConfig): UserOpBuilder;
/**
* Development Helper: Sample UserOp for testing
*
* TODO: Remove this helper once real implementation is complete
*/
declare function createSampleUserOp(smartAccountAddress: string): UserOperation;
/**
* Vaultum V2 Contract Integration
* Uses @vaultum/abi for canonical addresses and ABIs
*/
/**
* Get a typed contract instance for any Vaultum contract
* @param name Contract name
* @param chainId Network chain ID (e.g., 11155111 for Sepolia)
* @param provider Ethers provider
* @param signer Optional signer for write operations
*/
declare function getVaultumContract(name: ContractName, chainId: number, provider: Provider, signer?: Signer): ethers.Contract;
/**
* Sepolia V2 deployment addresses (for convenience)
*/
declare const SEPOLIA_V2: {
readonly CHAIN_ID: 11155111;
readonly SMART_ACCOUNT: string;
readonly SOCIAL_RECOVERY: string;
readonly SESSION_VALIDATOR: string;
readonly SPENDING_LIMITS: string;
};
/**
* Helper to check if a chain is supported
*/
declare function isSupportedChain(chainId: number): boolean;
/**
* Get all supported chain IDs
*/
declare function getSupportedChains(): number[];
/**
* @vaultum/sdk-js
* TypeScript SDK for Vaultum smart wallet
*/
declare const CHAINS: {
readonly ETHEREUM: "ethereum";
readonly ARBITRUM: "arbitrum";
readonly OPTIMISM: "optimism";
readonly POLYGON: "polygon";
readonly BASE: "base";
readonly SEPOLIA: "sepolia";
};
declare const MODULES: {
readonly SOCIAL_RECOVERY: "socialRecovery";
readonly SESSION_KEYS: "sessionKeys";
readonly SPENDING_LIMITS: "spendingLimits";
};
declare const SUPPORTED_CHAINS: {
readonly 1: "ethereum";
readonly 11155111: "sepolia";
readonly 8453: "base";
readonly 137: "polygon";
readonly 42161: "arbitrum";
readonly 10: "optimism";
};
declare const STANDARD_CONTRACTS: readonly ["SmartAccountFactory", "SmartAccount", "SocialRecoveryModule", "SessionKeyModule", "SpendingLimitModule", "EmergencyFreezeModule", "RiskAlertModule", "PolicyPaymaster", "VaultumRegistry", "SessionKeyValidator", "ValidatorManager", "ModuleManager"];
declare const VERSION = "0.1.0-alpha";
export { type AccountState, AddressCache, type AddressCacheKey, type AddressMapping, AddressNotFoundError, type AddressPrediction, type AddressResolver, CHAINS, type CacheEntry, type Capabilities, type ChainOperationResult, type ChainOperationStatus, type ContractInfo, type DeployAccountOptions, type EstimateResult, IdentityHandle, type JobInsights, type JobStatus, type LogStatus, MODULES, type MultiChainAddresses, type OperationId, type OperationLog, type OperationLogs, type OperationState, type OperationStatus, type OperationType, type OrchestrationJob, type OwnershipProof, type Quota, type RecoveryOptions, type RegistryCapabilities, RegistryError, RegistryUnavailableError, type ResolverConfig, type ResolverOptions, type ResolverStats, type SDKErrorCode, SEPOLIA_V2, STANDARD_CONTRACTS, SUPPORTED_CHAINS, type SessionKeyOptions, type SignatureTemplate, type StandardContract, type SubmitResponse, type SupportedChain, type SupportedChainId, type SupportedChainName, type UseAddressOptions, type UseAddressResult, UserOpBuilder, type UserOpBuilderConfig, type UserOperation$1 as UserOperation, VERSION, VaultumAPIClient, VaultumAddressResolver, VaultumClient, type VaultumConfig, VaultumError, type VersionDrift, type VersionInfo, type WaitResult, createSampleUserOp, createUserOpBuilder, getSupportedChains, getVaultumContract, isSupportedChain };