@veridex/sdk 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +21 -0
  3. package/README.md +212 -0
  4. package/dist/chains/aptos/index.d.mts +140 -0
  5. package/dist/chains/aptos/index.d.ts +140 -0
  6. package/dist/chains/aptos/index.js +563 -0
  7. package/dist/chains/aptos/index.js.map +1 -0
  8. package/dist/chains/aptos/index.mjs +536 -0
  9. package/dist/chains/aptos/index.mjs.map +1 -0
  10. package/dist/chains/evm/index.d.mts +5 -0
  11. package/dist/chains/evm/index.d.ts +5 -0
  12. package/dist/chains/evm/index.js +1233 -0
  13. package/dist/chains/evm/index.js.map +1 -0
  14. package/dist/chains/evm/index.mjs +1205 -0
  15. package/dist/chains/evm/index.mjs.map +1 -0
  16. package/dist/chains/solana/index.d.mts +116 -0
  17. package/dist/chains/solana/index.d.ts +116 -0
  18. package/dist/chains/solana/index.js +513 -0
  19. package/dist/chains/solana/index.js.map +1 -0
  20. package/dist/chains/solana/index.mjs +491 -0
  21. package/dist/chains/solana/index.mjs.map +1 -0
  22. package/dist/chains/starknet/index.d.mts +172 -0
  23. package/dist/chains/starknet/index.d.ts +172 -0
  24. package/dist/chains/starknet/index.js +534 -0
  25. package/dist/chains/starknet/index.js.map +1 -0
  26. package/dist/chains/starknet/index.mjs +507 -0
  27. package/dist/chains/starknet/index.mjs.map +1 -0
  28. package/dist/chains/sui/index.d.mts +182 -0
  29. package/dist/chains/sui/index.d.ts +182 -0
  30. package/dist/chains/sui/index.js +560 -0
  31. package/dist/chains/sui/index.js.map +1 -0
  32. package/dist/chains/sui/index.mjs +533 -0
  33. package/dist/chains/sui/index.mjs.map +1 -0
  34. package/dist/constants.d.mts +150 -0
  35. package/dist/constants.d.ts +150 -0
  36. package/dist/constants.js +430 -0
  37. package/dist/constants.js.map +1 -0
  38. package/dist/constants.mjs +392 -0
  39. package/dist/constants.mjs.map +1 -0
  40. package/dist/index-0NXfbk0z.d.ts +637 -0
  41. package/dist/index-D0dLVjTA.d.mts +637 -0
  42. package/dist/index.d.mts +3101 -0
  43. package/dist/index.d.ts +3101 -0
  44. package/dist/index.js +13186 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/index.mjs +13011 -0
  47. package/dist/index.mjs.map +1 -0
  48. package/dist/payload.d.mts +125 -0
  49. package/dist/payload.d.ts +125 -0
  50. package/dist/payload.js +315 -0
  51. package/dist/payload.js.map +1 -0
  52. package/dist/payload.mjs +269 -0
  53. package/dist/payload.mjs.map +1 -0
  54. package/dist/queries/index.d.mts +148 -0
  55. package/dist/queries/index.d.ts +148 -0
  56. package/dist/queries/index.js +1533 -0
  57. package/dist/queries/index.js.map +1 -0
  58. package/dist/queries/index.mjs +1508 -0
  59. package/dist/queries/index.mjs.map +1 -0
  60. package/dist/types-ChIsqCiw.d.mts +565 -0
  61. package/dist/types-ChIsqCiw.d.ts +565 -0
  62. package/dist/types-FJL7j6gQ.d.mts +172 -0
  63. package/dist/types-FJL7j6gQ.d.ts +172 -0
  64. package/dist/types.d.mts +407 -0
  65. package/dist/types.d.ts +407 -0
  66. package/dist/types.js +19 -0
  67. package/dist/types.js.map +1 -0
  68. package/dist/types.mjs +1 -0
  69. package/dist/types.mjs.map +1 -0
  70. package/dist/utils.d.mts +81 -0
  71. package/dist/utils.d.ts +81 -0
  72. package/dist/utils.js +430 -0
  73. package/dist/utils.js.map +1 -0
  74. package/dist/utils.mjs +390 -0
  75. package/dist/utils.mjs.map +1 -0
  76. package/dist/wormhole.d.mts +167 -0
  77. package/dist/wormhole.d.ts +167 -0
  78. package/dist/wormhole.js +468 -0
  79. package/dist/wormhole.js.map +1 -0
  80. package/dist/wormhole.mjs +422 -0
  81. package/dist/wormhole.mjs.map +1 -0
  82. package/package.json +151 -0
