@veridex/sdk 1.0.0-beta.9 → 1.1.0

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 (132) hide show
  1. package/LICENSE +170 -21
  2. package/README.md +574 -117
  3. package/dist/EVMClient-DtqvdfUP.d.mts +376 -0
  4. package/dist/auth/prepareAuth.d.mts +25 -0
  5. package/dist/auth/prepareAuth.js +2406 -0
  6. package/dist/auth/prepareAuth.js.map +1 -0
  7. package/dist/auth/prepareAuth.mjs +151 -0
  8. package/dist/auth/prepareAuth.mjs.map +1 -0
  9. package/dist/chains/aptos/index.d.mts +6 -5
  10. package/dist/chains/aptos/index.js +66 -39
  11. package/dist/chains/aptos/index.js.map +1 -1
  12. package/dist/chains/aptos/index.mjs +5 -547
  13. package/dist/chains/aptos/index.mjs.map +1 -1
  14. package/dist/chains/avalanche/index.d.mts +137 -0
  15. package/dist/chains/avalanche/index.js +1555 -0
  16. package/dist/chains/avalanche/index.js.map +1 -0
  17. package/dist/chains/avalanche/index.mjs +10 -0
  18. package/dist/chains/avalanche/index.mjs.map +1 -0
  19. package/dist/chains/evm/index.d.mts +5 -3
  20. package/dist/chains/evm/index.js +165 -3
  21. package/dist/chains/evm/index.js.map +1 -1
  22. package/dist/chains/evm/index.mjs +8 -1200
  23. package/dist/chains/evm/index.mjs.map +1 -1
  24. package/dist/chains/solana/index.d.mts +1 -1
  25. package/dist/chains/solana/index.js.map +1 -1
  26. package/dist/chains/solana/index.mjs +4 -486
  27. package/dist/chains/solana/index.mjs.map +1 -1
  28. package/dist/chains/stacks/index.d.mts +559 -0
  29. package/dist/chains/stacks/index.js +1207 -0
  30. package/dist/chains/stacks/index.js.map +1 -0
  31. package/dist/chains/stacks/index.mjs +71 -0
  32. package/dist/chains/stacks/index.mjs.map +1 -0
  33. package/dist/chains/starknet/index.d.mts +4 -5
  34. package/dist/chains/starknet/index.js +1 -13
  35. package/dist/chains/starknet/index.js.map +1 -1
  36. package/dist/chains/starknet/index.mjs +5 -503
  37. package/dist/chains/starknet/index.mjs.map +1 -1
  38. package/dist/chains/sui/index.d.mts +4 -4
  39. package/dist/chains/sui/index.js +2 -2
  40. package/dist/chains/sui/index.js.map +1 -1
  41. package/dist/chains/sui/index.mjs +5 -529
  42. package/dist/chains/sui/index.mjs.map +1 -1
  43. package/dist/chunk-5T6KPH7A.mjs +1082 -0
  44. package/dist/chunk-5T6KPH7A.mjs.map +1 -0
  45. package/dist/chunk-72ZA3OYQ.mjs +20 -0
  46. package/dist/chunk-72ZA3OYQ.mjs.map +1 -0
  47. package/dist/chunk-F3YAGZSW.mjs +269 -0
  48. package/dist/chunk-F3YAGZSW.mjs.map +1 -0
  49. package/dist/chunk-GWJRKDSA.mjs +549 -0
  50. package/dist/chunk-GWJRKDSA.mjs.map +1 -0
  51. package/dist/chunk-M3MM4YMF.mjs +417 -0
  52. package/dist/chunk-M3MM4YMF.mjs.map +1 -0
  53. package/dist/chunk-MLXQHIH2.mjs +426 -0
  54. package/dist/chunk-MLXQHIH2.mjs.map +1 -0
  55. package/dist/chunk-N4A2RMUN.mjs +216 -0
  56. package/dist/chunk-N4A2RMUN.mjs.map +1 -0
  57. package/dist/chunk-NUWSMJFJ.mjs +179 -0
  58. package/dist/chunk-NUWSMJFJ.mjs.map +1 -0
  59. package/dist/chunk-OVMMTL6H.mjs +330 -0
  60. package/dist/chunk-OVMMTL6H.mjs.map +1 -0
  61. package/dist/chunk-PDHZ5X5O.mjs +565 -0
  62. package/dist/chunk-PDHZ5X5O.mjs.map +1 -0
  63. package/dist/chunk-Q5O3M5LP.mjs +422 -0
  64. package/dist/chunk-Q5O3M5LP.mjs.map +1 -0
  65. package/dist/chunk-QDO6NQ7P.mjs +840 -0
  66. package/dist/chunk-QDO6NQ7P.mjs.map +1 -0
  67. package/dist/chunk-QT4ZZ4GM.mjs +509 -0
  68. package/dist/chunk-QT4ZZ4GM.mjs.map +1 -0
  69. package/dist/chunk-SXXGTQIR.mjs +464 -0
  70. package/dist/chunk-SXXGTQIR.mjs.map +1 -0
  71. package/dist/chunk-USDA5JTN.mjs +1249 -0
  72. package/dist/chunk-USDA5JTN.mjs.map +1 -0
  73. package/dist/chunk-V636MIV3.mjs +52 -0
  74. package/dist/chunk-V636MIV3.mjs.map +1 -0
  75. package/dist/chunk-X7BZMSPQ.mjs +407 -0
  76. package/dist/chunk-X7BZMSPQ.mjs.map +1 -0
  77. package/dist/chunk-YCUJZ6Z7.mjs +829 -0
  78. package/dist/chunk-YCUJZ6Z7.mjs.map +1 -0
  79. package/dist/constants.d.mts +1 -1
  80. package/dist/constants.js +26 -12
  81. package/dist/constants.js.map +1 -1
  82. package/dist/constants.mjs +16 -375
  83. package/dist/constants.mjs.map +1 -1
  84. package/dist/index-DDalBhAm.d.mts +243 -0
  85. package/dist/index.d.mts +2511 -556
  86. package/dist/index.js +15216 -10262
  87. package/dist/index.js.map +1 -1
  88. package/dist/index.mjs +4125 -7839
  89. package/dist/index.mjs.map +1 -1
  90. package/dist/passkey.d.mts +182 -0
  91. package/dist/passkey.js +914 -0
  92. package/dist/passkey.js.map +1 -0
  93. package/dist/passkey.mjs +15 -0
  94. package/dist/passkey.mjs.map +1 -0
  95. package/dist/payload.js.map +1 -1
  96. package/dist/payload.mjs +25 -244
  97. package/dist/payload.mjs.map +1 -1
  98. package/dist/portfolio-V347KZOL.mjs +13 -0
  99. package/dist/portfolio-V347KZOL.mjs.map +1 -0
  100. package/dist/queries/index.js +145 -12
  101. package/dist/queries/index.js.map +1 -1
  102. package/dist/queries/index.mjs +14 -1496
  103. package/dist/queries/index.mjs.map +1 -1
  104. package/dist/{types-FJL7j6gQ.d.ts → types-B7V5VNbO.d.mts} +6 -2
  105. package/dist/{types-ChIsqCiw.d.mts → types-DP2CQT8p.d.mts} +12 -1
  106. package/dist/types.d.mts +16 -0
  107. package/dist/types.js.map +1 -1
  108. package/dist/utils.js +25 -11
  109. package/dist/utils.js.map +1 -1
  110. package/dist/utils.mjs +19 -371
  111. package/dist/utils.mjs.map +1 -1
  112. package/dist/wormhole.js.map +1 -1
  113. package/dist/wormhole.mjs +25 -397
  114. package/dist/wormhole.mjs.map +1 -1
  115. package/package.json +28 -3
  116. package/scripts/patch-noble-curves.js +78 -0
  117. package/dist/chains/aptos/index.d.ts +0 -145
  118. package/dist/chains/evm/index.d.ts +0 -5
  119. package/dist/chains/solana/index.d.ts +0 -116
  120. package/dist/chains/starknet/index.d.ts +0 -172
  121. package/dist/chains/sui/index.d.ts +0 -182
  122. package/dist/constants.d.ts +0 -150
  123. package/dist/index-0NXfbk0z.d.ts +0 -637
  124. package/dist/index-D0dLVjTA.d.mts +0 -637
  125. package/dist/index.d.ts +0 -3123
  126. package/dist/payload.d.ts +0 -125
  127. package/dist/queries/index.d.ts +0 -148
  128. package/dist/types-ChIsqCiw.d.ts +0 -565
  129. package/dist/types-FJL7j6gQ.d.mts +0 -172
  130. package/dist/types.d.ts +0 -407
  131. package/dist/utils.d.ts +0 -81
  132. package/dist/wormhole.d.ts +0 -167
package/dist/index.d.mts CHANGED
@@ -1,18 +1,27 @@
1
- import { c as WalletManagerConfig, P as PasskeyCredential, U as UnifiedIdentity, d as ChainAddress, B as BridgeParams, a as ChainConfig, e as VAA, f as VeridexPayload, g as PreparedTransfer, h as PreparedBridge, i as VeridexConfig, C as ChainClient, T as TransferParams, E as ExecuteParams, D as DispatchResult, j as BridgeResult, k as TransferResult, l as ReceiveAddress, m as VaultInfo, V as VaultCreationResult, I as IdentityState, A as AuthorizedKey, n as AddBackupKeyResult, o as RemoveKeyResult } from './types-ChIsqCiw.mjs';
2
- export { u as ActionPayload, r as BridgeAction, t as ConfigAction, p as ConfigParams, y as CrossChainFees, s as ExecuteAction, w as TestResult, x as TransactionHistoryEntry, q as TransferAction, v as VAASignature, W as WebAuthnSignature } from './types-ChIsqCiw.mjs';
3
- import { P as PasskeyManager } from './index-D0dLVjTA.mjs';
4
- export { E as EVMHubClientAdapter, H as HubClient, S as SessionManager } from './index-D0dLVjTA.mjs';
1
+ import { b as WalletManagerConfig, P as PasskeyCredential, U as UnifiedIdentity, c as ChainAddress, B as BridgeParams, a as ChainConfig, d as VAA, e as VeridexPayload, f as PreparedTransfer, g as PreparedBridge, C as ChainClient, W as WebAuthnSignature, T as TransferParams, E as ExecuteParams, D as DispatchResult, h as VeridexConfig, i as BridgeResult, j as TransferResult, R as ReceiveAddress, k as VaultInfo, V as VaultCreationResult, I as IdentityState, A as AuthorizedKey, l as AddBackupKeyResult, m as RemoveKeyResult } from './types-DP2CQT8p.mjs';
2
+ export { s as ActionPayload, p as BridgeAction, r as ConfigAction, n as ConfigParams, w as CrossChainFees, q as ExecuteAction, u as TestResult, v as TransactionHistoryEntry, o as TransferAction, t as VAASignature } from './types-DP2CQT8p.mjs';
3
+ import { PasskeyManager, PasskeyCredential as PasskeyCredential$1, WebAuthnSignature as WebAuthnSignature$1 } from './passkey.mjs';
4
+ export { PasskeyManagerConfig, VERIDEX_RP_ID, detectRpId, supportsRelatedOrigins } from './passkey.mjs';
5
5
  import { ethers } from 'ethers';
6
- import { BridgeParams as BridgeParams$1, ChainConfig as ChainConfig$1 } from './types.mjs';
7
- export { AddGuardianResult, ApproveRecoveryResult, CancelRecoveryResult, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, InitiateRecoveryResult, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RevokeSessionParams, SessionKey, SessionValidationResult, SetupGuardiansResult } from './types.mjs';
8
- import { a as SessionStorage, S as SessionKey } from './types-FJL7j6gQ.mjs';
9
- export { A as ActionParams, b as SessionConfig, i as SessionError, h as SessionErrorCode, e as SessionEvent, f as SessionEventCallback, d as SessionManagerConfig, c as SessionSignature, g as SessionSignedAction } from './types-FJL7j6gQ.mjs';
6
+ import { BridgeParams as BridgeParams$1, ChainConfig as ChainConfig$1, SessionKey } from './types.mjs';
7
+ export { AddGuardianResult, ApproveRecoveryResult, CancelRecoveryResult, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, InitiateRecoveryResult, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RevokeSessionParams, SessionValidationResult, SetupGuardiansResult } from './types.mjs';
8
+ export { E as EVMHubClientAdapter, H as HubClient, S as SessionManager } from './index-DDalBhAm.mjs';
9
+ export { E as EVMClient, a as EVMClientConfig } from './EVMClient-DtqvdfUP.mjs';
10
+ export { SolanaClient, SolanaClientConfig } from './chains/solana/index.mjs';
11
+ export { AptosClient, AptosClientConfig } from './chains/aptos/index.mjs';
12
+ export { SuiClient, SuiClientConfig } from './chains/sui/index.mjs';
13
+ export { StarknetClient, StarknetClientConfig } from './chains/starknet/index.mjs';
14
+ 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.mjs';
15
+ import { S as SessionStorage, a as SessionKey$1 } from './types-B7V5VNbO.mjs';
16
+ 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-B7V5VNbO.mjs';
17
+ export { CONSISTENCY_LEVELS, FetchVAAOptions, GUARDIAN_CONFIG, WaitForSignaturesOptions, emitterToEvmAddress, encodeVAAForSolana, encodeVAAToBytes, evmAddressToBytes32, fetchVAA, fetchVAAByTxHash, fetchVAAByTxHashFallback, getSequenceFromTxReceipt, getWormholeCoreBridge, getWormholeRelayer, getWormholeTokenBridge, hasQuorum, normalizeEmitterAddress, parseVAA, parseVAABytes, parseVeridexPayload, supportsRelayer, validateEmitter, waitForGuardianSignatures } from './wormhole.mjs';
10
18
  export { ACTION_BRIDGE, ACTION_CONFIG, ACTION_EXECUTE, ACTION_TRANSFER, ACTION_TYPES, HUB_ABI, MAINNET_CHAINS, PROTOCOL_VERSION, TESTNET_CHAINS, VAULT_ABI, VAULT_FACTORY_ABI, WORMHOLE_API, WORMHOLE_CHAIN_IDS, WORMHOLE_CHAIN_IDS_FLAT } from './constants.mjs';
11
19
  export { base64URLDecode, base64URLEncode, computeKeyHash, encodeSignatureForSolidity, getAddressExplorerUrl, getChainByEvmId, getChainByWormholeId, getTxExplorerUrl, isEvmChain, isValidBytes32, isValidEvmAddress, isValidWormholeChainId, parseDERSignature, retryWithBackoff } from './utils.mjs';
12
20
  export { buildChallenge, buildGaslessChallenge, createGaslessMessageHash, createMessageHash, decodeActionPayload, decodeBridgeAction, decodeExecuteAction, decodeTransferAction, encodeAptosTransferAction, encodeBridgeAction, encodeConfigAction, encodeExecuteAction, encodeSolanaTransferAction, encodeSuiTransferAction, encodeTransferAction, encodeVeridexPayload, formatAmount, generateNonce, padTo32Bytes, parseAmount, solanaAddressToBytes32, trimTo20Bytes } from './payload.mjs';
13
- export { HubStateQuery, HubStateResult, PortfolioChainErrorCode, PortfolioChainResult, PortfolioQuery, PortfolioResult, QueryConfig, QueryHubStateError, QueryHubStateErrorCode, QueryHubStateNetwork, QueryHubStateOptions, QueryNetwork, QueryOperation, QueryOperationType, QueryPortfolioError, QueryPortfolioErrorCode, QueryPortfolioNetwork, QueryPortfolioOptions, QueryRequest, QueryResponse, WORMHOLE_QUERY_CHAIN_IDS, WORMHOLE_QUERY_PROXY_URLS, WORMHOLE_QUERY_RATE_LIMIT_PER_SECOND, queryHubState, queryPortfolio } from './queries/index.mjs';
14
- export { CONSISTENCY_LEVELS, FetchVAAOptions, GUARDIAN_CONFIG, WaitForSignaturesOptions, emitterToEvmAddress, encodeVAAForSolana, encodeVAAToBytes, evmAddressToBytes32, fetchVAA, fetchVAAByTxHash, fetchVAAByTxHashFallback, getSequenceFromTxReceipt, getWormholeCoreBridge, getWormholeRelayer, getWormholeTokenBridge, hasQuorum, normalizeEmitterAddress, parseVAA, parseVAABytes, parseVeridexPayload, supportsRelayer, validateEmitter, waitForGuardianSignatures } from './wormhole.mjs';
15
- import '@wormhole-foundation/wormhole-query-sdk';
21
+ import '@solana/web3.js';
22
+ import '@aptos-labs/ts-sdk';
23
+ import '@mysten/sui/client';
24
+ import 'starknet';
16
25
 
17
26
  /**
18
27
  * Veridex Protocol SDK - Wallet Manager
@@ -174,6 +183,8 @@ declare const EVM_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
174
183
  declare const BASE_SEPOLIA_TOKENS: ChainTokenList;
175
184
  declare const OPTIMISM_SEPOLIA_TOKENS: ChainTokenList;
176
185
  declare const ARBITRUM_SEPOLIA_TOKENS: ChainTokenList;
186
+ declare const ETHEREUM_SEPOLIA_TOKENS: ChainTokenList;
187
+ declare const MONAD_TESTNET_TOKENS: ChainTokenList;
177
188
  /**
178
189
  * All token lists indexed by Wormhole chain ID
179
190
  */
