@veridex/sdk 1.0.0-beta.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +170 -21
- package/README.md +574 -117
- package/dist/EVMClient-DtqvdfUP.d.mts +376 -0
- package/dist/auth/prepareAuth.d.mts +25 -0
- package/dist/auth/prepareAuth.js +2406 -0
- package/dist/auth/prepareAuth.js.map +1 -0
- package/dist/auth/prepareAuth.mjs +151 -0
- package/dist/auth/prepareAuth.mjs.map +1 -0
- package/dist/chains/aptos/index.d.mts +6 -5
- package/dist/chains/aptos/index.js +66 -39
- package/dist/chains/aptos/index.js.map +1 -1
- package/dist/chains/aptos/index.mjs +5 -547
- package/dist/chains/aptos/index.mjs.map +1 -1
- package/dist/chains/avalanche/index.d.mts +137 -0
- package/dist/chains/avalanche/index.js +1555 -0
- package/dist/chains/avalanche/index.js.map +1 -0
- package/dist/chains/avalanche/index.mjs +10 -0
- package/dist/chains/avalanche/index.mjs.map +1 -0
- package/dist/chains/evm/index.d.mts +5 -3
- package/dist/chains/evm/index.js +165 -3
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/chains/evm/index.mjs +8 -1200
- package/dist/chains/evm/index.mjs.map +1 -1
- package/dist/chains/solana/index.d.mts +1 -1
- package/dist/chains/solana/index.js.map +1 -1
- package/dist/chains/solana/index.mjs +4 -486
- package/dist/chains/solana/index.mjs.map +1 -1
- package/dist/chains/stacks/index.d.mts +559 -0
- package/dist/chains/stacks/index.js +1207 -0
- package/dist/chains/stacks/index.js.map +1 -0
- package/dist/chains/stacks/index.mjs +71 -0
- package/dist/chains/stacks/index.mjs.map +1 -0
- package/dist/chains/starknet/index.d.mts +3 -3
- package/dist/chains/starknet/index.js.map +1 -1
- package/dist/chains/starknet/index.mjs +5 -503
- package/dist/chains/starknet/index.mjs.map +1 -1
- package/dist/chains/sui/index.d.mts +2 -2
- package/dist/chains/sui/index.js.map +1 -1
- package/dist/chains/sui/index.mjs +5 -529
- package/dist/chains/sui/index.mjs.map +1 -1
- package/dist/chunk-5T6KPH7A.mjs +1082 -0
- package/dist/chunk-5T6KPH7A.mjs.map +1 -0
- package/dist/chunk-72ZA3OYQ.mjs +20 -0
- package/dist/chunk-72ZA3OYQ.mjs.map +1 -0
- package/dist/chunk-EFIURACP.mjs +438 -0
- package/dist/chunk-EFIURACP.mjs.map +1 -0
- package/dist/chunk-F3YAGZSW.mjs +269 -0
- package/dist/chunk-F3YAGZSW.mjs.map +1 -0
- package/dist/chunk-GWJRKDSA.mjs +549 -0
- package/dist/chunk-GWJRKDSA.mjs.map +1 -0
- package/dist/chunk-M3MM4YMF.mjs +417 -0
- package/dist/chunk-M3MM4YMF.mjs.map +1 -0
- package/dist/chunk-N4A2RMUN.mjs +216 -0
- package/dist/chunk-N4A2RMUN.mjs.map +1 -0
- package/dist/chunk-NUWSMJFJ.mjs +179 -0
- package/dist/chunk-NUWSMJFJ.mjs.map +1 -0
- package/dist/chunk-OVMMTL6H.mjs +330 -0
- package/dist/chunk-OVMMTL6H.mjs.map +1 -0
- package/dist/chunk-PDHZ5X5O.mjs +565 -0
- package/dist/chunk-PDHZ5X5O.mjs.map +1 -0
- package/dist/chunk-PRHNGA4G.mjs +464 -0
- package/dist/chunk-PRHNGA4G.mjs.map +1 -0
- package/dist/chunk-Q5O3M5LP.mjs +422 -0
- package/dist/chunk-Q5O3M5LP.mjs.map +1 -0
- package/dist/chunk-QDO6NQ7P.mjs +840 -0
- package/dist/chunk-QDO6NQ7P.mjs.map +1 -0
- package/dist/chunk-QT4ZZ4GM.mjs +509 -0
- package/dist/chunk-QT4ZZ4GM.mjs.map +1 -0
- package/dist/chunk-USDA5JTN.mjs +1249 -0
- package/dist/chunk-USDA5JTN.mjs.map +1 -0
- package/dist/chunk-V636MIV3.mjs +52 -0
- package/dist/chunk-V636MIV3.mjs.map +1 -0
- package/dist/chunk-X7BZMSPQ.mjs +407 -0
- package/dist/chunk-X7BZMSPQ.mjs.map +1 -0
- package/dist/chunk-YCUJZ6Z7.mjs +829 -0
- package/dist/chunk-YCUJZ6Z7.mjs.map +1 -0
- package/dist/constants.d.mts +1 -1
- package/dist/constants.js +26 -12
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +16 -375
- package/dist/constants.mjs.map +1 -1
- package/dist/index-DDalBhAm.d.mts +243 -0
- package/dist/index.d.mts +2508 -556
- package/dist/index.js +14576 -9628
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4108 -7840
- package/dist/index.mjs.map +1 -1
- package/dist/passkey.d.mts +182 -0
- package/dist/passkey.js +914 -0
- package/dist/passkey.js.map +1 -0
- package/dist/passkey.mjs +15 -0
- package/dist/passkey.mjs.map +1 -0
- package/dist/payload.js.map +1 -1
- package/dist/payload.mjs +25 -244
- package/dist/payload.mjs.map +1 -1
- package/dist/portfolio-V347KZOL.mjs +13 -0
- package/dist/portfolio-V347KZOL.mjs.map +1 -0
- package/dist/queries/index.js +145 -12
- package/dist/queries/index.js.map +1 -1
- package/dist/queries/index.mjs +14 -1496
- package/dist/queries/index.mjs.map +1 -1
- package/dist/{types-FJL7j6gQ.d.ts → types-B7V5VNbO.d.mts} +6 -2
- package/dist/{types-ChIsqCiw.d.mts → types-DP2CQT8p.d.mts} +12 -1
- package/dist/types.d.mts +16 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.js +25 -11
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +19 -371
- package/dist/utils.mjs.map +1 -1
- package/dist/wormhole.js.map +1 -1
- package/dist/wormhole.mjs +25 -397
- package/dist/wormhole.mjs.map +1 -1
- package/package.json +28 -3
- package/scripts/patch-noble-curves.js +78 -0
- package/dist/chains/aptos/index.d.ts +0 -145
- package/dist/chains/evm/index.d.ts +0 -5
- package/dist/chains/solana/index.d.ts +0 -116
- package/dist/chains/starknet/index.d.ts +0 -172
- package/dist/chains/sui/index.d.ts +0 -182
- package/dist/constants.d.ts +0 -150
- package/dist/index-0NXfbk0z.d.ts +0 -637
- package/dist/index-D0dLVjTA.d.mts +0 -637
- package/dist/index.d.ts +0 -3123
- package/dist/payload.d.ts +0 -125
- package/dist/queries/index.d.ts +0 -148
- package/dist/types-ChIsqCiw.d.ts +0 -565
- package/dist/types-FJL7j6gQ.d.mts +0 -172
- package/dist/types.d.ts +0 -407
- package/dist/utils.d.ts +0 -81
- package/dist/wormhole.d.ts +0 -167
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
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,
|
|
8
|
-
|
|
9
|
-
export {
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
import '@
|
|
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
|
-
*
|
|
1420
|
+
* Veridex Protocol SDK - Chain Presets
|
|
1410
1421
|
*
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1422
|
+
* Pre-configured chain settings for easy SDK initialization.
|
|
1423
|
+
* Developers only need to specify chain name and network type.
|
|
1413
1424
|
*
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
*
|
|
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
|
-
*
|
|
1566
|
-
*
|
|
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
|
|
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
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
/**
|
|
1600
|
-
|
|
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 -
|
|
3320
|
+
* Veridex Protocol SDK - Feature Flags
|
|
2076
3321
|
*
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
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 {
|
|
3352
|
+
* import { setFeatureFlags, getFeatureFlags } from '@veridex/sdk';
|
|
2083
3353
|
*
|
|
2084
|
-
* //
|
|
2085
|
-
*
|
|
3354
|
+
* // Disable multi-hub (default for hackathon demos)
|
|
3355
|
+
* setFeatureFlags({ multiHub: false });
|
|
2086
3356
|
*
|
|
2087
|
-
* //
|
|
2088
|
-
*
|
|
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
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
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
|
|
3387
|
+
* Get current feature flags (immutable copy).
|
|
2137
3388
|
*/
|
|
2138
|
-
declare function
|
|
3389
|
+
declare function getFeatureFlags(): Readonly<FeatureFlags>;
|
|
2139
3390
|
/**
|
|
2140
|
-
*
|
|
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
|
|
3404
|
+
declare function setFeatureFlags(flags: Partial<FeatureFlags>): void;
|
|
2143
3405
|
/**
|
|
2144
|
-
*
|
|
3406
|
+
* Reset feature flags to defaults.
|
|
3407
|
+
* Useful for testing and cleanup.
|
|
2145
3408
|
*/
|
|
2146
|
-
declare function
|
|
3409
|
+
declare function resetFeatureFlags(): void;
|
|
2147
3410
|
/**
|
|
2148
|
-
* Check if
|
|
3411
|
+
* Check if multi-hub is enabled.
|
|
3412
|
+
* Convenience function used throughout the SDK.
|
|
2149
3413
|
*/
|
|
2150
|
-
declare function
|
|
3414
|
+
declare function isMultiHubEnabled(): boolean;
|
|
2151
3415
|
/**
|
|
2152
|
-
* Get
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
3551
|
+
* @returns SDK configured for the primary hub chain
|
|
2274
3552
|
*
|
|
2275
3553
|
* @example
|
|
2276
3554
|
* ```typescript
|
|
@@ -2320,356 +3598,629 @@ 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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
3608
|
+
sponsorPrivateKey: string;
|
|
2352
3609
|
/**
|
|
2353
|
-
*
|
|
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
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
} | null;
|
|
2364
|
-
private normalizeSuiAddress;
|
|
3612
|
+
relayerUrl: string;
|
|
3613
|
+
/**
|
|
3614
|
+
* Relayer API key (required for enterprise)
|
|
3615
|
+
*/
|
|
3616
|
+
relayerApiKey: string;
|
|
2365
3617
|
}
|
|
2366
|
-
|
|
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 -
|
|
3644
|
+
* Veridex Protocol SDK - Browser Capabilities Detection
|
|
2370
3645
|
*
|
|
2371
|
-
*
|
|
2372
|
-
*
|
|
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
|
-
*
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2378
|
-
*
|
|
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
|
-
*
|
|
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
|
|
3694
|
+
type PlatformHint = 'apple' | 'google' | 'windows' | 'android' | 'linux' | 'unknown';
|
|
2384
3695
|
/**
|
|
2385
|
-
*
|
|
3696
|
+
* Recommendation for the best authentication strategy on this browser.
|
|
2386
3697
|
*/
|
|
2387
|
-
interface
|
|
2388
|
-
/**
|
|
2389
|
-
|
|
2390
|
-
/**
|
|
2391
|
-
|
|
2392
|
-
/**
|
|
2393
|
-
|
|
2394
|
-
/**
|
|
2395
|
-
|
|
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
|
-
*
|
|
3709
|
+
* Detect the current platform/ecosystem from user agent and platform strings.
|
|
2415
3710
|
*/
|
|
2416
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
2451
|
-
* Uses full WebAuthn data for authenticateAndDispatch
|
|
3720
|
+
* Get the recommended authentication strategy based on detected capabilities.
|
|
2452
3721
|
*/
|
|
2453
|
-
|
|
2454
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
|
2497
|
-
/**
|
|
2498
|
-
|
|
2499
|
-
/**
|
|
2500
|
-
|
|
2501
|
-
/**
|
|
2502
|
-
|
|
2503
|
-
/**
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
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
|
-
*
|
|
3776
|
+
* A credential entry combining the base credential with metadata.
|
|
2522
3777
|
*/
|
|
2523
|
-
interface
|
|
2524
|
-
/**
|
|
2525
|
-
|
|
2526
|
-
/**
|
|
2527
|
-
|
|
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
|
-
*
|
|
2539
|
-
*/
|
|
2540
|
-
interface
|
|
2541
|
-
/**
|
|
2542
|
-
|
|
2543
|
-
/**
|
|
2544
|
-
|
|
2545
|
-
/**
|
|
2546
|
-
|
|
2547
|
-
/**
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
/**
|
|
2552
|
-
|
|
2553
|
-
/**
|
|
2554
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
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
|
-
*
|
|
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
|
|
2573
|
-
private baseUrl;
|
|
3996
|
+
declare class CrossOriginAuth {
|
|
2574
3997
|
private config;
|
|
2575
|
-
constructor(config
|
|
3998
|
+
constructor(config?: CrossOriginAuthConfig);
|
|
2576
3999
|
/**
|
|
2577
|
-
*
|
|
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
|
-
|
|
4003
|
+
supportsRelatedOrigins(): Promise<boolean>;
|
|
2580
4004
|
/**
|
|
2581
|
-
*
|
|
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
|
-
|
|
4007
|
+
isSupported(): boolean;
|
|
2591
4008
|
/**
|
|
2592
|
-
*
|
|
2593
|
-
*
|
|
2594
|
-
*
|
|
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
|
-
* @
|
|
2605
|
-
* @
|
|
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
|
-
|
|
4016
|
+
authenticate(challenge?: Uint8Array): Promise<{
|
|
4017
|
+
credential: PasskeyCredential$1;
|
|
4018
|
+
signature: WebAuthnSignature$1;
|
|
4019
|
+
}>;
|
|
2612
4020
|
/**
|
|
2613
|
-
*
|
|
4021
|
+
* Register a new passkey with veridex.network as the RP.
|
|
4022
|
+
* This should only be called from veridex.network origins.
|
|
2614
4023
|
*/
|
|
2615
|
-
|
|
4024
|
+
register(username: string, displayName: string): Promise<PasskeyCredential$1>;
|
|
2616
4025
|
/**
|
|
2617
|
-
*
|
|
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
|
-
|
|
4030
|
+
connectWithVeridex(options?: {
|
|
4031
|
+
sessionChallengeId?: string;
|
|
4032
|
+
sessionChallenge?: string;
|
|
4033
|
+
}): Promise<CrossOriginSession>;
|
|
2620
4034
|
/**
|
|
2621
|
-
*
|
|
4035
|
+
* Popup-based authentication flow.
|
|
2622
4036
|
*/
|
|
2623
|
-
|
|
4037
|
+
private authenticateViaPopup;
|
|
2624
4038
|
/**
|
|
2625
|
-
*
|
|
4039
|
+
* Redirect-based authentication flow.
|
|
4040
|
+
* Stores state in sessionStorage and redirects to auth portal.
|
|
2626
4041
|
*/
|
|
2627
|
-
|
|
4042
|
+
private initiateRedirectAuth;
|
|
2628
4043
|
/**
|
|
2629
|
-
*
|
|
4044
|
+
* Complete redirect-based authentication.
|
|
4045
|
+
* Call this on your callback page to extract the session from URL params.
|
|
2630
4046
|
*/
|
|
2631
|
-
|
|
4047
|
+
completeRedirectAuth(): CrossOriginSession | null;
|
|
2632
4048
|
/**
|
|
2633
|
-
*
|
|
4049
|
+
* Generate a random state string for CSRF protection.
|
|
2634
4050
|
*/
|
|
2635
|
-
|
|
4051
|
+
private generateState;
|
|
4052
|
+
private decodeBase64Url;
|
|
4053
|
+
private requestServerSessionChallenge;
|
|
2636
4054
|
/**
|
|
2637
|
-
* Get
|
|
4055
|
+
* Get the RP ID being used.
|
|
2638
4056
|
*/
|
|
2639
|
-
|
|
4057
|
+
getRpId(): string;
|
|
2640
4058
|
/**
|
|
2641
|
-
*
|
|
4059
|
+
* Get the auth portal URL.
|
|
2642
4060
|
*/
|
|
2643
|
-
|
|
4061
|
+
getAuthPortalUrl(): string;
|
|
2644
4062
|
/**
|
|
2645
|
-
*
|
|
4063
|
+
* Create a server-validated session token via the relayer.
|
|
4064
|
+
* Call this after authenticating (via ROR or auth portal) to get a
|
|
4065
|
+
* server-side session that the relayer can verify on subsequent requests.
|
|
2646
4066
|
*/
|
|
2647
|
-
|
|
4067
|
+
createServerSession(session: CrossOriginSession): Promise<ServerSessionToken>;
|
|
2648
4068
|
/**
|
|
2649
|
-
*
|
|
4069
|
+
* Validate an existing server session token.
|
|
4070
|
+
* Returns the session details if valid, null if expired/revoked.
|
|
2650
4071
|
*/
|
|
2651
|
-
|
|
4072
|
+
validateServerSession(sessionId: string): Promise<ServerSessionToken | null>;
|
|
2652
4073
|
/**
|
|
2653
|
-
*
|
|
4074
|
+
* Revoke a server session token.
|
|
2654
4075
|
*/
|
|
2655
|
-
|
|
4076
|
+
revokeServerSession(sessionId: string): Promise<boolean>;
|
|
2656
4077
|
/**
|
|
2657
|
-
*
|
|
4078
|
+
* Full authentication flow: authenticate + create server session.
|
|
4079
|
+
* Automatically detects ROR support and falls back to auth portal.
|
|
2658
4080
|
*/
|
|
2659
|
-
|
|
4081
|
+
authenticateAndCreateSession(options?: {
|
|
4082
|
+
permissions?: string[];
|
|
4083
|
+
expiresInMs?: number;
|
|
4084
|
+
}): Promise<{
|
|
4085
|
+
session: CrossOriginSession;
|
|
4086
|
+
serverSession: ServerSessionToken;
|
|
4087
|
+
}>;
|
|
4088
|
+
}
|
|
4089
|
+
/**
|
|
4090
|
+
* Create a CrossOriginAuth instance for third-party app integration.
|
|
4091
|
+
*
|
|
4092
|
+
* @example
|
|
4093
|
+
* ```typescript
|
|
4094
|
+
* const auth = createCrossOriginAuth();
|
|
4095
|
+
*
|
|
4096
|
+
* // Check for Related Origin support
|
|
4097
|
+
* if (await auth.supportsRelatedOrigins()) {
|
|
4098
|
+
* const { credential, signature } = await auth.authenticate();
|
|
4099
|
+
* } else {
|
|
4100
|
+
* const session = await auth.connectWithVeridex();
|
|
4101
|
+
* }
|
|
4102
|
+
* ```
|
|
4103
|
+
*/
|
|
4104
|
+
declare function createCrossOriginAuth(config?: CrossOriginAuthConfig): CrossOriginAuth;
|
|
4105
|
+
/**
|
|
4106
|
+
* Helper for the auth portal page to send results back to the calling app.
|
|
4107
|
+
* Only used on auth.veridex.network, not in third-party apps.
|
|
4108
|
+
*/
|
|
4109
|
+
declare function sendAuthResponse(session: CrossOriginSession, targetOrigin: string): void;
|
|
4110
|
+
/**
|
|
4111
|
+
* Helper for the auth portal to send an error back to the calling app.
|
|
4112
|
+
*/
|
|
4113
|
+
declare function sendAuthError(error: string, code: string, targetOrigin: string): void;
|
|
4114
|
+
|
|
4115
|
+
/**
|
|
4116
|
+
* Veridex Protocol SDK — Injected Wallet Adapter
|
|
4117
|
+
*
|
|
4118
|
+
* Provides a standardized adapter for browser-injected EIP-1193 wallets
|
|
4119
|
+
* (MetaMask, Rabby, Coinbase Wallet, etc.). Used as the on-chain signer
|
|
4120
|
+
* for Veridex SDK operations that require a funded EOA for gas payment.
|
|
4121
|
+
*
|
|
4122
|
+
* Capabilities beyond basic connect:
|
|
4123
|
+
* - EIP-1193 event forwarding (accountsChanged, chainChanged, disconnect)
|
|
4124
|
+
* - Connection state tracking
|
|
4125
|
+
* - Clean disconnect with listener teardown
|
|
4126
|
+
* - Static availability detection
|
|
4127
|
+
*
|
|
4128
|
+
* ADR-0040 compliance: This adapter never touches passkey material.
|
|
4129
|
+
* It only provides an ethers.Signer for on-chain transaction submission.
|
|
4130
|
+
*
|
|
4131
|
+
* @module InjectedWalletAdapter
|
|
4132
|
+
*/
|
|
4133
|
+
|
|
4134
|
+
interface InjectedWalletConnection {
|
|
4135
|
+
provider: ethers.BrowserProvider;
|
|
4136
|
+
signer: ethers.JsonRpcSigner;
|
|
4137
|
+
address: string;
|
|
4138
|
+
chainId: number;
|
|
4139
|
+
}
|
|
4140
|
+
type WalletEvent = {
|
|
4141
|
+
type: 'accountsChanged';
|
|
4142
|
+
accounts: string[];
|
|
4143
|
+
} | {
|
|
4144
|
+
type: 'chainChanged';
|
|
4145
|
+
chainId: number;
|
|
4146
|
+
} | {
|
|
4147
|
+
type: 'disconnect';
|
|
4148
|
+
error?: unknown;
|
|
4149
|
+
};
|
|
4150
|
+
type WalletEventCallback = (event: WalletEvent) => void;
|
|
4151
|
+
interface InjectedWalletAdapterConfig {
|
|
4152
|
+
expectedChainId?: number;
|
|
4153
|
+
autoSwitchChain?: boolean;
|
|
4154
|
+
}
|
|
4155
|
+
declare class InjectedWalletAdapter {
|
|
4156
|
+
private readonly config;
|
|
4157
|
+
private eventCallbacks;
|
|
4158
|
+
private ethereum;
|
|
4159
|
+
private boundAccountsChanged;
|
|
4160
|
+
private boundChainChanged;
|
|
4161
|
+
private boundDisconnect;
|
|
4162
|
+
private connection;
|
|
4163
|
+
constructor(config?: InjectedWalletAdapterConfig);
|
|
4164
|
+
private getEthereum;
|
|
4165
|
+
isAvailable(): boolean;
|
|
4166
|
+
/** Returns the current active connection, or null. */
|
|
4167
|
+
getConnection(): InjectedWalletConnection | null;
|
|
4168
|
+
connect(expectedChainId?: number | undefined): Promise<InjectedWalletConnection>;
|
|
4169
|
+
/** Disconnect: clears local state and removes event listeners. */
|
|
4170
|
+
disconnect(): void;
|
|
4171
|
+
switchChain(chainId: number): Promise<void>;
|
|
4172
|
+
getCurrentChainId(): Promise<number>;
|
|
4173
|
+
/** Subscribe to wallet events (accountsChanged, chainChanged, disconnect). */
|
|
4174
|
+
on(callback: WalletEventCallback): () => void;
|
|
4175
|
+
private emit;
|
|
4176
|
+
private attachEventListeners;
|
|
4177
|
+
private detachEventListeners;
|
|
4178
|
+
}
|
|
4179
|
+
declare function createInjectedWalletAdapter(config?: InjectedWalletAdapterConfig): InjectedWalletAdapter;
|
|
4180
|
+
|
|
4181
|
+
/**
|
|
4182
|
+
* Veridex Protocol SDK - Chain Detector
|
|
4183
|
+
*
|
|
4184
|
+
* Phase 4: Multi-chain client support helper.
|
|
4185
|
+
*
|
|
4186
|
+
* Provides:
|
|
4187
|
+
* - Chain config lookup (testnet/mainnet)
|
|
4188
|
+
* - Auto-configuration for non-EVM ChainClient instances
|
|
4189
|
+
*/
|
|
4190
|
+
|
|
4191
|
+
interface ChainDetectorConfig {
|
|
4192
|
+
testnet?: boolean;
|
|
4193
|
+
rpcUrls?: Record<number, string>;
|
|
4194
|
+
}
|
|
4195
|
+
interface NativeBalanceCapable {
|
|
4196
|
+
getNativeBalance(address: string): Promise<bigint>;
|
|
4197
|
+
}
|
|
4198
|
+
declare class ChainDetector {
|
|
4199
|
+
private readonly testnet;
|
|
4200
|
+
private readonly rpcUrls;
|
|
4201
|
+
private readonly walletManager;
|
|
4202
|
+
constructor(config?: ChainDetectorConfig);
|
|
4203
|
+
getChainConfig(wormholeChainId: number): ChainConfig | undefined;
|
|
2660
4204
|
/**
|
|
2661
|
-
*
|
|
4205
|
+
* Create a chain client for non-EVM chains using repo constants.
|
|
4206
|
+
* For EVM, callers should instantiate EVMClient directly (Hub-driven).
|
|
2662
4207
|
*/
|
|
2663
|
-
|
|
4208
|
+
createClient(wormholeChainId: number): ChainClient;
|
|
2664
4209
|
/**
|
|
2665
|
-
*
|
|
4210
|
+
* Derive a best-effort vault address for a chain from the passkey credential.
|
|
4211
|
+
*
|
|
4212
|
+
* - EVM chains: requires vaultFactory/vaultImplementation in constants.
|
|
4213
|
+
* - Non-EVM chains: uses WalletManager chain-specific derivation.
|
|
2666
4214
|
*/
|
|
2667
|
-
|
|
4215
|
+
deriveVaultAddress(credential: PasskeyCredential, wormholeChainId: number): ChainAddress | null;
|
|
4216
|
+
getNonEvmNativeTokenMeta(wormholeChainId: number): {
|
|
4217
|
+
symbol: string;
|
|
4218
|
+
name: string;
|
|
4219
|
+
decimals: number;
|
|
4220
|
+
} | null;
|
|
4221
|
+
private normalizeSuiAddress;
|
|
2668
4222
|
}
|
|
2669
|
-
|
|
2670
|
-
* Create a RelayerClient instance
|
|
2671
|
-
*/
|
|
2672
|
-
declare function createRelayerClient(config: RelayerClientConfig): RelayerClient;
|
|
4223
|
+
declare function createChainDetector(config?: ChainDetectorConfig): ChainDetector;
|
|
2673
4224
|
|
|
2674
4225
|
/**
|
|
2675
4226
|
* Veridex Protocol SDK - Session Cryptography Utilities
|
|
@@ -2846,11 +4397,11 @@ declare class IndexedDBSessionStorage implements SessionStorage {
|
|
|
2846
4397
|
/**
|
|
2847
4398
|
* Save a session (encrypts private key)
|
|
2848
4399
|
*/
|
|
2849
|
-
save(session: SessionKey): Promise<void>;
|
|
4400
|
+
save(session: SessionKey$1): Promise<void>;
|
|
2850
4401
|
/**
|
|
2851
4402
|
* Load the active session (decrypts private key)
|
|
2852
4403
|
*/
|
|
2853
|
-
load(): Promise<SessionKey | null>;
|
|
4404
|
+
load(): Promise<SessionKey$1 | null>;
|
|
2854
4405
|
/**
|
|
2855
4406
|
* Get all stored sessions (internal helper)
|
|
2856
4407
|
*/
|
|
@@ -2893,11 +4444,11 @@ declare class LocalStorageSessionStorage implements SessionStorage {
|
|
|
2893
4444
|
/**
|
|
2894
4445
|
* Save a session (encrypts private key)
|
|
2895
4446
|
*/
|
|
2896
|
-
save(session: SessionKey): Promise<void>;
|
|
4447
|
+
save(session: SessionKey$1): Promise<void>;
|
|
2897
4448
|
/**
|
|
2898
4449
|
* Load the active session (decrypts private key)
|
|
2899
4450
|
*/
|
|
2900
|
-
load(): Promise<SessionKey | null>;
|
|
4451
|
+
load(): Promise<SessionKey$1 | null>;
|
|
2901
4452
|
/**
|
|
2902
4453
|
* Clear all sessions
|
|
2903
4454
|
*/
|
|
@@ -3049,11 +4600,11 @@ declare const VERIDEX_ERRORS: {
|
|
|
3049
4600
|
/** ABI decoding failed (parsing) */
|
|
3050
4601
|
readonly QUERY_PARSE_ABI_FAILED: 6216;
|
|
3051
4602
|
};
|
|
3052
|
-
type VeridexErrorCode = (typeof VERIDEX_ERRORS)[keyof typeof VERIDEX_ERRORS];
|
|
4603
|
+
type VeridexErrorCode$1 = (typeof VERIDEX_ERRORS)[keyof typeof VERIDEX_ERRORS];
|
|
3053
4604
|
/**
|
|
3054
4605
|
* Human-readable error messages for each error code.
|
|
3055
4606
|
*/
|
|
3056
|
-
declare const ERROR_MESSAGES: Record<VeridexErrorCode, string>;
|
|
4607
|
+
declare const ERROR_MESSAGES: Record<VeridexErrorCode$1, string>;
|
|
3057
4608
|
/**
|
|
3058
4609
|
* Check if an error code is in the core protocol range.
|
|
3059
4610
|
*/
|
|
@@ -3088,7 +4639,7 @@ declare function getErrorMessage(code: number): string;
|
|
|
3088
4639
|
* @param error - The error object from a failed transaction
|
|
3089
4640
|
* @returns The error code if found, undefined otherwise
|
|
3090
4641
|
*/
|
|
3091
|
-
declare function parseVeridexError(error: unknown): VeridexErrorCode | undefined;
|
|
4642
|
+
declare function parseVeridexError(error: unknown): VeridexErrorCode$1 | undefined;
|
|
3092
4643
|
/**
|
|
3093
4644
|
* Check if the error is a retryable error (e.g., expired query can be refreshed).
|
|
3094
4645
|
*/
|
|
@@ -3098,26 +4649,427 @@ declare function isRetryableError(code: number): boolean;
|
|
|
3098
4649
|
*/
|
|
3099
4650
|
declare function getSuggestedAction(code: number): string;
|
|
3100
4651
|
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
4652
|
+
/**
|
|
4653
|
+
* Veridex Protocol SDK — Unified Error Normalization
|
|
4654
|
+
*
|
|
4655
|
+
* Wraps chain-specific errors (ethers, Anchor, Clarity, Starknet felt, etc.)
|
|
4656
|
+
* into a single VeridexError class with a unified code, human-readable message,
|
|
4657
|
+
* and chain identifier. Integrators can catch `VeridexError` consistently
|
|
4658
|
+
* regardless of which chain's SDK surfaced the underlying fault.
|
|
4659
|
+
*/
|
|
4660
|
+
/**
|
|
4661
|
+
* Language-agnostic error codes that map consistently across all chains.
|
|
4662
|
+
*/
|
|
4663
|
+
declare enum VeridexErrorCode {
|
|
4664
|
+
NO_CREDENTIAL = "NO_CREDENTIAL",
|
|
4665
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
4666
|
+
INVALID_SIGNATURE = "INVALID_SIGNATURE",
|
|
4667
|
+
VAULT_NOT_FOUND = "VAULT_NOT_FOUND",
|
|
4668
|
+
VAULT_PAUSED = "VAULT_PAUSED",
|
|
4669
|
+
PROTOCOL_PAUSED = "PROTOCOL_PAUSED",
|
|
4670
|
+
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
|
4671
|
+
DAILY_LIMIT_EXCEEDED = "DAILY_LIMIT_EXCEEDED",
|
|
4672
|
+
INVALID_PAYLOAD = "INVALID_PAYLOAD",
|
|
4673
|
+
INVALID_ACTION = "INVALID_ACTION",
|
|
4674
|
+
EXPIRED = "EXPIRED",
|
|
4675
|
+
VAA_ALREADY_PROCESSED = "VAA_ALREADY_PROCESSED",
|
|
4676
|
+
INVALID_VAA = "INVALID_VAA",
|
|
4677
|
+
INVALID_EMITTER = "INVALID_EMITTER",
|
|
4678
|
+
BRIDGE_ERROR = "BRIDGE_ERROR",
|
|
4679
|
+
RPC_ERROR = "RPC_ERROR",
|
|
4680
|
+
TIMEOUT = "TIMEOUT",
|
|
4681
|
+
RELAYER_ERROR = "RELAYER_ERROR",
|
|
4682
|
+
SESSION_EXPIRED = "SESSION_EXPIRED",
|
|
4683
|
+
SESSION_INVALID = "SESSION_INVALID",
|
|
4684
|
+
UNSUPPORTED_FEATURE = "UNSUPPORTED_FEATURE",
|
|
4685
|
+
UNKNOWN = "UNKNOWN"
|
|
4686
|
+
}
|
|
4687
|
+
/**
|
|
4688
|
+
* Unified error class for all Veridex SDK operations.
|
|
4689
|
+
*
|
|
4690
|
+
* @example
|
|
4691
|
+
* ```typescript
|
|
4692
|
+
* try {
|
|
4693
|
+
* await sdk.executeTransfer(prepared, signer);
|
|
4694
|
+
* } catch (err) {
|
|
4695
|
+
* if (err instanceof VeridexError) {
|
|
4696
|
+
* console.log(err.code); // 'INSUFFICIENT_FUNDS'
|
|
4697
|
+
* console.log(err.chain); // 'base'
|
|
4698
|
+
* console.log(err.cause); // original ethers error
|
|
4699
|
+
* }
|
|
4700
|
+
* }
|
|
4701
|
+
* ```
|
|
4702
|
+
*/
|
|
4703
|
+
declare class VeridexError extends Error {
|
|
4704
|
+
/** Unified error code */
|
|
4705
|
+
readonly code: VeridexErrorCode;
|
|
4706
|
+
/** Chain name where the error originated (e.g. 'base', 'solana') */
|
|
4707
|
+
readonly chain: string | undefined;
|
|
4708
|
+
/** Original chain-specific error */
|
|
4709
|
+
readonly cause: unknown;
|
|
4710
|
+
/** Whether the operation could succeed if retried */
|
|
4711
|
+
readonly retryable: boolean;
|
|
4712
|
+
constructor(code: VeridexErrorCode, message?: string, options?: {
|
|
4713
|
+
chain?: string;
|
|
4714
|
+
cause?: unknown;
|
|
4715
|
+
retryable?: boolean;
|
|
4716
|
+
});
|
|
4717
|
+
}
|
|
4718
|
+
/**
|
|
4719
|
+
* Normalize any chain-specific error into a VeridexError.
|
|
4720
|
+
*
|
|
4721
|
+
* Call this at SDK boundaries (dispatch, balance fetch, vault creation) to
|
|
4722
|
+
* give integrators a consistent error surface.
|
|
4723
|
+
*
|
|
4724
|
+
* @param error - The original error from chain client / RPC / Anchor / etc.
|
|
4725
|
+
* @param chain - Chain identifier string (e.g. 'base', 'solana', 'starknet')
|
|
4726
|
+
* @returns A VeridexError wrapping the original
|
|
4727
|
+
*/
|
|
4728
|
+
declare function normalizeError(error: unknown, chain?: string): VeridexError;
|
|
4729
|
+
|
|
4730
|
+
/**
|
|
4731
|
+
* Veridex Protocol SDK — Enterprise Manager
|
|
4732
|
+
*
|
|
4733
|
+
* Bundles the operations that enterprise / integrator back-ends need:
|
|
4734
|
+
* - Batch vault creation across chains
|
|
4735
|
+
* - Admin spending limit management for multiple vaults
|
|
4736
|
+
* - Server-side signing helpers (non-WebAuthn path)
|
|
4737
|
+
* - Pre-built webhook-style event subscription
|
|
4738
|
+
*
|
|
4739
|
+
* All features delegate to existing SDK primitives — this is an
|
|
4740
|
+
* orchestration layer, not a divergent code path.
|
|
4741
|
+
*/
|
|
4742
|
+
|
|
4743
|
+
interface EnterpriseManagerConfig {
|
|
4744
|
+
/**
|
|
4745
|
+
* The VeridexSDK instance (typically created via `createSDK` or
|
|
4746
|
+
* `createEnterpriseSDK` with a sponsor key).
|
|
4747
|
+
*/
|
|
4748
|
+
sdk: VeridexSDK;
|
|
4749
|
+
/**
|
|
4750
|
+
* Maximum concurrent operations for batch methods (default: 3).
|
|
4751
|
+
*/
|
|
4752
|
+
maxConcurrency?: number;
|
|
4753
|
+
}
|
|
4754
|
+
interface BatchVaultRequest {
|
|
4755
|
+
/** Key hashes to create vaults for */
|
|
4756
|
+
keyHashes: string[];
|
|
4757
|
+
/** Optional: specific chain IDs to create vaults on (defaults to all sponsored chains) */
|
|
4758
|
+
chainIds?: number[];
|
|
4759
|
+
/** Maximum concurrent vault creations (overrides config default) */
|
|
4760
|
+
maxConcurrency?: number;
|
|
4761
|
+
}
|
|
4762
|
+
interface BatchVaultResult {
|
|
4763
|
+
total: number;
|
|
4764
|
+
succeeded: number;
|
|
4765
|
+
failed: number;
|
|
4766
|
+
results: Array<{
|
|
4767
|
+
keyHash: string;
|
|
4768
|
+
result: MultiChainVaultResult | null;
|
|
4769
|
+
error?: string;
|
|
4770
|
+
}>;
|
|
4771
|
+
}
|
|
4772
|
+
interface BatchTransferRequest {
|
|
4773
|
+
/** Transfers to execute */
|
|
4774
|
+
transfers: TransferParams[];
|
|
4775
|
+
/** Signer to pay for gas */
|
|
4776
|
+
signer: any;
|
|
4777
|
+
/** Maximum concurrent transfers (overrides config default) */
|
|
4778
|
+
maxConcurrency?: number;
|
|
4779
|
+
}
|
|
4780
|
+
interface BatchTransferResult {
|
|
4781
|
+
total: number;
|
|
4782
|
+
succeeded: number;
|
|
4783
|
+
failed: number;
|
|
4784
|
+
results: Array<{
|
|
4785
|
+
params: TransferParams;
|
|
4786
|
+
result: TransferResult | null;
|
|
4787
|
+
error?: string;
|
|
4788
|
+
}>;
|
|
4789
|
+
}
|
|
4790
|
+
interface BatchSpendingLimitRequest {
|
|
4791
|
+
/** Vault addresses and their new daily limit */
|
|
4792
|
+
updates: Array<{
|
|
4793
|
+
/** New daily limit in wei/base units (0 = unlimited) */
|
|
4794
|
+
newLimit: bigint;
|
|
4795
|
+
}>;
|
|
4796
|
+
/** Signer to pay for gas */
|
|
4797
|
+
signer: any;
|
|
4798
|
+
}
|
|
4799
|
+
interface BatchSpendingLimitResult {
|
|
4800
|
+
total: number;
|
|
4801
|
+
succeeded: number;
|
|
4802
|
+
failed: number;
|
|
4803
|
+
results: Array<{
|
|
4804
|
+
newLimit: bigint;
|
|
4805
|
+
result: TransferResult | null;
|
|
4806
|
+
error?: string;
|
|
4807
|
+
}>;
|
|
4808
|
+
}
|
|
4809
|
+
/** Lifecycle event types for batch operations */
|
|
4810
|
+
type BatchLifecycleEvent = {
|
|
4811
|
+
type: 'started';
|
|
4812
|
+
total: number;
|
|
4813
|
+
} | {
|
|
4814
|
+
type: 'item_started';
|
|
4815
|
+
index: number;
|
|
4816
|
+
total: number;
|
|
4817
|
+
} | {
|
|
4818
|
+
type: 'item_completed';
|
|
4819
|
+
index: number;
|
|
4820
|
+
total: number;
|
|
4821
|
+
success: boolean;
|
|
4822
|
+
error?: string;
|
|
4823
|
+
} | {
|
|
4824
|
+
type: 'completed';
|
|
4825
|
+
succeeded: number;
|
|
4826
|
+
failed: number;
|
|
4827
|
+
total: number;
|
|
3107
4828
|
};
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
4829
|
+
/** Callback for batch operation lifecycle events */
|
|
4830
|
+
type BatchLifecycleCallback = (event: BatchLifecycleEvent) => void;
|
|
4831
|
+
interface VaultOverview {
|
|
4832
|
+
keyHash: string;
|
|
4833
|
+
vaultAddress: string;
|
|
4834
|
+
wormholeChainId: number;
|
|
4835
|
+
exists: boolean;
|
|
4836
|
+
balance?: PortfolioBalance;
|
|
4837
|
+
limits?: SpendingLimits;
|
|
4838
|
+
}
|
|
4839
|
+
/**
|
|
4840
|
+
* High-level orchestration for enterprise / integrator use cases.
|
|
4841
|
+
*
|
|
4842
|
+
* @example
|
|
4843
|
+
* ```typescript
|
|
4844
|
+
* import { createEnterpriseSDK, EnterpriseManager } from '@veridex/sdk';
|
|
4845
|
+
*
|
|
4846
|
+
* const sdk = createEnterpriseSDK({
|
|
4847
|
+
* sponsorPrivateKey: process.env.SPONSOR_KEY!,
|
|
4848
|
+
* relayerUrl: 'https://relayer.veridex.network',
|
|
4849
|
+
* relayerApiKey: 'key',
|
|
4850
|
+
* });
|
|
4851
|
+
*
|
|
4852
|
+
* const enterprise = new EnterpriseManager({ sdk });
|
|
4853
|
+
*
|
|
4854
|
+
* // Batch create vaults for 50 users
|
|
4855
|
+
* const result = await enterprise.batchCreateVaults({
|
|
4856
|
+
* keyHashes: userKeyHashes,
|
|
4857
|
+
* });
|
|
4858
|
+
*
|
|
4859
|
+
* // Watch all vaults for balance changes
|
|
4860
|
+
* const unsub = enterprise.watchVaultBalance(
|
|
4861
|
+
* 10004, vaultAddress,
|
|
4862
|
+
* (event) => callWebhook(event),
|
|
4863
|
+
* );
|
|
4864
|
+
* ```
|
|
4865
|
+
*/
|
|
4866
|
+
declare class EnterpriseManager {
|
|
4867
|
+
private readonly sdk;
|
|
4868
|
+
private readonly balanceWatcher;
|
|
4869
|
+
private readonly maxConcurrency;
|
|
4870
|
+
constructor(config: EnterpriseManagerConfig);
|
|
4871
|
+
/**
|
|
4872
|
+
* Run tasks with bounded concurrency.
|
|
4873
|
+
*/
|
|
4874
|
+
private runWithConcurrency;
|
|
4875
|
+
/**
|
|
4876
|
+
* Create sponsored vaults for multiple users with concurrency control.
|
|
4877
|
+
*
|
|
4878
|
+
* Uses the SDK's GasSponsor under the hood. Errors for individual
|
|
4879
|
+
* key hashes are captured, not thrown — the batch continues.
|
|
4880
|
+
*/
|
|
4881
|
+
batchCreateVaults(request: BatchVaultRequest, onLifecycle?: BatchLifecycleCallback): Promise<BatchVaultResult>;
|
|
4882
|
+
/**
|
|
4883
|
+
* Check vault existence across all sponsored chains for a key hash.
|
|
4884
|
+
*/
|
|
4885
|
+
checkVaults(keyHash: string): Promise<Record<number, {
|
|
4886
|
+
exists: boolean;
|
|
4887
|
+
address: string;
|
|
4888
|
+
}>>;
|
|
4889
|
+
/**
|
|
4890
|
+
* List all chains where sponsorship is available.
|
|
4891
|
+
*/
|
|
4892
|
+
getSponsoredChains(): ChainDeploymentConfig[];
|
|
4893
|
+
/**
|
|
4894
|
+
* Execute multiple transfers with concurrency control.
|
|
4895
|
+
*
|
|
4896
|
+
* Each transfer is prepared and executed independently. Errors are
|
|
4897
|
+
* captured per-transfer so the batch continues on individual failures.
|
|
4898
|
+
*
|
|
4899
|
+
* @example
|
|
4900
|
+
* ```typescript
|
|
4901
|
+
* const result = await enterprise.batchTransfer({
|
|
4902
|
+
* transfers: [
|
|
4903
|
+
* { targetChain: 10004, token: '0x...', recipient: '0xAlice', amount: 1000000n },
|
|
4904
|
+
* { targetChain: 10004, token: '0x...', recipient: '0xBob', amount: 2000000n },
|
|
4905
|
+
* ],
|
|
4906
|
+
* signer,
|
|
4907
|
+
* maxConcurrency: 2,
|
|
4908
|
+
* }, (event) => console.log(event.type, event));
|
|
4909
|
+
* ```
|
|
4910
|
+
*/
|
|
4911
|
+
batchTransfer(request: BatchTransferRequest, onLifecycle?: BatchLifecycleCallback): Promise<BatchTransferResult>;
|
|
4912
|
+
/**
|
|
4913
|
+
* Update daily spending limits for the current vault in sequence.
|
|
4914
|
+
*
|
|
4915
|
+
* Each limit update requires a passkey signature, so these are executed
|
|
4916
|
+
* one-at-a-time (signing cannot be parallelized).
|
|
4917
|
+
*
|
|
4918
|
+
* @example
|
|
4919
|
+
* ```typescript
|
|
4920
|
+
* const result = await enterprise.batchSetSpendingLimits({
|
|
4921
|
+
* updates: [
|
|
4922
|
+
* { newLimit: ethers.parseEther('5.0') },
|
|
4923
|
+
* { newLimit: ethers.parseEther('10.0') },
|
|
4924
|
+
* ],
|
|
4925
|
+
* signer,
|
|
4926
|
+
* });
|
|
4927
|
+
* ```
|
|
4928
|
+
*/
|
|
4929
|
+
batchSetSpendingLimits(request: BatchSpendingLimitRequest, onLifecycle?: BatchLifecycleCallback): Promise<BatchSpendingLimitResult>;
|
|
4930
|
+
/**
|
|
4931
|
+
* Read spending limits for any vault address on the current chain.
|
|
4932
|
+
* Useful for admin dashboards that need to inspect user vaults.
|
|
4933
|
+
*/
|
|
4934
|
+
getSpendingLimitsForVault(vaultAddress: string, wormholeChainId?: number): Promise<SpendingLimits>;
|
|
4935
|
+
/**
|
|
4936
|
+
* Read spending limits for multiple vaults in parallel.
|
|
4937
|
+
*/
|
|
4938
|
+
getSpendingLimitsForVaults(vaultAddresses: string[], wormholeChainId?: number): Promise<Map<string, SpendingLimits | Error>>;
|
|
4939
|
+
/**
|
|
4940
|
+
* Watch a vault's balance for changes.
|
|
4941
|
+
*
|
|
4942
|
+
* The callback fires whenever the polling interval detects a difference.
|
|
4943
|
+
* Returns an unsubscribe function.
|
|
4944
|
+
*
|
|
4945
|
+
* @example
|
|
4946
|
+
* ```typescript
|
|
4947
|
+
* const unsub = enterprise.watchVaultBalance(
|
|
4948
|
+
* 10004,
|
|
4949
|
+
* '0xVaultAddr',
|
|
4950
|
+
* (event) => {
|
|
4951
|
+
* // Push to webhook, update dashboard, etc.
|
|
4952
|
+
* fetch(webhookUrl, { method: 'POST', body: JSON.stringify(event) });
|
|
4953
|
+
* },
|
|
4954
|
+
* { intervalMs: 10_000 },
|
|
4955
|
+
* );
|
|
4956
|
+
* ```
|
|
4957
|
+
*/
|
|
4958
|
+
watchVaultBalance(wormholeChainId: number, address: string, onChange: BalanceChangeCallback, options?: BalanceWatcherOptions, onError?: BalanceErrorCallback): Unsubscribe;
|
|
4959
|
+
/**
|
|
4960
|
+
* Stop all active balance watchers.
|
|
4961
|
+
*/
|
|
4962
|
+
stopAllWatchers(): void;
|
|
4963
|
+
/**
|
|
4964
|
+
* Get number of active balance watchers.
|
|
4965
|
+
*/
|
|
4966
|
+
get activeWatcherCount(): number;
|
|
4967
|
+
/**
|
|
4968
|
+
* Get a combined overview for a vault: existence, balances, limits.
|
|
4969
|
+
*
|
|
4970
|
+
* Useful for rendering an admin dashboard row.
|
|
4971
|
+
*/
|
|
4972
|
+
getVaultOverview(keyHash: string, wormholeChainId?: number): Promise<VaultOverview>;
|
|
4973
|
+
}
|
|
4974
|
+
|
|
4975
|
+
/**
|
|
4976
|
+
* @packageDocumentation
|
|
4977
|
+
* @module erc8004/contracts
|
|
4978
|
+
* @description
|
|
4979
|
+
* Low-level ERC-8004 contract utilities shared across SDK layers.
|
|
4980
|
+
*
|
|
4981
|
+
* Provides:
|
|
4982
|
+
* - Contract instance creation for Identity, Reputation, and Validation registries
|
|
4983
|
+
* - Address resolution by chain and network
|
|
4984
|
+
* - ABI references
|
|
4985
|
+
*
|
|
4986
|
+
* This module lives in the core SDK (`@veridex/sdk`) so that both the agent-sdk
|
|
4987
|
+
* and relayer can share the same contract interaction utilities.
|
|
4988
|
+
*
|
|
4989
|
+
* References:
|
|
4990
|
+
* - ADR-0029 §SDK Module Structure
|
|
4991
|
+
* - ERC8004_IMPLEMENTATION_PLAN.md Phase 1
|
|
4992
|
+
*/
|
|
4993
|
+
/** Identity Registry — same address on ALL EVM mainnets */
|
|
4994
|
+
declare const ERC8004_MAINNET_IDENTITY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
4995
|
+
/** Reputation Registry — same address on ALL EVM mainnets */
|
|
4996
|
+
declare const ERC8004_MAINNET_REPUTATION = "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
|
|
4997
|
+
/** Identity Registry — same address on ALL EVM testnets */
|
|
4998
|
+
declare const ERC8004_TESTNET_IDENTITY = "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
4999
|
+
/** Reputation Registry — same address on ALL EVM testnets */
|
|
5000
|
+
declare const ERC8004_TESTNET_REPUTATION = "0x8004B663056A597Dffe9eCcC1965A193B7388713";
|
|
5001
|
+
/**
|
|
5002
|
+
* Resolve canonical ERC-8004 registry addresses for a given network.
|
|
5003
|
+
*/
|
|
5004
|
+
declare function getERC8004Addresses(testnet: boolean): {
|
|
5005
|
+
identityRegistry: string;
|
|
5006
|
+
reputationRegistry: string;
|
|
3113
5007
|
};
|
|
3114
5008
|
/**
|
|
3115
|
-
*
|
|
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
|
|
5009
|
+
* Check if a chain has ERC-8004 singletons deployed.
|
|
3120
5010
|
*/
|
|
3121
|
-
declare function
|
|
5011
|
+
declare function isERC8004Chain(chainName: string): boolean;
|
|
5012
|
+
/** Chains where ERC-8004 singletons are deployed */
|
|
5013
|
+
declare const ERC8004_CHAINS: {
|
|
5014
|
+
readonly mainnet: readonly ["ethereum", "base", "polygon", "arbitrum", "optimism", "linea", "megaeth", "monad"];
|
|
5015
|
+
readonly testnet: readonly ["ethereum-sepolia", "base-sepolia", "polygon-amoy", "arbitrum-sepolia", "optimism-sepolia", "monad-testnet"];
|
|
5016
|
+
};
|
|
5017
|
+
/** Minimal Identity Registry ABI for read operations */
|
|
5018
|
+
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)"];
|
|
5019
|
+
/** Minimal Reputation Registry ABI for read operations */
|
|
5020
|
+
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)"];
|
|
5021
|
+
/** Full Identity Registry ABI (read + write) */
|
|
5022
|
+
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)"];
|
|
5023
|
+
/** Full Reputation Registry ABI (read + write) */
|
|
5024
|
+
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)"];
|
|
5025
|
+
/** Validation Registry ABI (Phase 3 — spec still under active update) */
|
|
5026
|
+
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[])"];
|
|
5027
|
+
|
|
5028
|
+
/**
|
|
5029
|
+
* @packageDocumentation
|
|
5030
|
+
* @module erc8004/types
|
|
5031
|
+
* @description
|
|
5032
|
+
* On-chain types for ERC-8004 registries.
|
|
5033
|
+
* These are the low-level types that map directly to contract return values.
|
|
5034
|
+
*
|
|
5035
|
+
* Higher-level SDK config types live in `@veridex/agent-sdk/identity/types`.
|
|
5036
|
+
*/
|
|
5037
|
+
/** Agent registration as stored on-chain in the ERC-8004 Identity Registry */
|
|
5038
|
+
interface ERC8004AgentRegistration {
|
|
5039
|
+
agentId: bigint;
|
|
5040
|
+
owner: string;
|
|
5041
|
+
agentURI: string;
|
|
5042
|
+
agentWallet: string;
|
|
5043
|
+
}
|
|
5044
|
+
/** Key-value metadata entry */
|
|
5045
|
+
interface ERC8004MetadataEntry {
|
|
5046
|
+
key: string;
|
|
5047
|
+
value: string;
|
|
5048
|
+
}
|
|
5049
|
+
/** Individual feedback entry from the Reputation Registry */
|
|
5050
|
+
interface ERC8004FeedbackEntry {
|
|
5051
|
+
value: bigint;
|
|
5052
|
+
valueDecimals: number;
|
|
5053
|
+
tag1: string;
|
|
5054
|
+
tag2: string;
|
|
5055
|
+
isRevoked: boolean;
|
|
5056
|
+
}
|
|
5057
|
+
/** Aggregated feedback summary from the Reputation Registry */
|
|
5058
|
+
interface ERC8004FeedbackSummary {
|
|
5059
|
+
count: bigint;
|
|
5060
|
+
summaryValue: bigint;
|
|
5061
|
+
summaryValueDecimals: number;
|
|
5062
|
+
}
|
|
5063
|
+
/** Validation status from the Validation Registry */
|
|
5064
|
+
interface ERC8004ValidationStatus {
|
|
5065
|
+
validatorAddress: string;
|
|
5066
|
+
agentId: bigint;
|
|
5067
|
+
response: number;
|
|
5068
|
+
responseHash: string;
|
|
5069
|
+
tag: string;
|
|
5070
|
+
lastUpdate: bigint;
|
|
5071
|
+
}
|
|
5072
|
+
/** CAIP-2 universal agent identifier format */
|
|
5073
|
+
type UniversalAgentIdentifier = string;
|
|
3122
5074
|
|
|
3123
|
-
export { ARBITRUM_SEPOLIA_TOKENS, type ActionDetails, type ActionDisplayType, AddBackupKeyResult, type
|
|
5075
|
+
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 };
|