@@ -0,0 +1,3101 @@
1
+ import { c as WalletManagerConfig, P as PasskeyCredential, U as UnifiedIdentity, d as ChainAddress, B as BridgeParams, a as ChainConfig, e as VAA, f as VeridexPayload, g as PreparedTransfer, h as PreparedBridge, i as VeridexConfig, C as ChainClient, T as TransferParams, E as ExecuteParams, D as DispatchResult, j as BridgeResult, k as TransferResult, l as ReceiveAddress, m as VaultInfo, V as VaultCreationResult, I as IdentityState, A as AuthorizedKey, n as AddBackupKeyResult, o as RemoveKeyResult } from './types-ChIsqCiw.mjs';
2
+ export { u as ActionPayload, r as BridgeAction, t as ConfigAction, p as ConfigParams, y as CrossChainFees, s as ExecuteAction, w as TestResult, x as TransactionHistoryEntry, q as TransferAction, v as VAASignature, W as WebAuthnSignature } from './types-ChIsqCiw.mjs';
3
+ import { P as PasskeyManager } from './index-D0dLVjTA.mjs';
4
+ export { E as EVMHubClientAdapter, H as HubClient, S as SessionManager } from './index-D0dLVjTA.mjs';
5
+ import { ethers } from 'ethers';
6
+ import { BridgeParams as BridgeParams$1, ChainConfig as ChainConfig$1 } from './types.mjs';
7
+ export { AddGuardianResult, ApproveRecoveryResult, CancelRecoveryResult, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, InitiateRecoveryResult, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RevokeSessionParams, SessionKey, SessionValidationResult, SetupGuardiansResult } from './types.mjs';
8
+ import { a as SessionStorage, S as SessionKey } from './types-FJL7j6gQ.mjs';
9
+ export { A as ActionParams, b as SessionConfig, i as SessionError, h as SessionErrorCode, e as SessionEvent, f as SessionEventCallback, d as SessionManagerConfig, c as SessionSignature, g as SessionSignedAction } from './types-FJL7j6gQ.mjs';
10
+ export { ACTION_BRIDGE, ACTION_CONFIG, ACTION_EXECUTE, ACTION_TRANSFER, ACTION_TYPES, HUB_ABI, MAINNET_CHAINS, PROTOCOL_VERSION, TESTNET_CHAINS, VAULT_ABI, VAULT_FACTORY_ABI, WORMHOLE_API, WORMHOLE_CHAIN_IDS, WORMHOLE_CHAIN_IDS_FLAT } from './constants.mjs';
11
+ export { base64URLDecode, base64URLEncode, computeKeyHash, encodeSignatureForSolidity, getAddressExplorerUrl, getChainByEvmId, getChainByWormholeId, getTxExplorerUrl, isEvmChain, isValidBytes32, isValidEvmAddress, isValidWormholeChainId, parseDERSignature, retryWithBackoff } from './utils.mjs';
12
+ export { buildChallenge, buildGaslessChallenge, createGaslessMessageHash, createMessageHash, decodeActionPayload, decodeBridgeAction, decodeExecuteAction, decodeTransferAction, encodeAptosTransferAction, encodeBridgeAction, encodeConfigAction, encodeExecuteAction, encodeSolanaTransferAction, encodeSuiTransferAction, encodeTransferAction, encodeVeridexPayload, formatAmount, generateNonce, padTo32Bytes, parseAmount, solanaAddressToBytes32, trimTo20Bytes } from './payload.mjs';
13
+ export { HubStateQuery, HubStateResult, PortfolioChainErrorCode, PortfolioChainResult, PortfolioQuery, PortfolioResult, QueryConfig, QueryHubStateError, QueryHubStateErrorCode, QueryHubStateNetwork, QueryHubStateOptions, QueryNetwork, QueryOperation, QueryOperationType, QueryPortfolioError, QueryPortfolioErrorCode, QueryPortfolioNetwork, QueryPortfolioOptions, QueryRequest, QueryResponse, WORMHOLE_QUERY_CHAIN_IDS, WORMHOLE_QUERY_PROXY_URLS, WORMHOLE_QUERY_RATE_LIMIT_PER_SECOND, queryHubState, queryPortfolio } from './queries/index.mjs';
14
+ export { CONSISTENCY_LEVELS, FetchVAAOptions, GUARDIAN_CONFIG, WaitForSignaturesOptions, emitterToEvmAddress, encodeVAAForSolana, encodeVAAToBytes, evmAddressToBytes32, fetchVAA, fetchVAAByTxHash, fetchVAAByTxHashFallback, getSequenceFromTxReceipt, getWormholeCoreBridge, getWormholeRelayer, getWormholeTokenBridge, hasQuorum, normalizeEmitterAddress, parseVAA, parseVAABytes, parseVeridexPayload, supportsRelayer, validateEmitter, waitForGuardianSignatures } from './wormhole.mjs';
15
+ import '@wormhole-foundation/wormhole-query-sdk';
16
+
17
+ /**
18
+ * Veridex Protocol SDK - Wallet Manager
19
+ *
20
+ * Manages deterministic wallet addresses across multiple chains.
21
+ * Vault addresses are computed using CREATE2 on EVM chains and chain-specific
22
+ * derivation on non-EVM chains, all based on the user's passkey public key.
23
+ */
24
+
25
+ /**
26
+ * Manages wallet address derivation and storage for Veridex Protocol
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const manager = new WalletManager();
31
+ *
32
+ * // Compute vault address for a credential
33
+ * const address = await manager.computeVaultAddress(
34
+ * credential.keyHash,
35
+ * factoryAddress,
36
+ * implementationAddress
37
+ * );
38
+ *
39
+ * // Get unified identity with addresses on all chains
40
+ * const identity = await manager.getUnifiedIdentity(credential, chainConfigs);
41
+ * ```
42
+ */
43
+ declare class WalletManager {
44
+ private config;
45
+ private addressCache;
46
+ constructor(config?: WalletManagerConfig);
47
+ /**
48
+ * Compute the deterministic vault address for an EVM chain
49
+ *
50
+ * Uses CREATE2 with EIP-1167 minimal proxy pattern:
51
+ * - Salt = keccak256(factoryAddress, ownerKeyHash)
52
+ * - InitCode = EIP-1167 proxy bytecode with implementation address
53
+ *
54
+ * @param keyHash - The owner's key hash (keccak256 of public key coordinates)
55
+ * @param factoryAddress - The vault factory contract address
56
+ * @param implementationAddress - The vault implementation contract address
57
+ * @returns The deterministic vault address
58
+ */
59
+ computeVaultAddress(keyHash: string, factoryAddress: string, implementationAddress: string): string;
60
+ /**
61
+ * Compute vault address from public key coordinates
62
+ *
63
+ * @param publicKeyX - P-256 public key X coordinate
64
+ * @param publicKeyY - P-256 public key Y coordinate
65
+ * @param factoryAddress - The vault factory contract address
66
+ * @param implementationAddress - The vault implementation contract address
67
+ * @returns The deterministic vault address
68
+ */
69
+ computeVaultAddressFromPublicKey(publicKeyX: bigint, publicKeyY: bigint, factoryAddress: string, implementationAddress: string): string;
70
+ /**
71
+ * Build EIP-1167 minimal proxy initcode
72
+ */
73
+ private buildProxyInitCode;
74
+ /**
75
+ * Get unified identity with addresses across all configured chains
76
+ *
77
+ * @param credential - The passkey credential
78
+ * @param chainConfigs - Map of chain configurations with factory/implementation addresses
79
+ * @returns Unified identity with addresses on each chain
80
+ */
81
+ getUnifiedIdentity(credential: PasskeyCredential, chainConfigs: Map<number, ChainAddressConfig>): Promise<UnifiedIdentity>;
82
+ /**
83
+ * Derive address for a specific chain
84
+ */
85
+ private deriveAddressForChain;
86
+ /**
87
+ * Derive address for non-EVM chains
88
+ *
89
+ * Each chain has its own address format:
90
+ * - Solana: Base58 encoded public key hash
91
+ * - Aptos: 32-byte hex address
92
+ * - Sui: 32-byte hex address with 0x prefix
93
+ */
94
+ private deriveNonEvmAddress;
95
+ /**
96
+ * Get cached address for a chain
97
+ */
98
+ getAddressForChain(keyHash: string, wormholeChainId: number): ChainAddress | undefined;
99
+ /**
100
+ * Get all cached addresses for a key hash
101
+ */
102
+ getAddresses(keyHash: string): ChainAddress[];
103
+ /**
104
+ * Update deployment status for an address
105
+ */
106
+ updateDeploymentStatus(keyHash: string, wormholeChainId: number, deployed: boolean, deploymentTxHash?: string): void;
107
+ /**
108
+ * Load addresses from localStorage
109
+ */
110
+ private loadFromStorage;
111
+ /**
112
+ * Save identity to localStorage
113
+ */
114
+ private saveToStorage;
115
+ /**
116
+ * Save addresses to localStorage
117
+ */
118
+ private saveAddressesToStorage;
119
+ /**
120
+ * Clear all cached data
121
+ */
122
+ clearCache(): void;
123
+ /**
124
+ * Load identity from storage
125
+ */
126
+ loadIdentityFromStorage(keyHash: string): UnifiedIdentity | null;
127
+ }
128
+ interface ChainAddressConfig {
129
+ chainName: string;
130
+ isEvm: boolean;
131
+ factoryAddress?: string;
132
+ implementationAddress?: string;
133
+ }
134
+
135
+ /**
136
+ * Veridex Protocol SDK - Token Constants
137
+ *
138
+ * Known tokens per chain for balance fetching and transfers
139
+ */
140
+ interface TokenInfo$1 {
141
+ /** Token symbol (e.g., 'USDC', 'ETH') */
142
+ symbol: string;
143
+ /** Token name (e.g., 'USD Coin') */
144
+ name: string;
145
+ /** Token address (use 'native' for native token) */
146
+ address: string;
147
+ /** Number of decimals */
148
+ decimals: number;
149
+ /** Optional logo URL */
150
+ logoUrl?: string;
151
+ /** Whether this is the native token */
152
+ isNative: boolean;
153
+ /** Wormhole-wrapped token address on other chains (by wormhole chain ID) */
154
+ wrappedAddresses?: Record<number, string>;
155
+ }
156
+ interface ChainTokenList {
157
+ /** Wormhole chain ID */
158
+ wormholeChainId: number;
159
+ /** Chain name */
160
+ chainName: string;
161
+ /** Native token info */
162
+ nativeToken: TokenInfo$1;
163
+ /** ERC20/SPL/etc tokens */
164
+ tokens: TokenInfo$1[];
165
+ }
166
+ /**
167
+ * Native token address constant
168
+ */
169
+ declare const NATIVE_TOKEN_ADDRESS = "native";
170
+ /**
171
+ * Zero address for EVM chains
172
+ */
173
+ declare const EVM_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
174
+ declare const BASE_SEPOLIA_TOKENS: ChainTokenList;
175
+ declare const OPTIMISM_SEPOLIA_TOKENS: ChainTokenList;
176
+ declare const ARBITRUM_SEPOLIA_TOKENS: ChainTokenList;
177
+ /**
178
+ * All token lists indexed by Wormhole chain ID
179
+ */
180
+ declare const TOKEN_REGISTRY: Record<number, ChainTokenList>;
181
+ /**
182
+ * Get token list for a chain
183
+ */
184
+ declare function getTokenList(wormholeChainId: number): ChainTokenList | null;
185
+ /**
186
+ * Get all tokens for a chain (native + ERC20)
187
+ */
188
+ declare function getAllTokens(wormholeChainId: number): TokenInfo$1[];
189
+ /**
190
+ * Get token info by symbol
191
+ */
192
+ declare function getTokenBySymbol(wormholeChainId: number, symbol: string): TokenInfo$1 | null;
193
+ /**
194
+ * Get token info by address
195
+ */
196
+ declare function getTokenByAddress(wormholeChainId: number, address: string): TokenInfo$1 | null;
197
+ /**
198
+ * Check if an address is the native token
199
+ */
200
+ declare function isNativeToken(address: string): boolean;
201
+ /**
202
+ * Get supported chain IDs
203
+ */
204
+ declare function getSupportedChainIds(): number[];
205
+ /**
206
+ * Get chain name by Wormhole chain ID
207
+ */
208
+ declare function getChainName(wormholeChainId: number): string | null;
209
+
210
+ /**
211
+ * Veridex Protocol SDK - Balance Manager
212
+ *
213
+ * Manages balance fetching for native tokens and ERC20s across chains
214
+ */
215
+
216
+ interface TokenBalance {
217
+ /** Token information */
218
+ token: TokenInfo$1;
219
+ /** Raw balance in smallest units */
220
+ balance: bigint;
221
+ /** Formatted balance with decimals */
222
+ formatted: string;
223
+ /** USD value (if price available) */
224
+ usdValue?: number;
225
+ }
226
+ interface PortfolioBalance {
227
+ /** Wormhole chain ID */
228
+ wormholeChainId: number;
229
+ /** Chain name */
230
+ chainName: string;
231
+ /** Address being queried */
232
+ address: string;
233
+ /** Individual token balances */
234
+ tokens: TokenBalance[];
235
+ /** Total USD value (if prices available) */
236
+ totalUsdValue?: number;
237
+ /** Timestamp of last update */
238
+ lastUpdated: number;
239
+ }
240
+ interface BalanceManagerConfig {
241
+ /** Whether to cache balances */
242
+ cacheBalances?: boolean;
243
+ /** Cache TTL in milliseconds */
244
+ cacheTtl?: number;
245
+ /** Custom RPC URLs by chain ID */
246
+ customRpcUrls?: Record<number, string>;
247
+ }
248
+ declare class BalanceManager {
249
+ private config;
250
+ private providers;
251
+ private cache;
252
+ constructor(config?: BalanceManagerConfig);
253
+ /**
254
+ * Get balance for a specific token on a chain
255
+ *
256
+ * @param wormholeChainId - The Wormhole chain ID
257
+ * @param address - The address to check balance for
258
+ * @param tokenAddress - Token address or 'native' for native token
259
+ * @returns TokenBalance with raw and formatted amounts
260
+ */
261
+ getBalance(wormholeChainId: number, address: string, tokenAddress: string): Promise<TokenBalance>;
262
+ /**
263
+ * Get all token balances for an address on a chain
264
+ *
265
+ * @param wormholeChainId - The Wormhole chain ID
266
+ * @param address - The address to check balances for
267
+ * @param includeZeroBalances - Whether to include tokens with 0 balance
268
+ * @returns PortfolioBalance with all token balances
269
+ */
270
+ getPortfolioBalance(wormholeChainId: number, address: string, includeZeroBalances?: boolean): Promise<PortfolioBalance>;
271
+ /**
272
+ * Get native token balance
273
+ *
274
+ * @param wormholeChainId - The Wormhole chain ID
275
+ * @param address - The address to check
276
+ * @returns TokenBalance for native token
277
+ */
278
+ getNativeBalance(wormholeChainId: number, address: string): Promise<TokenBalance>;
279
+ /**
280
+ * Get balances across multiple chains for an address
281
+ *
282
+ * @param address - The address to check
283
+ * @param chainIds - Array of Wormhole chain IDs to check
284
+ * @returns Array of PortfolioBalance for each chain
285
+ */
286
+ getMultiChainBalances(address: string, chainIds: number[]): Promise<PortfolioBalance[]>;
287
+ /**
288
+ * Clear the balance cache
289
+ */
290
+ clearCache(): void;
291
+ /**
292
+ * Invalidate cache for a specific address
293
+ */
294
+ invalidateCache(wormholeChainId: number, address: string): void;
295
+ /**
296
+ * Add or update RPC URL for a chain
297
+ */
298
+ setRpcUrl(wormholeChainId: number, rpcUrl: string): void;
299
+ /**
300
+ * Get or create a provider for a chain
301
+ */
302
+ private getProvider;
303
+ /**
304
+ * Fetch balance for a token
305
+ */
306
+ private fetchBalance;
307
+ /**
308
+ * Fetch token info from contract
309
+ */
310
+ private fetchTokenInfo;
311
+ }
312
+
313
+ /**
314
+ * Veridex Protocol SDK - Transaction Tracker
315
+ *
316
+ * Tracks transaction status from pending to confirmed
317
+ */
318
+ type TransactionStatus = 'pending' | 'submitted' | 'confirming' | 'confirmed' | 'failed' | 'dropped';
319
+ interface TransactionState {
320
+ /** Transaction hash */
321
+ hash: string;
322
+ /** Current status */
323
+ status: TransactionStatus;
324
+ /** Wormhole chain ID where transaction was sent */
325
+ wormholeChainId: number;
326
+ /** Block number when confirmed */
327
+ blockNumber?: number;
328
+ /** Number of confirmations */
329
+ confirmations: number;
330
+ /** Required confirmations for finality */
331
+ requiredConfirmations: number;
332
+ /** Gas used (after confirmation) */
333
+ gasUsed?: bigint;
334
+ /** Effective gas price */
335
+ effectiveGasPrice?: bigint;
336
+ /** Error message if failed */
337
+ error?: string;
338
+ /** Timestamp when transaction was submitted */
339
+ submittedAt: number;
340
+ /** Timestamp when transaction was confirmed */
341
+ confirmedAt?: number;
342
+ /** VAA sequence number (for cross-chain txs) */
343
+ vaaSequence?: bigint;
344
+ }
345
+ interface TrackerConfig {
346
+ /** Polling interval in ms (default: 2000) */
347
+ pollingInterval?: number;
348
+ /** Required confirmations for finality (default: 1) */
349
+ requiredConfirmations?: number;
350
+ /** Timeout in ms before marking as dropped (default: 300000 - 5 min) */
351
+ timeout?: number;
352
+ /** Custom RPC URLs by chain ID */
353
+ customRpcUrls?: Record<number, string>;
354
+ }
355
+ type TransactionCallback = (state: TransactionState) => void;
356
+ declare class TransactionTracker {
357
+ private config;
358
+ private providers;
359
+ private trackedTransactions;
360
+ private callbacks;
361
+ private pollingIntervals;
362
+ constructor(config?: TrackerConfig);
363
+ /**
364
+ * Track a transaction and receive status updates
365
+ *
366
+ * @param hash - Transaction hash
367
+ * @param wormholeChainId - Chain where transaction was sent
368
+ * @param callback - Optional callback for status updates
369
+ * @param vaaSequence - Optional VAA sequence for cross-chain transactions
370
+ * @returns Initial transaction state
371
+ */
372
+ track(hash: string, wormholeChainId: number, callback?: TransactionCallback, vaaSequence?: bigint): TransactionState;
373
+ /**
374
+ * Add a callback for transaction updates
375
+ */
376
+ addCallback(hash: string, callback: TransactionCallback): void;
377
+ /**
378
+ * Remove a callback
379
+ */
380
+ removeCallback(hash: string, callback: TransactionCallback): void;
381
+ /**
382
+ * Get current state of a tracked transaction
383
+ */
384
+ getState(hash: string): TransactionState | null;
385
+ /**
386
+ * Wait for a transaction to reach confirmed status
387
+ *
388
+ * @param hash - Transaction hash
389
+ * @param wormholeChainId - Chain where transaction was sent
390
+ * @returns Promise that resolves when confirmed or rejects on failure
391
+ */
392
+ waitForConfirmation(hash: string, wormholeChainId: number): Promise<TransactionState>;
393
+ /**
394
+ * Stop tracking a transaction
395
+ */
396
+ stopTracking(hash: string): void;
397
+ /**
398
+ * Stop tracking all transactions
399
+ */
400
+ stopAll(): void;
401
+ /**
402
+ * Get all tracked transactions
403
+ */
404
+ getAllTracked(): TransactionState[];
405
+ /**
406
+ * Get pending transactions
407
+ */
408
+ getPending(): TransactionState[];
409
+ /**
410
+ * Get or create provider for a chain
411
+ */
412
+ private getProvider;
413
+ /**
414
+ * Start polling for transaction status
415
+ */
416
+ private startPolling;
417
+ /**
418
+ * Check transaction status
419
+ */
420
+ private checkTransaction;
421
+ /**
422
+ * Update transaction state and notify callbacks
423
+ */
424
+ private updateState;
425
+ }
426
+ /**
427
+ * Create a formatted transaction explorer URL
428
+ */
429
+ declare function getExplorerUrl(wormholeChainId: number, hash: string): string | null;
430
+ /**
431
+ * Format transaction state for display
432
+ */
433
+ declare function formatTransactionState(state: TransactionState): string;
434
+
435
+ /**
436
+ * Veridex Protocol SDK - Cross-Chain Manager
437
+ *
438
+ * Orchestrates cross-chain transfers including:
439
+ * - VAA fetching and parsing
440
+ * - Fee estimation (message + relayer fees)
441
+ * - Transaction status tracking across chains
442
+ * - Lifecycle callbacks for UI updates
443
+ */
444
+
445
+ /**
446
+ * Cross-chain transfer lifecycle states
447
+ */
448
+ type CrossChainStatus = 'preparing' | 'signing' | 'dispatching' | 'waiting_confirmations' | 'waiting_guardians' | 'vaa_ready' | 'relaying' | 'executing' | 'completed' | 'failed';
449
+ /**
450
+ * Progress callback for cross-chain operations
451
+ */
452
+ interface CrossChainProgress {
453
+ status: CrossChainStatus;
454
+ step: number;
455
+ totalSteps: number;
456
+ message: string;
457
+ details?: {
458
+ txHash?: string;
459
+ sequence?: bigint;
460
+ guardianSignatures?: number;
461
+ requiredSignatures?: number;
462
+ vaaReady?: boolean;
463
+ destinationTxHash?: string;
464
+ };
465
+ }
466
+ /**
467
+ * Cross-chain transfer result
468
+ */
469
+ interface CrossChainResult {
470
+ /** Source chain transaction hash */
471
+ sourceTxHash: string;
472
+ /** Wormhole message sequence number */
473
+ sequence: bigint;
474
+ /** Emitter address (Hub contract) */
475
+ emitterAddress: string;
476
+ /** Source chain Wormhole ID */
477
+ sourceChain: number;
478
+ /** Destination chain Wormhole ID */
479
+ destinationChain: number;
480
+ /** VAA base64 (once ready) */
481
+ vaa?: string;
482
+ /** Parsed VAA */
483
+ parsedVaa?: VAA;
484
+ /** Destination chain transaction hash */
485
+ destinationTxHash?: string;
486
+ /** Total time taken in ms */
487
+ duration: number;
488
+ /** Final status */
489
+ status: CrossChainStatus;
490
+ /** Error message if failed */
491
+ error?: string;
492
+ }
493
+ /**
494
+ * Fee breakdown for cross-chain transfers
495
+ */
496
+ interface CrossChainFees {
497
+ /** Gas cost on source chain */
498
+ sourceGas: bigint;
499
+ /** Wormhole message fee */
500
+ messageFee: bigint;
501
+ /** Relayer fee (if using automatic relay) */
502
+ relayerFee: bigint;
503
+ /** Total estimated cost in source chain native token */
504
+ totalCost: bigint;
505
+ /** Formatted total cost */
506
+ formattedTotal: string;
507
+ /** Currency symbol */
508
+ currency: string;
509
+ }
510
+ /**
511
+ * Configuration for CrossChainManager
512
+ */
513
+ interface CrossChainConfig {
514
+ /** Use testnet APIs (default: true) */
515
+ testnet?: boolean;
516
+ /** Relayer service URL (optional) */
517
+ relayerUrl?: string;
518
+ /** Max time to wait for VAA (ms) */
519
+ vaaTimeoutMs?: number;
520
+ /** Interval to poll for VAA (ms) */
521
+ vaaPollingIntervalMs?: number;
522
+ /** Required block confirmations before fetching VAA */
523
+ confirmationsRequired?: number;
524
+ /** Auto-relay VAA to destination (requires relayer) */
525
+ autoRelay?: boolean;
526
+ }
527
+ /**
528
+ * Callback type for progress updates
529
+ */
530
+ type CrossChainProgressCallback = (progress: CrossChainProgress) => void;
531
+ /**
532
+ * Manages cross-chain transfer lifecycle
533
+ */
534
+ declare class CrossChainManager {
535
+ private config;
536
+ private pendingTransfers;
537
+ constructor(config?: CrossChainConfig);
538
+ /**
539
+ * Update configuration
540
+ */
541
+ setConfig(config: Partial<CrossChainConfig>): void;
542
+ /**
543
+ * Get current configuration
544
+ */
545
+ getConfig(): CrossChainConfig;
546
+ /**
547
+ * Estimate fees for a cross-chain transfer
548
+ */
549
+ estimateFees(params: BridgeParams, sourceChainConfig: ChainConfig, provider: ethers.Provider): Promise<CrossChainFees>;
550
+ /**
551
+ * Fetch relayer fee from relayer service
552
+ */
553
+ private fetchRelayerFee;
554
+ /**
555
+ * Fetch VAA by sequence number
556
+ */
557
+ fetchVAA(emitterChain: number, emitterAddress: string, sequence: bigint, onProgress?: CrossChainProgressCallback): Promise<string>;
558
+ /**
559
+ * Fetch VAA by transaction hash (more reliable)
560
+ */
561
+ fetchVAAByTxHash(txHash: string, onProgress?: CrossChainProgressCallback): Promise<string>;
562
+ /**
563
+ * Wait for guardians to sign a message with progress tracking
564
+ */
565
+ waitForGuardians(emitterChain: number, emitterAddress: string, sequence: bigint, onProgress?: CrossChainProgressCallback): Promise<VAA>;
566
+ /**
567
+ * Parse a VAA and extract Veridex payload
568
+ */
569
+ parseVAA(vaaBase64: string): {
570
+ vaa: VAA;
571
+ payload: VeridexPayload;
572
+ };
573
+ /**
574
+ * Encode VAA for on-chain submission
575
+ */
576
+ encodeVAAForSubmission(vaaBase64: string): string;
577
+ /**
578
+ * Track a cross-chain transfer
579
+ */
580
+ trackTransfer(sourceTxHash: string, sourceChain: number, destinationChain: number, sequence: bigint, emitterAddress: string): CrossChainResult;
581
+ /**
582
+ * Get pending transfer by source tx hash
583
+ */
584
+ getPendingTransfer(sourceTxHash: string): CrossChainResult | undefined;
585
+ /**
586
+ * Get all pending transfers
587
+ */
588
+ getAllPendingTransfers(): CrossChainResult[];
589
+ /**
590
+ * Update transfer status
591
+ */
592
+ updateTransfer(sourceTxHash: string, updates: Partial<CrossChainResult>): CrossChainResult | undefined;
593
+ /**
594
+ * Complete transfer with VAA
595
+ */
596
+ completeTransfer(sourceTxHash: string, vaa: string, destinationTxHash?: string): CrossChainResult | undefined;
597
+ /**
598
+ * Mark transfer as failed
599
+ */
600
+ failTransfer(sourceTxHash: string, error: string): CrossChainResult | undefined;
601
+ /**
602
+ * Clear completed/failed transfers
603
+ */
604
+ clearFinishedTransfers(): void;
605
+ /**
606
+ * Extract sequence from transaction receipt
607
+ */
608
+ getSequenceFromTx(provider: ethers.Provider, txHash: string, wormholeCoreBridge: string): Promise<bigint>;
609
+ /**
610
+ * Normalize address to emitter format
611
+ */
612
+ normalizeAddress(address: string): string;
613
+ /**
614
+ * Get explorer URL for a cross-chain transfer
615
+ */
616
+ getExplorerUrl(txHash: string, _chain: 'source' | 'destination', explorerBaseUrl: string): string;
617
+ /**
618
+ * Get Wormholescan URL for VAA
619
+ */
620
+ getWormholeExplorerUrl(emitterChain: number, emitterAddress: string, sequence: bigint): string;
621
+ /**
622
+ * Format wei to human-readable string
623
+ */
624
+ private formatWei;
625
+ }
626
+ declare const crossChainManager: CrossChainManager;
627
+
628
+ /**
629
+ * Veridex Protocol SDK - Transaction Summary Types
630
+ *
631
+ * Human-readable transaction summary types for security and UX (Issue #26)
632
+ *
633
+ * These types enable users to understand what they're signing before
634
+ * providing biometric authentication, preventing phishing and social engineering.
635
+ */
636
+ /**
637
+ * Human-readable action type
638
+ */
639
+ type ActionDisplayType = 'transfer' | 'bridge' | 'config' | 'execute' | 'unknown';
640
+ /**
641
+ * Token display information
642
+ */
643
+ interface TokenDisplay {
644
+ /** Token symbol (e.g., "ETH", "USDC") */
645
+ symbol: string;
646
+ /** Human-readable amount (e.g., "1.5") */
647
+ amount: string;
648
+ /** Raw amount in smallest unit */
649
+ rawAmount: bigint;
650
+ /** Token contract address */
651
+ address: string;
652
+ /** Number of decimals */
653
+ decimals: number;
654
+ /** Estimated USD value (if available) */
655
+ usdValue?: string;
656
+ /** Whether this is the native token */
657
+ isNative: boolean;
658
+ }
659
+ /**
660
+ * Recipient display information
661
+ */
662
+ interface RecipientDisplay {
663
+ /** Raw address (hex) */
664
+ address: string;
665
+ /** ENS name (if resolved) */
666
+ ens?: string;
667
+ /** Truncated address for display (e.g., "0x1234...5678") */
668
+ truncated: string;
669
+ /** Whether this is a contract address */
670
+ isContract?: boolean;
671
+ /** Whether this is a new recipient (never sent to before) */
672
+ isNewRecipient?: boolean;
673
+ /** Label if known (e.g., "My Wallet", "Exchange") */
674
+ label?: string;
675
+ }
676
+ /**
677
+ * Chain display information
678
+ */
679
+ interface ChainDisplay {
680
+ /** Wormhole chain ID */
681
+ id: number;
682
+ /** Human-readable chain name */
683
+ name: string;
684
+ /** Chain icon URL (optional) */
685
+ iconUrl?: string;
686
+ /** Whether this is a testnet */
687
+ isTestnet: boolean;
688
+ }
689
+ /**
690
+ * Risk level for warnings
691
+ */
692
+ type RiskLevel = 'info' | 'warning' | 'high' | 'critical';
693
+ /**
694
+ * Risk warning with message and metadata
695
+ */
696
+ interface RiskWarning {
697
+ /** Severity level */
698
+ level: RiskLevel;
699
+ /** Human-readable warning message */
700
+ message: string;
701
+ /** Warning type for programmatic handling */
702
+ type: RiskWarningType;
703
+ /** Additional context/details */
704
+ details?: string;
705
+ }
706
+ /**
707
+ * Types of risk warnings
708
+ */
709
+ type RiskWarningType = 'large_transaction' | 'new_recipient' | 'contract_interaction' | 'full_balance' | 'high_gas' | 'unknown_token' | 'cross_chain' | 'config_change' | 'all_tokens' | 'irreversible';
710
+ /**
711
+ * Transfer-specific details
712
+ */
713
+ interface TransferDetails {
714
+ token: TokenDisplay;
715
+ recipient: RecipientDisplay;
716
+ chain: ChainDisplay;
717
+ }
718
+ /**
719
+ * Bridge-specific details
720
+ */
721
+ interface BridgeDetails {
722
+ token: TokenDisplay;
723
+ sourceChain: ChainDisplay;
724
+ destinationChain: ChainDisplay;
725
+ recipient: RecipientDisplay;
726
+ /** Estimated bridge fee */
727
+ bridgeFee?: string;
728
+ /** Estimated arrival time */
729
+ estimatedTime?: string;
730
+ }
731
+ /**
732
+ * Execute (contract call) details
733
+ */
734
+ interface ExecuteDetails {
735
+ target: RecipientDisplay;
736
+ value: TokenDisplay;
737
+ chain: ChainDisplay;
738
+ /** Function signature if decodable */
739
+ functionName?: string;
740
+ /** Decoded function arguments if available */
741
+ decodedArgs?: Record<string, unknown>;
742
+ /** Raw calldata (hex) */
743
+ calldata: string;
744
+ }
745
+ /**
746
+ * Config change details
747
+ */
748
+ interface ConfigDetails {
749
+ configType: number;
750
+ configTypeName: string;
751
+ description: string;
752
+ changes: Array<{
753
+ field: string;
754
+ oldValue?: string;
755
+ newValue: string;
756
+ }>;
757
+ }
758
+ /**
759
+ * Union type for all action-specific details
760
+ */
761
+ type ActionDetails = TransferDetails | BridgeDetails | ExecuteDetails | ConfigDetails;
762
+ /**
763
+ * Complete transaction summary for display
764
+ */
765
+ interface TransactionSummary {
766
+ /** Action type for display */
767
+ action: ActionDisplayType;
768
+ /** Human-readable title (e.g., "Send ETH", "Bridge USDC") */
769
+ title: string;
770
+ /** Human-readable description */
771
+ description: string;
772
+ /** Action-specific details */
773
+ details: TransferDetails | BridgeDetails | ExecuteDetails | ConfigDetails | null;
774
+ /** Source vault information */
775
+ vault: {
776
+ address: string;
777
+ truncated: string;
778
+ chain: ChainDisplay;
779
+ };
780
+ /** Fee information */
781
+ fee: {
782
+ /** Estimated gas fee */
783
+ gas: string;
784
+ /** Gas in USD (if available) */
785
+ gasUsd?: string;
786
+ /** Whether fee is paid by relayer */
787
+ paidByRelayer: boolean;
788
+ /** Relayer fee (if applicable) */
789
+ relayerFee?: string;
790
+ /** Total fee */
791
+ total: string;
792
+ };
793
+ /** Risk warnings */
794
+ warnings: RiskWarning[];
795
+ /** Raw technical details for advanced users */
796
+ raw: {
797
+ actionType: number;
798
+ actionPayload: string;
799
+ nonce: bigint;
800
+ challenge: string;
801
+ chainId: number;
802
+ /** Expiration timestamp */
803
+ expiresAt: number;
804
+ /** Time until expiration in human readable form */
805
+ expiresIn: string;
806
+ };
807
+ /** Timestamp when summary was generated */
808
+ generatedAt: number;
809
+ }
810
+ /**
811
+ * Configuration for the transaction parser
812
+ */
813
+ interface TransactionParserConfig {
814
+ /** Default chain ID for vault operations */
815
+ defaultChainId?: number;
816
+ /** Known token registry (address -> info) */
817
+ knownTokens?: Map<string, TokenInfo>;
818
+ /** Known recipient labels (address -> label) */
819
+ knownRecipients?: Map<string, string>;
820
+ /** ENS resolver function */
821
+ ensResolver?: (address: string) => Promise<string | null>;
822
+ /** Contract detector function */
823
+ contractDetector?: (address: string) => Promise<boolean>;
824
+ /** Price oracle for USD values */
825
+ priceOracle?: (tokenAddress: string) => Promise<number | null>;
826
+ /** User's transaction history for new recipient detection */
827
+ transactionHistory?: Set<string>;
828
+ /** User's average transaction value for large tx detection */
829
+ averageTransactionValue?: bigint;
830
+ }
831
+ /**
832
+ * Token info for registry
833
+ */
834
+ interface TokenInfo {
835
+ symbol: string;
836
+ name: string;
837
+ decimals: number;
838
+ logoUrl?: string;
839
+ verified: boolean;
840
+ }
841
+ /**
842
+ * Get chain display info from Wormhole chain ID
843
+ */
844
+ declare const CHAIN_DISPLAY_INFO: Record<number, Omit<ChainDisplay, 'id'>>;
845
+ /**
846
+ * Get chain display info with fallback
847
+ */
848
+ declare function getChainDisplay(chainId: number): ChainDisplay;
849
+ /**
850
+ * Get config type name with fallback
851
+ */
852
+ declare function getConfigTypeName(configType: number): string;
853
+
854
+ /**
855
+ * Veridex Protocol SDK - Transaction Parser
856
+ *
857
+ * Parses transaction payloads into human-readable summaries (Issue #26)
858
+ *
859
+ * Security-critical: This module MUST accurately represent what users are signing.
860
+ * Any mismatch between displayed information and actual transaction is a security vulnerability.
861
+ */
862
+
863
+ /**
864
+ * Parses prepared transactions into human-readable summaries
865
+ */
866
+ declare class TransactionParser {
867
+ private config;
868
+ private tokenRegistry;
869
+ constructor(config?: TransactionParserConfig);
870
+ /**
871
+ * Main entry point: parse a prepared transfer into a human-readable summary
872
+ *
873
+ * This method determines the action type from the payload and delegates
874
+ * to the appropriate specialized parser.
875
+ *
876
+ * @param prepared - PreparedTransfer or PreparedBridge object from SDK
877
+ * @param vaultAddress - Optional vault address (uses default if not provided)
878
+ * @param vaultChainId - Optional vault chain ID (uses config default if not provided)
879
+ */
880
+ parse(prepared: PreparedTransfer | PreparedBridge, vaultAddress?: string, vaultChainId?: number): Promise<TransactionSummary>;
881
+ /**
882
+ * Detect action type from payload
883
+ */
884
+ private detectActionType;
885
+ /**
886
+ * Parse bridge action from PreparedTransfer
887
+ */
888
+ private parseBridgeFromPrepared;
889
+ /**
890
+ * Parse execute action from payload
891
+ */
892
+ private parseExecuteFromPayload;
893
+ /**
894
+ * Parse config action from payload
895
+ */
896
+ private parseConfigFromPayload;
897
+ /**
898
+ * Create a fallback summary for unknown action types
899
+ */
900
+ private createUnknownActionSummary;
901
+ /**
902
+ * Parse a prepared transfer into a human-readable summary
903
+ */
904
+ parseTransfer(prepared: PreparedTransfer, vaultAddress: string, vaultChainId: number): Promise<TransactionSummary>;
905
+ /**
906
+ * Parse a bridge operation into a human-readable summary
907
+ */
908
+ parseBridge(params: BridgeParams$1, actionPayload: string, nonce: bigint, challenge: Uint8Array, vaultAddress: string, vaultChainId: number, expiresAt: number, formattedCost: string): Promise<TransactionSummary>;
909
+ /**
910
+ * Parse an execute (contract call) operation into a human-readable summary
911
+ */
912
+ parseExecute(target: string, value: bigint, calldata: string, chainId: number, nonce: bigint, challenge: Uint8Array, vaultAddress: string, expiresAt: number, formattedCost: string): Promise<TransactionSummary>;
913
+ /**
914
+ * Parse a config change operation
915
+ */
916
+ parseConfig(configType: number, configData: string, chainId: number, nonce: bigint, challenge: Uint8Array, vaultAddress: string, expiresAt: number, formattedCost: string): Promise<TransactionSummary>;
917
+ /**
918
+ * Resolve token address to display info
919
+ */
920
+ private resolveToken;
921
+ /**
922
+ * Resolve recipient address to display info
923
+ */
924
+ private resolveRecipient;
925
+ /**
926
+ * Assess risks for a transfer transaction
927
+ */
928
+ private assessTransferRisks;
929
+ /**
930
+ * Assess risks for a bridge transaction
931
+ */
932
+ private assessBridgeRisks;
933
+ /**
934
+ * Assess risks for an execute transaction
935
+ */
936
+ private assessExecuteRisks;
937
+ /**
938
+ * Estimate bridge completion time
939
+ */
940
+ private estimateBridgeTime;
941
+ /**
942
+ * Try to decode a function call from calldata
943
+ */
944
+ private decodeFunctionCall;
945
+ /**
946
+ * Describe a config change in human-readable terms
947
+ */
948
+ private describeConfigChange;
949
+ /**
950
+ * Parse config changes into structured format
951
+ */
952
+ private parseConfigChanges;
953
+ /**
954
+ * Update parser configuration
955
+ */
956
+ updateConfig(config: Partial<TransactionParserConfig>): void;
957
+ /**
958
+ * Add a known token to the registry
959
+ */
960
+ addKnownToken(address: string, info: TokenInfo): void;
961
+ /**
962
+ * Add a known recipient label
963
+ */
964
+ addKnownRecipient(address: string, label: string): void;
965
+ }
966
+ /**
967
+ * Audit log entry for transaction summaries
968
+ * Used for security audits and debugging
969
+ */
970
+ interface TransactionAuditEntry {
971
+ /** Unique identifier matching the TransactionSummary.id */
972
+ summaryId: string;
973
+ /** ISO timestamp when summary was generated */
974
+ timestamp: string;
975
+ /** Action type that was parsed */
976
+ actionType: string;
977
+ /** Human-readable title shown to user */
978
+ titleDisplayed: string;
979
+ /** Human-readable description shown to user */
980
+ descriptionDisplayed: string;
981
+ /** Number of risk warnings shown */
982
+ riskWarningCount: number;
983
+ /** Highest risk level in warnings */
984
+ highestRiskLevel: string | null;
985
+ /** Whether technical details were available */
986
+ hasTechnicalDetails: boolean;
987
+ /** Hash of the raw payload for verification */
988
+ payloadHash: string;
989
+ /** Expiration time shown */
990
+ expiresAt: number;
991
+ /** Chain ID of the transaction */
992
+ targetChain: number;
993
+ /** Gas cost formatted as shown to user */
994
+ gasCostDisplayed: string;
995
+ }
996
+ /**
997
+ * Create an audit log entry from a transaction summary
998
+ *
999
+ * @param summary - The transaction summary that was displayed
1000
+ * @returns Audit entry for logging
1001
+ */
1002
+ declare function createAuditEntry(summary: TransactionSummary): TransactionAuditEntry;
1003
+ /**
1004
+ * Log a transaction summary for audit purposes
1005
+ *
1006
+ * @param summary - The transaction summary to log
1007
+ * @param logger - Optional custom logger (defaults to console.info)
1008
+ */
1009
+ declare function logTransactionSummary(summary: TransactionSummary, logger?: (entry: TransactionAuditEntry) => void): TransactionAuditEntry;
1010
+ /**
1011
+ * Create a transaction parser with optional configuration
1012
+ */
1013
+ declare function createTransactionParser(config?: TransactionParserConfig): TransactionParser;
1014
+
1015
+ /**
1016
+ * Veridex Protocol SDK - Spending Limits Type Definitions (Issue #27)
1017
+ *
1018
+ * Types for configuring, viewing, and enforcing spending limits on vaults.
1019
+ * Spending limits provide an additional security layer against:
1020
+ * - Compromised passkeys draining entire vault
1021
+ * - Accidental large transactions
1022
+ * - Malicious session key abuse
1023
+ *
1024
+ * Security Model:
1025
+ * - Limits are enforced on-chain by the vault contract
1026
+ * - Limit changes require passkey signature (Hub authentication)
1027
+ * - Circuit breaker auto-pauses vault on limit violation
1028
+ * - Daily limits reset 24 hours from first spend
1029
+ */
1030
+ /**
1031
+ * Current spending limits and usage for a vault
1032
+ */
1033
+ interface SpendingLimits {
1034
+ /** Daily spending limit (0 = unlimited) */
1035
+ dailyLimit: bigint;
1036
+ /** Amount spent in current 24-hour period */
1037
+ dailySpent: bigint;
1038
+ /** Remaining daily allowance */
1039
+ dailyRemaining: bigint;
1040
+ /** When the daily counter resets (UTC timestamp) */
1041
+ dayResetTime: Date;
1042
+ /** Time remaining until daily reset (milliseconds) */
1043
+ timeUntilReset: number;
1044
+ /** Per-transaction limit (0 = unlimited) */
1045
+ transactionLimit: bigint;
1046
+ /** Whether the vault is currently paused */
1047
+ isPaused: boolean;
1048
+ /** Last updated timestamp */
1049
+ lastUpdated: Date;
1050
+ /** Chain where these limits are enforced */
1051
+ chainId: number;
1052
+ }
1053
+ /**
1054
+ * Formatted spending limits for UI display
1055
+ */
1056
+ interface FormattedSpendingLimits {
1057
+ /** Daily limit as human-readable string (e.g., "1,000 USDC") */
1058
+ dailyLimit: string;
1059
+ /** Daily limit as raw number for calculations */
1060
+ dailyLimitValue: number;
1061
+ /** Amount spent today as human-readable string */
1062
+ dailySpent: string;
1063
+ /** Amount spent as raw number */
1064
+ dailySpentValue: number;
1065
+ /** Remaining daily allowance as human-readable string */
1066
+ dailyRemaining: string;
1067
+ /** Remaining as raw number */
1068
+ dailyRemainingValue: number;
1069
+ /** Percentage of daily limit used (0-100) */
1070
+ dailyUsedPercentage: number;
1071
+ /** Time until reset as human-readable string (e.g., "6h 23m") */
1072
+ timeUntilReset: string;
1073
+ /** Transaction limit as human-readable string */
1074
+ transactionLimit: string;
1075
+ /** Transaction limit as raw number */
1076
+ transactionLimitValue: number;
1077
+ /** Whether the vault is paused */
1078
+ isPaused: boolean;
1079
+ /** Whether daily limit is set (false = unlimited) */
1080
+ hasDailyLimit: boolean;
1081
+ /** Whether transaction limit is set (false = unlimited) */
1082
+ hasTransactionLimit: boolean;
1083
+ }
1084
+ /**
1085
+ * Spending limit configuration during vault creation
1086
+ */
1087
+ interface SpendingLimitConfig {
1088
+ /** Daily spending limit (optional, 0 = unlimited) */
1089
+ dailyLimit?: bigint;
1090
+ /** Per-transaction limit (optional, 0 = unlimited) */
1091
+ transactionLimit?: bigint;
1092
+ /** Whether to require 2FA for transactions above threshold */
1093
+ requireMultiSigAbove?: bigint;
1094
+ /** Whitelisted recipients (unlimited transfers allowed) */
1095
+ whitelistedRecipients?: string[];
1096
+ }
1097
+ /**
1098
+ * Parameters for setting daily limit
1099
+ */
1100
+ interface SetDailyLimitParams {
1101
+ /** New daily limit in wei/lamports/base units */
1102
+ limit: bigint;
1103
+ /** Optional chain to configure (defaults to current chain) */
1104
+ chainId?: number;
1105
+ }
1106
+ /**
1107
+ * Parameters for setting transaction limit
1108
+ */
1109
+ interface SetTransactionLimitParams {
1110
+ /** New transaction limit in wei/lamports/base units */
1111
+ limit: bigint;
1112
+ /** Optional chain to configure (defaults to current chain) */
1113
+ chainId?: number;
1114
+ }
1115
+ /**
1116
+ * Result of checking if a transaction is within limits
1117
+ */
1118
+ interface LimitCheckResult {
1119
+ /** Whether the transaction is allowed */
1120
+ allowed: boolean;
1121
+ /** Reason code if not allowed */
1122
+ reason?: LimitViolationType;
1123
+ /** Human-readable message */
1124
+ message: string;
1125
+ /** Amount that would be allowed (if partially allowed) */
1126
+ allowedAmount?: bigint;
1127
+ /** Amount that exceeds limit */
1128
+ excessAmount?: bigint;
1129
+ /** Time to wait if daily limit reached */
1130
+ waitTime?: number;
1131
+ /** Suggested actions for the user */
1132
+ suggestions?: LimitViolationSuggestion[];
1133
+ }
1134
+ /**
1135
+ * Types of limit violations
1136
+ */
1137
+ type LimitViolationType = 'daily_limit_exceeded' | 'transaction_limit_exceeded' | 'vault_paused' | 'insufficient_balance' | 'daily_limit_would_exceed';
1138
+ /**
1139
+ * Suggestion for resolving a limit violation
1140
+ */
1141
+ interface LimitViolationSuggestion {
1142
+ /** Action type */
1143
+ action: 'send_partial' | 'increase_limit' | 'wait_for_reset' | 'unpause_vault';
1144
+ /** Human-readable label */
1145
+ label: string;
1146
+ /** Additional data for the action */
1147
+ data?: {
1148
+ amount?: bigint;
1149
+ waitTimeMs?: number;
1150
+ newLimit?: bigint;
1151
+ };
1152
+ }
1153
+ /**
1154
+ * A spending transaction in the history
1155
+ */
1156
+ interface SpendingTransaction {
1157
+ /** Transaction hash */
1158
+ hash: string;
1159
+ /** Amount spent (in wei/lamports) */
1160
+ amount: bigint;
1161
+ /** Human-readable amount */
1162
+ formattedAmount: string;
1163
+ /** Token symbol */
1164
+ tokenSymbol: string;
1165
+ /** Recipient address */
1166
+ recipient: string;
1167
+ /** Recipient display name (ENS, label, or truncated) */
1168
+ recipientDisplay: string;
1169
+ /** When the transaction occurred */
1170
+ timestamp: Date;
1171
+ /** Relative time (e.g., "2h ago") */
1172
+ relativeTime: string;
1173
+ /** Transaction type */
1174
+ type: 'transfer' | 'bridge' | 'execute';
1175
+ /** Whether this counted against daily limit */
1176
+ countedAgainstLimit: boolean;
1177
+ }
1178
+ /**
1179
+ * Daily spending summary
1180
+ */
1181
+ interface DailySpendingSummary {
1182
+ /** Date for this summary */
1183
+ date: Date;
1184
+ /** Total amount spent */
1185
+ totalSpent: bigint;
1186
+ /** Formatted total */
1187
+ formattedTotal: string;
1188
+ /** Number of transactions */
1189
+ transactionCount: number;
1190
+ /** Individual transactions */
1191
+ transactions: SpendingTransaction[];
1192
+ }
1193
+ /**
1194
+ * Config types matching VeridexVault.sol
1195
+ */
1196
+ declare const CONFIG_TYPE: {
1197
+ /** Update daily limit */
1198
+ readonly DAILY_LIMIT: 1;
1199
+ /** Pause/unpause vault */
1200
+ readonly PAUSE: 2;
1201
+ /** Update guardians */
1202
+ readonly GUARDIANS: 3;
1203
+ /** Register sender */
1204
+ readonly REGISTER_SENDER: 4;
1205
+ /** Allow source chain */
1206
+ readonly ALLOW_CHAIN: 5;
1207
+ /** Set query verifier */
1208
+ readonly QUERY_VERIFIER: 6;
1209
+ };
1210
+ /**
1211
+ * Event emitted when spending limits change
1212
+ */
1213
+ interface SpendingLimitChangedEvent {
1214
+ /** Event type */
1215
+ type: 'daily_limit_changed' | 'transaction_limit_changed' | 'vault_paused' | 'vault_unpaused';
1216
+ /** Previous value */
1217
+ previousValue: bigint | boolean;
1218
+ /** New value */
1219
+ newValue: bigint | boolean;
1220
+ /** Transaction hash */
1221
+ txHash: string;
1222
+ /** Block timestamp */
1223
+ timestamp: Date;
1224
+ }
1225
+ /**
1226
+ * Callback for spending limit events
1227
+ */
1228
+ type SpendingLimitEventCallback = (event: SpendingLimitChangedEvent) => void;
1229
+ /**
1230
+ * Predefined spending limit configurations
1231
+ */
1232
+ interface LimitPreset {
1233
+ /** Preset identifier */
1234
+ id: string;
1235
+ /** Display name */
1236
+ name: string;
1237
+ /** Description */
1238
+ description: string;
1239
+ /** Daily limit suggestion (in USD equivalent) */
1240
+ dailyLimitUsd: number;
1241
+ /** Transaction limit suggestion (in USD equivalent) */
1242
+ transactionLimitUsd: number;
1243
+ /** Icon for UI */
1244
+ icon: string;
1245
+ /** Recommended for user type */
1246
+ recommendedFor: string;
1247
+ }
1248
+ /**
1249
+ * Standard limit presets
1250
+ */
1251
+ declare const LIMIT_PRESETS: LimitPreset[];
1252
+ /**
1253
+ * Duration display for reset countdown
1254
+ */
1255
+ interface DurationDisplay {
1256
+ hours: number;
1257
+ minutes: number;
1258
+ seconds: number;
1259
+ formatted: string;
1260
+ }
1261
+ /**
1262
+ * Calculate duration display from milliseconds
1263
+ */
1264
+ declare function formatDuration(ms: number): DurationDisplay;
1265
+ /**
1266
+ * Calculate percentage safely (handles zero division)
1267
+ */
1268
+ declare function calculatePercentage(spent: bigint, limit: bigint): number;
1269
+ /**
1270
+ * Format large numbers with appropriate units
1271
+ */
1272
+ declare function formatLargeAmount(amount: bigint, decimals?: number, symbol?: string): string;
1273
+
1274
+ /**
1275
+ * Veridex Protocol SDK - Spending Limits Manager (Issue #27)
1276
+ *
1277
+ * Manages vault spending limits including:
1278
+ * - Reading current limits and usage from on-chain state
1279
+ * - Preparing limit update transactions (requires passkey signature)
1280
+ * - Checking transactions against limits before signing
1281
+ * - Formatting limits for UI display
1282
+ *
1283
+ * Security Considerations:
1284
+ * - All limit changes require Hub authentication (passkey signature)
1285
+ * - Changes are propagated via VAA to spoke chains
1286
+ * - Local checks are advisory; on-chain enforcement is authoritative
1287
+ */
1288
+
1289
+ interface SpendingLimitsManagerConfig {
1290
+ /** Default token decimals for formatting */
1291
+ defaultDecimals?: number;
1292
+ /** Default token symbol for formatting */
1293
+ defaultSymbol?: string;
1294
+ /** Custom RPC URLs by chain ID */
1295
+ rpcUrls?: Record<number, string>;
1296
+ /** Cache TTL in milliseconds */
1297
+ cacheTtl?: number;
1298
+ /** Event callback for limit changes */
1299
+ onLimitChange?: SpendingLimitEventCallback;
1300
+ }
1301
+ declare class SpendingLimitsManager {
1302
+ private config;
1303
+ private cache;
1304
+ private eventListeners;
1305
+ constructor(config?: SpendingLimitsManagerConfig);
1306
+ /**
1307
+ * Get current spending limits for a vault
1308
+ * @param vaultAddress - Vault contract address
1309
+ * @param chainId - Chain ID where the vault is deployed
1310
+ * @param rpcUrl - Optional RPC URL override
1311
+ */
1312
+ getSpendingLimits(vaultAddress: string, chainId: number, rpcUrl?: string): Promise<SpendingLimits>;
1313
+ /**
1314
+ * Get spending limits formatted for UI display
1315
+ */
1316
+ getFormattedSpendingLimits(vaultAddress: string, chainId: number, options?: {
1317
+ rpcUrl?: string;
1318
+ decimals?: number;
1319
+ symbol?: string;
1320
+ }): Promise<FormattedSpendingLimits>;
1321
+ /**
1322
+ * Format raw limits for display
1323
+ */
1324
+ formatLimits(limits: SpendingLimits, decimals?: number, symbol?: string): FormattedSpendingLimits;
1325
+ /**
1326
+ * Check if a transaction amount is within limits
1327
+ * @param vaultAddress - Vault to check
1328
+ * @param chainId - Chain ID
1329
+ * @param amount - Amount to transfer (in base units)
1330
+ * @returns Result indicating if transfer is allowed
1331
+ */
1332
+ checkTransactionLimit(vaultAddress: string, chainId: number, amount: bigint, options?: {
1333
+ rpcUrl?: string;
1334
+ }): Promise<LimitCheckResult>;
1335
+ /**
1336
+ * Prepare a transaction to update the daily spending limit
1337
+ * Returns the config action payload that needs to be signed via passkey
1338
+ *
1339
+ * @param newLimit - New daily limit in base units (0 = unlimited)
1340
+ * @returns Config action payload for signing
1341
+ */
1342
+ prepareDailyLimitUpdate(newLimit: bigint): string;
1343
+ /**
1344
+ * Prepare a transaction to pause the vault
1345
+ * @returns Config action payload for signing
1346
+ */
1347
+ preparePauseVault(): string;
1348
+ /**
1349
+ * Prepare a transaction to unpause the vault
1350
+ * @returns Config action payload for signing
1351
+ */
1352
+ prepareUnpauseVault(): string;
1353
+ /**
1354
+ * Get the full spending limit configuration encoded as config payload
1355
+ * Used during vault creation to set initial limits
1356
+ */
1357
+ encodeInitialLimits(config: SpendingLimitConfig): string;
1358
+ /**
1359
+ * Get recent spending transactions for a vault
1360
+ * Note: This requires indexer integration for full history
1361
+ * @param vaultAddress - Vault to query
1362
+ * @param chainId - Chain ID
1363
+ * @param limit - Maximum number of transactions to return
1364
+ */
1365
+ getRecentTransactions(vaultAddress: string, chainId: number, limit?: number): Promise<SpendingTransaction[]>;
1366
+ /**
1367
+ * Get daily spending summary
1368
+ */
1369
+ getDailySpendingSummary(vaultAddress: string, chainId: number, date?: Date): Promise<DailySpendingSummary>;
1370
+ /**
1371
+ * Subscribe to spending limit change events
1372
+ */
1373
+ onLimitChange(callback: SpendingLimitEventCallback): () => void;
1374
+ /**
1375
+ * Notify listeners of a limit change event
1376
+ * Call this after a successful limit update transaction
1377
+ */
1378
+ notifyLimitChange(event: SpendingLimitChangedEvent): void;
1379
+ /**
1380
+ * Get a live countdown to daily limit reset
1381
+ * Returns an object with current time remaining that updates
1382
+ */
1383
+ getResetCountdown(vaultAddress: string, chainId: number, options?: {
1384
+ rpcUrl?: string;
1385
+ }): Promise<{
1386
+ getCurrentTimeRemaining: () => DurationDisplay;
1387
+ timeUntilResetMs: number;
1388
+ resetTime: Date;
1389
+ }>;
1390
+ /**
1391
+ * Clear the cache for a specific vault or all vaults
1392
+ */
1393
+ clearCache(vaultAddress?: string, chainId?: number): void;
1394
+ /**
1395
+ * Invalidate cache after a limit change
1396
+ */
1397
+ invalidateCacheAfterChange(vaultAddress: string, chainId: number): void;
1398
+ /**
1399
+ * Get a provider for the specified chain
1400
+ */
1401
+ private getProvider;
1402
+ }
1403
+ /**
1404
+ * Create a SpendingLimitsManager instance
1405
+ */
1406
+ declare function createSpendingLimitsManager(config?: SpendingLimitsManagerConfig): SpendingLimitsManager;
1407
+
1408
+ /**
1409
+ * Gas Sponsor Module
1410
+ *
1411
+ * Handles sponsored (gasless) vault creation for Veridex users.
1412
+ * Uses a Veridex-owned wallet to pay gas fees on behalf of users.
1413
+ *
1414
+ * This is a temporary solution until the full relayer is built.
1415
+ * In the future, this will be handled by:
1416
+ * - ERC-4337 Account Abstraction with Paymasters
1417
+ * - Dedicated Relayer service
1418
+ */
1419
+ interface ChainDeploymentConfig {
1420
+ name: string;
1421
+ chainId: number;
1422
+ wormholeChainId: number;
1423
+ rpcUrl: string;
1424
+ vaultFactory?: string;
1425
+ hubAddress?: string;
1426
+ isHub?: boolean;
1427
+ }
1428
+ interface SponsoredVaultResult {
1429
+ success: boolean;
1430
+ chain: string;
1431
+ wormholeChainId: number;
1432
+ vaultAddress?: string;
1433
+ transactionHash?: string;
1434
+ error?: string;
1435
+ alreadyExists?: boolean;
1436
+ }
1437
+ interface MultiChainVaultResult {
1438
+ keyHash: string;
1439
+ results: SponsoredVaultResult[];
1440
+ allSuccessful: boolean;
1441
+ vaultAddresses: Record<number, string>;
1442
+ }
1443
+ interface GasSponsorConfig {
1444
+ /**
1445
+ * Private key for the sponsor wallet (from env or secure storage)
1446
+ * This is the fallback when relayer is not available
1447
+ */
1448
+ sponsorPrivateKey?: string;
1449
+ /**
1450
+ * Integrator-provided sponsor key (for platforms using Veridex SDK)
1451
+ * Takes priority over Veridex default sponsorship
1452
+ */
1453
+ integratorSponsorKey?: string;
1454
+ /**
1455
+ * Relayer API endpoint for remote sponsorship (primary method)
1456
+ * When available, this takes priority over local wallet sponsorship
1457
+ */
1458
+ relayerUrl?: string;
1459
+ /** API key for relayer service authentication */
1460
+ relayerApiKey?: string;
1461
+ /** @deprecated Use relayerUrl instead */
1462
+ sponsorApiUrl?: string;
1463
+ /** @deprecated Use relayerApiKey instead */
1464
+ sponsorApiKey?: string;
1465
+ /** Whether to use testnet configurations */
1466
+ testnet?: boolean;
1467
+ /** Custom RPC URLs by wormhole chain ID */
1468
+ customRpcUrls?: Record<number, string>;
1469
+ }
1470
+ /** Sponsorship source type */
1471
+ type SponsorshipSource = 'relayer' | 'integrator' | 'veridex' | 'none';
1472
+ /**
1473
+ * Gas Sponsorship with layered fallback:
1474
+ * 1. Relayer (primary) - Remote relayer service handles gas
1475
+ * 2. Integrator wallet - Platform using SDK provides their own sponsor key
1476
+ * 3. Veridex wallet (fallback) - Veridex's default sponsor wallet
1477
+ */
1478
+ declare class GasSponsor {
1479
+ private config;
1480
+ private sponsorWallet?;
1481
+ private integratorWallet?;
1482
+ private chains;
1483
+ constructor(config?: GasSponsorConfig);
1484
+ /**
1485
+ * Determine which sponsorship source is available
1486
+ * Priority: Relayer > Integrator > Veridex > None
1487
+ */
1488
+ getSponsorshipSource(): SponsorshipSource;
1489
+ /**
1490
+ * Get the active sponsor wallet (integrator takes priority)
1491
+ */
1492
+ private getActiveWallet;
1493
+ /**
1494
+ * Get supported chains for vault deployment
1495
+ */
1496
+ getSupportedChains(): ChainDeploymentConfig[];
1497
+ /**
1498
+ * Get the hub chain configuration
1499
+ */
1500
+ getHubChain(): ChainDeploymentConfig | undefined;
1501
+ /**
1502
+ * Check if sponsor is configured (has relayer, integrator key, or Veridex key)
1503
+ */
1504
+ isConfigured(): boolean;
1505
+ /**
1506
+ * Get sponsor wallet balance on a specific chain
1507
+ */
1508
+ getSponsorBalance(wormholeChainId: number): Promise<bigint>;
1509
+ /**
1510
+ * Check if a vault exists for a given key hash on a chain
1511
+ */
1512
+ checkVaultExists(keyHash: string, wormholeChainId: number): Promise<{
1513
+ exists: boolean;
1514
+ address: string;
1515
+ }>;
1516
+ /**
1517
+ * Get predicted vault address for a key hash on a chain
1518
+ */
1519
+ computeVaultAddress(keyHash: string, wormholeChainId: number): Promise<string | null>;
1520
+ /**
1521
+ * Create a vault on a specific chain (sponsored)
1522
+ *
1523
+ * Sponsorship priority:
1524
+ * 1. Relayer API (future - not yet implemented)
1525
+ * 2. Integrator wallet (if provided)
1526
+ * 3. Veridex sponsor wallet (fallback)
1527
+ */
1528
+ createVaultOnChain(keyHash: string, wormholeChainId: number): Promise<SponsoredVaultResult>;
1529
+ /**
1530
+ * Create vault via relayer service (future primary method)
1531
+ *
1532
+ * The relayer handles:
1533
+ * - Gas payment on behalf of users
1534
+ * - Transaction submission and monitoring
1535
+ * - Rate limiting and abuse prevention
1536
+ */
1537
+ private createVaultViaRelayer;
1538
+ /**
1539
+ * Create vault with a specific wallet (internal helper)
1540
+ */
1541
+ private createVaultWithWallet;
1542
+ /**
1543
+ * Create vaults on all supported chains (sponsored)
1544
+ */
1545
+ createVaultsOnAllChains(keyHash: string): Promise<MultiChainVaultResult>;
1546
+ /**
1547
+ * Check vault status on all chains
1548
+ */
1549
+ checkVaultsOnAllChains(keyHash: string): Promise<Record<number, {
1550
+ exists: boolean;
1551
+ address: string;
1552
+ }>>;
1553
+ }
1554
+ /**
1555
+ * Create a GasSponsor instance
1556
+ *
1557
+ * @example
1558
+ * ```ts
1559
+ * // With environment variable
1560
+ * const sponsor = createGasSponsor({
1561
+ * sponsorPrivateKey: process.env.VERIDEX_SPONSOR_KEY,
1562
+ * testnet: true,
1563
+ * });
1564
+ *
1565
+ * // Create vaults for a user
1566
+ * const result = await sponsor.createVaultsOnAllChains(userKeyHash);
1567
+ * ```
1568
+ */
1569
+ declare function createGasSponsor(config?: GasSponsorConfig): GasSponsor;
1570
+
1571
+ declare class VeridexSDK {
1572
+ readonly passkey: PasskeyManager;
1573
+ readonly wallet: WalletManager;
1574
+ readonly balance: BalanceManager;
1575
+ readonly transactions: TransactionTracker;
1576
+ readonly crossChain: CrossChainManager;
1577
+ readonly sponsor: GasSponsor;
1578
+ readonly transactionParser: TransactionParser;
1579
+ readonly spendingLimits: SpendingLimitsManager;
1580
+ private readonly chain;
1581
+ private readonly relayer?;
1582
+ private readonly queryApiKey?;
1583
+ private readonly testnet;
1584
+ private readonly sponsorPrivateKey?;
1585
+ private readonly chainRpcUrls?;
1586
+ private readonly chainDetector;
1587
+ private unifiedIdentity;
1588
+ constructor(config: VeridexConfig);
1589
+ getChainConfig(): ChainConfig;
1590
+ getChainClient(): ChainClient;
1591
+ getNonce(): Promise<bigint>;
1592
+ getMessageFee(): Promise<bigint>;
1593
+ buildTransferPayload(params: TransferParams): Promise<string>;
1594
+ buildExecutePayload(params: ExecuteParams): Promise<string>;
1595
+ buildBridgePayload(params: BridgeParams): Promise<string>;
1596
+ transfer(params: TransferParams, signer: any): Promise<DispatchResult>;
1597
+ execute(params: ExecuteParams, signer: any): Promise<DispatchResult>;
1598
+ bridge(params: BridgeParams, signer: any): Promise<DispatchResult>;
1599
+ /**
1600
+ * Prepare a bridge/cross-chain transfer with fee estimation
1601
+ *
1602
+ * @param params - Bridge parameters
1603
+ * @returns PreparedBridge with fee estimates
1604
+ */
1605
+ prepareBridge(params: BridgeParams): Promise<PreparedBridge>;
1606
+ /**
1607
+ * Execute a prepared bridge with full cross-chain tracking
1608
+ *
1609
+ * @param prepared - PreparedBridge from prepareBridge()
1610
+ * @param signer - Signer to pay for gas
1611
+ * @param onProgress - Optional callback for progress updates
1612
+ * @returns BridgeResult with cross-chain tracking info
1613
+ */
1614
+ executeBridge(prepared: PreparedBridge, signer: any, onProgress?: CrossChainProgressCallback): Promise<BridgeResult>;
1615
+ /**
1616
+ * Execute a gasless bridge using the relayer
1617
+ *
1618
+ * The relayer pays for the Hub transaction (and Wormhole fee), then observes
1619
+ * the resulting Dispatch event and relays the VAA to the destination spoke.
1620
+ */
1621
+ bridgeViaRelayer(params: BridgeParams, onProgress?: CrossChainProgressCallback): Promise<BridgeResult>;
1622
+ /**
1623
+ * Execute a full bridge with automatic preparation
1624
+ *
1625
+ * @param params - Bridge parameters
1626
+ * @param signer - Signer to pay for gas
1627
+ * @param onProgress - Optional callback for progress updates
1628
+ * @returns BridgeResult with cross-chain tracking info
1629
+ */
1630
+ bridgeWithTracking(params: BridgeParams, signer: any, onProgress?: CrossChainProgressCallback): Promise<BridgeResult>;
1631
+ /**
1632
+ * Fetch VAA for a completed transaction
1633
+ * Use this if VAA fetch failed during bridge execution
1634
+ *
1635
+ * @param txHash - Source chain transaction hash
1636
+ * @returns VAA base64 string
1637
+ */
1638
+ fetchVAAForTransaction(txHash: string): Promise<string>;
1639
+ /**
1640
+ * Get cross-chain transfer fees
1641
+ *
1642
+ * @param params - Bridge parameters
1643
+ * @returns CrossChainFees with breakdown
1644
+ */
1645
+ getBridgeFees(params: BridgeParams): Promise<CrossChainFees>;
1646
+ /**
1647
+ * Get all pending cross-chain transfers
1648
+ */
1649
+ getPendingBridges(): CrossChainResult[];
1650
+ /**
1651
+ * Get Wormholescan explorer URL for a cross-chain transfer
1652
+ */
1653
+ getWormholeExplorerUrl(sequence: bigint): string;
1654
+ /**
1655
+ * Prepare a transfer with gas estimation
1656
+ * Call this before transfer() to show user the cost
1657
+ *
1658
+ * @param params - Transfer parameters
1659
+ * @returns PreparedTransfer with gas estimates and challenge
1660
+ */
1661
+ prepareTransfer(params: TransferParams): Promise<PreparedTransfer>;
1662
+ /**
1663
+ * Get a human-readable summary of a prepared transfer (Issue #26)
1664
+ *
1665
+ * Use this to show users what they're signing before biometric authentication.
1666
+ * The summary includes:
1667
+ * - Action type (transfer, bridge, execute, config)
1668
+ * - Human-readable amounts (not wei)
1669
+ * - Recipient display (truncated address, ENS if available)
1670
+ * - Chain information
1671
+ * - Risk warnings for unusual transactions
1672
+ * - Gas cost breakdown
1673
+ * - Expiration countdown
1674
+ *
1675
+ * @example
1676
+ * ```typescript
1677
+ * const prepared = await sdk.prepareTransfer({
1678
+ * recipient: '0x123...',
1679
+ * amount: '1000000000000000000', // 1 ETH in wei
1680
+ * tokenAddress: NATIVE_TOKEN_ADDRESS,
1681
+ * targetChain: 10004, // Base Sepolia
1682
+ * });
1683
+ *
1684
+ * const summary = await sdk.getTransactionSummary(prepared);
1685
+ * console.log(summary.title); // "Transfer"
1686
+ * console.log(summary.description); // "Send 1.0 ETH to 0x123...abc"
1687
+ * console.log(summary.details.formattedAmount); // "1.0"
1688
+ * console.log(summary.risks); // [{ type: 'large_transaction', level: 'high', ... }]
1689
+ * ```
1690
+ *
1691
+ * @param prepared - PreparedTransfer or PreparedBridge from prepare methods
1692
+ * @returns Promise<TransactionSummary> with human-readable details
1693
+ */
1694
+ getTransactionSummary(prepared: PreparedTransfer | PreparedBridge): Promise<TransactionSummary>;
1695
+ /**
1696
+ * Get current spending limits for your vault
1697
+ *
1698
+ * @example
1699
+ * ```typescript
1700
+ * const limits = await sdk.getSpendingLimits();
1701
+ * console.log(`Daily remaining: ${limits.dailyRemaining}`);
1702
+ * console.log(`Resets in: ${limits.timeUntilReset}ms`);
1703
+ * ```
1704
+ *
1705
+ * @param chainId - Optional chain ID (defaults to current chain)
1706
+ * @returns Promise<SpendingLimits> with current limits and usage
1707
+ */
1708
+ getSpendingLimits(chainId?: number): Promise<SpendingLimits>;
1709
+ /**
1710
+ * Get spending limits formatted for UI display
1711
+ *
1712
+ * @example
1713
+ * ```typescript
1714
+ * const formatted = await sdk.getFormattedSpendingLimits();
1715
+ * console.log(`${formatted.dailyUsedPercentage}% of daily limit used`);
1716
+ * console.log(`Resets in: ${formatted.timeUntilReset}`);
1717
+ * ```
1718
+ */
1719
+ getFormattedSpendingLimits(chainId?: number): Promise<FormattedSpendingLimits>;
1720
+ /**
1721
+ * Check if a transaction amount is within spending limits
1722
+ *
1723
+ * @example
1724
+ * ```typescript
1725
+ * const check = await sdk.checkSpendingLimit(ethers.parseEther("1.0"));
1726
+ * if (!check.allowed) {
1727
+ * console.log(check.message);
1728
+ * console.log('Suggestions:', check.suggestions);
1729
+ * }
1730
+ * ```
1731
+ *
1732
+ * @param amount - Amount to check (in wei/base units)
1733
+ * @param chainId - Optional chain ID
1734
+ * @returns LimitCheckResult with allowed status and suggestions
1735
+ */
1736
+ checkSpendingLimit(amount: bigint, chainId?: number): Promise<LimitCheckResult>;
1737
+ /**
1738
+ * Prepare a transaction to update the daily spending limit
1739
+ * Returns a PreparedTransfer that can be signed and executed
1740
+ *
1741
+ * @example
1742
+ * ```typescript
1743
+ * // Set daily limit to 5 ETH
1744
+ * const prepared = await sdk.prepareSetDailyLimit(ethers.parseEther("5.0"));
1745
+ * const result = await sdk.executeTransfer(prepared, signer);
1746
+ * ```
1747
+ *
1748
+ * @param newLimit - New daily limit (0 = unlimited)
1749
+ * @returns PreparedTransfer for signing
1750
+ */
1751
+ prepareSetDailyLimit(newLimit: bigint): Promise<PreparedTransfer>;
1752
+ /**
1753
+ * Prepare a transaction to pause the vault (emergency stop)
1754
+ * Pausing prevents all withdrawals until unpaused
1755
+ *
1756
+ * @example
1757
+ * ```typescript
1758
+ * const prepared = await sdk.preparePauseVault();
1759
+ * const result = await sdk.executeTransfer(prepared, signer);
1760
+ * ```
1761
+ */
1762
+ preparePauseVault(): Promise<PreparedTransfer>;
1763
+ /**
1764
+ * Prepare a transaction to unpause the vault
1765
+ *
1766
+ * @example
1767
+ * ```typescript
1768
+ * const prepared = await sdk.prepareUnpauseVault();
1769
+ * const result = await sdk.executeTransfer(prepared, signer);
1770
+ * ```
1771
+ */
1772
+ prepareUnpauseVault(): Promise<PreparedTransfer>;
1773
+ /**
1774
+ * Execute a prepared transfer
1775
+ * Use this after prepareTransfer() for better UX
1776
+ *
1777
+ * @param prepared - PreparedTransfer from prepareTransfer()
1778
+ * @param signer - Signer to pay for gas
1779
+ * @returns TransferResult with tracking info
1780
+ */
1781
+ executeTransfer(prepared: PreparedTransfer, signer: any): Promise<TransferResult>;
1782
+ /**
1783
+ * Enhanced transfer with automatic tracking
1784
+ *
1785
+ * @param params - Transfer parameters
1786
+ * @param signer - Signer to pay for gas
1787
+ * @param onStatusChange - Optional callback for transaction status updates
1788
+ * @returns TransferResult with tracking info
1789
+ */
1790
+ transferWithTracking(params: TransferParams, signer: any, onStatusChange?: TransactionCallback): Promise<TransferResult>;
1791
+ /**
1792
+ * Execute a gasless transfer using the relayer
1793
+ *
1794
+ * This method allows users to send funds without paying gas themselves.
1795
+ * The relayer service submits the transaction to the Hub and pays the gas.
1796
+ * The relayer then automatically relays the VAA to the destination spoke chain.
1797
+ *
1798
+ * @param params - Transfer parameters (to, amount, token, targetChain)
1799
+ * @param onStatusChange - Optional callback for transaction status updates
1800
+ * @returns TransferResult with Hub tx hash and tracking info
1801
+ */
1802
+ transferViaRelayer(params: TransferParams, onStatusChange?: TransactionCallback): Promise<TransferResult>;
1803
+ /**
1804
+ * Wait for a transaction to confirm
1805
+ *
1806
+ * @param hash - Transaction hash
1807
+ * @returns TransactionState when confirmed
1808
+ */
1809
+ waitForTransaction(hash: string): Promise<TransactionState>;
1810
+ /**
1811
+ * Get native token balance for the current vault
1812
+ *
1813
+ * @returns TokenBalance with native token balance
1814
+ */
1815
+ getVaultNativeBalance(): Promise<TokenBalance>;
1816
+ /**
1817
+ * Get all token balances for the current vault
1818
+ *
1819
+ * @param includeZeroBalances - Whether to include tokens with 0 balance
1820
+ * @returns PortfolioBalance with all token balances
1821
+ */
1822
+ getVaultBalances(includeZeroBalances?: boolean): Promise<PortfolioBalance>;
1823
+ /**
1824
+ * Get token balance for a specific token
1825
+ *
1826
+ * @param tokenAddress - Token contract address or 'native'
1827
+ * @returns TokenBalance for the specified token
1828
+ */
1829
+ getVaultTokenBalance(tokenAddress: string): Promise<TokenBalance>;
1830
+ /**
1831
+ * Get balances across multiple chains
1832
+ *
1833
+ * @param chainIds - Array of Wormhole chain IDs to check
1834
+ * @returns Array of PortfolioBalance for each chain
1835
+ */
1836
+ getMultiChainBalances(chainIds: number[]): Promise<PortfolioBalance[]>;
1837
+ /**
1838
+ * Get token list for a chain
1839
+ */
1840
+ getTokenList(wormholeChainId?: number): TokenInfo$1[];
1841
+ /**
1842
+ * Get token by symbol
1843
+ */
1844
+ getTokenBySymbol(symbol: string, wormholeChainId?: number): TokenInfo$1 | null;
1845
+ /**
1846
+ * Get receive address information for sharing
1847
+ * Use this to generate QR codes or share your vault address
1848
+ *
1849
+ * @returns ReceiveAddress with address and sharing info
1850
+ */
1851
+ getReceiveAddress(): ReceiveAddress;
1852
+ /**
1853
+ * Generate receive address with amount (for payment requests)
1854
+ *
1855
+ * @param amount - Amount to request
1856
+ * @param tokenAddress - Token address or 'native'
1857
+ * @param tokenDecimals - Token decimals
1858
+ * @returns ReceiveAddress with payment request info
1859
+ */
1860
+ getPaymentRequest(amount: bigint, tokenAddress?: string, tokenDecimals?: number): ReceiveAddress;
1861
+ /**
1862
+ * Format wei to ether string
1863
+ */
1864
+ private formatWei;
1865
+ /**
1866
+ * Format units based on decimals
1867
+ */
1868
+ private formatUnits;
1869
+ getVaultInfo(targetChainId?: number): Promise<VaultInfo | null>;
1870
+ /**
1871
+ * Get the deterministic vault address for the current credential
1872
+ * This computes the address off-chain without requiring the vault to exist
1873
+ *
1874
+ * @returns The vault address that will be used when vault is created
1875
+ */
1876
+ getVaultAddress(): string;
1877
+ /**
1878
+ * Get the vault address for a specific key hash
1879
+ *
1880
+ * @param keyHash - The user's key hash
1881
+ * @returns The deterministic vault address
1882
+ */
1883
+ getVaultAddressForKeyHash(keyHash: string): string;
1884
+ /**
1885
+ * Get unified identity with addresses across chains
1886
+ *
1887
+ * @returns UnifiedIdentity containing credential info and chain addresses
1888
+ */
1889
+ getUnifiedIdentity(): Promise<UnifiedIdentity>;
1890
+ /**
1891
+ * Get the current chain address from unified identity
1892
+ */
1893
+ getCurrentChainAddress(): Promise<ChainAddress | null>;
1894
+ /**
1895
+ * Update deployment status for cached identity
1896
+ */
1897
+ private updateDeploymentStatus;
1898
+ /**
1899
+ * Add a chain address to the unified identity
1900
+ * Used when configuring multiple chains
1901
+ */
1902
+ addChainAddress(address: ChainAddress): void;
1903
+ /**
1904
+ * Create a vault for the current credential
1905
+ *
1906
+ * @param signer - The signer to pay for gas
1907
+ * @returns VaultCreationResult with address and transaction details
1908
+ */
1909
+ createVault(signer: any): Promise<VaultCreationResult>;
1910
+ /**
1911
+ * Create a vault with sponsored gas (Veridex pays for gas)
1912
+ *
1913
+ * Uses the sponsor wallet configured in SDK initialization.
1914
+ * If no sponsor is configured, throws an error.
1915
+ *
1916
+ * @param wormholeChainId - Optional chain ID for multi-chain creation
1917
+ * @returns VaultCreationResult with address and transaction details
1918
+ */
1919
+ createVaultSponsored(wormholeChainId?: number): Promise<VaultCreationResult>;
1920
+ /**
1921
+ * Check if sponsored vault creation is available
1922
+ */
1923
+ hasSponsoredVaultCreation(): boolean;
1924
+ /**
1925
+ * Ensure vault exists, creating with sponsor if available
1926
+ * Falls back to requiring a signer if no sponsor configured
1927
+ *
1928
+ * @param signer - Optional signer (only required if no sponsor configured)
1929
+ * @returns The vault address
1930
+ */
1931
+ ensureVaultAuto(signer?: any): Promise<string>;
1932
+ /**
1933
+ * Ensure vault exists, creating if necessary
1934
+ *
1935
+ * @param signer - The signer to pay for gas (only used if creation needed)
1936
+ * @returns The vault address
1937
+ */
1938
+ ensureVault(signer: any): Promise<string>;
1939
+ /**
1940
+ * Estimate gas for vault creation
1941
+ */
1942
+ estimateVaultCreationGas(): Promise<bigint>;
1943
+ vaultExists(): Promise<boolean>;
1944
+ /**
1945
+ * Check if gas sponsorship is configured
1946
+ *
1947
+ * @returns true if a sponsor is configured (relayer, integrator, or Veridex)
1948
+ */
1949
+ isSponsorshipAvailable(): boolean;
1950
+ /**
1951
+ * Get the active sponsorship source
1952
+ *
1953
+ * Priority order:
1954
+ * 1. 'relayer' - Remote relayer service (future primary)
1955
+ * 2. 'integrator' - Platform-provided sponsor key
1956
+ * 3. 'veridex' - Veridex default sponsor (fallback)
1957
+ * 4. 'none' - No sponsorship available
1958
+ *
1959
+ * @returns The active sponsorship source
1960
+ */
1961
+ getSponsorshipSource(): 'relayer' | 'integrator' | 'veridex' | 'none';
1962
+ /**
1963
+ * Get supported chains for sponsored vault creation
1964
+ *
1965
+ * @returns Array of chain configurations
1966
+ */
1967
+ getSponsoredChains(): ChainDeploymentConfig[];
1968
+ /**
1969
+ * Create a vault on a specific chain using gas sponsorship
1970
+ * User doesn't need to pay gas - Veridex pays
1971
+ *
1972
+ * @param wormholeChainId - The Wormhole chain ID to create vault on
1973
+ * @returns Result with vault address
1974
+ */
1975
+ createSponsoredVault(wormholeChainId: number): Promise<SponsoredVaultResult>;
1976
+ /**
1977
+ * Create vaults on all supported chains using gas sponsorship
1978
+ * User doesn't need to pay gas - Veridex pays
1979
+ *
1980
+ * @returns Multi-chain result with all vault addresses
1981
+ */
1982
+ createSponsoredVaultsOnAllChains(): Promise<MultiChainVaultResult>;
1983
+ /**
1984
+ * Check if vaults exist on all supported chains
1985
+ *
1986
+ * @returns Map of chain ID to vault status
1987
+ */
1988
+ checkVaultsOnAllChains(): Promise<Record<number, {
1989
+ exists: boolean;
1990
+ address: string;
1991
+ }>>;
1992
+ /**
1993
+ * Ensure vaults exist on all chains, creating if necessary (sponsored)
1994
+ *
1995
+ * @returns Result with all vault addresses
1996
+ */
1997
+ ensureSponsoredVaultsOnAllChains(): Promise<MultiChainVaultResult>;
1998
+ /**
1999
+ * Get the identity state for the current passkey
2000
+ * Returns information about the identity including key count and root status
2001
+ *
2002
+ * @returns Identity state or null if no credential set
2003
+ */
2004
+ getIdentityState(): Promise<IdentityState | null>;
2005
+ /**
2006
+ * Get all authorized passkeys for the current identity
2007
+ *
2008
+ * @returns Array of authorized keys with root status, or null if no credential
2009
+ */
2010
+ listAuthorizedPasskeys(): Promise<AuthorizedKey[] | null>;
2011
+ /**
2012
+ * Check if the current identity has backup passkeys registered
2013
+ * Returns false if only one passkey (the root) is registered
2014
+ *
2015
+ * @returns True if backup passkeys exist, false otherwise
2016
+ */
2017
+ hasBackupPasskeys(): Promise<boolean>;
2018
+ /**
2019
+ * Register a backup passkey for the current identity
2020
+ * The backup passkey can be used to recover access if the primary is lost
2021
+ *
2022
+ * @param newCredential The new passkey credential to add as backup
2023
+ * @param signer Ethereum signer to pay gas (optional, uses relayer if not provided)
2024
+ * @returns Result with transaction hash and sequence for cross-chain sync
2025
+ */
2026
+ addBackupPasskey(newCredential: PasskeyCredential, signer?: any): Promise<AddBackupKeyResult>;
2027
+ /**
2028
+ * Remove a passkey from the current identity
2029
+ * Cannot remove the last remaining passkey
2030
+ *
2031
+ * @param keyToRemove Hash of the passkey to remove
2032
+ * @param signer Ethereum signer to pay gas
2033
+ * @returns Result with transaction hash and sequence for cross-chain sync
2034
+ */
2035
+ removePasskey(keyToRemove: string, signer: any): Promise<RemoveKeyResult>;
2036
+ /**
2037
+ * Check if a specific passkey is authorized for the current identity
2038
+ *
2039
+ * @param keyHash Hash of the passkey to check
2040
+ * @returns True if authorized, false otherwise
2041
+ */
2042
+ isPasskeyAuthorized(keyHash: string): Promise<boolean>;
2043
+ /**
2044
+ * Get the identity hash for the current passkey
2045
+ * This is the keyHash of the first/root passkey registered
2046
+ *
2047
+ * @returns Identity hash or null if no credential/identity
2048
+ */
2049
+ getIdentity(): Promise<string | null>;
2050
+ getCredential(): PasskeyCredential | null;
2051
+ setCredential(credential: PasskeyCredential): void;
2052
+ hasCredential(): boolean;
2053
+ clearCredential(): void;
2054
+ }
2055
+
2056
+ /**
2057
+ * Veridex Protocol SDK - Chain Presets
2058
+ *
2059
+ * Pre-configured chain settings for easy SDK initialization.
2060
+ * Developers only need to specify chain name and network type.
2061
+ *
2062
+ * @example
2063
+ * ```typescript
2064
+ * import { createSDK } from '@veridex/sdk';
2065
+ *
2066
+ * // Simple initialization - testnet by default
2067
+ * const sdk = await createSDK('base');
2068
+ *
2069
+ * // Or specify mainnet
2070
+ * const mainnetSdk = await createSDK('base', { network: 'mainnet' });
2071
+ * ```
2072
+ */
2073
+
2074
+ /**
2075
+ * All supported chain names for easy reference
2076
+ */
2077
+ declare const CHAIN_NAMES: {
2078
+ readonly BASE: "base";
2079
+ readonly OPTIMISM: "optimism";
2080
+ readonly ARBITRUM: "arbitrum";
2081
+ readonly SCROLL: "scroll";
2082
+ readonly BLAST: "blast";
2083
+ readonly MANTLE: "mantle";
2084
+ readonly ETHEREUM: "ethereum";
2085
+ readonly POLYGON: "polygon";
2086
+ readonly BSC: "bsc";
2087
+ readonly AVALANCHE: "avalanche";
2088
+ readonly FANTOM: "fantom";
2089
+ readonly CELO: "celo";
2090
+ readonly MOONBEAM: "moonbeam";
2091
+ readonly SOLANA: "solana";
2092
+ readonly APTOS: "aptos";
2093
+ readonly SUI: "sui";
2094
+ readonly STARKNET: "starknet";
2095
+ readonly NEAR: "near";
2096
+ readonly SEI: "sei";
2097
+ };
2098
+ type ChainName = typeof CHAIN_NAMES[keyof typeof CHAIN_NAMES];
2099
+ type NetworkType = 'mainnet' | 'testnet';
2100
+ interface ChainPreset {
2101
+ /** Human-readable chain name */
2102
+ displayName: string;
2103
+ /** Chain type for client selection */
2104
+ type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'near' | 'cosmos';
2105
+ /** Whether this chain can be a hub */
2106
+ canBeHub: boolean;
2107
+ /** Testnet configuration */
2108
+ testnet: ChainConfig$1;
2109
+ /** Mainnet configuration */
2110
+ mainnet: ChainConfig$1;
2111
+ }
2112
+ declare const CHAIN_PRESETS: Record<ChainName, ChainPreset>;
2113
+ /**
2114
+ * Get chain configuration by name and network
2115
+ */
2116
+ declare function getChainConfig(chain: ChainName, network?: NetworkType): ChainConfig$1;
2117
+ /**
2118
+ * Get chain preset by name
2119
+ */
2120
+ declare function getChainPreset(chain: ChainName): ChainPreset;
2121
+ /**
2122
+ * Get all supported chain names
2123
+ */
2124
+ declare function getSupportedChains(): ChainName[];
2125
+ /**
2126
+ * Get hub-capable chains
2127
+ */
2128
+ declare function getHubChains(): ChainName[];
2129
+ /**
2130
+ * Check if chain is supported
2131
+ */
2132
+ declare function isChainSupported(chain: string): chain is ChainName;
2133
+ /**
2134
+ * Get default hub chain
2135
+ */
2136
+ declare function getDefaultHub(network?: NetworkType): ChainConfig$1;
2137
+
2138
+ /**
2139
+ * Veridex Protocol SDK - Simplified Initialization
2140
+ *
2141
+ * Factory functions for easy SDK creation with minimal configuration.
2142
+ *
2143
+ * @example
2144
+ * ```typescript
2145
+ * import { createSDK } from '@veridex/sdk';
2146
+ *
2147
+ * // Simplest usage - testnet by default
2148
+ * const sdk = await createSDK('base');
2149
+ *
2150
+ * // Register passkey and start using
2151
+ * await sdk.passkey.register('user@example.com', 'My Wallet');
2152
+ * const vault = await sdk.getVaultAddress();
2153
+ * ```
2154
+ */
2155
+
2156
+ /**
2157
+ * Simplified SDK configuration
2158
+ * Only specify what you need - everything else has sensible defaults
2159
+ */
2160
+ interface SimpleSDKConfig {
2161
+ /**
2162
+ * Network to connect to
2163
+ * @default 'testnet'
2164
+ */
2165
+ network?: NetworkType;
2166
+ /**
2167
+ * Custom RPC URL (optional - defaults to public endpoints)
2168
+ */
2169
+ rpcUrl?: string;
2170
+ /**
2171
+ * Relayer URL for gasless transactions (optional)
2172
+ */
2173
+ relayerUrl?: string;
2174
+ /**
2175
+ * Relayer API key (optional)
2176
+ */
2177
+ relayerApiKey?: string;
2178
+ /**
2179
+ * Sponsor private key for gasless vault creation (optional)
2180
+ * If not provided, users pay their own gas
2181
+ */
2182
+ sponsorPrivateKey?: string;
2183
+ /**
2184
+ * Integrator sponsor key (optional)
2185
+ * Allows platforms to pay for their users' transactions
2186
+ */
2187
+ integratorSponsorKey?: string;
2188
+ /**
2189
+ * Additional RPC URLs for multi-chain operations
2190
+ * Maps chain name to RPC URL
2191
+ */
2192
+ rpcUrls?: Partial<Record<ChainName, string>>;
2193
+ }
2194
+ /**
2195
+ * Session-specific configuration
2196
+ */
2197
+ interface SessionConfig {
2198
+ /**
2199
+ * Chain to use for sessions
2200
+ */
2201
+ chain: ChainName;
2202
+ /**
2203
+ * Network to connect to
2204
+ * @default 'testnet'
2205
+ */
2206
+ network?: NetworkType;
2207
+ /**
2208
+ * Session duration in seconds
2209
+ * @default 3600 (1 hour)
2210
+ */
2211
+ duration?: number;
2212
+ /**
2213
+ * Maximum value per transaction
2214
+ * @default BigInt(1e18) (1 token)
2215
+ */
2216
+ maxValue?: bigint;
2217
+ /**
2218
+ * Require user verification for session creation
2219
+ * @default true
2220
+ */
2221
+ requireUV?: boolean;
2222
+ }
2223
+ /**
2224
+ * Create a Veridex SDK instance with minimal configuration
2225
+ *
2226
+ * @param chain - Chain name (e.g., 'base', 'optimism', 'solana')
2227
+ * @param config - Optional configuration overrides
2228
+ * @returns Configured VeridexSDK instance
2229
+ *
2230
+ * @example
2231
+ * ```typescript
2232
+ * // Simplest usage - testnet by default
2233
+ * const sdk = await createSDK('base');
2234
+ *
2235
+ * // Use mainnet
2236
+ * const mainnetSdk = await createSDK('base', { network: 'mainnet' });
2237
+ *
2238
+ * // With custom RPC
2239
+ * const customSdk = await createSDK('base', {
2240
+ * rpcUrl: 'https://my-rpc.example.com'
2241
+ * });
2242
+ *
2243
+ * // With relayer for gasless transactions
2244
+ * const gaslessSdk = await createSDK('base', {
2245
+ * relayerUrl: 'https://relayer.veridex.io',
2246
+ * relayerApiKey: 'your-api-key',
2247
+ * });
2248
+ * ```
2249
+ */
2250
+ declare function createSDK(chain: ChainName, config?: SimpleSDKConfig): VeridexSDK;
2251
+ /**
2252
+ * Create SDK for the default hub chain (Base)
2253
+ *
2254
+ * @param config - Optional configuration
2255
+ * @returns SDK configured for Base hub chain
2256
+ *
2257
+ * @example
2258
+ * ```typescript
2259
+ * const sdk = createHubSDK();
2260
+ * await sdk.passkey.register('user', 'My Wallet');
2261
+ * ```
2262
+ */
2263
+ declare function createHubSDK(config?: SimpleSDKConfig): VeridexSDK;
2264
+ /**
2265
+ * Create SDK for testnet (convenience function)
2266
+ *
2267
+ * @param chain - Chain name
2268
+ * @param config - Optional configuration (network is forced to testnet)
2269
+ * @returns SDK configured for testnet
2270
+ */
2271
+ declare function createTestnetSDK(chain?: ChainName, config?: Omit<SimpleSDKConfig, 'network'>): VeridexSDK;
2272
+ /**
2273
+ * Create SDK for mainnet (convenience function)
2274
+ *
2275
+ * @param chain - Chain name
2276
+ * @param config - Optional configuration (network is forced to mainnet)
2277
+ * @returns SDK configured for mainnet
2278
+ */
2279
+ declare function createMainnetSDK(chain?: ChainName, config?: Omit<SimpleSDKConfig, 'network'>): VeridexSDK;
2280
+ /**
2281
+ * Create a session-enabled SDK
2282
+ *
2283
+ * @param chain - Chain name
2284
+ * @param config - Session configuration
2285
+ * @returns SDK configured for session key usage
2286
+ *
2287
+ * @example
2288
+ * ```typescript
2289
+ * import { createSessionSDK, SessionManager } from '@veridex/sdk';
2290
+ *
2291
+ * const sdk = createSessionSDK('base');
2292
+ * const sessionManager = new SessionManager({ sdk });
2293
+ *
2294
+ * // Create a session (one passkey auth)
2295
+ * const session = await sessionManager.createSession({
2296
+ * duration: 3600,
2297
+ * maxValue: BigInt(1e18),
2298
+ * });
2299
+ *
2300
+ * // Execute multiple transactions without prompts
2301
+ * await sessionManager.executeWithSession(params, session);
2302
+ * ```
2303
+ */
2304
+ declare function createSessionSDK(chain?: ChainName, config?: SimpleSDKConfig): VeridexSDK;
2305
+
2306
+ /**
2307
+ * Veridex Protocol SDK - Chain Detector
2308
+ *
2309
+ * Phase 4: Multi-chain client support helper.
2310
+ *
2311
+ * Provides:
2312
+ * - Chain config lookup (testnet/mainnet)
2313
+ * - Auto-configuration for non-EVM ChainClient instances
2314
+ */
2315
+
2316
+ interface ChainDetectorConfig {
2317
+ testnet?: boolean;
2318
+ rpcUrls?: Record<number, string>;
2319
+ }
2320
+ interface NativeBalanceCapable {
2321
+ getNativeBalance(address: string): Promise<bigint>;
2322
+ }
2323
+ declare class ChainDetector {
2324
+ private readonly testnet;
2325
+ private readonly rpcUrls;
2326
+ private readonly walletManager;
2327
+ constructor(config?: ChainDetectorConfig);
2328
+ getChainConfig(wormholeChainId: number): ChainConfig | undefined;
2329
+ /**
2330
+ * Create a chain client for non-EVM chains using repo constants.
2331
+ * For EVM, callers should instantiate EVMClient directly (Hub-driven).
2332
+ */
2333
+ createClient(wormholeChainId: number): ChainClient;
2334
+ /**
2335
+ * Derive a best-effort vault address for a chain from the passkey credential.
2336
+ *
2337
+ * - EVM chains: requires vaultFactory/vaultImplementation in constants.
2338
+ * - Non-EVM chains: uses WalletManager chain-specific derivation.
2339
+ */
2340
+ deriveVaultAddress(credential: PasskeyCredential, wormholeChainId: number): ChainAddress | null;
2341
+ getNonEvmNativeTokenMeta(wormholeChainId: number): {
2342
+ symbol: string;
2343
+ name: string;
2344
+ decimals: number;
2345
+ } | null;
2346
+ private normalizeSuiAddress;
2347
+ }
2348
+ declare function createChainDetector(config?: ChainDetectorConfig): ChainDetector;
2349
+
2350
+ /**
2351
+ * Veridex Protocol SDK - Relayer Client
2352
+ *
2353
+ * Client for interacting with the Veridex relayer service.
2354
+ * The relayer automatically submits VAAs to destination chains.
2355
+ *
2356
+ * Features:
2357
+ * - Submit VAA for relay
2358
+ * - Check relay status
2359
+ * - Get supported routes
2360
+ * - Fee estimation
2361
+ */
2362
+ /**
2363
+ * Relay request status
2364
+ */
2365
+ type RelayStatus = 'pending' | 'processing' | 'submitted' | 'confirmed' | 'failed';
2366
+ /**
2367
+ * Relay request result
2368
+ */
2369
+ interface RelayRequest {
2370
+ /** Unique relay request ID */
2371
+ id: string;
2372
+ /** VAA sequence number */
2373
+ sequence: bigint;
2374
+ /** Source chain Wormhole ID */
2375
+ sourceChain: number;
2376
+ /** Destination chain Wormhole ID */
2377
+ destinationChain: number;
2378
+ /** Relay status */
2379
+ status: RelayStatus;
2380
+ /** Source transaction hash */
2381
+ sourceTxHash: string;
2382
+ /** Destination transaction hash (when completed) */
2383
+ destinationTxHash?: string;
2384
+ /** Timestamp when request was created */
2385
+ createdAt: number;
2386
+ /** Timestamp when request was last updated */
2387
+ updatedAt: number;
2388
+ /** Error message if failed */
2389
+ error?: string;
2390
+ /** Gas used on destination chain */
2391
+ gasUsed?: bigint;
2392
+ /** Fee paid */
2393
+ feePaid?: bigint;
2394
+ }
2395
+ /**
2396
+ * Supported route information
2397
+ */
2398
+ interface RelayRoute {
2399
+ /** Source chain Wormhole ID */
2400
+ sourceChain: number;
2401
+ /** Destination chain Wormhole ID */
2402
+ destinationChain: number;
2403
+ /** Whether the route is active */
2404
+ active: boolean;
2405
+ /** Estimated relay time in seconds */
2406
+ estimatedTimeSeconds: number;
2407
+ /** Base fee in destination chain native token */
2408
+ baseFee: bigint;
2409
+ /** Fee per gas unit */
2410
+ gasPrice: bigint;
2411
+ /** Maximum gas limit */
2412
+ maxGas: bigint;
2413
+ }
2414
+ /**
2415
+ * Relayer service info
2416
+ */
2417
+ interface RelayerInfo {
2418
+ /** Relayer name/identifier */
2419
+ name: string;
2420
+ /** Relayer version */
2421
+ version: string;
2422
+ /** Supported chains */
2423
+ supportedChains: number[];
2424
+ /** Available routes */
2425
+ routes: RelayRoute[];
2426
+ /** Whether the relayer is online */
2427
+ online: boolean;
2428
+ /** Current queue depth */
2429
+ queueDepth: number;
2430
+ }
2431
+ /**
2432
+ * Request body for submitting a signed action to the relayer (gasless)
2433
+ * Uses full WebAuthn data for authenticateAndDispatch
2434
+ */
2435
+ interface SubmitSignedActionRequest {
2436
+ /** WebAuthn authenticatorData (hex) */
2437
+ authenticatorData: string;
2438
+ /** WebAuthn clientDataJSON (raw string) */
2439
+ clientDataJSON: string;
2440
+ /** Index of "challenge":"..." in clientDataJSON */
2441
+ challengeIndex: number;
2442
+ /** Index of "type":"..." in clientDataJSON */
2443
+ typeIndex: number;
2444
+ /** P-256 signature r component (hex) */
2445
+ r: string;
2446
+ /** P-256 signature s component (hex) */
2447
+ s: string;
2448
+ /** P-256 public key X coordinate (hex) */
2449
+ publicKeyX: string;
2450
+ /** P-256 public key Y coordinate (hex) */
2451
+ publicKeyY: string;
2452
+ /** Target chain Wormhole ID */
2453
+ targetChain: number;
2454
+ /** Action payload (hex) */
2455
+ actionPayload: string;
2456
+ /** User nonce */
2457
+ nonce: number;
2458
+ }
2459
+ /**
2460
+ * Response from submitting a signed action
2461
+ */
2462
+ interface SubmitActionResult {
2463
+ /** Whether the submission was successful */
2464
+ success: boolean;
2465
+ /** Transaction hash on Hub chain */
2466
+ txHash?: string;
2467
+ /** Wormhole sequence number */
2468
+ sequence?: string;
2469
+ /** Error message if failed */
2470
+ error?: string;
2471
+ /** Human-readable message */
2472
+ message?: string;
2473
+ }
2474
+ /**
2475
+ * Query submission request (Issue #11/#12)
2476
+ * For optimistic execution via Wormhole Query proofs (~5-7s vs ~120s)
2477
+ */
2478
+ interface SubmitQueryRequest {
2479
+ /** Target spoke chain Wormhole ID */
2480
+ targetChain: number;
2481
+ /** User's key hash */
2482
+ userKeyHash: string;
2483
+ /** Serialized transaction for spoke chain */
2484
+ serializedTx: string;
2485
+ /** Query proof with Guardian signatures */
2486
+ queryProof: {
2487
+ /** Raw query response bytes */
2488
+ queryResponse: string;
2489
+ /** Guardian signatures */
2490
+ signatures: string;
2491
+ };
2492
+ /** Whether to fallback to VAA if Query fails */
2493
+ fallbackToVaa?: boolean;
2494
+ /** Optional metadata */
2495
+ metadata?: {
2496
+ /** User's preferred execution path */
2497
+ preferredPath?: 'query' | 'vaa';
2498
+ /** Transaction value in USD (for routing decisions) */
2499
+ estimatedValueUSD?: number;
2500
+ };
2501
+ }
2502
+ /**
2503
+ * Query submission result (Issue #11/#12)
2504
+ */
2505
+ interface SubmitQueryResult {
2506
+ /** Whether submission succeeded */
2507
+ success: boolean;
2508
+ /** Transaction hash on spoke chain */
2509
+ txHash?: string;
2510
+ /** Execution path used */
2511
+ path: 'query' | 'vaa';
2512
+ /** Latency in milliseconds */
2513
+ latencyMs?: number;
2514
+ /** Error message if failed */
2515
+ error?: string;
2516
+ /** Whether fallback to VAA occurred */
2517
+ fellBack?: boolean;
2518
+ }
2519
+ /**
2520
+ * Fee quote for a relay
2521
+ */
2522
+ interface RelayFeeQuote {
2523
+ /** Source chain Wormhole ID */
2524
+ sourceChain: number;
2525
+ /** Destination chain Wormhole ID */
2526
+ destinationChain: number;
2527
+ /** Estimated fee in source chain native token */
2528
+ feeInSourceToken: bigint;
2529
+ /** Estimated fee in destination chain native token */
2530
+ feeInDestinationToken: bigint;
2531
+ /** Estimated gas on destination */
2532
+ estimatedGas: bigint;
2533
+ /** Quote expiration timestamp */
2534
+ expiresAt: number;
2535
+ /** Quote ID for submission */
2536
+ quoteId: string;
2537
+ }
2538
+ /**
2539
+ * Configuration for RelayerClient
2540
+ */
2541
+ interface RelayerClientConfig {
2542
+ /** Base URL of the relayer service */
2543
+ baseUrl: string;
2544
+ /** API key for authentication (optional) */
2545
+ apiKey?: string;
2546
+ /** Timeout for requests in ms */
2547
+ timeoutMs?: number;
2548
+ /** Max retries for failed requests */
2549
+ maxRetries?: number;
2550
+ }
2551
+ /**
2552
+ * Client for the Veridex relayer service
2553
+ */
2554
+ declare class RelayerClient {
2555
+ private baseUrl;
2556
+ private config;
2557
+ constructor(config: RelayerClientConfig);
2558
+ /**
2559
+ * Submit a VAA for relay to destination chain
2560
+ */
2561
+ submitRelay(vaaBase64: string, sourceChain: number, destinationChain: number, sourceTxHash: string, sequence: bigint, feeQuoteId?: string): Promise<RelayRequest>;
2562
+ /**
2563
+ * Submit a signed action to the relayer for gasless execution
2564
+ *
2565
+ * This allows users to execute transfers without paying gas themselves.
2566
+ * The relayer will submit the transaction to the Hub chain and pay the gas.
2567
+ * The relayer then automatically relays the VAA to the destination spoke chain.
2568
+ *
2569
+ * @param request - The signed action request with passkey signature
2570
+ * @returns Result including Hub tx hash and Wormhole sequence
2571
+ */
2572
+ submitSignedAction(request: SubmitSignedActionRequest): Promise<SubmitActionResult>;
2573
+ /**
2574
+ * Submit a Query-based transaction for optimistic execution (Issue #11/#12)
2575
+ *
2576
+ * Uses Wormhole Cross-Chain Queries (CCQ) to achieve ~5-7 second latency
2577
+ * vs ~120+ seconds for traditional VAA flow.
2578
+ *
2579
+ * Flow:
2580
+ * 1. Client fetches Hub state via queryHubState() from SDK
2581
+ * 2. Client constructs and signs transaction
2582
+ * 3. Client submits Query proof + tx to this endpoint
2583
+ * 4. Relayer validates format and submits to spoke chain
2584
+ * 5. Spoke chain verifies Guardian signatures on-chain
2585
+ *
2586
+ * @param request - Query submission with Guardian-signed proof
2587
+ * @returns Result including spoke tx hash and execution path
2588
+ */
2589
+ submitQuery(request: SubmitQueryRequest): Promise<SubmitQueryResult>;
2590
+ /**
2591
+ * Get relay request status
2592
+ */
2593
+ getRelayStatus(requestId: string): Promise<RelayRequest>;
2594
+ /**
2595
+ * Get relay status by source transaction hash
2596
+ */
2597
+ getRelayBySourceTx(sourceTxHash: string): Promise<RelayRequest | null>;
2598
+ /**
2599
+ * Get relay status by sequence number
2600
+ */
2601
+ getRelayBySequence(sourceChain: number, sequence: bigint): Promise<RelayRequest | null>;
2602
+ /**
2603
+ * Cancel a pending relay request
2604
+ */
2605
+ cancelRelay(requestId: string): Promise<boolean>;
2606
+ /**
2607
+ * Poll for relay completion
2608
+ */
2609
+ waitForRelay(requestId: string, timeoutMs?: number, pollingIntervalMs?: number, onProgress?: (status: RelayStatus) => void): Promise<RelayRequest>;
2610
+ /**
2611
+ * Get fee quote for a relay
2612
+ */
2613
+ getFeeQuote(sourceChain: number, destinationChain: number, estimatedGas?: bigint): Promise<RelayFeeQuote>;
2614
+ /**
2615
+ * Get relayer service info
2616
+ */
2617
+ getInfo(): Promise<RelayerInfo>;
2618
+ /**
2619
+ * Get supported routes
2620
+ */
2621
+ getRoutes(): Promise<RelayRoute[]>;
2622
+ /**
2623
+ * Check if a route is supported
2624
+ */
2625
+ isRouteSupported(sourceChain: number, destinationChain: number): Promise<boolean>;
2626
+ /**
2627
+ * Check relayer health
2628
+ */
2629
+ healthCheck(): Promise<boolean>;
2630
+ /**
2631
+ * Get all pending relay requests for a user
2632
+ */
2633
+ getPendingRelays(userKeyHash: string): Promise<RelayRequest[]>;
2634
+ /**
2635
+ * Get relay history for a user
2636
+ */
2637
+ getRelayHistory(userKeyHash: string, limit?: number, offset?: number): Promise<RelayRequest[]>;
2638
+ /**
2639
+ * Make an HTTP request to the relayer
2640
+ */
2641
+ private fetch;
2642
+ /**
2643
+ * Sleep helper
2644
+ */
2645
+ private sleep;
2646
+ }
2647
+ /**
2648
+ * Create a RelayerClient instance
2649
+ */
2650
+ declare function createRelayerClient(config: RelayerClientConfig): RelayerClient;
2651
+
2652
+ /**
2653
+ * Veridex Protocol SDK - Session Cryptography Utilities
2654
+ *
2655
+ * Provides cryptographic operations for session key management:
2656
+ * - secp256k1 key generation (NOT secp256r1 - sessions are software-backed)
2657
+ * - ECDSA signing with session keys
2658
+ * - Key hash derivation (keccak256)
2659
+ * - Secure random generation
2660
+ */
2661
+ /** Maximum session duration enforced on-chain (24 hours) */
2662
+ declare const MAX_SESSION_DURATION = 86400;
2663
+ /** Minimum session duration (60 seconds) */
2664
+ declare const MIN_SESSION_DURATION = 60;
2665
+ /** Default session duration (1 hour) */
2666
+ declare const DEFAULT_SESSION_DURATION = 3600;
2667
+ /** Default refresh buffer (5 minutes before expiry) */
2668
+ declare const DEFAULT_REFRESH_BUFFER = 300;
2669
+ /**
2670
+ * Key pair for secp256k1 session keys
2671
+ */
2672
+ interface KeyPair {
2673
+ publicKey: Uint8Array;
2674
+ privateKey: Uint8Array;
2675
+ address: string;
2676
+ }
2677
+ /**
2678
+ * Generate a new secp256k1 key pair for session key
2679
+ *
2680
+ * Security:
2681
+ * - Uses cryptographically secure random (ethers.Wallet.createRandom)
2682
+ * - Returns uncompressed public key (65 bytes)
2683
+ * - Private key is 32 bytes
2684
+ *
2685
+ * @returns KeyPair with public/private keys and derived address
2686
+ */
2687
+ declare function generateSecp256k1KeyPair(): KeyPair;
2688
+ /**
2689
+ * Compute keccak256 hash of public key (session key identifier)
2690
+ *
2691
+ * This hash is used as the on-chain identifier for the session.
2692
+ * It matches the Solidity keccak256(publicKey) computation.
2693
+ *
2694
+ * @param publicKey Uncompressed public key (65 bytes)
2695
+ * @returns Hex string of keccak256 hash (0x...)
2696
+ */
2697
+ declare function computeSessionKeyHash(publicKey: Uint8Array): string;
2698
+ /**
2699
+ * Sign a message hash with a session key (secp256k1 ECDSA)
2700
+ *
2701
+ * @param privateKey Session private key (32 bytes)
2702
+ * @param messageHash Message hash to sign (32 bytes)
2703
+ * @returns Signature with r, s, v components
2704
+ */
2705
+ declare function signWithSessionKey(privateKey: Uint8Array, messageHash: Uint8Array | string): {
2706
+ r: string;
2707
+ s: string;
2708
+ v: number;
2709
+ signature: Uint8Array;
2710
+ };
2711
+ /**
2712
+ * Hash an action for signing
2713
+ *
2714
+ * Creates a deterministic hash of action parameters that can be
2715
+ * signed with a session key and verified on-chain.
2716
+ *
2717
+ * Hash format: keccak256(abi.encodePacked(
2718
+ * action, targetChain, value, keccak256(payload), nonce, deadline
2719
+ * ))
2720
+ *
2721
+ * @param params Action parameters
2722
+ * @returns Message hash (32 bytes)
2723
+ */
2724
+ declare function hashAction(params: {
2725
+ action: string;
2726
+ targetChain: number;
2727
+ value: bigint;
2728
+ payload: Uint8Array;
2729
+ nonce: number;
2730
+ deadline?: number;
2731
+ }): Uint8Array;
2732
+ /**
2733
+ * Verify a session key signature
2734
+ *
2735
+ * Used for testing and client-side validation before submission.
2736
+ * On-chain verification is handled by Spoke contracts via CCQ.
2737
+ *
2738
+ * @param messageHash Message that was signed
2739
+ * @param signature Signature to verify
2740
+ * @param expectedPublicKey Expected public key of signer
2741
+ * @returns True if signature is valid
2742
+ */
2743
+ declare function verifySessionSignature(messageHash: Uint8Array | string, signature: Uint8Array, expectedPublicKey: Uint8Array): boolean;
2744
+ /**
2745
+ * Derive an AES-GCM encryption key for session storage
2746
+ *
2747
+ * Uses PBKDF2 to derive a key from a user-specific seed.
2748
+ * The seed should be derived from the user's Passkey credential ID.
2749
+ *
2750
+ * Security considerations:
2751
+ * - Uses 100,000 iterations (OWASP minimum)
2752
+ * - Salt is derived from credential ID (unique per user)
2753
+ * - Key is bound to specific browser/device via extractable: false
2754
+ *
2755
+ * @param credentialId User's Passkey credential ID (unique identifier)
2756
+ * @returns AES-GCM encryption key
2757
+ */
2758
+ declare function deriveEncryptionKey(credentialId: string): Promise<CryptoKey>;
2759
+ /**
2760
+ * Encrypt data with AES-GCM
2761
+ *
2762
+ * @param data Data to encrypt
2763
+ * @param key AES-GCM encryption key
2764
+ * @returns Encrypted data with IV prepended
2765
+ */
2766
+ declare function encrypt(data: Uint8Array, key: CryptoKey): Promise<Uint8Array>;
2767
+ /**
2768
+ * Decrypt data with AES-GCM
2769
+ *
2770
+ * @param encryptedData Data with IV prepended
2771
+ * @param key AES-GCM encryption key
2772
+ * @returns Decrypted data
2773
+ */
2774
+ declare function decrypt(encryptedData: Uint8Array, key: CryptoKey): Promise<Uint8Array>;
2775
+ /**
2776
+ * Validate session configuration
2777
+ *
2778
+ * @param config Session configuration to validate
2779
+ * @throws SessionError if configuration is invalid
2780
+ */
2781
+ declare function validateSessionConfig(config: {
2782
+ duration: number;
2783
+ maxValue: bigint;
2784
+ }): void;
2785
+
2786
+ /**
2787
+ * Veridex Protocol SDK - Secure Session Storage
2788
+ *
2789
+ * Provides encrypted storage for session keys using IndexedDB or LocalStorage.
2790
+ * Private keys are ALWAYS encrypted at rest using AES-GCM.
2791
+ *
2792
+ * Security guarantees:
2793
+ * - Private keys never stored in plaintext
2794
+ * - Encryption keys derived from Passkey credential ID (user-bound)
2795
+ * - Keys are non-extractable (remain in browser's crypto subsystem)
2796
+ * - Automatic cleanup on revocation or expiry
2797
+ */
2798
+
2799
+ /**
2800
+ * IndexedDB-based session storage with encryption
2801
+ *
2802
+ * Preferred storage backend because:
2803
+ * - Larger storage quota (~50MB vs ~10MB)
2804
+ * - Structured storage (no serialization overhead)
2805
+ * - Better performance for binary data
2806
+ * - Non-blocking async API
2807
+ */
2808
+ declare class IndexedDBSessionStorage implements SessionStorage {
2809
+ private db;
2810
+ private encryptionKey;
2811
+ private credentialId;
2812
+ /**
2813
+ * @param credentialId User's Passkey credential ID (for key derivation)
2814
+ */
2815
+ constructor(credentialId: string);
2816
+ /**
2817
+ * Initialize database connection
2818
+ */
2819
+ private initialize;
2820
+ /**
2821
+ * Get or derive encryption key
2822
+ */
2823
+ private getEncryptionKey;
2824
+ /**
2825
+ * Save a session (encrypts private key)
2826
+ */
2827
+ save(session: SessionKey): Promise<void>;
2828
+ /**
2829
+ * Load the active session (decrypts private key)
2830
+ */
2831
+ load(): Promise<SessionKey | null>;
2832
+ /**
2833
+ * Get all stored sessions (internal helper)
2834
+ */
2835
+ private getAllSessions;
2836
+ /**
2837
+ * Clear all sessions
2838
+ */
2839
+ clear(): Promise<void>;
2840
+ /**
2841
+ * Check if any session exists
2842
+ */
2843
+ exists(): Promise<boolean>;
2844
+ /**
2845
+ * Close database connection
2846
+ */
2847
+ close(): void;
2848
+ }
2849
+ /**
2850
+ * LocalStorage-based session storage with encryption
2851
+ *
2852
+ * Fallback storage backend when IndexedDB is unavailable.
2853
+ *
2854
+ * Limitations:
2855
+ * - Smaller storage quota (~10MB)
2856
+ * - Synchronous API (blocks main thread)
2857
+ * - String-based storage (requires serialization)
2858
+ */
2859
+ declare class LocalStorageSessionStorage implements SessionStorage {
2860
+ private encryptionKey;
2861
+ private credentialId;
2862
+ private storageKey;
2863
+ /**
2864
+ * @param credentialId User's Passkey credential ID (for key derivation)
2865
+ */
2866
+ constructor(credentialId: string);
2867
+ /**
2868
+ * Get or derive encryption key
2869
+ */
2870
+ private getEncryptionKey;
2871
+ /**
2872
+ * Save a session (encrypts private key)
2873
+ */
2874
+ save(session: SessionKey): Promise<void>;
2875
+ /**
2876
+ * Load the active session (decrypts private key)
2877
+ */
2878
+ load(): Promise<SessionKey | null>;
2879
+ /**
2880
+ * Clear all sessions
2881
+ */
2882
+ clear(): Promise<void>;
2883
+ /**
2884
+ * Check if any session exists
2885
+ */
2886
+ exists(): Promise<boolean>;
2887
+ }
2888
+ /**
2889
+ * Create appropriate session storage based on environment
2890
+ *
2891
+ * @param credentialId User's Passkey credential ID
2892
+ * @param preferredBackend Preferred storage backend ('indexeddb' or 'localstorage')
2893
+ * @returns Session storage implementation
2894
+ */
2895
+ declare function createSessionStorage(credentialId: string, preferredBackend?: 'indexeddb' | 'localstorage'): SessionStorage;
2896
+
2897
+ /**
2898
+ * Veridex Solana Program Error Codes
2899
+ *
2900
+ * Error code constants for parsing and handling Veridex program errors.
2901
+ * These codes map directly to the Anchor error enum variants in the
2902
+ * Solana program.
2903
+ *
2904
+ * @packageDocumentation
2905
+ */
2906
+ /**
2907
+ * Error code range boundaries.
2908
+ * Use these to categorize errors programmatically.
2909
+ */
2910
+ declare const ERROR_RANGES: {
2911
+ /** Core protocol errors (paused, unauthorized, limits, etc.) */
2912
+ readonly CORE: {
2913
+ readonly min: 6000;
2914
+ readonly max: 6099;
2915
+ };
2916
+ /** Query execution errors */
2917
+ readonly QUERY_EXECUTION: {
2918
+ readonly min: 6100;
2919
+ readonly max: 6149;
2920
+ };
2921
+ /** ABI decoding errors */
2922
+ readonly ABI: {
2923
+ readonly min: 6150;
2924
+ readonly max: 6199;
2925
+ };
2926
+ /** Query parsing/validation errors */
2927
+ readonly QUERY_PARSING: {
2928
+ readonly min: 6200;
2929
+ readonly max: 6299;
2930
+ };
2931
+ };
2932
+ declare const VERIDEX_ERRORS: {
2933
+ /** Protocol is globally paused */
2934
+ readonly PROTOCOL_PAUSED: 6000;
2935
+ /** Vault is paused */
2936
+ readonly VAULT_PAUSED: 6001;
2937
+ /** VAA already processed (replay protection) */
2938
+ readonly VAA_ALREADY_PROCESSED: 6002;
2939
+ /** Invalid emitter chain */
2940
+ readonly INVALID_EMITTER_CHAIN: 6003;
2941
+ /** Invalid emitter address */
2942
+ readonly INVALID_EMITTER: 6004;
2943
+ /** Invalid owner */
2944
+ readonly INVALID_OWNER: 6005;
2945
+ /** Invalid target chain */
2946
+ readonly INVALID_TARGET_CHAIN: 6006;
2947
+ /** Invalid payload version */
2948
+ readonly INVALID_PAYLOAD_VERSION: 6007;
2949
+ /** Invalid action payload */
2950
+ readonly INVALID_ACTION_PAYLOAD: 6008;
2951
+ /** Invalid action type */
2952
+ readonly INVALID_ACTION_TYPE: 6009;
2953
+ /** Daily limit exceeded */
2954
+ readonly DAILY_LIMIT_EXCEEDED: 6010;
2955
+ /** Insufficient funds */
2956
+ readonly INSUFFICIENT_FUNDS: 6011;
2957
+ /** Unauthorized */
2958
+ readonly UNAUTHORIZED: 6012;
2959
+ /** Invalid VAA */
2960
+ readonly INVALID_VAA: 6013;
2961
+ /** Token bridge not configured */
2962
+ readonly TOKEN_BRIDGE_NOT_CONFIGURED: 6014;
2963
+ /** Invalid bridge parameters */
2964
+ readonly INVALID_BRIDGE_PARAMS: 6015;
2965
+ /** Invalid query response format */
2966
+ readonly INVALID_QUERY_RESPONSE: 6100;
2967
+ /** Query response expired (> 60 seconds old) */
2968
+ readonly QUERY_EXPIRED: 6101;
2969
+ /** Query signature verification failed */
2970
+ readonly QUERY_INVALID: 6102;
2971
+ /** Query result doesn't match expected state */
2972
+ readonly QUERY_MISMATCH: 6103;
2973
+ /** Query block time is in the future */
2974
+ readonly QUERY_FUTURE_BLOCK: 6104;
2975
+ /** Invalid nonce in query response */
2976
+ readonly INVALID_QUERY_NONCE: 6105;
2977
+ /** Secp256k1 verification instruction missing */
2978
+ readonly SECP256K1_INSTRUCTION_MISSING: 6106;
2979
+ /** Invalid secp256k1 instruction format */
2980
+ readonly INVALID_SECP256K1_INSTRUCTION: 6107;
2981
+ /** Insufficient Guardian signatures on query */
2982
+ readonly INSUFFICIENT_SIGNATURES: 6108;
2983
+ /** Chain ID mismatch in query response */
2984
+ readonly CHAIN_ID_MISMATCH: 6109;
2985
+ /** Query result not found */
2986
+ readonly QUERY_RESULT_NOT_FOUND: 6110;
2987
+ /** ABI decoding: insufficient data */
2988
+ readonly ABI_INSUFFICIENT_DATA: 6150;
2989
+ /** ABI decoding: value overflow */
2990
+ readonly ABI_OVERFLOW: 6151;
2991
+ /** ABI decoding: invalid encoding */
2992
+ readonly ABI_INVALID_ENCODING: 6152;
2993
+ /** ABI decoding: general failure */
2994
+ readonly ABI_DECODING_FAILED: 6153;
2995
+ /** Invalid query response format (parsing) */
2996
+ readonly QUERY_PARSE_INVALID_RESPONSE: 6200;
2997
+ /** Invalid query version */
2998
+ readonly QUERY_PARSE_INVALID_VERSION: 6201;
2999
+ /** Unsupported query type */
3000
+ readonly QUERY_PARSE_UNSUPPORTED_TYPE: 6202;
3001
+ /** Query response is stale (parsing) */
3002
+ readonly QUERY_PARSE_STALE: 6203;
3003
+ /** Query block time is in the future (parsing) */
3004
+ readonly QUERY_PARSE_FUTURE_BLOCK: 6204;
3005
+ /** Invalid Hub state data */
3006
+ readonly QUERY_PARSE_INVALID_HUB_STATE: 6205;
3007
+ /** Invalid nonce (parsing) */
3008
+ readonly QUERY_PARSE_INVALID_NONCE: 6206;
3009
+ /** Query result doesn't match expected (parsing) */
3010
+ readonly QUERY_PARSE_MISMATCH: 6207;
3011
+ /** Secp256k1 instruction not found (parsing) */
3012
+ readonly QUERY_PARSE_SECP256K1_MISSING: 6208;
3013
+ /** Invalid Secp256k1 instruction (parsing) */
3014
+ readonly QUERY_PARSE_INVALID_SECP256K1: 6209;
3015
+ /** Insufficient Guardian signatures (parsing) */
3016
+ readonly QUERY_PARSE_INSUFFICIENT_SIGS: 6210;
3017
+ /** Invalid Guardian signature (parsing) */
3018
+ readonly QUERY_PARSE_INVALID_GUARDIAN_SIG: 6211;
3019
+ /** Chain ID mismatch (parsing) */
3020
+ readonly QUERY_PARSE_CHAIN_ID_MISMATCH: 6212;
3021
+ /** Guardian index out of range */
3022
+ readonly QUERY_PARSE_GUARDIAN_INDEX_OOB: 6213;
3023
+ /** Non-increasing Guardian index */
3024
+ readonly QUERY_PARSE_NON_INCREASING_INDEX: 6214;
3025
+ /** Query signature verification failed (parsing) */
3026
+ readonly QUERY_PARSE_INVALID_SIGNATURE: 6215;
3027
+ /** ABI decoding failed (parsing) */
3028
+ readonly QUERY_PARSE_ABI_FAILED: 6216;
3029
+ };
3030
+ type VeridexErrorCode = (typeof VERIDEX_ERRORS)[keyof typeof VERIDEX_ERRORS];
3031
+ /**
3032
+ * Human-readable error messages for each error code.
3033
+ */
3034
+ declare const ERROR_MESSAGES: Record<VeridexErrorCode, string>;
3035
+ /**
3036
+ * Check if an error code is in the core protocol range.
3037
+ */
3038
+ declare function isCoreError(code: number): boolean;
3039
+ /**
3040
+ * Check if an error code is a query execution error.
3041
+ */
3042
+ declare function isQueryExecutionError(code: number): boolean;
3043
+ /**
3044
+ * Check if an error code is an ABI decoding error.
3045
+ */
3046
+ declare function isAbiError(code: number): boolean;
3047
+ /**
3048
+ * Check if an error code is a query parsing error.
3049
+ */
3050
+ declare function isQueryParsingError(code: number): boolean;
3051
+ /**
3052
+ * Check if an error is related to query operations (execution or parsing).
3053
+ */
3054
+ declare function isQueryError(code: number): boolean;
3055
+ /**
3056
+ * Get the error category as a human-readable string.
3057
+ */
3058
+ declare function getErrorCategory(code: number): string;
3059
+ /**
3060
+ * Get the human-readable message for an error code.
3061
+ */
3062
+ declare function getErrorMessage(code: number): string;
3063
+ /**
3064
+ * Parse an Anchor program error to extract the Veridex error code.
3065
+ *
3066
+ * @param error - The error object from a failed transaction
3067
+ * @returns The error code if found, undefined otherwise
3068
+ */
3069
+ declare function parseVeridexError(error: unknown): VeridexErrorCode | undefined;
3070
+ /**
3071
+ * Check if the error is a retryable error (e.g., expired query can be refreshed).
3072
+ */
3073
+ declare function isRetryableError(code: number): boolean;
3074
+ /**
3075
+ * Suggested user action for common errors.
3076
+ */
3077
+ declare function getSuggestedAction(code: number): string;
3078
+
3079
+ type AuthenticateAndPrepareParams = {
3080
+ credential: PasskeyCredential;
3081
+ action?: TransferParams | ExecuteParams | BridgeParams;
3082
+ /** Pre-encoded Hub action payload (hex string). If provided, `action` is ignored. */
3083
+ actionPayload?: string;
3084
+ targetChain: number;
3085
+ };
3086
+ type AuthenticateAndPrepareResult = {
3087
+ serializedTx: Uint8Array;
3088
+ queryProof: Uint8Array<ArrayBufferLike>;
3089
+ estimatedLatency: number;
3090
+ fallbackAvailable: boolean;
3091
+ };
3092
+ /**
3093
+ * Client-first authentication preparation:
3094
+ * - user signs locally (FaceID/TouchID)
3095
+ * - client queries Wormhole Query Proxy for Guardian-attested nonce/state
3096
+ * - client returns a ready-to-submit relayer payload (JSON bytes)
3097
+ * - falls back to RPC nonce if Queries fails
3098
+ */
3099
+ declare function authenticateAndPrepare(userParams: AuthenticateAndPrepareParams, apiKey: string): Promise<AuthenticateAndPrepareResult>;
3100
+
3101
+ export { ARBITRUM_SEPOLIA_TOKENS, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AuthenticateAndPrepareParams, type AuthenticateAndPrepareResult, AuthorizedKey, BASE_SEPOLIA_TOKENS, BalanceManager, type BalanceManagerConfig, type BridgeDetails, BridgeParams, BridgeResult, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, ChainAddress, type ChainAddressConfig, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, DEFAULT_REFRESH_BUFFER, DEFAULT_SESSION_DURATION, type DailySpendingSummary, DispatchResult, type DurationDisplay, ERROR_MESSAGES, ERROR_RANGES, EVM_ZERO_ADDRESS, type ExecuteDetails, ExecuteParams, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, IdentityState, IndexedDBSessionStorage, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, type MultiChainVaultResult, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PasskeyCredential, PasskeyManager, type PortfolioBalance, PreparedBridge, PreparedTransfer, ReceiveAddress, type RecipientDisplay, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, RelayerClient, type RelayerClientConfig, type RelayerInfo, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SimpleSDKConfig, type SessionConfig as SimpleSessionConfig, type SpendingLimitChangedEvent, type SpendingLimitConfig, type SpendingLimitEventCallback, type SpendingLimits, SpendingLimitsManager, type SpendingLimitsManagerConfig, type SpendingTransaction, type SponsoredVaultResult, type SponsorshipSource, type SubmitActionResult, type SubmitQueryRequest, type SubmitQueryResult, type SubmitSignedActionRequest, TOKEN_REGISTRY, type TokenBalance, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, UnifiedIdentity, VAA, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, VeridexConfig, type VeridexErrorCode, VeridexPayload, VeridexSDK, WalletManager, WalletManagerConfig, authenticateAndPrepare, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainDetector, createGasSponsor, createHubSDK, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getErrorCategory, getErrorMessage, getExplorerUrl, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, parseVeridexError, signWithSessionKey, validateSessionConfig, verifySessionSignature };