@veridex/sdk 1.0.0-beta.22 → 1.0.0-beta.24

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