@@ -1406,199 +1417,1401 @@ declare class SpendingLimitsManager {
1406
1417
  declare function createSpendingLimitsManager(config?: SpendingLimitsManagerConfig): SpendingLimitsManager;
1407
1418
 
1408
1419
  /**
1409
- * Gas Sponsor Module
1420
+ * Veridex Protocol SDK - Chain Presets
1410
1421
  *
1411
- * Handles sponsored (gasless) vault creation for Veridex users.
1412
- * Uses a Veridex-owned wallet to pay gas fees on behalf of users.
1422
+ * Pre-configured chain settings for easy SDK initialization.
1423
+ * Developers only need to specify chain name and network type.
1413
1424
  *
1414
- * This is a temporary solution until the full relayer is built.
1415
- * In the future, this will be handled by:
1416
- * - ERC-4337 Account Abstraction with Paymasters
1417
- * - Dedicated Relayer service
1425
+ * @example
1426
+ * ```typescript
1427
+ * import { createSDK } from '@veridex/sdk';
1428
+ *
1429
+ * // Simple initialization - testnet by default
1430
+ * const sdk = await createSDK('base');
1431
+ *
1432
+ * // Or specify mainnet
1433
+ * const mainnetSdk = await createSDK('base', { network: 'mainnet' });
1434
+ * ```
1418
1435
  */
1419
- interface ChainDeploymentConfig {
1420
- name: string;
1421
- chainId: number;
1422
- wormholeChainId: number;
1423
- rpcUrl: string;
1424
- vaultFactory?: string;
1425
- hubAddress?: string;
1426
- isHub?: boolean;
1427
- }
1428
- interface SponsoredVaultResult {
1429
- success: boolean;
1430
- chain: string;
1431
- wormholeChainId: number;
1432
- vaultAddress?: string;
1433
- transactionHash?: string;
1434
- error?: string;
1435
- alreadyExists?: boolean;
1436
- }
1437
- interface MultiChainVaultResult {
1438
- keyHash: string;
1439
- results: SponsoredVaultResult[];
1440
- allSuccessful: boolean;
1441
- vaultAddresses: Record<number, string>;
1442
- }
1443
- interface GasSponsorConfig {
1444
- /**
1445
- * Private key for the sponsor wallet (from env or secure storage)
1446
- * This is the fallback when relayer is not available
1447
- */
1448
- sponsorPrivateKey?: string;
1449
- /**
1450
- * Integrator-provided sponsor key (for platforms using Veridex SDK)
1451
- * Takes priority over Veridex default sponsorship
1452
- */
1453
- integratorSponsorKey?: string;
1454
- /**
1455
- * Relayer API endpoint for remote sponsorship (primary method)
1456
- * When available, this takes priority over local wallet sponsorship
1457
- */
1458
- relayerUrl?: string;
1459
- /** API key for relayer service authentication */
1460
- relayerApiKey?: string;
1461
- /** @deprecated Use relayerUrl instead */
1462
- sponsorApiUrl?: string;
1463
- /** @deprecated Use relayerApiKey instead */
1464
- sponsorApiKey?: string;
1465
- /** Whether to use testnet configurations */
1466
- testnet?: boolean;
1467
- /** Custom RPC URLs by wormhole chain ID */
1468
- customRpcUrls?: Record<number, string>;
1469
- }
1470
- /** Sponsorship source type */
1471
- type SponsorshipSource = 'relayer' | 'integrator' | 'veridex' | 'none';
1436
+
1472
1437
  /**
1473
- * Gas Sponsorship with layered fallback:
1474
- * 1. Relayer (primary) - Remote relayer service handles gas
1475
- * 2. Integrator wallet - Platform using SDK provides their own sponsor key
1476
- * 3. Veridex wallet (fallback) - Veridex's default sponsor wallet
1438
+ * All supported chain names for easy reference
1477
1439
  */
1478
- declare class GasSponsor {
1479
- private config;
1480
- private sponsorWallet?;
1481
- private integratorWallet?;
1482
- private chains;
1483
- constructor(config?: GasSponsorConfig);
1484
- /**
1485
- * Determine which sponsorship source is available
1486
- * Priority: Relayer > Integrator > Veridex > None
1487
- */
1488
- getSponsorshipSource(): SponsorshipSource;
1489
- /**
1490
- * Get the active sponsor wallet (integrator takes priority)
1491
- */
1492
- private getActiveWallet;
1493
- /**
1494
- * Get supported chains for vault deployment
1495
- */
1496
- getSupportedChains(): ChainDeploymentConfig[];
1497
- /**
1498
- * Get the hub chain configuration
1499
- */
1500
- getHubChain(): ChainDeploymentConfig | undefined;
1501
- /**
1502
- * Check if sponsor is configured (has relayer, integrator key, or Veridex key)
1503
- */
1504
- isConfigured(): boolean;
1505
- /**
1506
- * Get sponsor wallet balance on a specific chain
1507
- */
1508
- getSponsorBalance(wormholeChainId: number): Promise<bigint>;
1509
- /**
1510
- * Check if a vault exists for a given key hash on a chain
1511
- */
1512
- checkVaultExists(keyHash: string, wormholeChainId: number): Promise<{
1513
- exists: boolean;
1514
- address: string;
1515
- }>;
1516
- /**
1517
- * Get predicted vault address for a key hash on a chain
1518
- */
1519
- computeVaultAddress(keyHash: string, wormholeChainId: number): Promise<string | null>;
1520
- /**
1521
- * Create a vault on a specific chain (sponsored)
1522
- *
1523
- * Sponsorship priority:
1524
- * 1. Relayer API (future - not yet implemented)
1525
- * 2. Integrator wallet (if provided)
1526
- * 3. Veridex sponsor wallet (fallback)
1527
- */
1528
- createVaultOnChain(keyHash: string, wormholeChainId: number): Promise<SponsoredVaultResult>;
1529
- /**
1530
- * Create vault via relayer service (future primary method)
1531
- *
1532
- * The relayer handles:
1533
- * - Gas payment on behalf of users
1534
- * - Transaction submission and monitoring
1535
- * - Rate limiting and abuse prevention
1536
- */
1537
- private createVaultViaRelayer;
1538
- /**
1539
- * Create vault with a specific wallet (internal helper)
1540
- */
1541
- private createVaultWithWallet;
1542
- /**
1543
- * Create vaults on all supported chains (sponsored)
1544
- */
1545
- createVaultsOnAllChains(keyHash: string): Promise<MultiChainVaultResult>;
1546
- /**
1547
- * Check vault status on all chains
1548
- */
1549
- checkVaultsOnAllChains(keyHash: string): Promise<Record<number, {
1550
- exists: boolean;
1551
- address: string;
1552
- }>>;
1440
+ declare const CHAIN_NAMES: {
1441
+ readonly BASE: "base";
1442
+ readonly OPTIMISM: "optimism";
1443
+ readonly ARBITRUM: "arbitrum";
1444
+ readonly SCROLL: "scroll";
1445
+ readonly BLAST: "blast";
1446
+ readonly MANTLE: "mantle";
1447
+ readonly ETHEREUM: "ethereum";
1448
+ readonly POLYGON: "polygon";
1449
+ readonly BSC: "bsc";
1450
+ readonly AVALANCHE: "avalanche";
1451
+ readonly FANTOM: "fantom";
1452
+ readonly CELO: "celo";
1453
+ readonly MOONBEAM: "moonbeam";
1454
+ readonly MONAD: "monad";
1455
+ readonly SOLANA: "solana";
1456
+ readonly APTOS: "aptos";
1457
+ readonly SUI: "sui";
1458
+ readonly STARKNET: "starknet";
1459
+ readonly STACKS: "stacks";
1460
+ readonly NEAR: "near";
1461
+ readonly SEI: "sei";
1462
+ };
1463
+ type ChainName = typeof CHAIN_NAMES[keyof typeof CHAIN_NAMES];
1464
+ type NetworkType = 'mainnet' | 'testnet';
1465
+ interface ChainPreset {
1466
+ /** Human-readable chain name */
1467
+ displayName: string;
1468
+ /** Chain type for client selection */
1469
+ type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'stacks' | 'near' | 'cosmos';
1470
+ /** Whether this chain can be a hub */
1471
+ canBeHub: boolean;
1472
+ /** Testnet configuration */
1473
+ testnet: ChainConfig$1;
1474
+ /** Mainnet configuration */
1475
+ mainnet: ChainConfig$1;
1553
1476
  }
1477
+ declare const CHAIN_PRESETS: Record<ChainName, ChainPreset>;
1554
1478
  /**
1555
- * Create a GasSponsor instance
1479
+ * Get chain configuration by name and network
1480
+ */
1481
+ declare function getChainConfig(chain: ChainName, network?: NetworkType): ChainConfig$1;
1482
+ /**
1483
+ * Get chain preset by name
1484
+ */
1485
+ declare function getChainPreset(chain: ChainName): ChainPreset;
1486
+ /**
1487
+ * Get all supported chain names
1488
+ */
1489
+ declare function getSupportedChains(): ChainName[];
1490
+ /**
1491
+ * Get hub-capable chains.
1556
1492
  *
1557
- * @example
1558
- * ```ts
1559
- * // With environment variable
1560
- * const sponsor = createGasSponsor({
1561
- * sponsorPrivateKey: process.env.VERIDEX_SPONSOR_KEY,
1562
- * testnet: true,
1563
- * });
1493
+ * When multi-hub feature flag is disabled, returns only the primary hub chain ('base').
1494
+ * When enabled, returns all chains with canBeHub: true.
1495
+ */
1496
+ declare function getHubChains(): ChainName[];
1497
+ /**
1498
+ * Check if chain is supported
1499
+ */
1500
+ declare function isChainSupported(chain: string): chain is ChainName;
1501
+ /**
1502
+ * Check if a specific chain is currently acting as a hub.
1564
1503
  *
1565
- * // Create vaults for a user
1566
- * const result = await sponsor.createVaultsOnAllChains(userKeyHash);
1567
- * ```
1504
+ * When multi-hub is disabled, only the primary hub ('base') returns true.
1505
+ * When enabled, any chain with canBeHub: true returns true.
1568
1506
  */
1569
- declare function createGasSponsor(config?: GasSponsorConfig): GasSponsor;
1507
+ declare function isHubChain(chain: ChainName): boolean;
1508
+ /**
1509
+ * Get default hub chain.
1510
+ *
1511
+ * Returns the effective primary hub's config. When multi-hub is disabled,
1512
+ * this always returns Base. When enabled, it returns the configured primary hub.
1513
+ */
1514
+ declare function getDefaultHub(network?: NetworkType): ChainConfig$1;
1570
1515
 
1571
- declare class VeridexSDK {
1572
- readonly passkey: PasskeyManager;
1573
- readonly wallet: WalletManager;
1574
- readonly balance: BalanceManager;
1575
- readonly transactions: TransactionTracker;
1576
- readonly crossChain: CrossChainManager;
1577
- readonly sponsor: GasSponsor;
1578
- readonly transactionParser: TransactionParser;
1579
- readonly spendingLimits: SpendingLimitsManager;
1580
- private readonly chain;
1581
- private readonly relayer?;
1582
- private readonly queryApiKey?;
1583
- private readonly testnet;
1584
- private readonly sponsorPrivateKey?;
1585
- private readonly chainRpcUrls?;
1586
- private readonly chainDetector;
1587
- private unifiedIdentity;
1588
- constructor(config: VeridexConfig);
1589
- getChainConfig(): ChainConfig;
1590
- getChainClient(): ChainClient;
1591
- getNonce(): Promise<bigint>;
1592
- getMessageFee(): Promise<bigint>;
1593
- buildTransferPayload(params: TransferParams): Promise<string>;
1594
- buildExecutePayload(params: ExecuteParams): Promise<string>;
1595
- buildBridgePayload(params: BridgeParams): Promise<string>;
1596
- transfer(params: TransferParams, signer: any): Promise<DispatchResult>;
1597
- execute(params: ExecuteParams, signer: any): Promise<DispatchResult>;
1598
- bridge(params: BridgeParams, signer: any): Promise<DispatchResult>;
1599
- /**
1600
- * Prepare a bridge/cross-chain transfer with fee estimation
1601
- *
1516
+ /**
1517
+ * Veridex Protocol SDK - Relayer Client
1518
+ *
1519
+ * Client for interacting with the Veridex relayer service.
1520
+ * The relayer automatically submits VAAs to destination chains.
1521
+ *
1522
+ * Features:
1523
+ * - Submit VAA for relay
1524
+ * - Check relay status
1525
+ * - Get supported routes
1526
+ * - Fee estimation
1527
+ */
1528
+ /**
1529
+ * Relay request status
1530
+ */
1531
+ type RelayStatus = 'pending' | 'processing' | 'submitted' | 'confirmed' | 'failed';
1532
+ /**
1533
+ * Relay request result
1534
+ */
1535
+ interface RelayRequest {
1536
+ /** Unique relay request ID */
1537
+ id: string;
1538
+ /** VAA sequence number */
1539
+ sequence: bigint;
1540
+ /** Source chain Wormhole ID */
1541
+ sourceChain: number;
1542
+ /** Destination chain Wormhole ID */
1543
+ destinationChain: number;
1544
+ /** Relay status */
1545
+ status: RelayStatus;
1546
+ /** Source transaction hash */
1547
+ sourceTxHash: string;
1548
+ /** Destination transaction hash (when completed) */
1549
+ destinationTxHash?: string;
1550
+ /** Timestamp when request was created */
1551
+ createdAt: number;
1552
+ /** Timestamp when request was last updated */
1553
+ updatedAt: number;
1554
+ /** Error message if failed */
1555
+ error?: string;
1556
+ /** Gas used on destination chain */
1557
+ gasUsed?: bigint;
1558
+ /** Fee paid */
1559
+ feePaid?: bigint;
1560
+ }
1561
+ /**
1562
+ * Supported route information
1563
+ */
1564
+ interface RelayRoute {
1565
+ /** Source chain Wormhole ID */
1566
+ sourceChain: number;
1567
+ /** Destination chain Wormhole ID */
1568
+ destinationChain: number;
1569
+ /** Whether the route is active */
1570
+ active: boolean;
1571
+ /** Estimated relay time in seconds */
1572
+ estimatedTimeSeconds: number;
1573
+ /** Base fee in destination chain native token */
1574
+ baseFee: bigint;
1575
+ /** Fee per gas unit */
1576
+ gasPrice: bigint;
1577
+ /** Maximum gas limit */
1578
+ maxGas: bigint;
1579
+ }
1580
+ /**
1581
+ * Relayer service info
1582
+ */
1583
+ interface RelayerInfo {
1584
+ /** Relayer name/identifier */
1585
+ name: string;
1586
+ /** Relayer version */
1587
+ version: string;
1588
+ /** Supported chains */
1589
+ supportedChains: number[];
1590
+ /** Available routes */
1591
+ routes: RelayRoute[];
1592
+ /** Whether the relayer is online */
1593
+ online: boolean;
1594
+ /** Current queue depth */
1595
+ queueDepth: number;
1596
+ }
1597
+ /**
1598
+ * Request body for submitting a signed action to the relayer (gasless)
1599
+ * Uses full WebAuthn data for authenticateAndDispatch
1600
+ */
1601
+ interface SubmitSignedActionRequest {
1602
+ /** WebAuthn authenticatorData (hex) */
1603
+ authenticatorData: string;
1604
+ /** WebAuthn clientDataJSON (raw string) */
1605
+ clientDataJSON: string;
1606
+ /** Index of "challenge":"..." in clientDataJSON */
1607
+ challengeIndex: number;
1608
+ /** Index of "type":"..." in clientDataJSON */
1609
+ typeIndex: number;
1610
+ /** P-256 signature r component (hex) */
1611
+ r: string;
1612
+ /** P-256 signature s component (hex) */
1613
+ s: string;
1614
+ /** P-256 public key X coordinate (hex) */
1615
+ publicKeyX: string;
1616
+ /** P-256 public key Y coordinate (hex) */
1617
+ publicKeyY: string;
1618
+ /** Target chain Wormhole ID */
1619
+ targetChain: number;
1620
+ /** Action payload (hex) */
1621
+ actionPayload: string;
1622
+ /** User nonce */
1623
+ nonce: number;
1624
+ }
1625
+ /**
1626
+ * Response from submitting a signed action
1627
+ */
1628
+ interface SubmitActionResult {
1629
+ /** Whether the submission was successful */
1630
+ success: boolean;
1631
+ /** Transaction hash on Hub chain */
1632
+ txHash?: string;
1633
+ /** Wormhole sequence number */
1634
+ sequence?: string;
1635
+ /** Error message if failed */
1636
+ error?: string;
1637
+ /** Human-readable message */
1638
+ message?: string;
1639
+ }
1640
+ /**
1641
+ * Query submission request (Issue #11/#12)
1642
+ * For optimistic execution via Wormhole Query proofs (~5-7s vs ~120s)
1643
+ */
1644
+ interface SubmitQueryRequest {
1645
+ /** Target spoke chain Wormhole ID */
1646
+ targetChain: number;
1647
+ /** User's key hash */
1648
+ userKeyHash: string;
1649
+ /** Serialized transaction for spoke chain */
1650
+ serializedTx: string;
1651
+ /** Query proof with Guardian signatures */
1652
+ queryProof: {
1653
+ /** Raw query response bytes */
1654
+ queryResponse: string;
1655
+ /** Guardian signatures */
1656
+ signatures: string;
1657
+ };
1658
+ /** Whether to fallback to VAA if Query fails */
1659
+ fallbackToVaa?: boolean;
1660
+ /** Optional metadata */
1661
+ metadata?: {
1662
+ /** User's preferred execution path */
1663
+ preferredPath?: 'query' | 'vaa';
1664
+ /** Transaction value in USD (for routing decisions) */
1665
+ estimatedValueUSD?: number;
1666
+ };
1667
+ }
1668
+ /**
1669
+ * Query submission result (Issue #11/#12)
1670
+ */
1671
+ interface SubmitQueryResult {
1672
+ /** Whether submission succeeded */
1673
+ success: boolean;
1674
+ /** Transaction hash on spoke chain */
1675
+ txHash?: string;
1676
+ /** Execution path used */
1677
+ path: 'query' | 'vaa';
1678
+ /** Latency in milliseconds */
1679
+ latencyMs?: number;
1680
+ /** Error message if failed */
1681
+ error?: string;
1682
+ /** Whether fallback to VAA occurred */
1683
+ fellBack?: boolean;
1684
+ }
1685
+ /**
1686
+ * Fee quote for a relay
1687
+ */
1688
+ interface RelayFeeQuote {
1689
+ /** Source chain Wormhole ID */
1690
+ sourceChain: number;
1691
+ /** Destination chain Wormhole ID */
1692
+ destinationChain: number;
1693
+ /** Estimated fee in source chain native token */
1694
+ feeInSourceToken: bigint;
1695
+ /** Estimated fee in destination chain native token */
1696
+ feeInDestinationToken: bigint;
1697
+ /** Estimated gas on destination */
1698
+ estimatedGas: bigint;
1699
+ /** Quote expiration timestamp */
1700
+ expiresAt: number;
1701
+ /** Quote ID for submission */
1702
+ quoteId: string;
1703
+ }
1704
+ /**
1705
+ * Configuration for RelayerClient
1706
+ */
1707
+ interface RelayerClientConfig {
1708
+ /** Base URL of the relayer service */
1709
+ baseUrl: string;
1710
+ /** API key for authentication (optional) */
1711
+ apiKey?: string;
1712
+ /** Timeout for requests in ms */
1713
+ timeoutMs?: number;
1714
+ /** Max retries for failed requests */
1715
+ maxRetries?: number;
1716
+ }
1717
+ type RegisteredAppStatus = 'active' | 'suspended' | 'revoked';
1718
+ type RegisteredAppTrustLevel = 'verified' | 'registered' | 'pending';
1719
+ interface RegisteredAppSummary {
1720
+ id: string;
1721
+ name: string;
1722
+ origin: string;
1723
+ trustLevel: RegisteredAppTrustLevel;
1724
+ status: RegisteredAppStatus;
1725
+ requestCount: number;
1726
+ createdAt: number;
1727
+ lastUsedAt?: number;
1728
+ }
1729
+ interface RegisteredAppDetail extends RegisteredAppSummary {
1730
+ description?: string;
1731
+ apiKey?: string;
1732
+ activeSessionCount?: number;
1733
+ }
1734
+ interface RelayerAppSession {
1735
+ id: string;
1736
+ keyHash: string;
1737
+ appOrigin: string;
1738
+ sessionPublicKey: string;
1739
+ permissions: string[];
1740
+ expiresAt: number;
1741
+ createdAt: number;
1742
+ revoked: boolean;
1743
+ active: boolean;
1744
+ }
1745
+ interface CredentialMetadataRecord {
1746
+ credentialId: string;
1747
+ keyHash: string;
1748
+ displayName: string;
1749
+ platformHint: string;
1750
+ backupEligible: boolean | null;
1751
+ backupState: boolean | null;
1752
+ isRoot: boolean;
1753
+ status: 'active' | 'revoked';
1754
+ lastUsedAt: number | null;
1755
+ useCount: number;
1756
+ createdAt: number;
1757
+ updatedAt: number;
1758
+ }
1759
+ /**
1760
+ * Client for the Veridex relayer service
1761
+ */
1762
+ declare class RelayerClient {
1763
+ private baseUrl;
1764
+ private config;
1765
+ constructor(config: RelayerClientConfig);
1766
+ /**
1767
+ * Submit a VAA for relay to destination chain
1768
+ */
1769
+ submitRelay(vaaBase64: string, sourceChain: number, destinationChain: number, sourceTxHash: string, sequence: bigint, feeQuoteId?: string): Promise<RelayRequest>;
1770
+ /**
1771
+ * Submit a signed action to the relayer for gasless execution
1772
+ *
1773
+ * This allows users to execute transfers without paying gas themselves.
1774
+ * The relayer will submit the transaction to the Hub chain and pay the gas.
1775
+ * The relayer then automatically relays the VAA to the destination spoke chain.
1776
+ *
1777
+ * @param request - The signed action request with passkey signature
1778
+ * @returns Result including Hub tx hash and Wormhole sequence
1779
+ */
1780
+ submitSignedAction(request: SubmitSignedActionRequest): Promise<SubmitActionResult>;
1781
+ /**
1782
+ * Submit a Query-based transaction for optimistic execution (Issue #11/#12)
1783
+ *
1784
+ * Uses Wormhole Cross-Chain Queries (CCQ) to achieve ~5-7 second latency
1785
+ * vs ~120+ seconds for traditional VAA flow.
1786
+ *
1787
+ * Flow:
1788
+ * 1. Client fetches Hub state via queryHubState() from SDK
1789
+ * 2. Client constructs and signs transaction
1790
+ * 3. Client submits Query proof + tx to this endpoint
1791
+ * 4. Relayer validates format and submits to spoke chain
1792
+ * 5. Spoke chain verifies Guardian signatures on-chain
1793
+ *
1794
+ * @param request - Query submission with Guardian-signed proof
1795
+ * @returns Result including spoke tx hash and execution path
1796
+ */
1797
+ submitQuery(request: SubmitQueryRequest): Promise<SubmitQueryResult>;
1798
+ /**
1799
+ * Get relay request status
1800
+ */
1801
+ getRelayStatus(requestId: string): Promise<RelayRequest>;
1802
+ /**
1803
+ * Get relay status by source transaction hash
1804
+ */
1805
+ getRelayBySourceTx(sourceTxHash: string): Promise<RelayRequest | null>;
1806
+ /**
1807
+ * Get relay status by sequence number
1808
+ */
1809
+ getRelayBySequence(sourceChain: number, sequence: bigint): Promise<RelayRequest | null>;
1810
+ /**
1811
+ * Cancel a pending relay request
1812
+ */
1813
+ cancelRelay(requestId: string): Promise<boolean>;
1814
+ /**
1815
+ * Poll for relay completion
1816
+ */
1817
+ waitForRelay(requestId: string, timeoutMs?: number, pollingIntervalMs?: number, onProgress?: (status: RelayStatus) => void): Promise<RelayRequest>;
1818
+ /**
1819
+ * Get fee quote for a relay
1820
+ */
1821
+ getFeeQuote(sourceChain: number, destinationChain: number, estimatedGas?: bigint): Promise<RelayFeeQuote>;
1822
+ /**
1823
+ * Get relayer service info
1824
+ */
1825
+ getInfo(): Promise<RelayerInfo>;
1826
+ /**
1827
+ * Get supported routes
1828
+ */
1829
+ getRoutes(): Promise<RelayRoute[]>;
1830
+ /**
1831
+ * Check if a route is supported
1832
+ */
1833
+ isRouteSupported(sourceChain: number, destinationChain: number): Promise<boolean>;
1834
+ /**
1835
+ * Check relayer health
1836
+ */
1837
+ healthCheck(): Promise<boolean>;
1838
+ listApps(): Promise<RegisteredAppSummary[]>;
1839
+ getApp(appId: string): Promise<RegisteredAppDetail>;
1840
+ updateAppStatus(appId: string, status: RegisteredAppStatus): Promise<void>;
1841
+ updateAppTrustLevel(appId: string, trustLevel: RegisteredAppTrustLevel): Promise<void>;
1842
+ listAppSessions(appId: string, options?: {
1843
+ includeRevoked?: boolean;
1844
+ }): Promise<RelayerAppSession[]>;
1845
+ revokeAppSessions(appId: string, sessionId?: string): Promise<number>;
1846
+ listCredentialMetadata(keyHash: string): Promise<CredentialMetadataRecord[]>;
1847
+ /**
1848
+ * Get all pending relay requests for a user
1849
+ */
1850
+ getPendingRelays(userKeyHash: string): Promise<RelayRequest[]>;
1851
+ /**
1852
+ * Get relay history for a user
1853
+ */
1854
+ getRelayHistory(userKeyHash: string, limit?: number, offset?: number): Promise<RelayRequest[]>;
1855
+ /**
1856
+ * SDK version for telemetry
1857
+ */
1858
+ private static readonly SDK_VERSION;
1859
+ /**
1860
+ * Make an HTTP request to the relayer
1861
+ */
1862
+ private fetch;
1863
+ /**
1864
+ * Sleep helper
1865
+ */
1866
+ private sleep;
1867
+ }
1868
+ /**
1869
+ * Create a RelayerClient instance
1870
+ */
1871
+ declare function createRelayerClient(config: RelayerClientConfig): RelayerClient;
1872
+
1873
+ type RecoveryStatusResult$1 = {
1874
+ isActive: boolean;
1875
+ newOwnerKeyHash: string;
1876
+ initiatedAt: bigint;
1877
+ approvalCount: bigint;
1878
+ threshold: bigint;
1879
+ canExecuteAt: bigint;
1880
+ expiresAt: bigint;
1881
+ };
1882
+ interface PortabilityOverview {
1883
+ credential: PasskeyCredential$1;
1884
+ unifiedIdentity: UnifiedIdentity;
1885
+ supportedChainIdentity: UnifiedIdentity;
1886
+ localCredentialCount: number;
1887
+ remoteCredentials: CredentialMetadataRecord[];
1888
+ syncedCredentialCount: number;
1889
+ backupEligibleCount: number;
1890
+ backupBackedCount: number;
1891
+ rootCredentialCount: number;
1892
+ supportedChainCount: number;
1893
+ nonEvmAddressCount: number;
1894
+ }
1895
+ interface RecoveryOverview {
1896
+ identityKeyHash: string;
1897
+ guardians: string[];
1898
+ threshold: bigint;
1899
+ isConfigured: boolean;
1900
+ recovery: RecoveryStatusResult$1;
1901
+ }
1902
+ interface AccountManagerConfig {
1903
+ passkey: PasskeyManager;
1904
+ wallet: WalletManager;
1905
+ chain: ChainClient;
1906
+ relayer?: RelayerClient;
1907
+ testnet?: boolean;
1908
+ getUnifiedIdentity: () => Promise<UnifiedIdentity>;
1909
+ }
1910
+ declare class AccountManager {
1911
+ private readonly passkey;
1912
+ private readonly wallet;
1913
+ private readonly chain;
1914
+ private readonly relayer?;
1915
+ private readonly network;
1916
+ private readonly getUnifiedIdentityImpl;
1917
+ constructor(config: AccountManagerConfig);
1918
+ private requireCredential;
1919
+ private requireRelayer;
1920
+ getPortabilityOverview(): Promise<PortabilityOverview>;
1921
+ getSupportedChainIdentity(chainNames?: ChainName[]): Promise<UnifiedIdentity>;
1922
+ getSupportedChainAddresses(chainNames?: ChainName[]): Promise<ChainAddress[]>;
1923
+ listCredentialMetadata(keyHash?: string): Promise<CredentialMetadataRecord[]>;
1924
+ getRecoveryOverview(identityKeyHash?: string): Promise<RecoveryOverview>;
1925
+ getOnchainSessions(identityKeyHash?: string): Promise<SessionKey[]>;
1926
+ listApps(): Promise<RegisteredAppSummary[]>;
1927
+ getApp(appId: string): Promise<RegisteredAppDetail>;
1928
+ updateAppStatus(appId: string, status: RegisteredAppStatus): Promise<void>;
1929
+ updateAppTrustLevel(appId: string, trustLevel: RegisteredAppTrustLevel): Promise<void>;
1930
+ listAppSessions(appId: string, options?: {
1931
+ includeRevoked?: boolean;
1932
+ }): Promise<RelayerAppSession[]>;
1933
+ revokeAppSession(appId: string, sessionId: string): Promise<number>;
1934
+ revokeAllAppSessions(appId: string): Promise<number>;
1935
+ private buildChainAddressConfigMap;
1936
+ }
1937
+
1938
+ /**
1939
+ * Veridex Protocol SDK — Recovery Manager
1940
+ *
1941
+ * Orchestrates the full guardian-based social recovery lifecycle on top of the
1942
+ * low-level EVMClient methods. Provides a high-level, ergonomic API for:
1943
+ *
1944
+ * 1. Guardian configuration (setup / add / remove)
1945
+ * 2. Recovery initiation (initiateRecovery — called from a guardian device)
1946
+ * 3. Approval collection (approveRecovery — each guardian signs)
1947
+ * 4. Execution (executeRecovery — permissionless after threshold + timelock)
1948
+ * 5. Cancellation (cancelRecovery — by the current owner)
1949
+ * 6. Status monitoring (readiness, state, approvals)
1950
+ *
1951
+ * Design rationale
1952
+ * ────────────────
1953
+ * • All mutating operations require a WebAuthn signature and an on-chain signer
1954
+ * (ethers.Signer). The SDK never holds private-key material — ADR-0040.
1955
+ * • The manager delegates on-chain calls to the provided ChainClient, which must
1956
+ * implement {@link RecoveryCapableChainClient}. At runtime this is checked via
1957
+ * duck-typing so non-EVM chains that lack recovery simply throw clearly.
1958
+ * • Cross-chain propagation of recovery results (new-owner VAA) is out of scope
1959
+ * for this manager; it is handled by the relayer once the Hub emits the VAA.
1960
+ *
1961
+ * @module RecoveryManager
1962
+ */
1963
+
1964
+ /**
1965
+ * Subset of ChainClient that supports the guardian / recovery contract surface.
1966
+ * EVMClient satisfies this; non-EVM clients currently do not.
1967
+ */
1968
+ interface RecoveryCapableChainClient extends ChainClient {
1969
+ getGuardians(identityKeyHash: string): Promise<GuardiansResult>;
1970
+ getRecoveryStatus(identityKeyHash: string): Promise<RecoveryStatusResult>;
1971
+ hasGuardianApproved(identityKeyHash: string, guardianKeyHash: string): Promise<boolean>;
1972
+ setupGuardians(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, guardians: string[], threshold: bigint, signer: unknown): Promise<{
1973
+ receipt: unknown;
1974
+ sequence: bigint;
1975
+ }>;
1976
+ addGuardian(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, guardianKeyHash: string, signer: unknown): Promise<{
1977
+ receipt: unknown;
1978
+ sequence: bigint;
1979
+ }>;
1980
+ removeGuardian(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, guardianKeyHash: string, signer: unknown): Promise<{
1981
+ receipt: unknown;
1982
+ sequence: bigint;
1983
+ }>;
1984
+ initiateRecovery(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, identityToRecover: string, newOwnerKeyHash: string, signer: unknown): Promise<{
1985
+ receipt: unknown;
1986
+ sequence: bigint;
1987
+ }>;
1988
+ approveRecovery(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, identityToRecover: string, signer: unknown): Promise<{
1989
+ receipt: unknown;
1990
+ sequence: bigint;
1991
+ }>;
1992
+ executeRecovery(identityToRecover: string, newPublicKeyX: bigint, newPublicKeyY: bigint, signer: unknown): Promise<{
1993
+ receipt: unknown;
1994
+ sequence: bigint;
1995
+ }>;
1996
+ cancelRecovery(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, signer: unknown): Promise<{
1997
+ receipt: unknown;
1998
+ sequence: bigint;
1999
+ }>;
2000
+ }
2001
+ interface GuardiansResult {
2002
+ guardians: string[];
2003
+ threshold: bigint;
2004
+ isConfigured: boolean;
2005
+ }
2006
+ interface RecoveryStatusResult {
2007
+ isActive: boolean;
2008
+ newOwnerKeyHash: string;
2009
+ initiatedAt: bigint;
2010
+ approvalCount: bigint;
2011
+ threshold: bigint;
2012
+ canExecuteAt: bigint;
2013
+ expiresAt: bigint;
2014
+ }
2015
+ interface RecoveryReadiness {
2016
+ /** Whether at least one guardian is configured */
2017
+ guardiansConfigured: boolean;
2018
+ /** Number of guardians */
2019
+ guardianCount: number;
2020
+ /** Required approval count */
2021
+ threshold: bigint;
2022
+ /** Whether a recovery is currently in progress */
2023
+ recoveryInProgress: boolean;
2024
+ /** If in progress, whether it can be executed now */
2025
+ canExecuteNow: boolean;
2026
+ /** If in progress, whether it has expired */
2027
+ isExpired: boolean;
2028
+ /** If in progress, how many more approvals are needed (0 when ready) */
2029
+ approvalsRemaining: number;
2030
+ /** Full recovery status if active */
2031
+ recoveryStatus: RecoveryStatusResult | null;
2032
+ /** List of guardian key hashes */
2033
+ guardians: string[];
2034
+ }
2035
+ interface SetupGuardiansParams {
2036
+ /** WebAuthn assertion for the operation */
2037
+ signature: WebAuthnSignature;
2038
+ /** Guardian key hashes to set */
2039
+ guardians: string[];
2040
+ /** Approval threshold (must be >= 1 and <= guardians.length) */
2041
+ threshold: number;
2042
+ /** Ethers signer to submit the transaction */
2043
+ signer: unknown;
2044
+ }
2045
+ interface AddGuardianParams {
2046
+ signature: WebAuthnSignature;
2047
+ guardianKeyHash: string;
2048
+ signer: unknown;
2049
+ }
2050
+ interface RemoveGuardianParams {
2051
+ signature: WebAuthnSignature;
2052
+ guardianKeyHash: string;
2053
+ signer: unknown;
2054
+ }
2055
+ interface InitiateRecoveryParams {
2056
+ signature: WebAuthnSignature;
2057
+ /** Identity key hash to recover */
2058
+ identityToRecover: string;
2059
+ /** New owner key hash that will replace the old one */
2060
+ newOwnerKeyHash: string;
2061
+ signer: unknown;
2062
+ }
2063
+ interface ApproveRecoveryParams {
2064
+ signature: WebAuthnSignature;
2065
+ identityToRecover: string;
2066
+ signer: unknown;
2067
+ }
2068
+ interface ExecuteRecoveryParams {
2069
+ identityToRecover: string;
2070
+ /** The new owner's P-256 public key X coordinate */
2071
+ newPublicKeyX: bigint;
2072
+ /** The new owner's P-256 public key Y coordinate */
2073
+ newPublicKeyY: bigint;
2074
+ signer: unknown;
2075
+ }
2076
+ interface CancelRecoveryParams {
2077
+ signature: WebAuthnSignature;
2078
+ signer: unknown;
2079
+ }
2080
+ interface RecoveryManagerConfig {
2081
+ passkey: PasskeyManager;
2082
+ chain: ChainClient;
2083
+ }
2084
+ declare class RecoveryManager {
2085
+ private readonly passkey;
2086
+ private readonly chain;
2087
+ constructor(config: RecoveryManagerConfig);
2088
+ /**
2089
+ * Get full recovery readiness — combines guardian config and recovery state
2090
+ * into a single, user-friendly view.
2091
+ */
2092
+ getReadiness(identityKeyHash?: string): Promise<RecoveryReadiness>;
2093
+ /**
2094
+ * Check whether a specific guardian has already approved the active recovery.
2095
+ */
2096
+ hasGuardianApproved(identityKeyHash: string, guardianKeyHash: string): Promise<boolean>;
2097
+ /**
2098
+ * Get the raw guardian configuration for a given identity.
2099
+ */
2100
+ getGuardians(identityKeyHash?: string): Promise<GuardiansResult>;
2101
+ /**
2102
+ * Get the raw recovery status for a given identity.
2103
+ */
2104
+ getRecoveryStatus(identityKeyHash?: string): Promise<RecoveryStatusResult>;
2105
+ /**
2106
+ * Configure the guardian set and approval threshold for the current identity.
2107
+ *
2108
+ * @throws If threshold < 1 or threshold > guardians.length
2109
+ */
2110
+ setupGuardians(params: SetupGuardiansParams): Promise<{
2111
+ sequence: bigint;
2112
+ }>;
2113
+ /**
2114
+ * Add a single guardian to the current identity's guardian set.
2115
+ */
2116
+ addGuardian(params: AddGuardianParams): Promise<{
2117
+ sequence: bigint;
2118
+ }>;
2119
+ /**
2120
+ * Remove a guardian from the current identity's guardian set.
2121
+ */
2122
+ removeGuardian(params: RemoveGuardianParams): Promise<{
2123
+ sequence: bigint;
2124
+ }>;
2125
+ /**
2126
+ * Initiate social recovery — typically called from a guardian's device.
2127
+ *
2128
+ * The caller must be a guardian of the identity being recovered.
2129
+ */
2130
+ initiateRecovery(params: InitiateRecoveryParams): Promise<{
2131
+ sequence: bigint;
2132
+ }>;
2133
+ /**
2134
+ * Approve an in-progress recovery — each guardian calls this once.
2135
+ */
2136
+ approveRecovery(params: ApproveRecoveryParams): Promise<{
2137
+ sequence: bigint;
2138
+ }>;
2139
+ /**
2140
+ * Execute a recovery after threshold + timelock are satisfied.
2141
+ *
2142
+ * This is permissionless — anyone may call it. No WebAuthn signature required.
2143
+ */
2144
+ executeRecovery(params: ExecuteRecoveryParams): Promise<{
2145
+ sequence: bigint;
2146
+ }>;
2147
+ /**
2148
+ * Cancel an in-progress recovery — only the current owner can do this.
2149
+ */
2150
+ cancelRecovery(params: CancelRecoveryParams): Promise<{
2151
+ sequence: bigint;
2152
+ }>;
2153
+ private requireCredential;
2154
+ }
2155
+
2156
+ /**
2157
+ * Veridex Protocol SDK — Multisig Manager (ADR-0037)
2158
+ *
2159
+ * Implements the SDK surface for **threshold multisig transaction authorization**.
2160
+ *
2161
+ * Architecture summary (from ADR-0037):
2162
+ * ─────────────────────────────────────
2163
+ * • A per-identity **TransactionPolicy** on the Hub defines whether threshold
2164
+ * approval is required. When `policy.enabled === true`, direct dispatch of
2165
+ * protected actions (transfer, execute, bridge, config) reverts on-chain.
2166
+ * • Instead, an authorized key **creates a proposal**. Other authorized keys
2167
+ * **approve** it. Once `approvalCount >= threshold`, anyone may **execute** it.
2168
+ * • Sessions are disabled for threshold-governed identities in Phase 1.
2169
+ * • Proposals expire after `proposalTtl`.
2170
+ * • Execution emits a Wormhole VAA wrapping the inner action
2171
+ * (ACTION_EXECUTE_MULTISIG = 14).
2172
+ *
2173
+ * This manager exposes:
2174
+ * 1. Policy configuration & queries
2175
+ * 2. Proposal lifecycle (create / approve / cancel / execute / query)
2176
+ * 3. Convenience proposal creators for transfer, execute, bridge
2177
+ * 4. Policy-aware guard for direct dispatch (`assertDirectDispatchAllowed`)
2178
+ *
2179
+ * @module MultisigManager
2180
+ */
2181
+
2182
+ /** Phase 1 action type bitmask values (ADR-0037 §2) */
2183
+ declare const PROTECTED_ACTION: {
2184
+ readonly TRANSFER: number;
2185
+ readonly EXECUTE: number;
2186
+ readonly BRIDGE: number;
2187
+ readonly CONFIG: number;
2188
+ };
2189
+ /** Default protected-action mask covering all sensitive operations */
2190
+ declare const DEFAULT_PROTECTED_ACTION_MASK: number;
2191
+ /** Default proposal TTL in seconds (24 hours) */
2192
+ declare const DEFAULT_PROPOSAL_TTL = 86400;
2193
+ type ProposalState = 'none' | 'pending' | 'approved' | 'executed' | 'cancelled' | 'expired';
2194
+ /**
2195
+ * Per-identity transaction policy stored on-chain (Hub).
2196
+ */
2197
+ interface MultisigPolicy {
2198
+ enabled: boolean;
2199
+ threshold: number;
2200
+ protectedActionMask: number;
2201
+ proposalTtl: number;
2202
+ disableSessions: boolean;
2203
+ }
2204
+ /**
2205
+ * On-chain transaction proposal.
2206
+ */
2207
+ interface TransactionProposal {
2208
+ proposalId: string;
2209
+ identityKeyHash: string;
2210
+ proposerKeyHash: string;
2211
+ targetChain: number;
2212
+ actionType: number;
2213
+ actionHash: string;
2214
+ actionPayload: string;
2215
+ createdAt: bigint;
2216
+ expiresAt: bigint;
2217
+ approvalCount: number;
2218
+ requiredThreshold: number;
2219
+ state: ProposalState;
2220
+ }
2221
+ /**
2222
+ * Human-readable summary of a proposal's action payload.
2223
+ */
2224
+ interface ProposalActionSummary {
2225
+ type: 'transfer' | 'execute' | 'bridge' | 'config' | 'unknown';
2226
+ description: string;
2227
+ targetChain: number;
2228
+ /** Decoded parameters — shape depends on `type` */
2229
+ params: TransferParams | ExecuteParams | BridgeParams | Record<string, unknown>;
2230
+ }
2231
+ interface CreateProposalResult {
2232
+ proposalId: string;
2233
+ sequence: bigint;
2234
+ summary: ProposalActionSummary;
2235
+ }
2236
+ interface ApproveProposalResult {
2237
+ proposalId: string;
2238
+ approvalCount: number;
2239
+ thresholdReached: boolean;
2240
+ }
2241
+ interface ExecuteProposalResult {
2242
+ proposalId: string;
2243
+ sequence: bigint;
2244
+ dispatch: DispatchResult;
2245
+ }
2246
+ /**
2247
+ * Chain client methods required for threshold multisig.
2248
+ * In Phase 1 these exist only on EVMClient (Hub chain).
2249
+ */
2250
+ interface MultisigCapableChainClient extends ChainClient {
2251
+ configureTransactionPolicy(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, threshold: number, protectedActionMask: number, proposalTtl: number, disableSessions: boolean, signer: unknown): Promise<{
2252
+ receipt: unknown;
2253
+ }>;
2254
+ getTransactionPolicy(identityKeyHash: string): Promise<MultisigPolicy>;
2255
+ createTransactionProposal(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, signer: unknown): Promise<{
2256
+ proposalId: string;
2257
+ receipt: unknown;
2258
+ sequence: bigint;
2259
+ }>;
2260
+ approveTransactionProposal(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, proposalId: string, signer: unknown): Promise<{
2261
+ receipt: unknown;
2262
+ approvalCount: number;
2263
+ thresholdReached: boolean;
2264
+ }>;
2265
+ cancelTransactionProposal(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, proposalId: string, signer: unknown): Promise<{
2266
+ receipt: unknown;
2267
+ }>;
2268
+ executeTransactionProposal(proposalId: string, signer: unknown): Promise<{
2269
+ receipt: unknown;
2270
+ sequence: bigint;
2271
+ }>;
2272
+ getTransactionProposal(proposalId: string): Promise<TransactionProposal>;
2273
+ hasApprovedTransactionProposal(proposalId: string, keyHash: string): Promise<boolean>;
2274
+ }
2275
+ interface MultisigManagerConfig {
2276
+ passkey: PasskeyManager;
2277
+ chain: ChainClient;
2278
+ }
2279
+ interface ConfigurePolicyParams {
2280
+ signature: WebAuthnSignature;
2281
+ threshold: number;
2282
+ protectedActionMask?: number;
2283
+ proposalTtl?: number;
2284
+ disableSessions?: boolean;
2285
+ signer: unknown;
2286
+ }
2287
+ interface CreateProposalParams {
2288
+ signature: WebAuthnSignature;
2289
+ targetChain: number;
2290
+ actionPayload: string;
2291
+ signer: unknown;
2292
+ }
2293
+ interface ApproveProposalParams {
2294
+ signature: WebAuthnSignature;
2295
+ proposalId: string;
2296
+ signer: unknown;
2297
+ }
2298
+ interface CancelProposalParams {
2299
+ signature: WebAuthnSignature;
2300
+ proposalId: string;
2301
+ signer: unknown;
2302
+ }
2303
+ interface ExecuteProposalParams {
2304
+ proposalId: string;
2305
+ signer: unknown;
2306
+ }
2307
+ declare class MultisigManager {
2308
+ private readonly passkey;
2309
+ private readonly chain;
2310
+ constructor(config: MultisigManagerConfig);
2311
+ /**
2312
+ * Query the current transaction policy for the active identity.
2313
+ */
2314
+ getPolicy(identityKeyHash?: string): Promise<MultisigPolicy>;
2315
+ /**
2316
+ * Configure (or update) the transaction policy for the current identity.
2317
+ *
2318
+ * @throws If threshold < 2
2319
+ */
2320
+ configurePolicy(params: ConfigurePolicyParams): Promise<void>;
2321
+ /**
2322
+ * Check whether direct (single-signer) dispatch is allowed for the given
2323
+ * action type under the current policy. Throws a descriptive error when
2324
+ * threshold approval is required instead.
2325
+ *
2326
+ * Call this before `sdk.transfer()` / `sdk.execute()` / `sdk.bridge()`
2327
+ * to fail fast in the SDK rather than reverting on-chain.
2328
+ */
2329
+ assertDirectDispatchAllowed(actionType: 'transfer' | 'execute' | 'bridge' | 'config', identityKeyHash?: string): Promise<void>;
2330
+ /**
2331
+ * Create a new transaction proposal.
2332
+ *
2333
+ * The proposer's signature counts as the first approval automatically.
2334
+ */
2335
+ createProposal(params: CreateProposalParams): Promise<CreateProposalResult>;
2336
+ /**
2337
+ * Approve an existing proposal. Each authorized key may approve once.
2338
+ */
2339
+ approveProposal(params: ApproveProposalParams): Promise<ApproveProposalResult>;
2340
+ /**
2341
+ * Cancel a proposal — only allowed by an authorized key of the identity.
2342
+ */
2343
+ cancelProposal(params: CancelProposalParams): Promise<void>;
2344
+ /**
2345
+ * Execute a proposal after threshold + timelock are satisfied.
2346
+ * Permissionless — anyone may call.
2347
+ */
2348
+ executeProposal(params: ExecuteProposalParams): Promise<ExecuteProposalResult>;
2349
+ /**
2350
+ * Retrieve a proposal by ID.
2351
+ */
2352
+ getProposal(proposalId: string): Promise<TransactionProposal>;
2353
+ /**
2354
+ * Check whether a specific key has approved a given proposal.
2355
+ */
2356
+ hasApproved(proposalId: string, keyHash?: string): Promise<boolean>;
2357
+ /**
2358
+ * Convenience: check if a proposal is ready for execution.
2359
+ */
2360
+ isProposalExecutable(proposalId: string): Promise<boolean>;
2361
+ private requireCredential;
2362
+ }
2363
+
2364
+ /**
2365
+ * Veridex Protocol SDK — Launch Gate & Policy Enforcement (ADR-0040)
2366
+ *
2367
+ * Runtime validation layer that enforces the product boundaries defined in
2368
+ * ADR-0040 across the SDK surface. Every SDK operation that touches
2369
+ * credentials, sessions, or dispatch is funnelled through this module's
2370
+ * `validate*` helpers to catch violations early with clear developer errors.
2371
+ *
2372
+ * Non-negotiables enforced here:
2373
+ *
2374
+ * 1. Passkeys are non-extractable. No API may expose private-key material.
2375
+ * 2. Self-custody is preserved. The SDK never constructs or transmits
2376
+ * private keys.
2377
+ * 3. Cross-site passkey reuse is scoped to the Veridex RP federation model.
2378
+ * 4. Cross-ecosystem portability requires explicit credential registration.
2379
+ * 5. MetaMask interop is limited to smart-account / injected-wallet flows.
2380
+ * 6. Chain parity claims require real cryptographic verification.
2381
+ *
2382
+ * Additionally this module exposes a lightweight **CapabilityMatrix** that
2383
+ * integrators can use to understand what is available on a given platform,
2384
+ * browser, and chain combination — preventing false assumptions at the UI
2385
+ * level.
2386
+ *
2387
+ * @module PolicyEnforcement
2388
+ */
2389
+ /**
2390
+ * Capability tiers per chain type — used to gate SDK features at runtime.
2391
+ */
2392
+ type ChainCapabilityTier = 'full' | 'partial' | 'unsupported';
2393
+ interface ChainCapabilities {
2394
+ /** WebAuthn P-256 verification on-chain */
2395
+ passkeyVerification: ChainCapabilityTier;
2396
+ /** On-chain session key registration and validation */
2397
+ sessionKeys: ChainCapabilityTier;
2398
+ /** Guardian recovery initiation, approval, execution */
2399
+ recovery: ChainCapabilityTier;
2400
+ /** Threshold multisig (ADR-0037) */
2401
+ multisig: ChainCapabilityTier;
2402
+ /** Cross-chain VAA reception (Wormhole spoke) */
2403
+ crossChainReceive: ChainCapabilityTier;
2404
+ }
2405
+ /**
2406
+ * Canonical capability definitions per chain type.
2407
+ * These are validated before claiming "supported" status.
2408
+ */
2409
+ declare const CHAIN_CAPABILITIES: Record<string, ChainCapabilities>;
2410
+ /**
2411
+ * Prevent any code path that would attempt to export or derive private keys
2412
+ * from passkey material (ADR-0040, Non-Negotiable #1).
2413
+ */
2414
+ declare function validateNoKeyExtraction(operation: string): void;
2415
+ /**
2416
+ * Validate that a chain has real (not placeholder) support for a capability
2417
+ * before claiming it is available (ADR-0040, Non-Negotiable #6).
2418
+ */
2419
+ declare function validateChainCapability(chainType: string, capability: keyof ChainCapabilities, operation: string): void;
2420
+ /**
2421
+ * Validate that MetaMask interop claims are limited to the smart-account
2422
+ * execution path (ADR-0040, Non-Negotiable #5).
2423
+ */
2424
+ declare function validateMetaMaskInteropClaim(interopType: string): void;
2425
+ /**
2426
+ * Validate that session creation is allowed for the given identity's
2427
+ * multisig policy state (ADR-0037 §9).
2428
+ */
2429
+ declare function validateSessionCreationPolicy(policyEnabled: boolean, sessionsDisabled: boolean): void;
2430
+ /**
2431
+ * Validate that cross-site passkey reuse is within the Veridex federation
2432
+ * model (ADR-0040, Non-Negotiable #3).
2433
+ */
2434
+ declare function validateFederatedOrigin(rpId: string, allowedRpIds?: string[]): void;
2435
+ interface PlatformCapabilityMatrix {
2436
+ /** Whether passkeys (WebAuthn) are supported on this platform */
2437
+ webauthnSupported: boolean;
2438
+ /** Whether conditional UI (autofill) is available */
2439
+ conditionalUISupported: boolean;
2440
+ /** Whether platform authenticators are available (Touch ID, Face ID, etc.) */
2441
+ platformAuthenticatorAvailable: boolean;
2442
+ /** Chain-specific capabilities */
2443
+ chainCapabilities: ChainCapabilities;
2444
+ /** Feature set available for the current configuration */
2445
+ features: {
2446
+ passkeyAuth: boolean;
2447
+ sessionKeys: boolean;
2448
+ socialRecovery: boolean;
2449
+ thresholdMultisig: boolean;
2450
+ crossChainBridge: boolean;
2451
+ injectedWalletInterop: boolean;
2452
+ gaslessTransactions: boolean;
2453
+ };
2454
+ }
2455
+ /**
2456
+ * Build a capability matrix for the current platform and chain configuration.
2457
+ * Used by integrator UIs to show/hide features appropriately.
2458
+ */
2459
+ declare function buildCapabilityMatrix(chainType: string, platformInfo: {
2460
+ webauthnSupported: boolean;
2461
+ conditionalUISupported: boolean;
2462
+ platformAuthenticatorAvailable: boolean;
2463
+ }, hasRelayer: boolean): PlatformCapabilityMatrix;
2464
+ type PolicyViolationCode = 'NON_EXTRACTABLE_CREDENTIAL' | 'UNKNOWN_CHAIN_TYPE' | 'UNSUPPORTED_CAPABILITY' | 'UNSUPPORTED_METAMASK_INTEROP' | 'SESSIONS_DISABLED_BY_POLICY' | 'UNFEDERATED_ORIGIN';
2465
+ declare class PolicyViolationError extends Error {
2466
+ readonly code: PolicyViolationCode;
2467
+ constructor(message: string, code: PolicyViolationCode);
2468
+ }
2469
+
2470
+ /**
2471
+ * Veridex Protocol SDK — Balance Watcher
2472
+ *
2473
+ * Provides a polling-based subscription API for vault balance changes.
2474
+ * Returns an unsubscribe function so integrators can react to incoming
2475
+ * transfers, outgoing withdrawals, or spending limit resets without
2476
+ * manually implementing polling.
2477
+ *
2478
+ * Where chains expose WebSocket endpoints in the future, this module
2479
+ * can be extended to use push-based notifications without changing the
2480
+ * public API surface.
2481
+ */
2482
+
2483
+ /** Event types emitted by the balance watcher */
2484
+ type BalanceEventType = 'balanceChange' | 'error';
2485
+ /** Callback signature for balance change events */
2486
+ type BalanceChangeCallback = (event: BalanceChangeEvent) => void;
2487
+ /** Callback signature for error events */
2488
+ type BalanceErrorCallback = (error: Error) => void;
2489
+ /** A balance change event delivered to subscribers */
2490
+ interface BalanceChangeEvent {
2491
+ /** Wormhole chain ID */
2492
+ wormholeChainId: number;
2493
+ /** Vault address */
2494
+ address: string;
2495
+ /** Updated portfolio snapshot */
2496
+ portfolio: PortfolioBalance;
2497
+ /** Individual tokens whose balance changed since last poll */
2498
+ changes: TokenBalanceChange[];
2499
+ /** Timestamp of this poll */
2500
+ timestamp: number;
2501
+ }
2502
+ /** Describes a single token balance that changed */
2503
+ interface TokenBalanceChange {
2504
+ token: TokenBalance['token'];
2505
+ previousBalance: bigint;
2506
+ currentBalance: bigint;
2507
+ /** Positive = received, negative = sent/withdrawn */
2508
+ delta: bigint;
2509
+ }
2510
+ /** Options for the watcher */
2511
+ interface BalanceWatcherOptions {
2512
+ /** Poll interval in milliseconds (default: 15_000 — 15 seconds) */
2513
+ intervalMs?: number;
2514
+ /** Minimum interval allowed (floor, to protect against aggressive polling) */
2515
+ minIntervalMs?: number;
2516
+ /** Whether to emit an initial event immediately with current balances */
2517
+ emitInitial?: boolean;
2518
+ }
2519
+ /** Function to stop watching */
2520
+ type Unsubscribe = () => void;
2521
+ /**
2522
+ * Watch vault balances for changes via periodic polling.
2523
+ *
2524
+ * @example
2525
+ * ```typescript
2526
+ * const watcher = new BalanceWatcher(fetchBalance);
2527
+ *
2528
+ * const unsub = watcher.watch(
2529
+ * 10004, '0xVaultAddr',
2530
+ * (event) => {
2531
+ * for (const c of event.changes) {
2532
+ * console.log(`${c.token.symbol}: ${c.delta > 0n ? '+' : ''}${c.delta}`);
2533
+ * }
2534
+ * },
2535
+ * { intervalMs: 10_000 }
2536
+ * );
2537
+ *
2538
+ * // Later:
2539
+ * unsub();
2540
+ * ```
2541
+ */
2542
+ declare class BalanceWatcher {
2543
+ private readonly fetchBalance;
2544
+ private subscriptions;
2545
+ /**
2546
+ * @param fetchBalance - Function that fetches the current portfolio balance.
2547
+ * Typically bound to `BalanceManager.getPortfolioBalance` or the SDK's
2548
+ * `getVaultBalances()`.
2549
+ */
2550
+ constructor(fetchBalance: (wormholeChainId: number, address: string) => Promise<PortfolioBalance>);
2551
+ /**
2552
+ * Start watching a vault's balances.
2553
+ *
2554
+ * @returns An unsubscribe function that stops polling.
2555
+ */
2556
+ watch(wormholeChainId: number, address: string, onChange: BalanceChangeCallback, options?: BalanceWatcherOptions, onError?: BalanceErrorCallback): Unsubscribe;
2557
+ /**
2558
+ * Stop all watchers.
2559
+ */
2560
+ stopAll(): void;
2561
+ /**
2562
+ * Get the number of active subscriptions.
2563
+ */
2564
+ get activeCount(): number;
2565
+ private removeCallback;
2566
+ private diffBalances;
2567
+ }
2568
+
2569
+ /**
2570
+ * Gas Sponsor Module
2571
+ *
2572
+ * Handles sponsored (gasless) vault creation for Veridex users.
2573
+ * Uses a Veridex-owned wallet to pay gas fees on behalf of users.
2574
+ *
2575
+ * This is a temporary solution until the full relayer is built.
2576
+ * In the future, this will be handled by:
2577
+ * - ERC-4337 Account Abstraction with Paymasters
2578
+ * - Dedicated Relayer service
2579
+ */
2580
+ interface ChainDeploymentConfig {
2581
+ name: string;
2582
+ chainId: number;
2583
+ wormholeChainId: number;
2584
+ rpcUrl: string;
2585
+ vaultFactory?: string;
2586
+ hubAddress?: string;
2587
+ isHub?: boolean;
2588
+ }
2589
+ interface SponsoredVaultResult {
2590
+ success: boolean;
2591
+ chain: string;
2592
+ wormholeChainId: number;
2593
+ vaultAddress?: string;
2594
+ transactionHash?: string;
2595
+ error?: string;
2596
+ alreadyExists?: boolean;
2597
+ }
2598
+ interface MultiChainVaultResult {
2599
+ keyHash: string;
2600
+ results: SponsoredVaultResult[];
2601
+ allSuccessful: boolean;
2602
+ vaultAddresses: Record<number, string>;
2603
+ }
2604
+ interface GasSponsorConfig {
2605
+ /**
2606
+ * Private key for the sponsor wallet (from env or secure storage)
2607
+ * This is the fallback when relayer is not available
2608
+ */
2609
+ sponsorPrivateKey?: string;
2610
+ /**
2611
+ * Integrator-provided sponsor key (for platforms using Veridex SDK)
2612
+ * Takes priority over Veridex default sponsorship
2613
+ */
2614
+ integratorSponsorKey?: string;
2615
+ /**
2616
+ * Relayer API endpoint for remote sponsorship (primary method)
2617
+ * When available, this takes priority over local wallet sponsorship
2618
+ */
2619
+ relayerUrl?: string;
2620
+ /** API key for relayer service authentication */
2621
+ relayerApiKey?: string;
2622
+ /** @deprecated Use relayerUrl instead */
2623
+ sponsorApiUrl?: string;
2624
+ /** @deprecated Use relayerApiKey instead */
2625
+ sponsorApiKey?: string;
2626
+ /** Whether to use testnet configurations */
2627
+ testnet?: boolean;
2628
+ /** Custom RPC URLs by wormhole chain ID */
2629
+ customRpcUrls?: Record<number, string>;
2630
+ }
2631
+ /** Sponsorship source type */
2632
+ type SponsorshipSource = 'relayer' | 'integrator' | 'veridex' | 'none';
2633
+ /**
2634
+ * Gas Sponsorship with layered fallback:
2635
+ * 1. Relayer (primary) - Remote relayer service handles gas
2636
+ * 2. Integrator wallet - Platform using SDK provides their own sponsor key
2637
+ * 3. Veridex wallet (fallback) - Veridex's default sponsor wallet
2638
+ */
2639
+ declare class GasSponsor {
2640
+ private config;
2641
+ private sponsorWallet?;
2642
+ private integratorWallet?;
2643
+ private chains;
2644
+ constructor(config?: GasSponsorConfig);
2645
+ /**
2646
+ * Determine which sponsorship source is available
2647
+ * Priority: Relayer > Integrator > Veridex > None
2648
+ */
2649
+ getSponsorshipSource(): SponsorshipSource;
2650
+ /**
2651
+ * Get the active sponsor wallet (integrator takes priority)
2652
+ */
2653
+ private getActiveWallet;
2654
+ /**
2655
+ * Get supported chains for vault deployment
2656
+ */
2657
+ getSupportedChains(): ChainDeploymentConfig[];
2658
+ /**
2659
+ * Get the hub chain configuration
2660
+ */
2661
+ getHubChain(): ChainDeploymentConfig | undefined;
2662
+ /**
2663
+ * Check if sponsor is configured (has relayer, integrator key, or Veridex key)
2664
+ */
2665
+ isConfigured(): boolean;
2666
+ /**
2667
+ * Get sponsor wallet balance on a specific chain
2668
+ */
2669
+ getSponsorBalance(wormholeChainId: number): Promise<bigint>;
2670
+ /**
2671
+ * Check if a vault exists for a given key hash on a chain
2672
+ */
2673
+ checkVaultExists(keyHash: string, wormholeChainId: number): Promise<{
2674
+ exists: boolean;
2675
+ address: string;
2676
+ }>;
2677
+ /**
2678
+ * Get predicted vault address for a key hash on a chain
2679
+ */
2680
+ computeVaultAddress(keyHash: string, wormholeChainId: number): Promise<string | null>;
2681
+ /**
2682
+ * Create a vault on a specific chain (sponsored)
2683
+ *
2684
+ * Sponsorship priority:
2685
+ * 1. Relayer API (future - not yet implemented)
2686
+ * 2. Integrator wallet (if provided)
2687
+ * 3. Veridex sponsor wallet (fallback)
2688
+ */
2689
+ createVaultOnChain(keyHash: string, wormholeChainId: number): Promise<SponsoredVaultResult>;
2690
+ /**
2691
+ * Create vault via relayer service (future primary method)
2692
+ *
2693
+ * The relayer handles:
2694
+ * - Gas payment on behalf of users
2695
+ * - Transaction submission and monitoring
2696
+ * - Rate limiting and abuse prevention
2697
+ */
2698
+ private createVaultViaRelayer;
2699
+ /**
2700
+ * Create vault with a specific wallet (internal helper)
2701
+ */
2702
+ private createVaultWithWallet;
2703
+ /**
2704
+ * Create vaults on all supported chains (sponsored)
2705
+ */
2706
+ createVaultsOnAllChains(keyHash: string): Promise<MultiChainVaultResult>;
2707
+ /**
2708
+ * Check vault status on all chains
2709
+ */
2710
+ checkVaultsOnAllChains(keyHash: string): Promise<Record<number, {
2711
+ exists: boolean;
2712
+ address: string;
2713
+ }>>;
2714
+ }
2715
+ /**
2716
+ * Create a GasSponsor instance
2717
+ *
2718
+ * @example
2719
+ * ```ts
2720
+ * // With environment variable
2721
+ * const sponsor = createGasSponsor({
2722
+ * sponsorPrivateKey: process.env.VERIDEX_SPONSOR_KEY,
2723
+ * testnet: true,
2724
+ * });
2725
+ *
2726
+ * // Create vaults for a user
2727
+ * const result = await sponsor.createVaultsOnAllChains(userKeyHash);
2728
+ * ```
2729
+ */
2730
+ declare function createGasSponsor(config?: GasSponsorConfig): GasSponsor;
2731
+
2732
+ declare class VeridexSDK {
2733
+ readonly passkey: PasskeyManager;
2734
+ readonly wallet: WalletManager;
2735
+ readonly account: AccountManager;
2736
+ readonly balance: BalanceManager;
2737
+ readonly transactions: TransactionTracker;
2738
+ readonly crossChain: CrossChainManager;
2739
+ readonly sponsor: GasSponsor;
2740
+ readonly transactionParser: TransactionParser;
2741
+ readonly spendingLimits: SpendingLimitsManager;
2742
+ readonly recovery: RecoveryManager | null;
2743
+ readonly multisig: MultisigManager | null;
2744
+ readonly balanceWatcher: BalanceWatcher;
2745
+ private readonly chain;
2746
+ private readonly relayer?;
2747
+ private readonly queryApiKey?;
2748
+ private readonly testnet;
2749
+ private readonly sponsorPrivateKey?;
2750
+ private readonly chainRpcUrls?;
2751
+ private readonly chainDetector;
2752
+ private readonly preparedTransferTtl;
2753
+ private unifiedIdentity;
2754
+ constructor(config: VeridexConfig);
2755
+ getChainConfig(): ChainConfig;
2756
+ getChainClient(): ChainClient;
2757
+ /**
2758
+ * Returns a capability matrix for the current chain, useful for integrator
2759
+ * UIs to understand what operations the platform supports.
2760
+ */
2761
+ getCapabilityMatrix(platformInfo?: {
2762
+ webauthnSupported: boolean;
2763
+ conditionalUISupported: boolean;
2764
+ platformAuthenticatorAvailable: boolean;
2765
+ }): PlatformCapabilityMatrix;
2766
+ /**
2767
+ * Check if a specific feature is supported on the current chain.
2768
+ *
2769
+ * Unlike `getCapabilityMatrix()` which returns the full matrix, this is a
2770
+ * simple boolean check for the most common per-chain capability queries.
2771
+ *
2772
+ * @param feature - Feature name to check
2773
+ * @returns `true` if fully or partially supported; `false` if unsupported
2774
+ *
2775
+ * @example
2776
+ * ```typescript
2777
+ * if (sdk.supportsFeature('recovery')) {
2778
+ * // Show recovery UI
2779
+ * }
2780
+ * ```
2781
+ */
2782
+ supportsFeature(feature: keyof ChainCapabilities): boolean;
2783
+ /**
2784
+ * Resolve a chain name to its CHAIN_CAPABILITIES key.
2785
+ */
2786
+ private resolveChainType;
2787
+ /**
2788
+ * Watch for balance changes on a vault.
2789
+ *
2790
+ * Uses polling under the hood; the returned function stops the watcher.
2791
+ *
2792
+ * @example
2793
+ * ```typescript
2794
+ * const unsub = sdk.watchBalance(
2795
+ * (event) => console.log('Balance changed:', event.changes),
2796
+ * { intervalMs: 10_000 },
2797
+ * );
2798
+ *
2799
+ * // later
2800
+ * unsub();
2801
+ * ```
2802
+ */
2803
+ watchBalance(onChange: BalanceChangeCallback, options?: BalanceWatcherOptions, onError?: BalanceErrorCallback): Unsubscribe;
2804
+ getNonce(): Promise<bigint>;
2805
+ getMessageFee(): Promise<bigint>;
2806
+ buildTransferPayload(params: TransferParams): Promise<string>;
2807
+ buildExecutePayload(params: ExecuteParams): Promise<string>;
2808
+ buildBridgePayload(params: BridgeParams): Promise<string>;
2809
+ transfer(params: TransferParams, signer: any): Promise<DispatchResult>;
2810
+ execute(params: ExecuteParams, signer: any): Promise<DispatchResult>;
2811
+ bridge(params: BridgeParams, signer: any): Promise<DispatchResult>;
2812
+ /**
2813
+ * Prepare a bridge/cross-chain transfer with fee estimation
2814
+ *
1602
2815
  * @param params - Bridge parameters
1603
2816
  * @returns PreparedBridge with fee estimates
1604
2817
  */
@@ -1842,6 +3055,38 @@ declare class VeridexSDK {
1842
3055
  * Get token by symbol
1843
3056
  */
1844
3057
  getTokenBySymbol(symbol: string, wormholeChainId?: number): TokenInfo$1 | null;
3058
+ /**
3059
+ * Get vault addresses across all supported chains at once.
3060
+ *
3061
+ * Unlike calling `getVaultAddressForChain()` in a loop, this returns a
3062
+ * structured map that frontends can render directly.
3063
+ *
3064
+ * @example
3065
+ * ```typescript
3066
+ * const addresses = sdk.getMultiChainAddresses();
3067
+ * for (const [chainId, addr] of Object.entries(addresses)) {
3068
+ * console.log(`Chain ${chainId}: ${addr}`);
3069
+ * }
3070
+ * ```
3071
+ */
3072
+ getMultiChainAddresses(): Record<number, string>;
3073
+ /**
3074
+ * Get a combined portfolio view across multiple chains.
3075
+ *
3076
+ * Returns vault address + balances per chain, suitable for a dashboard or
3077
+ * portfolio summary screen.
3078
+ *
3079
+ * @example
3080
+ * ```typescript
3081
+ * const portfolio = await sdk.getMultiChainPortfolio();
3082
+ * for (const entry of portfolio) {
3083
+ * console.log(`${entry.chainName}: ${entry.tokens.length} tokens`);
3084
+ * }
3085
+ * ```
3086
+ *
3087
+ * @param chainIds - Optional array of Wormhole chain IDs. Defaults to all sponsored chains.
3088
+ */
3089
+ getMultiChainPortfolio(chainIds?: number[]): Promise<PortfolioBalance[]>;
1845
3090
  /**
1846
3091
  * Get receive address information for sharing
1847
3092
  * Use this to generate QR codes or share your vault address
@@ -2072,86 +3317,108 @@ declare class VeridexSDK {
2072
3317
  }
2073
3318
 
2074
3319
  /**
2075
- * Veridex Protocol SDK - Chain Presets
3320
+ * Veridex Protocol SDK - Feature Flags
2076
3321
  *
2077
- * Pre-configured chain settings for easy SDK initialization.
2078
- * Developers only need to specify chain name and network type.
3322
+ * Centralized feature flag management for toggling SDK capabilities.
3323
+ * These flags allow operators to enable/disable features at runtime,
3324
+ * which is critical for:
3325
+ * - Hackathon demos (Avalanche Build Games: single hub for simplicity)
3326
+ * - Enterprise deployments (controlled rollout of multi-hub)
3327
+ * - Compliance (restrict routing to audited chains only)
3328
+ *
3329
+ * ## Multi-Hub Feature
3330
+ *
3331
+ * When `multiHub` is **disabled** (default):
3332
+ * - Only the primary hub chain (Base) is used for identity and session management
3333
+ * - `getHubChains()` returns only `['base']`
3334
+ * - `getDefaultHub()` returns Base config
3335
+ * - Avalanche operates as a spoke chain (payments only, identity on Base)
3336
+ *
3337
+ * When `multiHub` is **enabled**:
3338
+ * - All chains marked `canBeHub: true` are available as hubs
3339
+ * - `getHubChains()` returns all hub-capable chains
3340
+ * - `getDefaultHub()` can be overridden to point at any hub chain
3341
+ * - Avalanche can operate as a secondary hub with its own identity registry
3342
+ *
3343
+ * ## Enterprise Risk Alignment
3344
+ *
3345
+ * Feature flags enable the "Enterprise Trust Firewall" narrative:
3346
+ * - Single hub = single source of truth = simpler audit trail
3347
+ * - Multi-hub = horizontal scaling for enterprise multi-region deployments
3348
+ * - Trace logging integration points are hub-aware
2079
3349
  *
2080
3350
  * @example
2081
3351
  * ```typescript
2082
- * import { createSDK } from '@veridex/sdk';
3352
+ * import { setFeatureFlags, getFeatureFlags } from '@veridex/sdk';
2083
3353
  *
2084
- * // Simple initialization - testnet by default
2085
- * const sdk = await createSDK('base');
3354
+ * // Disable multi-hub (default for hackathon demos)
3355
+ * setFeatureFlags({ multiHub: false });
2086
3356
  *
2087
- * // Or specify mainnet
2088
- * const mainnetSdk = await createSDK('base', { network: 'mainnet' });
3357
+ * // Enable multi-hub for enterprise deployment
3358
+ * setFeatureFlags({ multiHub: true });
3359
+ *
3360
+ * // Check current flags
3361
+ * const flags = getFeatureFlags();
3362
+ * console.log(flags.multiHub); // false
2089
3363
  * ```
2090
3364
  */
2091
3365
 
2092
- /**
2093
- * All supported chain names for easy reference
2094
- */
2095
- declare const CHAIN_NAMES: {
2096
- readonly BASE: "base";
2097
- readonly OPTIMISM: "optimism";
2098
- readonly ARBITRUM: "arbitrum";
2099
- readonly SCROLL: "scroll";
2100
- readonly BLAST: "blast";
2101
- readonly MANTLE: "mantle";
2102
- readonly ETHEREUM: "ethereum";
2103
- readonly POLYGON: "polygon";
2104
- readonly BSC: "bsc";
2105
- readonly AVALANCHE: "avalanche";
2106
- readonly FANTOM: "fantom";
2107
- readonly CELO: "celo";
2108
- readonly MOONBEAM: "moonbeam";
2109
- readonly SOLANA: "solana";
2110
- readonly APTOS: "aptos";
2111
- readonly SUI: "sui";
2112
- readonly STARKNET: "starknet";
2113
- readonly NEAR: "near";
2114
- readonly SEI: "sei";
2115
- };
2116
- type ChainName = typeof CHAIN_NAMES[keyof typeof CHAIN_NAMES];
2117
- type NetworkType = 'mainnet' | 'testnet';
2118
- interface ChainPreset {
2119
- /** Human-readable chain name */
2120
- displayName: string;
2121
- /** Chain type for client selection */
2122
- type: 'evm' | 'solana' | 'aptos' | 'sui' | 'starknet' | 'near' | 'cosmos';
2123
- /** Whether this chain can be a hub */
2124
- canBeHub: boolean;
2125
- /** Testnet configuration */
2126
- testnet: ChainConfig$1;
2127
- /** Mainnet configuration */
2128
- mainnet: ChainConfig$1;
3366
+ interface FeatureFlags {
3367
+ /**
3368
+ * Enable multi-hub architecture.
3369
+ *
3370
+ * When false (default), only 'base' is treated as a hub chain.
3371
+ * When true, all chains with `canBeHub: true` in presets are available.
3372
+ *
3373
+ * @default false
3374
+ */
3375
+ multiHub: boolean;
3376
+ /**
3377
+ * Primary hub chain override.
3378
+ *
3379
+ * When multiHub is false, this is ignored (always 'base').
3380
+ * When multiHub is true, this sets the preferred hub chain.
3381
+ *
3382
+ * @default 'base'
3383
+ */
3384
+ primaryHub: ChainName;
2129
3385
  }
2130
- declare const CHAIN_PRESETS: Record<ChainName, ChainPreset>;
2131
- /**
2132
- * Get chain configuration by name and network
2133
- */
2134
- declare function getChainConfig(chain: ChainName, network?: NetworkType): ChainConfig$1;
2135
3386
  /**
2136
- * Get chain preset by name
3387
+ * Get current feature flags (immutable copy).
2137
3388
  */
2138
- declare function getChainPreset(chain: ChainName): ChainPreset;
3389
+ declare function getFeatureFlags(): Readonly<FeatureFlags>;
2139
3390
  /**
2140
- * Get all supported chain names
3391
+ * Set feature flags. Merges with current flags.
3392
+ *
3393
+ * @param flags - Partial flags to merge
3394
+ *
3395
+ * @example
3396
+ * ```typescript
3397
+ * // Enable multi-hub
3398
+ * setFeatureFlags({ multiHub: true });
3399
+ *
3400
+ * // Set Avalanche as primary hub
3401
+ * setFeatureFlags({ multiHub: true, primaryHub: 'avalanche' });
3402
+ * ```
2141
3403
  */
2142
- declare function getSupportedChains(): ChainName[];
3404
+ declare function setFeatureFlags(flags: Partial<FeatureFlags>): void;
2143
3405
  /**
2144
- * Get hub-capable chains
3406
+ * Reset feature flags to defaults.
3407
+ * Useful for testing and cleanup.
2145
3408
  */
2146
- declare function getHubChains(): ChainName[];
3409
+ declare function resetFeatureFlags(): void;
2147
3410
  /**
2148
- * Check if chain is supported
3411
+ * Check if multi-hub is enabled.
3412
+ * Convenience function used throughout the SDK.
2149
3413
  */
2150
- declare function isChainSupported(chain: string): chain is ChainName;
3414
+ declare function isMultiHubEnabled(): boolean;
2151
3415
  /**
2152
- * Get default hub chain
3416
+ * Get the effective primary hub chain name.
3417
+ *
3418
+ * When multiHub is false, always returns 'base'.
3419
+ * When multiHub is true, returns the configured primaryHub.
2153
3420
  */
2154
- declare function getDefaultHub(network?: NetworkType): ChainConfig$1;
3421
+ declare function getEffectivePrimaryHub(): ChainName;
2155
3422
 
2156
3423
  /**
2157
3424
  * Veridex Protocol SDK - Simplified Initialization
@@ -2238,6 +3505,14 @@ interface SessionConfig {
2238
3505
  */
2239
3506
  requireUV?: boolean;
2240
3507
  }
3508
+ /**
3509
+ * Create the appropriate chain client based on chain type.
3510
+ *
3511
+ * Exposed as a public API so integrators can instantiate chain clients
3512
+ * independently of the full VeridexSDK constructor (e.g. for testing
3513
+ * or for dynamic multi-chain client access).
3514
+ */
3515
+ declare function createChainClient(chain: ChainName, network: NetworkType, customRpcUrl?: string): ChainClient;
2241
3516
  /**
2242
3517
  * Create a Veridex SDK instance with minimal configuration
2243
3518
  *
@@ -2260,17 +3535,20 @@ interface SessionConfig {
2260
3535
  *
2261
3536
  * // With relayer for gasless transactions
2262
3537
  * const gaslessSdk = await createSDK('base', {
2263
- * relayerUrl: 'https://relayer.veridex.io',
3538
+ * relayerUrl: 'https://relayer.veridex.network',
2264
3539
  * relayerApiKey: 'your-api-key',
2265
3540
  * });
2266
3541
  * ```
2267
3542
  */
2268
3543
  declare function createSDK(chain: ChainName, config?: SimpleSDKConfig): VeridexSDK;
2269
3544
  /**
2270
- * Create SDK for the default hub chain (Base)
3545
+ * Create SDK for the default hub chain.
3546
+ *
3547
+ * When multi-hub is disabled, always creates SDK for Base.
3548
+ * When enabled, uses the configured primary hub chain.
2271
3549
  *
2272
3550
  * @param config - Optional configuration
2273
- * @returns SDK configured for Base hub chain
3551
+ * @returns SDK configured for the primary hub chain
2274
3552
  *
2275
3553
  * @example
2276
3554
  * ```typescript
@@ -2320,356 +3598,632 @@ declare function createMainnetSDK(chain?: ChainName, config?: Omit<SimpleSDKConf
2320
3598
  * ```
2321
3599
  */
2322
3600
  declare function createSessionSDK(chain?: ChainName, config?: SimpleSDKConfig): VeridexSDK;
2323
-
2324
3601
  /**
2325
- * Veridex Protocol SDK - Chain Detector
2326
- *
2327
- * Phase 4: Multi-chain client support helper.
2328
- *
2329
- * Provides:
2330
- * - Chain config lookup (testnet/mainnet)
2331
- * - Auto-configuration for non-EVM ChainClient instances
3602
+ * Enterprise SDK configuration extends SimpleSDKConfig with required sponsor/relayer keys.
2332
3603
  */
2333
-
2334
- interface ChainDetectorConfig {
2335
- testnet?: boolean;
2336
- rpcUrls?: Record<number, string>;
2337
- }
2338
- interface NativeBalanceCapable {
2339
- getNativeBalance(address: string): Promise<bigint>;
2340
- }
2341
- declare class ChainDetector {
2342
- private readonly testnet;
2343
- private readonly rpcUrls;
2344
- private readonly walletManager;
2345
- constructor(config?: ChainDetectorConfig);
2346
- getChainConfig(wormholeChainId: number): ChainConfig | undefined;
3604
+ interface EnterpriseSDKConfig extends SimpleSDKConfig {
2347
3605
  /**
2348
- * Create a chain client for non-EVM chains using repo constants.
2349
- * For EVM, callers should instantiate EVMClient directly (Hub-driven).
3606
+ * Sponsor private key for gasless vault creation (required for batch ops)
2350
3607
  */
2351
- createClient(wormholeChainId: number): ChainClient;
3608
+ sponsorPrivateKey: string;
2352
3609
  /**
2353
- * Derive a best-effort vault address for a chain from the passkey credential.
2354
- *
2355
- * - EVM chains: requires vaultFactory/vaultImplementation in constants.
2356
- * - Non-EVM chains: uses WalletManager chain-specific derivation.
3610
+ * Relayer URL (required for enterprise)
2357
3611
  */
2358
- deriveVaultAddress(credential: PasskeyCredential, wormholeChainId: number): ChainAddress | null;
2359
- getNonEvmNativeTokenMeta(wormholeChainId: number): {
2360
- symbol: string;
2361
- name: string;
2362
- decimals: number;
2363
- } | null;
2364
- private normalizeSuiAddress;
3612
+ relayerUrl: string;
3613
+ /**
3614
+ * Relayer API key (required for enterprise)
3615
+ */
3616
+ relayerApiKey: string;
2365
3617
  }
2366
- declare function createChainDetector(config?: ChainDetectorConfig): ChainDetector;
3618
+ /**
3619
+ * Create an SDK pre-configured for enterprise / integrator back-end use.
3620
+ *
3621
+ * This factory requires `sponsorPrivateKey`, `relayerUrl`, and `relayerApiKey`
3622
+ * — features that enterprise environments always need.
3623
+ *
3624
+ * @param chain - Chain name (e.g., 'base')
3625
+ * @param config - Enterprise-specific configuration
3626
+ * @returns VeridexSDK ready for enterprise operations
3627
+ *
3628
+ * @example
3629
+ * ```typescript
3630
+ * import { createEnterpriseSDK, EnterpriseManager } from '@veridex/sdk';
3631
+ *
3632
+ * const sdk = createEnterpriseSDK('base', {
3633
+ * sponsorPrivateKey: process.env.SPONSOR_KEY!,
3634
+ * relayerUrl: 'https://relayer.veridex.network',
3635
+ * relayerApiKey: process.env.RELAYER_KEY!,
3636
+ * });
3637
+ *
3638
+ * const enterprise = new EnterpriseManager({ sdk });
3639
+ * ```
3640
+ */
3641
+ declare function createEnterpriseSDK(chain: ChainName, config: EnterpriseSDKConfig): VeridexSDK;
2367
3642
 
2368
3643
  /**
2369
- * Veridex Protocol SDK - Relayer Client
3644
+ * Veridex Protocol SDK - Browser Capabilities Detection
2370
3645
  *
2371
- * Client for interacting with the Veridex relayer service.
2372
- * The relayer automatically submits VAAs to destination chains.
3646
+ * Detects WebAuthn and passkey capabilities of the current browser/platform.
3647
+ * Used to drive UI branching (ROR vs Auth Portal fallback, conditional UI,
3648
+ * PRF availability, backup-state awareness, hybrid transport support).
2373
3649
  *
2374
- * Features:
2375
- * - Submit VAA for relay
2376
- * - Check relay status
2377
- * - Get supported routes
2378
- * - Fee estimation
3650
+ * @example
3651
+ * ```typescript
3652
+ * import { detectCapabilities } from '@veridex/sdk';
3653
+ *
3654
+ * const caps = await detectCapabilities();
3655
+ * if (caps.relatedOrigins) {
3656
+ * // Direct cross-domain passkey usage
3657
+ * } else {
3658
+ * // Auth Portal popup/redirect fallback
3659
+ * }
3660
+ *
3661
+ * if (caps.prf) {
3662
+ * // Can use PRF extension for recovery vault encryption
3663
+ * }
3664
+ * ```
2379
3665
  */
2380
3666
  /**
2381
- * Relay request status
3667
+ * Complete browser capability report for passkey-related features.
3668
+ */
3669
+ interface BrowserCapabilities {
3670
+ /** Basic WebAuthn support (navigator.credentials + PublicKeyCredential) */
3671
+ webauthn: boolean;
3672
+ /** Platform authenticator available (Touch ID, Face ID, Windows Hello) */
3673
+ platformAuthenticator: boolean;
3674
+ /** Related Origin Requests (WebAuthn L3) — cross-domain passkey use */
3675
+ relatedOrigins: boolean;
3676
+ /** Conditional UI / autofill-assisted passkey selection */
3677
+ conditionalMediation: boolean;
3678
+ /** Hybrid transport (phone as authenticator via QR/BLE) */
3679
+ hybridTransport: boolean;
3680
+ /** PRF extension (pseudo-random function for key wrapping) */
3681
+ prf: boolean;
3682
+ /** User-verifying platform authenticator (biometric bound) */
3683
+ userVerification: boolean;
3684
+ /** Whether passkeys on this device are backed up / synced to cloud */
3685
+ backupEligible: boolean | null;
3686
+ /** Detected platform / ecosystem */
3687
+ platform: PlatformHint;
3688
+ /** Raw getClientCapabilities result (if available) */
3689
+ rawCapabilities: Record<string, boolean> | null;
3690
+ }
3691
+ /**
3692
+ * Platform hint for ecosystem-specific guidance.
2382
3693
  */
2383
- type RelayStatus = 'pending' | 'processing' | 'submitted' | 'confirmed' | 'failed';
3694
+ type PlatformHint = 'apple' | 'google' | 'windows' | 'android' | 'linux' | 'unknown';
2384
3695
  /**
2385
- * Relay request result
3696
+ * Recommendation for the best authentication strategy on this browser.
2386
3697
  */
2387
- interface RelayRequest {
2388
- /** Unique relay request ID */
2389
- id: string;
2390
- /** VAA sequence number */
2391
- sequence: bigint;
2392
- /** Source chain Wormhole ID */
2393
- sourceChain: number;
2394
- /** Destination chain Wormhole ID */
2395
- destinationChain: number;
2396
- /** Relay status */
2397
- status: RelayStatus;
2398
- /** Source transaction hash */
2399
- sourceTxHash: string;
2400
- /** Destination transaction hash (when completed) */
2401
- destinationTxHash?: string;
2402
- /** Timestamp when request was created */
2403
- createdAt: number;
2404
- /** Timestamp when request was last updated */
2405
- updatedAt: number;
2406
- /** Error message if failed */
2407
- error?: string;
2408
- /** Gas used on destination chain */
2409
- gasUsed?: bigint;
2410
- /** Fee paid */
2411
- feePaid?: bigint;
3698
+ interface AuthStrategy {
3699
+ /** Primary method to attempt */
3700
+ primary: 'ror' | 'conditional' | 'portal-popup' | 'portal-redirect';
3701
+ /** Fallback if primary fails */
3702
+ fallback: 'portal-popup' | 'portal-redirect' | 'none';
3703
+ /** Whether hybrid transport is available as an additional option */
3704
+ hybridAvailable: boolean;
3705
+ /** Human-readable explanation */
3706
+ reason: string;
2412
3707
  }
2413
3708
  /**
2414
- * Supported route information
3709
+ * Detect the current platform/ecosystem from user agent and platform strings.
2415
3710
  */
2416
- interface RelayRoute {
2417
- /** Source chain Wormhole ID */
2418
- sourceChain: number;
2419
- /** Destination chain Wormhole ID */
2420
- destinationChain: number;
2421
- /** Whether the route is active */
2422
- active: boolean;
2423
- /** Estimated relay time in seconds */
2424
- estimatedTimeSeconds: number;
2425
- /** Base fee in destination chain native token */
2426
- baseFee: bigint;
2427
- /** Fee per gas unit */
2428
- gasPrice: bigint;
2429
- /** Maximum gas limit */
2430
- maxGas: bigint;
2431
- }
3711
+ declare function detectPlatform(): PlatformHint;
2432
3712
  /**
2433
- * Relayer service info
3713
+ * Detect all browser capabilities related to passkeys and WebAuthn.
3714
+ *
3715
+ * This performs multiple async checks in parallel for efficiency.
3716
+ * Safe to call on any browser — returns sensible defaults for unsupported features.
2434
3717
  */
2435
- interface RelayerInfo {
2436
- /** Relayer name/identifier */
2437
- name: string;
2438
- /** Relayer version */
2439
- version: string;
2440
- /** Supported chains */
2441
- supportedChains: number[];
2442
- /** Available routes */
2443
- routes: RelayRoute[];
2444
- /** Whether the relayer is online */
2445
- online: boolean;
2446
- /** Current queue depth */
2447
- queueDepth: number;
2448
- }
3718
+ declare function detectCapabilities(): Promise<BrowserCapabilities>;
2449
3719
  /**
2450
- * Request body for submitting a signed action to the relayer (gasless)
2451
- * Uses full WebAuthn data for authenticateAndDispatch
3720
+ * Get the recommended authentication strategy based on detected capabilities.
2452
3721
  */
2453
- interface SubmitSignedActionRequest {
2454
- /** WebAuthn authenticatorData (hex) */
2455
- authenticatorData: string;
2456
- /** WebAuthn clientDataJSON (raw string) */
2457
- clientDataJSON: string;
2458
- /** Index of "challenge":"..." in clientDataJSON */
2459
- challengeIndex: number;
2460
- /** Index of "type":"..." in clientDataJSON */
2461
- typeIndex: number;
2462
- /** P-256 signature r component (hex) */
2463
- r: string;
2464
- /** P-256 signature s component (hex) */
2465
- s: string;
2466
- /** P-256 public key X coordinate (hex) */
2467
- publicKeyX: string;
2468
- /** P-256 public key Y coordinate (hex) */
2469
- publicKeyY: string;
2470
- /** Target chain Wormhole ID */
2471
- targetChain: number;
2472
- /** Action payload (hex) */
2473
- actionPayload: string;
2474
- /** User nonce */
2475
- nonce: number;
2476
- }
3722
+ declare function getAuthStrategy(): Promise<AuthStrategy>;
3723
+
2477
3724
  /**
2478
- * Response from submitting a signed action
3725
+ * Veridex Protocol SDK - Credential Manager
3726
+ *
3727
+ * First-class credential inventory management: list, rename, track usage,
3728
+ * detect device/platform hints, revoke, and add-backup flows.
3729
+ *
3730
+ * This module sits on top of PasskeyManager and provides the account-management
3731
+ * layer that PasskeyManager's low-level credential storage doesn't cover.
3732
+ *
3733
+ * @example
3734
+ * ```typescript
3735
+ * import { CredentialManager } from '@veridex/sdk';
3736
+ *
3737
+ * const manager = new CredentialManager({ relayerUrl: '...' });
3738
+ *
3739
+ * // List all credentials with metadata
3740
+ * const credentials = manager.listCredentials();
3741
+ *
3742
+ * // Rename a credential
3743
+ * manager.renameCredential(credentialId, 'MacBook Pro');
3744
+ *
3745
+ * // Check which credential was used most recently
3746
+ * const recent = manager.getMostRecentCredential();
3747
+ * ```
2479
3748
  */
2480
- interface SubmitActionResult {
2481
- /** Whether the submission was successful */
2482
- success: boolean;
2483
- /** Transaction hash on Hub chain */
2484
- txHash?: string;
2485
- /** Wormhole sequence number */
2486
- sequence?: string;
2487
- /** Error message if failed */
2488
- error?: string;
2489
- /** Human-readable message */
2490
- message?: string;
2491
- }
3749
+
2492
3750
  /**
2493
- * Query submission request (Issue #11/#12)
2494
- * For optimistic execution via Wormhole Query proofs (~5-7s vs ~120s)
3751
+ * Extended credential metadata stored alongside the base PasskeyCredential.
2495
3752
  */
2496
- interface SubmitQueryRequest {
2497
- /** Target spoke chain Wormhole ID */
2498
- targetChain: number;
2499
- /** User's key hash */
2500
- userKeyHash: string;
2501
- /** Serialized transaction for spoke chain */
2502
- serializedTx: string;
2503
- /** Query proof with Guardian signatures */
2504
- queryProof: {
2505
- /** Raw query response bytes */
2506
- queryResponse: string;
2507
- /** Guardian signatures */
2508
- signatures: string;
2509
- };
2510
- /** Whether to fallback to VAA if Query fails */
2511
- fallbackToVaa?: boolean;
2512
- /** Optional metadata */
2513
- metadata?: {
2514
- /** User's preferred execution path */
2515
- preferredPath?: 'query' | 'vaa';
2516
- /** Transaction value in USD (for routing decisions) */
2517
- estimatedValueUSD?: number;
2518
- };
3753
+ interface CredentialMetadata {
3754
+ /** User-assigned display name (e.g., "MacBook Pro", "iPhone 15") */
3755
+ displayName: string;
3756
+ /** When this credential was first registered (ISO 8601) */
3757
+ createdAt: string;
3758
+ /** When this credential was last used for authentication (ISO 8601) */
3759
+ lastUsedAt: string | null;
3760
+ /** Number of times this credential has been used */
3761
+ useCount: number;
3762
+ /** Platform/ecosystem hint from registration context */
3763
+ platformHint: PlatformHint;
3764
+ /** User agent string at registration time (for device identification) */
3765
+ registrationUserAgent: string;
3766
+ /** Whether the authenticator indicated backup eligibility */
3767
+ backupEligible: boolean | null;
3768
+ /** Whether the authenticator indicated the credential is currently backed up */
3769
+ backupState: boolean | null;
3770
+ /** Whether this is the root (first) credential for the identity */
3771
+ isRoot: boolean;
3772
+ /** Credential status */
3773
+ status: 'active' | 'revoked';
2519
3774
  }
2520
3775
  /**
2521
- * Query submission result (Issue #11/#12)
3776
+ * A credential entry combining the base credential with metadata.
2522
3777
  */
2523
- interface SubmitQueryResult {
2524
- /** Whether submission succeeded */
2525
- success: boolean;
2526
- /** Transaction hash on spoke chain */
2527
- txHash?: string;
2528
- /** Execution path used */
2529
- path: 'query' | 'vaa';
2530
- /** Latency in milliseconds */
2531
- latencyMs?: number;
2532
- /** Error message if failed */
2533
- error?: string;
2534
- /** Whether fallback to VAA occurred */
2535
- fellBack?: boolean;
3778
+ interface ManagedCredential {
3779
+ /** Base passkey credential (credentialId, publicKey, keyHash) */
3780
+ credential: PasskeyCredential$1;
3781
+ /** Extended metadata */
3782
+ metadata: CredentialMetadata;
2536
3783
  }
2537
3784
  /**
2538
- * Fee quote for a relay
2539
- */
2540
- interface RelayFeeQuote {
2541
- /** Source chain Wormhole ID */
2542
- sourceChain: number;
2543
- /** Destination chain Wormhole ID */
2544
- destinationChain: number;
2545
- /** Estimated fee in source chain native token */
2546
- feeInSourceToken: bigint;
2547
- /** Estimated fee in destination chain native token */
2548
- feeInDestinationToken: bigint;
2549
- /** Estimated gas on destination */
2550
- estimatedGas: bigint;
2551
- /** Quote expiration timestamp */
2552
- expiresAt: number;
2553
- /** Quote ID for submission */
2554
- quoteId: string;
3785
+ * Options for adding a credential to the inventory.
3786
+ */
3787
+ interface AddCredentialOptions {
3788
+ /** Display name for this credential */
3789
+ displayName?: string;
3790
+ /** Whether this is the root credential */
3791
+ isRoot?: boolean;
3792
+ /** Backup eligibility from authenticator response */
3793
+ backupEligible?: boolean;
3794
+ /** Backup state from authenticator response */
3795
+ backupState?: boolean;
3796
+ }
3797
+ interface CredentialManagerConfig {
3798
+ /** localStorage key for credential metadata */
3799
+ storageKey?: string;
3800
+ /** Relayer URL for remote credential metadata sync */
3801
+ relayerUrl?: string;
3802
+ }
3803
+ declare class CredentialManager {
3804
+ private config;
3805
+ constructor(config?: CredentialManagerConfig);
3806
+ /**
3807
+ * List all credentials with their metadata.
3808
+ * Merges base credentials (from PasskeyManager storage) with metadata.
3809
+ */
3810
+ listCredentials(): ManagedCredential[];
3811
+ /**
3812
+ * Get a single credential by ID with metadata.
3813
+ */
3814
+ getCredential(credentialId: string): ManagedCredential | null;
3815
+ /**
3816
+ * Get the most recently used credential.
3817
+ */
3818
+ getMostRecentCredential(): ManagedCredential | null;
3819
+ /**
3820
+ * Get the root (first) credential for the identity.
3821
+ */
3822
+ getRootCredential(): ManagedCredential | null;
3823
+ /**
3824
+ * Get count of active credentials.
3825
+ */
3826
+ getActiveCount(): number;
3827
+ /**
3828
+ * Add a newly registered credential to the inventory with metadata.
3829
+ * Call this after PasskeyManager.register() to track the credential.
3830
+ */
3831
+ addCredential(credential: PasskeyCredential$1, options?: AddCredentialOptions): ManagedCredential;
3832
+ /**
3833
+ * Record that a credential was used for authentication.
3834
+ */
3835
+ recordUsage(credentialId: string): void;
3836
+ /**
3837
+ * Rename a credential's display name.
3838
+ */
3839
+ renameCredential(credentialId: string, displayName: string): boolean;
3840
+ /**
3841
+ * Mark a credential as revoked (local metadata only).
3842
+ * Actual on-chain revocation happens through VeridexHub.removeKey().
3843
+ */
3844
+ markRevoked(credentialId: string): boolean;
3845
+ /**
3846
+ * Update backup state flags (call after authenticator response provides these).
3847
+ */
3848
+ updateBackupState(credentialId: string, backupEligible: boolean, backupState: boolean): void;
3849
+ /**
3850
+ * Remove a credential's metadata from local storage.
3851
+ * Does NOT remove the base credential from PasskeyManager storage.
3852
+ */
3853
+ removeMetadata(credentialId: string): void;
3854
+ /**
3855
+ * Sync credential metadata to the relayer for cross-device availability.
3856
+ * Only syncs public metadata (display name, platform, timestamps), never keys.
3857
+ */
3858
+ syncToRelayer(credentialId: string): Promise<boolean>;
3859
+ /**
3860
+ * Fetch credential metadata from the relayer (for cross-device restore).
3861
+ */
3862
+ fetchFromRelayer(keyHash: string): Promise<ManagedCredential[] | null>;
3863
+ /**
3864
+ * Get a summary suitable for migration/device-addition flows.
3865
+ * Returns what the user should see when deciding to add another device.
3866
+ */
3867
+ getMigrationSummary(): {
3868
+ totalCredentials: number;
3869
+ activeCredentials: number;
3870
+ platforms: PlatformHint[];
3871
+ hasBackup: boolean;
3872
+ rootDevice: string | null;
3873
+ };
3874
+ private loadMetadataMap;
3875
+ private saveMetadataMap;
3876
+ private saveMetadata;
3877
+ private loadBaseCredentials;
3878
+ private generateDisplayName;
3879
+ private createDefaultMetadata;
2555
3880
  }
3881
+
2556
3882
  /**
2557
- * Configuration for RelayerClient
3883
+ * Veridex Protocol SDK - Cross-Origin Authentication
3884
+ *
3885
+ * Enables passkey sharing across different domains using WebAuthn Related Origin Requests.
3886
+ *
3887
+ * There are two approaches for cross-domain passkey usage:
3888
+ *
3889
+ * 1. **Related Origin Requests (Recommended)** - W3C Standard
3890
+ * - Host a `.well-known/webauthn` file at veridex.network
3891
+ * - Third-party apps use rpId: 'veridex.network' directly
3892
+ * - Requires browser support for Related Origin Requests
3893
+ * - No popup needed, seamless UX
3894
+ *
3895
+ * 2. **Auth Portal Flow (Fallback)** - Popup/Redirect Pattern
3896
+ * - User is redirected to auth.veridex.network
3897
+ * - Signs with their passkey at veridex.network
3898
+ * - Returns a session token to the third-party app
3899
+ * - Works on all browsers, but requires popup/redirect
3900
+ *
3901
+ * @example Related Origins (Recommended)
3902
+ * ```typescript
3903
+ * import { createCrossOriginAuth } from '@veridex/sdk';
3904
+ *
3905
+ * const auth = createCrossOriginAuth();
3906
+ *
3907
+ * // Check if browser supports Related Origin Requests
3908
+ * if (await auth.supportsRelatedOrigins()) {
3909
+ * // Direct passkey usage with veridex.network rpId
3910
+ * const credential = await auth.authenticate();
3911
+ * } else {
3912
+ * // Fallback to Auth Portal
3913
+ * const session = await auth.authenticateViaPortal();
3914
+ * }
3915
+ * ```
3916
+ *
3917
+ * @example Auth Portal Flow
3918
+ * ```typescript
3919
+ * const auth = createCrossOriginAuth({
3920
+ * authPortalUrl: 'https://auth.veridex.network',
3921
+ * mode: 'popup', // or 'redirect'
3922
+ * });
3923
+ *
3924
+ * const session = await auth.connectWithVeridex();
3925
+ * // session contains: { address, sessionKey, expiresAt }
3926
+ * ```
2558
3927
  */
2559
- interface RelayerClientConfig {
2560
- /** Base URL of the relayer service */
2561
- baseUrl: string;
2562
- /** API key for authentication (optional) */
2563
- apiKey?: string;
2564
- /** Timeout for requests in ms */
2565
- timeoutMs?: number;
2566
- /** Max retries for failed requests */
2567
- maxRetries?: number;
3928
+
3929
+ /** Default auth portal URL */
3930
+ declare const DEFAULT_AUTH_PORTAL_URL = "https://auth.veridex.network";
3931
+ /** Default relayer API URL for server-side session tokens */
3932
+ declare const DEFAULT_RELAYER_URL = "https://amused-kameko-veridex-demo-37453117.koyeb.app/api/v1";
3933
+ /** Message types for postMessage communication */
3934
+ declare const AUTH_MESSAGE_TYPES: {
3935
+ readonly AUTH_REQUEST: "VERIDEX_AUTH_REQUEST";
3936
+ readonly AUTH_RESPONSE: "VERIDEX_AUTH_RESPONSE";
3937
+ readonly AUTH_ERROR: "VERIDEX_AUTH_ERROR";
3938
+ };
3939
+ interface CrossOriginAuthConfig {
3940
+ /** The Veridex RP ID (defaults to veridex.network) */
3941
+ rpId?: string;
3942
+ /** Auth portal URL for popup/redirect flow */
3943
+ authPortalUrl?: string;
3944
+ /** Relayer API URL for server-side session tokens */
3945
+ relayerUrl?: string;
3946
+ /** Authentication mode: popup or redirect */
3947
+ mode?: 'popup' | 'redirect';
3948
+ /** Popup window features */
3949
+ popupFeatures?: string;
3950
+ /** Timeout for auth operations (ms) */
3951
+ timeout?: number;
3952
+ /** Callback URL for redirect mode */
3953
+ redirectUri?: string;
3954
+ }
3955
+ interface CrossOriginSession {
3956
+ /** User's vault address */
3957
+ address: string;
3958
+ /** Session key public key (for signing transactions) */
3959
+ sessionPublicKey: string;
3960
+ /** Session key (encrypted, stored on client) */
3961
+ encryptedSessionKey?: string;
3962
+ /** When the session expires */
3963
+ expiresAt: number;
3964
+ /** Proof of passkey ownership */
3965
+ signature: WebAuthnSignature$1;
3966
+ /** The credential used */
3967
+ credential: PasskeyCredential$1;
3968
+ /** Server-validated session token ID (from relayer) */
3969
+ serverSessionId?: string;
3970
+ /** Relayer-issued challenge binding for server session creation */
3971
+ serverChallengeId?: string;
3972
+ }
3973
+ /** Server-side session token returned by the relayer */
3974
+ interface ServerSessionToken {
3975
+ id: string;
3976
+ keyHash: string;
3977
+ appOrigin: string;
3978
+ permissions: string[];
3979
+ expiresAt: number;
3980
+ createdAt: number;
3981
+ }
3982
+ interface AuthPortalMessage {
3983
+ type: typeof AUTH_MESSAGE_TYPES[keyof typeof AUTH_MESSAGE_TYPES];
3984
+ payload: CrossOriginSession | {
3985
+ error: string;
3986
+ code: string;
3987
+ };
3988
+ origin: string;
2568
3989
  }
2569
3990
  /**
2570
- * Client for the Veridex relayer service
3991
+ * Manages cross-origin passkey authentication for third-party apps.
3992
+ *
3993
+ * Third-party developers can use this to enable Veridex passkey authentication
3994
+ * in their own applications without users having to create new passkeys.
2571
3995
  */
2572
- declare class RelayerClient {
2573
- private baseUrl;
3996
+ declare class CrossOriginAuth {
2574
3997
  private config;
2575
- constructor(config: RelayerClientConfig);
3998
+ constructor(config?: CrossOriginAuthConfig);
2576
3999
  /**
2577
- * Submit a VAA for relay to destination chain
4000
+ * Check if the browser supports Related Origin Requests.
4001
+ * This is a WebAuthn Level 3 feature that allows using passkeys across different domains.
2578
4002
  */
2579
- submitRelay(vaaBase64: string, sourceChain: number, destinationChain: number, sourceTxHash: string, sequence: bigint, feeQuoteId?: string): Promise<RelayRequest>;
4003
+ supportsRelatedOrigins(): Promise<boolean>;
2580
4004
  /**
2581
- * Submit a signed action to the relayer for gasless execution
2582
- *
2583
- * This allows users to execute transfers without paying gas themselves.
2584
- * The relayer will submit the transaction to the Hub chain and pay the gas.
2585
- * The relayer then automatically relays the VAA to the destination spoke chain.
2586
- *
2587
- * @param request - The signed action request with passkey signature
2588
- * @returns Result including Hub tx hash and Wormhole sequence
4005
+ * Check if WebAuthn is supported at all.
2589
4006
  */
2590
- submitSignedAction(request: SubmitSignedActionRequest): Promise<SubmitActionResult>;
4007
+ isSupported(): boolean;
2591
4008
  /**
2592
- * Submit a Query-based transaction for optimistic execution (Issue #11/#12)
2593
- *
2594
- * Uses Wormhole Cross-Chain Queries (CCQ) to achieve ~5-7 second latency
2595
- * vs ~120+ seconds for traditional VAA flow.
2596
- *
2597
- * Flow:
2598
- * 1. Client fetches Hub state via queryHubState() from SDK
2599
- * 2. Client constructs and signs transaction
2600
- * 3. Client submits Query proof + tx to this endpoint
2601
- * 4. Relayer validates format and submits to spoke chain
2602
- * 5. Spoke chain verifies Guardian signatures on-chain
4009
+ * Authenticate using Related Origin Requests.
4010
+ * This allows using a passkey registered at veridex.network from any origin
4011
+ * listed in the /.well-known/webauthn file.
2603
4012
  *
2604
- * @param request - Query submission with Guardian-signed proof
2605
- * @returns Result including spoke tx hash and execution path
2606
- */
2607
- submitQuery(request: SubmitQueryRequest): Promise<SubmitQueryResult>;
2608
- /**
2609
- * Get relay request status
4013
+ * @throws If browser doesn't support Related Origin Requests
4014
+ * @throws If the current origin isn't listed in veridex.network's well-known file
2610
4015
  */
2611
- getRelayStatus(requestId: string): Promise<RelayRequest>;
4016
+ authenticate(challenge?: Uint8Array): Promise<{
4017
+ credential: PasskeyCredential$1;
4018
+ signature: WebAuthnSignature$1;
4019
+ }>;
2612
4020
  /**
2613
- * Get relay status by source transaction hash
4021
+ * Register a new passkey with veridex.network as the RP.
4022
+ * This should only be called from veridex.network origins.
2614
4023
  */
2615
- getRelayBySourceTx(sourceTxHash: string): Promise<RelayRequest | null>;
4024
+ register(username: string, displayName: string): Promise<PasskeyCredential$1>;
2616
4025
  /**
2617
- * Get relay status by sequence number
4026
+ * Authenticate via the Veridex Auth Portal.
4027
+ * Opens a popup or redirects to auth.veridex.network where the user
4028
+ * signs with their passkey, then returns a session to the calling app.
2618
4029
  */
2619
- getRelayBySequence(sourceChain: number, sequence: bigint): Promise<RelayRequest | null>;
4030
+ connectWithVeridex(options?: {
4031
+ sessionChallengeId?: string;
4032
+ sessionChallenge?: string;
4033
+ register?: boolean;
4034
+ username?: string;
4035
+ displayName?: string;
4036
+ }): Promise<CrossOriginSession>;
2620
4037
  /**
2621
- * Cancel a pending relay request
4038
+ * Popup-based authentication flow.
2622
4039
  */
2623
- cancelRelay(requestId: string): Promise<boolean>;
4040
+ private authenticateViaPopup;
2624
4041
  /**
2625
- * Poll for relay completion
4042
+ * Redirect-based authentication flow.
4043
+ * Stores state in sessionStorage and redirects to auth portal.
2626
4044
  */
2627
- waitForRelay(requestId: string, timeoutMs?: number, pollingIntervalMs?: number, onProgress?: (status: RelayStatus) => void): Promise<RelayRequest>;
4045
+ private initiateRedirectAuth;
2628
4046
  /**
2629
- * Get fee quote for a relay
4047
+ * Complete redirect-based authentication.
4048
+ * Call this on your callback page to extract the session from URL params.
2630
4049
  */
2631
- getFeeQuote(sourceChain: number, destinationChain: number, estimatedGas?: bigint): Promise<RelayFeeQuote>;
4050
+ completeRedirectAuth(): CrossOriginSession | null;
2632
4051
  /**
2633
- * Get relayer service info
4052
+ * Generate a random state string for CSRF protection.
2634
4053
  */
2635
- getInfo(): Promise<RelayerInfo>;
4054
+ private generateState;
4055
+ private decodeBase64Url;
4056
+ private requestServerSessionChallenge;
2636
4057
  /**
2637
- * Get supported routes
4058
+ * Get the RP ID being used.
2638
4059
  */
2639
- getRoutes(): Promise<RelayRoute[]>;
4060
+ getRpId(): string;
2640
4061
  /**
2641
- * Check if a route is supported
4062
+ * Get the auth portal URL.
2642
4063
  */
2643
- isRouteSupported(sourceChain: number, destinationChain: number): Promise<boolean>;
4064
+ getAuthPortalUrl(): string;
2644
4065
  /**
2645
- * Check relayer health
4066
+ * Create a server-validated session token via the relayer.
4067
+ * Call this after authenticating (via ROR or auth portal) to get a
4068
+ * server-side session that the relayer can verify on subsequent requests.
2646
4069
  */
2647
- healthCheck(): Promise<boolean>;
4070
+ createServerSession(session: CrossOriginSession): Promise<ServerSessionToken>;
2648
4071
  /**
2649
- * Get all pending relay requests for a user
4072
+ * Validate an existing server session token.
4073
+ * Returns the session details if valid, null if expired/revoked.
2650
4074
  */
2651
- getPendingRelays(userKeyHash: string): Promise<RelayRequest[]>;
4075
+ validateServerSession(sessionId: string): Promise<ServerSessionToken | null>;
2652
4076
  /**
2653
- * Get relay history for a user
4077
+ * Revoke a server session token.
2654
4078
  */
2655
- getRelayHistory(userKeyHash: string, limit?: number, offset?: number): Promise<RelayRequest[]>;
4079
+ revokeServerSession(sessionId: string): Promise<boolean>;
2656
4080
  /**
2657
- * SDK version for telemetry
4081
+ * Full authentication flow: authenticate + create server session.
4082
+ * Automatically detects ROR support and falls back to auth portal.
2658
4083
  */
2659
- private static readonly SDK_VERSION;
4084
+ authenticateAndCreateSession(options?: {
4085
+ permissions?: string[];
4086
+ expiresInMs?: number;
4087
+ }): Promise<{
4088
+ session: CrossOriginSession;
4089
+ serverSession: ServerSessionToken;
4090
+ }>;
4091
+ }
4092
+ /**
4093
+ * Create a CrossOriginAuth instance for third-party app integration.
4094
+ *
4095
+ * @example
4096
+ * ```typescript
4097
+ * const auth = createCrossOriginAuth();
4098
+ *
4099
+ * // Check for Related Origin support
4100
+ * if (await auth.supportsRelatedOrigins()) {
4101
+ * const { credential, signature } = await auth.authenticate();
4102
+ * } else {
4103
+ * const session = await auth.connectWithVeridex();
4104
+ * }
4105
+ * ```
4106
+ */
4107
+ declare function createCrossOriginAuth(config?: CrossOriginAuthConfig): CrossOriginAuth;
4108
+ /**
4109
+ * Helper for the auth portal page to send results back to the calling app.
4110
+ * Only used on auth.veridex.network, not in third-party apps.
4111
+ */
4112
+ declare function sendAuthResponse(session: CrossOriginSession, targetOrigin: string): void;
4113
+ /**
4114
+ * Helper for the auth portal to send an error back to the calling app.
4115
+ */
4116
+ declare function sendAuthError(error: string, code: string, targetOrigin: string): void;
4117
+
4118
+ /**
4119
+ * Veridex Protocol SDK — Injected Wallet Adapter
4120
+ *
4121
+ * Provides a standardized adapter for browser-injected EIP-1193 wallets
4122
+ * (MetaMask, Rabby, Coinbase Wallet, etc.). Used as the on-chain signer
4123
+ * for Veridex SDK operations that require a funded EOA for gas payment.
4124
+ *
4125
+ * Capabilities beyond basic connect:
4126
+ * - EIP-1193 event forwarding (accountsChanged, chainChanged, disconnect)
4127
+ * - Connection state tracking
4128
+ * - Clean disconnect with listener teardown
4129
+ * - Static availability detection
4130
+ *
4131
+ * ADR-0040 compliance: This adapter never touches passkey material.
4132
+ * It only provides an ethers.Signer for on-chain transaction submission.
4133
+ *
4134
+ * @module InjectedWalletAdapter
4135
+ */
4136
+
4137
+ interface InjectedWalletConnection {
4138
+ provider: ethers.BrowserProvider;
4139
+ signer: ethers.JsonRpcSigner;
4140
+ address: string;
4141
+ chainId: number;
4142
+ }
4143
+ type WalletEvent = {
4144
+ type: 'accountsChanged';
4145
+ accounts: string[];
4146
+ } | {
4147
+ type: 'chainChanged';
4148
+ chainId: number;
4149
+ } | {
4150
+ type: 'disconnect';
4151
+ error?: unknown;
4152
+ };
4153
+ type WalletEventCallback = (event: WalletEvent) => void;
4154
+ interface InjectedWalletAdapterConfig {
4155
+ expectedChainId?: number;
4156
+ autoSwitchChain?: boolean;
4157
+ }
4158
+ declare class InjectedWalletAdapter {
4159
+ private readonly config;
4160
+ private eventCallbacks;
4161
+ private ethereum;
4162
+ private boundAccountsChanged;
4163
+ private boundChainChanged;
4164
+ private boundDisconnect;
4165
+ private connection;
4166
+ constructor(config?: InjectedWalletAdapterConfig);
4167
+ private getEthereum;
4168
+ isAvailable(): boolean;
4169
+ /** Returns the current active connection, or null. */
4170
+ getConnection(): InjectedWalletConnection | null;
4171
+ connect(expectedChainId?: number | undefined): Promise<InjectedWalletConnection>;
4172
+ /** Disconnect: clears local state and removes event listeners. */
4173
+ disconnect(): void;
4174
+ switchChain(chainId: number): Promise<void>;
4175
+ getCurrentChainId(): Promise<number>;
4176
+ /** Subscribe to wallet events (accountsChanged, chainChanged, disconnect). */
4177
+ on(callback: WalletEventCallback): () => void;
4178
+ private emit;
4179
+ private attachEventListeners;
4180
+ private detachEventListeners;
4181
+ }
4182
+ declare function createInjectedWalletAdapter(config?: InjectedWalletAdapterConfig): InjectedWalletAdapter;
4183
+
4184
+ /**
4185
+ * Veridex Protocol SDK - Chain Detector
4186
+ *
4187
+ * Phase 4: Multi-chain client support helper.
4188
+ *
4189
+ * Provides:
4190
+ * - Chain config lookup (testnet/mainnet)
4191
+ * - Auto-configuration for non-EVM ChainClient instances
4192
+ */
4193
+
4194
+ interface ChainDetectorConfig {
4195
+ testnet?: boolean;
4196
+ rpcUrls?: Record<number, string>;
4197
+ }
4198
+ interface NativeBalanceCapable {
4199
+ getNativeBalance(address: string): Promise<bigint>;
4200
+ }
4201
+ declare class ChainDetector {
4202
+ private readonly testnet;
4203
+ private readonly rpcUrls;
4204
+ private readonly walletManager;
4205
+ constructor(config?: ChainDetectorConfig);
4206
+ getChainConfig(wormholeChainId: number): ChainConfig | undefined;
2660
4207
  /**
2661
- * Make an HTTP request to the relayer
4208
+ * Create a chain client for non-EVM chains using repo constants.
4209
+ * For EVM, callers should instantiate EVMClient directly (Hub-driven).
2662
4210
  */
2663
- private fetch;
4211
+ createClient(wormholeChainId: number): ChainClient;
2664
4212
  /**
2665
- * Sleep helper
4213
+ * Derive a best-effort vault address for a chain from the passkey credential.
4214
+ *
4215
+ * - EVM chains: requires vaultFactory/vaultImplementation in constants.
4216
+ * - Non-EVM chains: uses WalletManager chain-specific derivation.
2666
4217
  */
2667
- private sleep;
4218
+ deriveVaultAddress(credential: PasskeyCredential, wormholeChainId: number): ChainAddress | null;
4219
+ getNonEvmNativeTokenMeta(wormholeChainId: number): {
4220
+ symbol: string;
4221
+ name: string;
4222
+ decimals: number;
4223
+ } | null;
4224
+ private normalizeSuiAddress;
2668
4225
  }
2669
- /**
2670
- * Create a RelayerClient instance
2671
- */
2672
- declare function createRelayerClient(config: RelayerClientConfig): RelayerClient;
4226
+ declare function createChainDetector(config?: ChainDetectorConfig): ChainDetector;
2673
4227
 
2674
4228
  /**
2675
4229
  * Veridex Protocol SDK - Session Cryptography Utilities
@@ -2846,11 +4400,11 @@ declare class IndexedDBSessionStorage implements SessionStorage {
2846
4400
  /**
2847
4401
  * Save a session (encrypts private key)
2848
4402
  */
2849
- save(session: SessionKey): Promise<void>;
4403
+ save(session: SessionKey$1): Promise<void>;
2850
4404
  /**
2851
4405
  * Load the active session (decrypts private key)
2852
4406
  */
2853
- load(): Promise<SessionKey | null>;
4407
+ load(): Promise<SessionKey$1 | null>;
2854
4408
  /**
2855
4409
  * Get all stored sessions (internal helper)
2856
4410
  */
@@ -2893,11 +4447,11 @@ declare class LocalStorageSessionStorage implements SessionStorage {
2893
4447
  /**
2894
4448
  * Save a session (encrypts private key)
2895
4449
  */
2896
- save(session: SessionKey): Promise<void>;
4450
+ save(session: SessionKey$1): Promise<void>;
2897
4451
  /**
2898
4452
  * Load the active session (decrypts private key)
2899
4453
  */
2900
- load(): Promise<SessionKey | null>;
4454
+ load(): Promise<SessionKey$1 | null>;
2901
4455
  /**
2902
4456
  * Clear all sessions
2903
4457
  */
@@ -3049,11 +4603,11 @@ declare const VERIDEX_ERRORS: {
3049
4603
  /** ABI decoding failed (parsing) */
3050
4604
  readonly QUERY_PARSE_ABI_FAILED: 6216;
3051
4605
  };
3052
- type VeridexErrorCode = (typeof VERIDEX_ERRORS)[keyof typeof VERIDEX_ERRORS];
4606
+ type VeridexErrorCode$1 = (typeof VERIDEX_ERRORS)[keyof typeof VERIDEX_ERRORS];
3053
4607
  /**
3054
4608
  * Human-readable error messages for each error code.
3055
4609
  */
3056
- declare const ERROR_MESSAGES: Record<VeridexErrorCode, string>;
4610
+ declare const ERROR_MESSAGES: Record<VeridexErrorCode$1, string>;
3057
4611
  /**
3058
4612
  * Check if an error code is in the core protocol range.
3059
4613
  */
@@ -3088,7 +4642,7 @@ declare function getErrorMessage(code: number): string;
3088
4642
  * @param error - The error object from a failed transaction
3089
4643
  * @returns The error code if found, undefined otherwise
3090
4644
  */
3091
- declare function parseVeridexError(error: unknown): VeridexErrorCode | undefined;
4645
+ declare function parseVeridexError(error: unknown): VeridexErrorCode$1 | undefined;
3092
4646
  /**
3093
4647
  * Check if the error is a retryable error (e.g., expired query can be refreshed).
3094
4648
  */
@@ -3098,26 +4652,427 @@ declare function isRetryableError(code: number): boolean;
3098
4652
  */
3099
4653
  declare function getSuggestedAction(code: number): string;
3100
4654
 
3101
- type AuthenticateAndPrepareParams = {
3102
- credential: PasskeyCredential;
3103
- action?: TransferParams | ExecuteParams | BridgeParams;
3104
- /** Pre-encoded Hub action payload (hex string). If provided, `action` is ignored. */
3105
- actionPayload?: string;
3106
- targetChain: number;
4655
+ /**
4656
+ * Veridex Protocol SDK — Unified Error Normalization
4657
+ *
4658
+ * Wraps chain-specific errors (ethers, Anchor, Clarity, Starknet felt, etc.)
4659
+ * into a single VeridexError class with a unified code, human-readable message,
4660
+ * and chain identifier. Integrators can catch `VeridexError` consistently
4661
+ * regardless of which chain's SDK surfaced the underlying fault.
4662
+ */
4663
+ /**
4664
+ * Language-agnostic error codes that map consistently across all chains.
4665
+ */
4666
+ declare enum VeridexErrorCode {
4667
+ NO_CREDENTIAL = "NO_CREDENTIAL",
4668
+ UNAUTHORIZED = "UNAUTHORIZED",
4669
+ INVALID_SIGNATURE = "INVALID_SIGNATURE",
4670
+ VAULT_NOT_FOUND = "VAULT_NOT_FOUND",
4671
+ VAULT_PAUSED = "VAULT_PAUSED",
4672
+ PROTOCOL_PAUSED = "PROTOCOL_PAUSED",
4673
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
4674
+ DAILY_LIMIT_EXCEEDED = "DAILY_LIMIT_EXCEEDED",
4675
+ INVALID_PAYLOAD = "INVALID_PAYLOAD",
4676
+ INVALID_ACTION = "INVALID_ACTION",
4677
+ EXPIRED = "EXPIRED",
4678
+ VAA_ALREADY_PROCESSED = "VAA_ALREADY_PROCESSED",
4679
+ INVALID_VAA = "INVALID_VAA",
4680
+ INVALID_EMITTER = "INVALID_EMITTER",
4681
+ BRIDGE_ERROR = "BRIDGE_ERROR",
4682
+ RPC_ERROR = "RPC_ERROR",
4683
+ TIMEOUT = "TIMEOUT",
4684
+ RELAYER_ERROR = "RELAYER_ERROR",
4685
+ SESSION_EXPIRED = "SESSION_EXPIRED",
4686
+ SESSION_INVALID = "SESSION_INVALID",
4687
+ UNSUPPORTED_FEATURE = "UNSUPPORTED_FEATURE",
4688
+ UNKNOWN = "UNKNOWN"
4689
+ }
4690
+ /**
4691
+ * Unified error class for all Veridex SDK operations.
4692
+ *
4693
+ * @example
4694
+ * ```typescript
4695
+ * try {
4696
+ * await sdk.executeTransfer(prepared, signer);
4697
+ * } catch (err) {
4698
+ * if (err instanceof VeridexError) {
4699
+ * console.log(err.code); // 'INSUFFICIENT_FUNDS'
4700
+ * console.log(err.chain); // 'base'
4701
+ * console.log(err.cause); // original ethers error
4702
+ * }
4703
+ * }
4704
+ * ```
4705
+ */
4706
+ declare class VeridexError extends Error {
4707
+ /** Unified error code */
4708
+ readonly code: VeridexErrorCode;
4709
+ /** Chain name where the error originated (e.g. 'base', 'solana') */
4710
+ readonly chain: string | undefined;
4711
+ /** Original chain-specific error */
4712
+ readonly cause: unknown;
4713
+ /** Whether the operation could succeed if retried */
4714
+ readonly retryable: boolean;
4715
+ constructor(code: VeridexErrorCode, message?: string, options?: {
4716
+ chain?: string;
4717
+ cause?: unknown;
4718
+ retryable?: boolean;
4719
+ });
4720
+ }
4721
+ /**
4722
+ * Normalize any chain-specific error into a VeridexError.
4723
+ *
4724
+ * Call this at SDK boundaries (dispatch, balance fetch, vault creation) to
4725
+ * give integrators a consistent error surface.
4726
+ *
4727
+ * @param error - The original error from chain client / RPC / Anchor / etc.
4728
+ * @param chain - Chain identifier string (e.g. 'base', 'solana', 'starknet')
4729
+ * @returns A VeridexError wrapping the original
4730
+ */
4731
+ declare function normalizeError(error: unknown, chain?: string): VeridexError;
4732
+
4733
+ /**
4734
+ * Veridex Protocol SDK — Enterprise Manager
4735
+ *
4736
+ * Bundles the operations that enterprise / integrator back-ends need:
4737
+ * - Batch vault creation across chains
4738
+ * - Admin spending limit management for multiple vaults
4739
+ * - Server-side signing helpers (non-WebAuthn path)
4740
+ * - Pre-built webhook-style event subscription
4741
+ *
4742
+ * All features delegate to existing SDK primitives — this is an
4743
+ * orchestration layer, not a divergent code path.
4744
+ */
4745
+
4746
+ interface EnterpriseManagerConfig {
4747
+ /**
4748
+ * The VeridexSDK instance (typically created via `createSDK` or
4749
+ * `createEnterpriseSDK` with a sponsor key).
4750
+ */
4751
+ sdk: VeridexSDK;
4752
+ /**
4753
+ * Maximum concurrent operations for batch methods (default: 3).
4754
+ */
4755
+ maxConcurrency?: number;
4756
+ }
4757
+ interface BatchVaultRequest {
4758
+ /** Key hashes to create vaults for */
4759
+ keyHashes: string[];
4760
+ /** Optional: specific chain IDs to create vaults on (defaults to all sponsored chains) */
4761
+ chainIds?: number[];
4762
+ /** Maximum concurrent vault creations (overrides config default) */
4763
+ maxConcurrency?: number;
4764
+ }
4765
+ interface BatchVaultResult {
4766
+ total: number;
4767
+ succeeded: number;
4768
+ failed: number;
4769
+ results: Array<{
4770
+ keyHash: string;
4771
+ result: MultiChainVaultResult | null;
4772
+ error?: string;
4773
+ }>;
4774
+ }
4775
+ interface BatchTransferRequest {
4776
+ /** Transfers to execute */
4777
+ transfers: TransferParams[];
4778
+ /** Signer to pay for gas */
4779
+ signer: any;
4780
+ /** Maximum concurrent transfers (overrides config default) */
4781
+ maxConcurrency?: number;
4782
+ }
4783
+ interface BatchTransferResult {
4784
+ total: number;
4785
+ succeeded: number;
4786
+ failed: number;
4787
+ results: Array<{
4788
+ params: TransferParams;
4789
+ result: TransferResult | null;
4790
+ error?: string;
4791
+ }>;
4792
+ }
4793
+ interface BatchSpendingLimitRequest {
4794
+ /** Vault addresses and their new daily limit */
4795
+ updates: Array<{
4796
+ /** New daily limit in wei/base units (0 = unlimited) */
4797
+ newLimit: bigint;
4798
+ }>;
4799
+ /** Signer to pay for gas */
4800
+ signer: any;
4801
+ }
4802
+ interface BatchSpendingLimitResult {
4803
+ total: number;
4804
+ succeeded: number;
4805
+ failed: number;
4806
+ results: Array<{
4807
+ newLimit: bigint;
4808
+ result: TransferResult | null;
4809
+ error?: string;
4810
+ }>;
4811
+ }
4812
+ /** Lifecycle event types for batch operations */
4813
+ type BatchLifecycleEvent = {
4814
+ type: 'started';
4815
+ total: number;
4816
+ } | {
4817
+ type: 'item_started';
4818
+ index: number;
4819
+ total: number;
4820
+ } | {
4821
+ type: 'item_completed';
4822
+ index: number;
4823
+ total: number;
4824
+ success: boolean;
4825
+ error?: string;
4826
+ } | {
4827
+ type: 'completed';
4828
+ succeeded: number;
4829
+ failed: number;
4830
+ total: number;
3107
4831
  };
3108
- type AuthenticateAndPrepareResult = {
3109
- serializedTx: Uint8Array;
3110
- queryProof: Uint8Array<ArrayBufferLike>;
3111
- estimatedLatency: number;
3112
- fallbackAvailable: boolean;
4832
+ /** Callback for batch operation lifecycle events */
4833
+ type BatchLifecycleCallback = (event: BatchLifecycleEvent) => void;
4834
+ interface VaultOverview {
4835
+ keyHash: string;
4836
+ vaultAddress: string;
4837
+ wormholeChainId: number;
4838
+ exists: boolean;
4839
+ balance?: PortfolioBalance;
4840
+ limits?: SpendingLimits;
4841
+ }
4842
+ /**
4843
+ * High-level orchestration for enterprise / integrator use cases.
4844
+ *
4845
+ * @example
4846
+ * ```typescript
4847
+ * import { createEnterpriseSDK, EnterpriseManager } from '@veridex/sdk';
4848
+ *
4849
+ * const sdk = createEnterpriseSDK({
4850
+ * sponsorPrivateKey: process.env.SPONSOR_KEY!,
4851
+ * relayerUrl: 'https://relayer.veridex.network',
4852
+ * relayerApiKey: 'key',
4853
+ * });
4854
+ *
4855
+ * const enterprise = new EnterpriseManager({ sdk });
4856
+ *
4857
+ * // Batch create vaults for 50 users
4858
+ * const result = await enterprise.batchCreateVaults({
4859
+ * keyHashes: userKeyHashes,
4860
+ * });
4861
+ *
4862
+ * // Watch all vaults for balance changes
4863
+ * const unsub = enterprise.watchVaultBalance(
4864
+ * 10004, vaultAddress,
4865
+ * (event) => callWebhook(event),
4866
+ * );
4867
+ * ```
4868
+ */
4869
+ declare class EnterpriseManager {
4870
+ private readonly sdk;
4871
+ private readonly balanceWatcher;
4872
+ private readonly maxConcurrency;
4873
+ constructor(config: EnterpriseManagerConfig);
4874
+ /**
4875
+ * Run tasks with bounded concurrency.
4876
+ */
4877
+ private runWithConcurrency;
4878
+ /**
4879
+ * Create sponsored vaults for multiple users with concurrency control.
4880
+ *
4881
+ * Uses the SDK's GasSponsor under the hood. Errors for individual
4882
+ * key hashes are captured, not thrown — the batch continues.
4883
+ */
4884
+ batchCreateVaults(request: BatchVaultRequest, onLifecycle?: BatchLifecycleCallback): Promise<BatchVaultResult>;
4885
+ /**
4886
+ * Check vault existence across all sponsored chains for a key hash.
4887
+ */
4888
+ checkVaults(keyHash: string): Promise<Record<number, {
4889
+ exists: boolean;
4890
+ address: string;
4891
+ }>>;
4892
+ /**
4893
+ * List all chains where sponsorship is available.
4894
+ */
4895
+ getSponsoredChains(): ChainDeploymentConfig[];
4896
+ /**
4897
+ * Execute multiple transfers with concurrency control.
4898
+ *
4899
+ * Each transfer is prepared and executed independently. Errors are
4900
+ * captured per-transfer so the batch continues on individual failures.
4901
+ *
4902
+ * @example
4903
+ * ```typescript
4904
+ * const result = await enterprise.batchTransfer({
4905
+ * transfers: [
4906
+ * { targetChain: 10004, token: '0x...', recipient: '0xAlice', amount: 1000000n },
4907
+ * { targetChain: 10004, token: '0x...', recipient: '0xBob', amount: 2000000n },
4908
+ * ],
4909
+ * signer,
4910
+ * maxConcurrency: 2,
4911
+ * }, (event) => console.log(event.type, event));
4912
+ * ```
4913
+ */
4914
+ batchTransfer(request: BatchTransferRequest, onLifecycle?: BatchLifecycleCallback): Promise<BatchTransferResult>;
4915
+ /**
4916
+ * Update daily spending limits for the current vault in sequence.
4917
+ *
4918
+ * Each limit update requires a passkey signature, so these are executed
4919
+ * one-at-a-time (signing cannot be parallelized).
4920
+ *
4921
+ * @example
4922
+ * ```typescript
4923
+ * const result = await enterprise.batchSetSpendingLimits({
4924
+ * updates: [
4925
+ * { newLimit: ethers.parseEther('5.0') },
4926
+ * { newLimit: ethers.parseEther('10.0') },
4927
+ * ],
4928
+ * signer,
4929
+ * });
4930
+ * ```
4931
+ */
4932
+ batchSetSpendingLimits(request: BatchSpendingLimitRequest, onLifecycle?: BatchLifecycleCallback): Promise<BatchSpendingLimitResult>;
4933
+ /**
4934
+ * Read spending limits for any vault address on the current chain.
4935
+ * Useful for admin dashboards that need to inspect user vaults.
4936
+ */
4937
+ getSpendingLimitsForVault(vaultAddress: string, wormholeChainId?: number): Promise<SpendingLimits>;
4938
+ /**
4939
+ * Read spending limits for multiple vaults in parallel.
4940
+ */
4941
+ getSpendingLimitsForVaults(vaultAddresses: string[], wormholeChainId?: number): Promise<Map<string, SpendingLimits | Error>>;
4942
+ /**
4943
+ * Watch a vault's balance for changes.
4944
+ *
4945
+ * The callback fires whenever the polling interval detects a difference.
4946
+ * Returns an unsubscribe function.
4947
+ *
4948
+ * @example
4949
+ * ```typescript
4950
+ * const unsub = enterprise.watchVaultBalance(
4951
+ * 10004,
4952
+ * '0xVaultAddr',
4953
+ * (event) => {
4954
+ * // Push to webhook, update dashboard, etc.
4955
+ * fetch(webhookUrl, { method: 'POST', body: JSON.stringify(event) });
4956
+ * },
4957
+ * { intervalMs: 10_000 },
4958
+ * );
4959
+ * ```
4960
+ */
4961
+ watchVaultBalance(wormholeChainId: number, address: string, onChange: BalanceChangeCallback, options?: BalanceWatcherOptions, onError?: BalanceErrorCallback): Unsubscribe;
4962
+ /**
4963
+ * Stop all active balance watchers.
4964
+ */
4965
+ stopAllWatchers(): void;
4966
+ /**
4967
+ * Get number of active balance watchers.
4968
+ */
4969
+ get activeWatcherCount(): number;
4970
+ /**
4971
+ * Get a combined overview for a vault: existence, balances, limits.
4972
+ *
4973
+ * Useful for rendering an admin dashboard row.
4974
+ */
4975
+ getVaultOverview(keyHash: string, wormholeChainId?: number): Promise<VaultOverview>;
4976
+ }
4977
+
4978
+ /**
4979
+ * @packageDocumentation
4980
+ * @module erc8004/contracts
4981
+ * @description
4982
+ * Low-level ERC-8004 contract utilities shared across SDK layers.
4983
+ *
4984
+ * Provides:
4985
+ * - Contract instance creation for Identity, Reputation, and Validation registries
4986
+ * - Address resolution by chain and network
4987
+ * - ABI references
4988
+ *
4989
+ * This module lives in the core SDK (`@veridex/sdk`) so that both the agent-sdk
4990
+ * and relayer can share the same contract interaction utilities.
4991
+ *
4992
+ * References:
4993
+ * - ADR-0029 §SDK Module Structure
4994
+ * - ERC8004_IMPLEMENTATION_PLAN.md Phase 1
4995
+ */
4996
+ /** Identity Registry — same address on ALL EVM mainnets */
4997
+ declare const ERC8004_MAINNET_IDENTITY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
4998
+ /** Reputation Registry — same address on ALL EVM mainnets */
4999
+ declare const ERC8004_MAINNET_REPUTATION = "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
5000
+ /** Identity Registry — same address on ALL EVM testnets */
5001
+ declare const ERC8004_TESTNET_IDENTITY = "0x8004A818BFB912233c491871b3d84c89A494BD9e";
5002
+ /** Reputation Registry — same address on ALL EVM testnets */
5003
+ declare const ERC8004_TESTNET_REPUTATION = "0x8004B663056A597Dffe9eCcC1965A193B7388713";
5004
+ /**
5005
+ * Resolve canonical ERC-8004 registry addresses for a given network.
5006
+ */
5007
+ declare function getERC8004Addresses(testnet: boolean): {
5008
+ identityRegistry: string;
5009
+ reputationRegistry: string;
3113
5010
  };
3114
5011
  /**
3115
- * Client-first authentication preparation:
3116
- * - user signs locally (FaceID/TouchID)
3117
- * - client queries Wormhole Query Proxy for Guardian-attested nonce/state
3118
- * - client returns a ready-to-submit relayer payload (JSON bytes)
3119
- * - falls back to RPC nonce if Queries fails
5012
+ * Check if a chain has ERC-8004 singletons deployed.
3120
5013
  */
3121
- declare function authenticateAndPrepare(userParams: AuthenticateAndPrepareParams, apiKey: string): Promise<AuthenticateAndPrepareResult>;
5014
+ declare function isERC8004Chain(chainName: string): boolean;
5015
+ /** Chains where ERC-8004 singletons are deployed */
5016
+ declare const ERC8004_CHAINS: {
5017
+ readonly mainnet: readonly ["ethereum", "base", "polygon", "arbitrum", "optimism", "linea", "megaeth", "monad"];
5018
+ readonly testnet: readonly ["ethereum-sepolia", "base-sepolia", "polygon-amoy", "arbitrum-sepolia", "optimism-sepolia", "monad-testnet"];
5019
+ };
5020
+ /** Minimal Identity Registry ABI for read operations */
5021
+ 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)"];
5022
+ /** Minimal Reputation Registry ABI for read operations */
5023
+ 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)"];
5024
+ /** Full Identity Registry ABI (read + write) */
5025
+ 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)"];
5026
+ /** Full Reputation Registry ABI (read + write) */
5027
+ 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)"];
5028
+ /** Validation Registry ABI (Phase 3 — spec still under active update) */
5029
+ 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[])"];
5030
+
5031
+ /**
5032
+ * @packageDocumentation
5033
+ * @module erc8004/types
5034
+ * @description
5035
+ * On-chain types for ERC-8004 registries.
5036
+ * These are the low-level types that map directly to contract return values.
5037
+ *
5038
+ * Higher-level SDK config types live in `@veridex/agent-sdk/identity/types`.
5039
+ */
5040
+ /** Agent registration as stored on-chain in the ERC-8004 Identity Registry */
5041
+ interface ERC8004AgentRegistration {
5042
+ agentId: bigint;
5043
+ owner: string;
5044
+ agentURI: string;
5045
+ agentWallet: string;
5046
+ }
5047
+ /** Key-value metadata entry */
5048
+ interface ERC8004MetadataEntry {
5049
+ key: string;
5050
+ value: string;
5051
+ }
5052
+ /** Individual feedback entry from the Reputation Registry */
5053
+ interface ERC8004FeedbackEntry {
5054
+ value: bigint;
5055
+ valueDecimals: number;
5056
+ tag1: string;
5057
+ tag2: string;
5058
+ isRevoked: boolean;
5059
+ }
5060
+ /** Aggregated feedback summary from the Reputation Registry */
5061
+ interface ERC8004FeedbackSummary {
5062
+ count: bigint;
5063
+ summaryValue: bigint;
5064
+ summaryValueDecimals: number;
5065
+ }
5066
+ /** Validation status from the Validation Registry */
5067
+ interface ERC8004ValidationStatus {
5068
+ validatorAddress: string;
5069
+ agentId: bigint;
5070
+ response: number;
5071
+ responseHash: string;
5072
+ tag: string;
5073
+ lastUpdate: bigint;
5074
+ }
5075
+ /** CAIP-2 universal agent identifier format */
5076
+ type UniversalAgentIdentifier = string;
3122
5077
 
3123
- export { ARBITRUM_SEPOLIA_TOKENS, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AuthenticateAndPrepareParams, type AuthenticateAndPrepareResult, AuthorizedKey, BASE_SEPOLIA_TOKENS, BalanceManager, type BalanceManagerConfig, type BridgeDetails, BridgeParams, BridgeResult, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, ChainAddress, type ChainAddressConfig, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, DEFAULT_REFRESH_BUFFER, DEFAULT_SESSION_DURATION, type DailySpendingSummary, DispatchResult, type DurationDisplay, ERROR_MESSAGES, ERROR_RANGES, EVM_ZERO_ADDRESS, type ExecuteDetails, ExecuteParams, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, IdentityState, IndexedDBSessionStorage, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, type MultiChainVaultResult, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PasskeyCredential, PasskeyManager, type PortfolioBalance, PreparedBridge, PreparedTransfer, ReceiveAddress, type RecipientDisplay, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, RelayerClient, type RelayerClientConfig, type RelayerInfo, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SimpleSDKConfig, type SessionConfig as SimpleSessionConfig, type SpendingLimitChangedEvent, type SpendingLimitConfig, type SpendingLimitEventCallback, type SpendingLimits, SpendingLimitsManager, type SpendingLimitsManagerConfig, type SpendingTransaction, type SponsoredVaultResult, type SponsorshipSource, type SubmitActionResult, type SubmitQueryRequest, type SubmitQueryResult, type SubmitSignedActionRequest, TOKEN_REGISTRY, type TokenBalance, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, UnifiedIdentity, VAA, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, VeridexConfig, type VeridexErrorCode, VeridexPayload, VeridexSDK, WalletManager, WalletManagerConfig, authenticateAndPrepare, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainDetector, createGasSponsor, createHubSDK, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getErrorCategory, getErrorMessage, getExplorerUrl, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, parseVeridexError, signWithSessionKey, validateSessionConfig, verifySessionSignature };
5078
+ export { ARBITRUM_SEPOLIA_TOKENS, AUTH_MESSAGE_TYPES, AccountManager, type AccountManagerConfig, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type AddCredentialOptions, type AddGuardianParams, type ApproveProposalParams, type ApproveProposalResult, type ApproveRecoveryParams, type AuthPortalMessage, type AuthStrategy, AuthorizedKey, BASE_SEPOLIA_TOKENS, type BalanceChangeCallback, type BalanceChangeEvent, type BalanceErrorCallback, type BalanceEventType, BalanceManager, type BalanceManagerConfig, BalanceWatcher, type BalanceWatcherOptions, type BatchLifecycleCallback, type BatchLifecycleEvent, type BatchSpendingLimitRequest, type BatchSpendingLimitResult, type BatchTransferRequest, type BatchTransferResult, type BatchVaultRequest, type BatchVaultResult, type BridgeDetails, BridgeParams, BridgeResult, type BrowserCapabilities, CHAIN_CAPABILITIES, CHAIN_DISPLAY_INFO, CHAIN_NAMES, CHAIN_PRESETS, CONFIG_TYPE, type CancelProposalParams, type CancelRecoveryParams, ChainAddress, type ChainAddressConfig, type ChainCapabilities, type ChainCapabilityTier, ChainClient, ChainConfig, type ChainDeploymentConfig, ChainDetector, type ChainDetectorConfig, type ChainDisplay, type ChainName, type ChainTokenList, type ConfigDetails, type ConfigurePolicyParams, type CreateProposalParams, type CreateProposalResult, CredentialManager, type CredentialMetadata, type CredentialMetadataRecord, type CrossChainConfig, CrossChainManager, type CrossChainProgress, type CrossChainProgressCallback, type CrossChainResult, type CrossChainStatus, CrossOriginAuth, type CrossOriginAuthConfig, type CrossOriginSession, DEFAULT_AUTH_PORTAL_URL, DEFAULT_PROPOSAL_TTL, DEFAULT_PROTECTED_ACTION_MASK, 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, EnterpriseManager, type EnterpriseManagerConfig, type EnterpriseSDKConfig, type ExecuteDetails, ExecuteParams, type ExecuteProposalParams, type ExecuteProposalResult, type ExecuteRecoveryParams, type FeatureFlags, type FormattedSpendingLimits, GasSponsor, type GasSponsorConfig, type GuardiansResult, IDENTITY_REGISTRY_ABI, IDENTITY_REGISTRY_READ_ABI, IdentityState, IndexedDBSessionStorage, type InitiateRecoveryParams, InjectedWalletAdapter, type InjectedWalletAdapterConfig, type InjectedWalletConnection, type KeyPair, LIMIT_PRESETS, type LimitCheckResult, type LimitPreset, type LimitViolationSuggestion, type LimitViolationType, LocalStorageSessionStorage, MAX_SESSION_DURATION, MIN_SESSION_DURATION, MONAD_TESTNET_TOKENS, type ManagedCredential, type MultiChainVaultResult, type MultisigCapableChainClient, MultisigManager, type MultisigManagerConfig, type MultisigPolicy, NATIVE_TOKEN_ADDRESS, type NativeBalanceCapable, type NetworkType, OPTIMISM_SEPOLIA_TOKENS, PROTECTED_ACTION, PasskeyCredential$1 as PasskeyCredential, PasskeyManager, type PlatformCapabilityMatrix, type PlatformHint, type PolicyViolationCode, PolicyViolationError, type PortabilityOverview, type PortfolioBalance, PreparedBridge, PreparedTransfer, type ProposalActionSummary, type ProposalState, REPUTATION_REGISTRY_ABI, REPUTATION_REGISTRY_READ_ABI, ReceiveAddress, type RecipientDisplay, type RecoveryCapableChainClient, RecoveryManager, type RecoveryManagerConfig, type RecoveryOverview, type RecoveryReadiness, type RecoveryStatusResult, type RegisteredAppDetail, type RegisteredAppStatus, type RegisteredAppSummary, type RegisteredAppTrustLevel, type RelayFeeQuote, type RelayRequest, type RelayRoute, type RelayStatus, type RelayerAppSession, RelayerClient, type RelayerClientConfig, type RelayerInfo, type RemoveGuardianParams, RemoveKeyResult, type RiskLevel, type RiskWarning, type RiskWarningType, type ServerSessionToken, SessionKey, SessionStorage, type SetDailyLimitParams, type SetTransactionLimitParams, type SetupGuardiansParams, 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 TokenBalanceChange, type TokenDisplay, type TokenInfo$1 as TokenInfo, type TrackerConfig, type TransactionAuditEntry, type TransactionCallback, TransactionParser, type TransactionParserConfig, type TransactionProposal, type TransactionState, type TransactionStatus, type TransactionSummary, TransactionTracker, type TransferDetails, TransferParams, TransferResult, VeridexErrorCode as UnifiedErrorCode, UnifiedIdentity, type UniversalAgentIdentifier, type Unsubscribe, VAA, VALIDATION_REGISTRY_ABI, VERIDEX_ERRORS, VaultCreationResult, VaultInfo, type VaultOverview, VeridexConfig, VeridexError, type VeridexErrorCode$1 as VeridexErrorCode, VeridexPayload, VeridexSDK, type WalletEvent, type WalletEventCallback, WalletManager, WalletManagerConfig, WebAuthnSignature$1 as WebAuthnSignature, buildCapabilityMatrix, calculatePercentage, computeSessionKeyHash, createAuditEntry, createChainClient, createChainDetector, createCrossOriginAuth, createEnterpriseSDK, createGasSponsor, createHubSDK, createInjectedWalletAdapter, createMainnetSDK, createRelayerClient, createSDK, createSessionSDK, createSessionStorage, createSpendingLimitsManager, createTestnetSDK, createTransactionParser, crossChainManager, decrypt, VeridexSDK as default, deriveEncryptionKey, detectCapabilities, detectPlatform, encrypt, formatDuration, formatLargeAmount, formatTransactionState, generateSecp256k1KeyPair, getAllTokens, getAuthStrategy, getChainConfig, getChainDisplay, getChainName, getChainPreset, getConfigTypeName, getDefaultHub, getERC8004Addresses, getEffectivePrimaryHub, getErrorCategory, getErrorMessage, getExplorerUrl, getFeatureFlags, getHubChains, getSuggestedAction, getSupportedChainIds, getSupportedChains, getTokenByAddress, getTokenBySymbol, getTokenList, hashAction, isAbiError, isChainSupported, isCoreError, isERC8004Chain, isHubChain, isMultiHubEnabled, isNativeToken, isQueryError, isQueryExecutionError, isQueryParsingError, isRetryableError, logTransactionSummary, normalizeError, parseVeridexError, resetFeatureFlags, sendAuthError, sendAuthResponse, setFeatureFlags, signWithSessionKey, validateChainCapability, validateFederatedOrigin, validateMetaMaskInteropClaim, validateNoKeyExtraction, validateSessionConfig, validateSessionCreationPolicy, verifySessionSignature };