@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
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { S as SessionKey } from '../../types-FJL7j6gQ.js';
|
|
2
|
-
import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult, R as RegisterSessionParams, b as RevokeSessionParams, S as SessionValidationResult } from '../../types-ChIsqCiw.js';
|
|
3
|
-
import { RpcProvider } from 'starknet';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Veridex Protocol SDK - Starknet Chain Client
|
|
7
|
-
*
|
|
8
|
-
* Production-grade implementation of ChainClient interface for Starknet.
|
|
9
|
-
* Supports custom bridge attestation, gasless execution via Hub dispatch.
|
|
10
|
-
*
|
|
11
|
-
* Security:
|
|
12
|
-
* - Native starknet::eth_signature::verify_eth_signature for validation
|
|
13
|
-
* - Custom bridge with multi-relayer threshold attestations
|
|
14
|
-
* - Replay protection via nonce verification on Hub
|
|
15
|
-
* - Bridge validates source_chain == hub_chain_id (10004 = Base Sepolia)
|
|
16
|
-
*
|
|
17
|
-
* Architecture:
|
|
18
|
-
* - Starknet actions MUST be dispatched via Hub (Base Sepolia)
|
|
19
|
-
* - Hub publishes Wormhole message → relayer monitors → relayer submits attestation
|
|
20
|
-
* - Bridge accumulates attestations → threshold reached → spoke executes
|
|
21
|
-
* - Spoke validates source_chain == hubChainId (NOT targetChain)
|
|
22
|
-
*
|
|
23
|
-
* Custom Bridge:
|
|
24
|
-
* - Bridge address: 0x2c458c1ae64556482b05cc2d3ee5b032ed114d68429dda2062c9849a5a725f8
|
|
25
|
-
* - Chain ID: 50001 (custom range 50000+, reserved for non-Wormhole chains)
|
|
26
|
-
* - Hub Chain ID: 10004 (Base Sepolia - what bridge validates as source)
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
interface StarknetClientConfig {
|
|
30
|
-
wormholeChainId: number;
|
|
31
|
-
rpcUrl: string;
|
|
32
|
-
spokeContractAddress?: string;
|
|
33
|
-
bridgeContractAddress?: string;
|
|
34
|
-
network?: 'mainnet' | 'sepolia' | 'testnet';
|
|
35
|
-
hubRpcUrl?: string;
|
|
36
|
-
hubContractAddress?: string;
|
|
37
|
-
}
|
|
38
|
-
declare class StarknetClient implements ChainClient {
|
|
39
|
-
private config;
|
|
40
|
-
private provider;
|
|
41
|
-
private hubRpcUrl?;
|
|
42
|
-
private hubContractAddress?;
|
|
43
|
-
constructor(config: StarknetClientConfig);
|
|
44
|
-
getConfig(): ChainConfig;
|
|
45
|
-
getNonce(_userKeyHash: string): Promise<bigint>;
|
|
46
|
-
getMessageFee(): Promise<bigint>;
|
|
47
|
-
buildTransferPayload(params: TransferParams): Promise<string>;
|
|
48
|
-
buildExecutePayload(params: ExecuteParams): Promise<string>;
|
|
49
|
-
buildBridgePayload(params: BridgeParams): Promise<string>;
|
|
50
|
-
dispatch(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, signer: any): Promise<DispatchResult>;
|
|
51
|
-
dispatchGasless(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, relayerUrl: string): Promise<DispatchResult>;
|
|
52
|
-
computeVaultAddress(userKeyHash: string): string;
|
|
53
|
-
vaultExists(userKeyHash: string): Promise<boolean>;
|
|
54
|
-
createVault(userKeyHash: string, signer: any): Promise<VaultCreationResult>;
|
|
55
|
-
createVaultSponsored?(userKeyHash: string, sponsorPrivateKey: string, rpcUrl?: string): Promise<VaultCreationResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Create a vault via the relayer (sponsored/gasless)
|
|
58
|
-
* This is the recommended way to create Starknet vaults
|
|
59
|
-
*
|
|
60
|
-
* The relayer will dispatch a vault creation action from Hub via custom bridge to Starknet spoke
|
|
61
|
-
*/
|
|
62
|
-
createVaultViaRelayer(userKeyHash: string, relayerUrl: string): Promise<VaultCreationResult>;
|
|
63
|
-
/**
|
|
64
|
-
* Get vault info via relayer (includes existence check)
|
|
65
|
-
*/
|
|
66
|
-
getVaultViaRelayer(userKeyHash: string, relayerUrl: string): Promise<{
|
|
67
|
-
vaultAddress: string;
|
|
68
|
-
exists: boolean;
|
|
69
|
-
}>;
|
|
70
|
-
estimateVaultCreationGas(_userKeyHash: string): Promise<bigint>;
|
|
71
|
-
getFactoryAddress(): string | undefined;
|
|
72
|
-
getImplementationAddress(): string | undefined;
|
|
73
|
-
getNativeBalance(address: string): Promise<bigint>;
|
|
74
|
-
getProvider(): RpcProvider;
|
|
75
|
-
/**
|
|
76
|
-
* Register a session key on the Hub (must be called via Hub client)
|
|
77
|
-
* Starknet spokes validate sessions via CCQ, but registration happens on Hub
|
|
78
|
-
*
|
|
79
|
-
* @throws Error - Session management must be done via Hub chain
|
|
80
|
-
*/
|
|
81
|
-
registerSession(_params: RegisterSessionParams): Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
* Revoke a session key on the Hub (must be called via Hub client)
|
|
84
|
-
*
|
|
85
|
-
* @throws Error - Session management must be done via Hub chain
|
|
86
|
-
*/
|
|
87
|
-
revokeSession(_params: RevokeSessionParams): Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Check if a session is active by querying the Hub
|
|
90
|
-
* This method queries the Hub contract directly for session validation
|
|
91
|
-
*
|
|
92
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
93
|
-
* @param sessionKeyHash - Hash of session key to validate
|
|
94
|
-
* @returns Session validation result with expiry and limits
|
|
95
|
-
*/
|
|
96
|
-
isSessionActive(userKeyHash: string, sessionKeyHash: string): Promise<SessionValidationResult>;
|
|
97
|
-
/**
|
|
98
|
-
* Get all sessions for a user from the Hub
|
|
99
|
-
*
|
|
100
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
101
|
-
* @returns Array of all sessions (active and expired/revoked)
|
|
102
|
-
*/
|
|
103
|
-
getUserSessions(userKeyHash: string): Promise<SessionKey[]>;
|
|
104
|
-
/**
|
|
105
|
-
* Get user state from Hub (comprehensive state query)
|
|
106
|
-
* Returns key hash, nonce, and last action hash for CCQ validation
|
|
107
|
-
*
|
|
108
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
109
|
-
* @returns User state with nonce and last action hash
|
|
110
|
-
*/
|
|
111
|
-
getUserState(userKeyHash: string): Promise<{
|
|
112
|
-
keyHash: string;
|
|
113
|
-
nonce: bigint;
|
|
114
|
-
lastActionHash: string;
|
|
115
|
-
}>;
|
|
116
|
-
/**
|
|
117
|
-
* Get user's last action hash from Hub
|
|
118
|
-
* Used for optimistic execution and nonce validation
|
|
119
|
-
*
|
|
120
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
121
|
-
* @returns Last action hash (zero hash if no actions)
|
|
122
|
-
*/
|
|
123
|
-
getUserLastActionHash(userKeyHash: string): Promise<string>;
|
|
124
|
-
/**
|
|
125
|
-
* Execute with query-based validation (faster than VAA, ~23s vs 60-90s)
|
|
126
|
-
* Uses Wormhole CCQ to validate Hub state, then executes on Starknet
|
|
127
|
-
*
|
|
128
|
-
* @param params Query execution parameters with CCQ response
|
|
129
|
-
* @returns Dispatch result with transaction hash
|
|
130
|
-
*
|
|
131
|
-
* @remarks
|
|
132
|
-
* Query-based execution flow:
|
|
133
|
-
* 1. Query Hub state via Wormhole CCQ
|
|
134
|
-
* 2. Validate Guardian signatures on query response
|
|
135
|
-
* 3. Execute on Starknet with validated state
|
|
136
|
-
* 4. Hub state must be < 60s stale (enforced by QueryVerifier)
|
|
137
|
-
*/
|
|
138
|
-
executeWithQuery(_params: {
|
|
139
|
-
userKeyHash: string;
|
|
140
|
-
queryResponse: Uint8Array;
|
|
141
|
-
actionType: number;
|
|
142
|
-
actionPayload: Uint8Array;
|
|
143
|
-
relayerUrl?: string;
|
|
144
|
-
}): Promise<DispatchResult>;
|
|
145
|
-
private computeKeyHash;
|
|
146
|
-
private buildMessageHash;
|
|
147
|
-
/**
|
|
148
|
-
* Get vault address by owner key hash
|
|
149
|
-
*
|
|
150
|
-
* @param ownerKeyHash - Owner's passkey hash
|
|
151
|
-
* @returns Vault address on Starknet (felt252 as hex string)
|
|
152
|
-
*/
|
|
153
|
-
getVaultAddress(ownerKeyHash: string): Promise<string | null>;
|
|
154
|
-
/**
|
|
155
|
-
* Check if vault exists and get basic info
|
|
156
|
-
*
|
|
157
|
-
* @param ownerKeyHash - Owner's passkey hash
|
|
158
|
-
* @returns Vault info or null if not found
|
|
159
|
-
*/
|
|
160
|
-
getVaultInfo(ownerKeyHash: string): Promise<{
|
|
161
|
-
address: string;
|
|
162
|
-
ownerKeyHash: string;
|
|
163
|
-
} | null>;
|
|
164
|
-
/**
|
|
165
|
-
* Check if spoke contract is paused
|
|
166
|
-
*
|
|
167
|
-
* @returns Whether the protocol is paused
|
|
168
|
-
*/
|
|
169
|
-
isProtocolPaused(): Promise<boolean>;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export { StarknetClient, type StarknetClientConfig };
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { SuiClient as SuiClient$1 } from '@mysten/sui/client';
|
|
2
|
-
import { S as SessionKey } from '../../types-FJL7j6gQ.js';
|
|
3
|
-
import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult, R as RegisterSessionParams, b as RevokeSessionParams, S as SessionValidationResult } from '../../types-ChIsqCiw.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Veridex Protocol SDK - Sui Chain Client
|
|
7
|
-
*
|
|
8
|
-
* Production-grade implementation of ChainClient interface for Sui.
|
|
9
|
-
* Supports session management, query-based execution, and vault operations.
|
|
10
|
-
*
|
|
11
|
-
* Security:
|
|
12
|
-
* - Native sui::ecdsa_k1::secp256k1_verify for signature validation
|
|
13
|
-
* - CCQ-based session validation with 60s staleness window
|
|
14
|
-
* - Replay protection via nonce verification
|
|
15
|
-
*
|
|
16
|
-
* Note: Sui is a spoke chain. Session registration/revocation happens on Hub.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
interface SuiClientConfig {
|
|
20
|
-
wormholeChainId: number;
|
|
21
|
-
rpcUrl: string;
|
|
22
|
-
packageId: string;
|
|
23
|
-
wormholeCoreBridge: string;
|
|
24
|
-
tokenBridge?: string;
|
|
25
|
-
network?: 'mainnet' | 'testnet' | 'devnet';
|
|
26
|
-
hubRpcUrl?: string;
|
|
27
|
-
hubContractAddress?: string;
|
|
28
|
-
}
|
|
29
|
-
declare class SuiClient implements ChainClient {
|
|
30
|
-
private config;
|
|
31
|
-
private client;
|
|
32
|
-
private packageId;
|
|
33
|
-
private hubRpcUrl?;
|
|
34
|
-
private hubContractAddress?;
|
|
35
|
-
constructor(config: SuiClientConfig);
|
|
36
|
-
getConfig(): ChainConfig;
|
|
37
|
-
getNonce(_userKeyHash: string): Promise<bigint>;
|
|
38
|
-
getMessageFee(): Promise<bigint>;
|
|
39
|
-
buildTransferPayload(params: TransferParams): Promise<string>;
|
|
40
|
-
buildExecutePayload(params: ExecuteParams): Promise<string>;
|
|
41
|
-
buildBridgePayload(params: BridgeParams): Promise<string>;
|
|
42
|
-
dispatch(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, signer: any): Promise<DispatchResult>;
|
|
43
|
-
dispatchGasless(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, relayerUrl: string): Promise<DispatchResult>;
|
|
44
|
-
getVaultAddress(userKeyHash: string): Promise<string | null>;
|
|
45
|
-
computeVaultAddress(userKeyHash: string): string;
|
|
46
|
-
vaultExists(_userKeyHash: string): Promise<boolean>;
|
|
47
|
-
createVault(userKeyHash: string, signer: any): Promise<VaultCreationResult>;
|
|
48
|
-
createVaultSponsored?(userKeyHash: string, sponsorPrivateKey: string, rpcUrl?: string): Promise<VaultCreationResult>;
|
|
49
|
-
/**
|
|
50
|
-
* Create a vault via the relayer (sponsored/gasless)
|
|
51
|
-
* This is the recommended way to create Sui vaults
|
|
52
|
-
*
|
|
53
|
-
* The relayer will dispatch a vault creation action from Hub to Sui spoke
|
|
54
|
-
*/
|
|
55
|
-
createVaultViaRelayer(userKeyHash: string, relayerUrl: string): Promise<VaultCreationResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Get vault info via relayer (includes existence check)
|
|
58
|
-
*/
|
|
59
|
-
getVaultViaRelayer(userKeyHash: string, relayerUrl: string): Promise<{
|
|
60
|
-
vaultAddress: string;
|
|
61
|
-
exists: boolean;
|
|
62
|
-
}>;
|
|
63
|
-
estimateVaultCreationGas(_userKeyHash: string): Promise<bigint>;
|
|
64
|
-
getFactoryAddress(): string | undefined;
|
|
65
|
-
getImplementationAddress(): string | undefined;
|
|
66
|
-
getNativeBalance(address: string): Promise<bigint>;
|
|
67
|
-
getTokenBalance(coinType: string, ownerAddress: string): Promise<bigint>;
|
|
68
|
-
getClient(): SuiClient$1;
|
|
69
|
-
getPackageId(): string;
|
|
70
|
-
/**
|
|
71
|
-
* Register a session key on the Hub (must be called via Hub client)
|
|
72
|
-
* Sui spokes validate sessions via CCQ, but registration happens on Hub
|
|
73
|
-
*
|
|
74
|
-
* @throws Error - Session management must be done via Hub chain
|
|
75
|
-
*/
|
|
76
|
-
registerSession(_params: RegisterSessionParams): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Revoke a session key on the Hub (must be called via Hub client)
|
|
79
|
-
*
|
|
80
|
-
* @throws Error - Session management must be done via Hub chain
|
|
81
|
-
*/
|
|
82
|
-
revokeSession(_params: RevokeSessionParams): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Check if a session is active by querying the Hub
|
|
85
|
-
* This method queries the Hub contract directly for session validation
|
|
86
|
-
*
|
|
87
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
88
|
-
* @param sessionKeyHash - Hash of session key to validate
|
|
89
|
-
* @returns Session validation result with expiry and limits
|
|
90
|
-
*/
|
|
91
|
-
isSessionActive(_userKeyHash: string, _sessionKeyHash: string): Promise<SessionValidationResult>;
|
|
92
|
-
/**
|
|
93
|
-
* Get all sessions for a user from the Hub
|
|
94
|
-
*
|
|
95
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
96
|
-
* @returns Array of all sessions (active and expired/revoked)
|
|
97
|
-
*/
|
|
98
|
-
getUserSessions(userKeyHash: string): Promise<SessionKey[]>;
|
|
99
|
-
/**
|
|
100
|
-
* Get user state from Hub (comprehensive state query)
|
|
101
|
-
* Returns key hash, nonce, and last action hash for CCQ validation
|
|
102
|
-
*
|
|
103
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
104
|
-
* @returns User state with nonce and last action hash
|
|
105
|
-
*/
|
|
106
|
-
getUserState(userKeyHash: string): Promise<{
|
|
107
|
-
keyHash: string;
|
|
108
|
-
nonce: bigint;
|
|
109
|
-
lastActionHash: string;
|
|
110
|
-
}>;
|
|
111
|
-
/**
|
|
112
|
-
* Get user's last action hash from Hub
|
|
113
|
-
* Used for optimistic execution and nonce validation
|
|
114
|
-
*
|
|
115
|
-
* @param userKeyHash - Hash of user's Passkey public key
|
|
116
|
-
* @returns Last action hash (zero hash if no actions)
|
|
117
|
-
*/
|
|
118
|
-
getUserLastActionHash(userKeyHash: string): Promise<string>;
|
|
119
|
-
/**
|
|
120
|
-
* Execute with query-based validation (faster than VAA, ~23s vs 60-90s)
|
|
121
|
-
* Uses Wormhole CCQ to validate Hub state, then executes on Sui
|
|
122
|
-
*
|
|
123
|
-
* @param params Query execution parameters with CCQ response
|
|
124
|
-
* @returns Dispatch result with transaction hash
|
|
125
|
-
*
|
|
126
|
-
* @remarks
|
|
127
|
-
* Query-based execution flow:
|
|
128
|
-
* 1. Query Hub state via Wormhole CCQ
|
|
129
|
-
* 2. Validate Guardian signatures on query response
|
|
130
|
-
* 3. Execute on Sui with validated state
|
|
131
|
-
* 4. Hub state must be < 60s stale (enforced by QueryVerifier)
|
|
132
|
-
*/
|
|
133
|
-
executeWithQuery(_params: {
|
|
134
|
-
userKeyHash: string;
|
|
135
|
-
queryResponse: Uint8Array;
|
|
136
|
-
actionType: number;
|
|
137
|
-
actionPayload: Uint8Array;
|
|
138
|
-
relayerUrl?: string;
|
|
139
|
-
}): Promise<DispatchResult>;
|
|
140
|
-
private computeKeyHash;
|
|
141
|
-
private buildMessageHash;
|
|
142
|
-
/**
|
|
143
|
-
* Get vault object ID by owner key hash
|
|
144
|
-
*
|
|
145
|
-
* @param ownerKeyHash - Owner's passkey hash (32 bytes as hex)
|
|
146
|
-
* @param configObjectId - Shared Config object ID
|
|
147
|
-
* @param registryObjectId - Shared VaultRegistry object ID
|
|
148
|
-
* @returns Vault object ID or null if not found
|
|
149
|
-
*/
|
|
150
|
-
getVaultId(ownerKeyHash: string, registryObjectId: string): Promise<string | null>;
|
|
151
|
-
/**
|
|
152
|
-
* Get vault owner key hash from vault object
|
|
153
|
-
*
|
|
154
|
-
* @param vaultObjectId - Vault object ID
|
|
155
|
-
* @returns Owner key hash as hex string
|
|
156
|
-
*/
|
|
157
|
-
getVaultOwner(vaultObjectId: string): Promise<string | null>;
|
|
158
|
-
/**
|
|
159
|
-
* Get authorized signers for a vault
|
|
160
|
-
*
|
|
161
|
-
* @param vaultObjectId - Vault object ID
|
|
162
|
-
* @returns Array of authorized signer key hashes
|
|
163
|
-
*/
|
|
164
|
-
getAuthorizedSigners(vaultObjectId: string): Promise<string[]>;
|
|
165
|
-
/**
|
|
166
|
-
* Check if a VAA has been processed (for replay protection)
|
|
167
|
-
*
|
|
168
|
-
* @param vaaHash - VAA hash as hex string
|
|
169
|
-
* @param processedVaasObjectId - ProcessedVAAs shared object ID
|
|
170
|
-
* @returns Whether the VAA has been processed
|
|
171
|
-
*/
|
|
172
|
-
isVaaProcessed(vaaHash: string, processedVaasObjectId: string): Promise<boolean>;
|
|
173
|
-
/**
|
|
174
|
-
* Check if protocol is paused
|
|
175
|
-
*
|
|
176
|
-
* @param configObjectId - Config shared object ID
|
|
177
|
-
* @returns Whether the protocol is paused
|
|
178
|
-
*/
|
|
179
|
-
isProtocolPaused(configObjectId: string): Promise<boolean>;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export { SuiClient, type SuiClientConfig };
|
package/dist/constants.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { ChainConfig } from './types.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Veridex Protocol SDK - Constants and Chain Configurations
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
declare const ACTION_TYPES: {
|
|
8
|
-
readonly TRANSFER: 1;
|
|
9
|
-
readonly EXECUTE: 2;
|
|
10
|
-
readonly CONFIG: 3;
|
|
11
|
-
readonly BRIDGE: 4;
|
|
12
|
-
};
|
|
13
|
-
declare const ACTION_TRANSFER = 1;
|
|
14
|
-
declare const ACTION_EXECUTE = 2;
|
|
15
|
-
declare const ACTION_CONFIG = 3;
|
|
16
|
-
declare const ACTION_BRIDGE = 4;
|
|
17
|
-
declare const PROTOCOL_VERSION = 1;
|
|
18
|
-
/**
|
|
19
|
-
* Wormhole Chain IDs organized by network
|
|
20
|
-
* @see https://docs.wormhole.com/wormhole/reference/constants
|
|
21
|
-
*/
|
|
22
|
-
declare const WORMHOLE_CHAIN_IDS: {
|
|
23
|
-
readonly MAINNET: {
|
|
24
|
-
readonly SOLANA: 1;
|
|
25
|
-
readonly ETHEREUM: 2;
|
|
26
|
-
readonly TERRA: 3;
|
|
27
|
-
readonly BSC: 4;
|
|
28
|
-
readonly POLYGON: 5;
|
|
29
|
-
readonly AVALANCHE: 6;
|
|
30
|
-
readonly OASIS: 7;
|
|
31
|
-
readonly ALGORAND: 8;
|
|
32
|
-
readonly AURORA: 9;
|
|
33
|
-
readonly FANTOM: 10;
|
|
34
|
-
readonly KARURA: 11;
|
|
35
|
-
readonly ACALA: 12;
|
|
36
|
-
readonly KLAYTN: 13;
|
|
37
|
-
readonly CELO: 14;
|
|
38
|
-
readonly NEAR: 15;
|
|
39
|
-
readonly MOONBEAM: 16;
|
|
40
|
-
readonly NEON: 17;
|
|
41
|
-
readonly TERRA2: 18;
|
|
42
|
-
readonly INJECTIVE: 19;
|
|
43
|
-
readonly OSMOSIS: 20;
|
|
44
|
-
readonly SUI: 21;
|
|
45
|
-
readonly APTOS: 22;
|
|
46
|
-
readonly ARBITRUM: 23;
|
|
47
|
-
readonly OPTIMISM: 24;
|
|
48
|
-
readonly GNOSIS: 25;
|
|
49
|
-
readonly PYTHNET: 26;
|
|
50
|
-
readonly XPLA: 28;
|
|
51
|
-
readonly BASE: 30;
|
|
52
|
-
readonly SEI: 32;
|
|
53
|
-
readonly ROOTSTOCK: 33;
|
|
54
|
-
readonly SCROLL: 34;
|
|
55
|
-
readonly MANTLE: 35;
|
|
56
|
-
readonly BLAST: 36;
|
|
57
|
-
readonly XLAYER: 37;
|
|
58
|
-
readonly LINEA: 38;
|
|
59
|
-
readonly BERACHAIN: 39;
|
|
60
|
-
readonly SEIEVM: 40;
|
|
61
|
-
};
|
|
62
|
-
readonly TESTNET: {
|
|
63
|
-
readonly SOLANA_DEVNET: 1;
|
|
64
|
-
readonly GOERLI: 2;
|
|
65
|
-
readonly BSC_TESTNET: 4;
|
|
66
|
-
readonly POLYGON_MUMBAI: 5;
|
|
67
|
-
readonly AVALANCHE_FUJI: 6;
|
|
68
|
-
readonly FANTOM_TESTNET: 10;
|
|
69
|
-
readonly CELO_ALFAJORES: 14;
|
|
70
|
-
readonly MOONBASE_ALPHA: 16;
|
|
71
|
-
readonly SUI_TESTNET: 21;
|
|
72
|
-
readonly APTOS_TESTNET: 22;
|
|
73
|
-
readonly SEPOLIA: 10002;
|
|
74
|
-
readonly ARBITRUM_SEPOLIA: 10003;
|
|
75
|
-
readonly BASE_SEPOLIA: 10004;
|
|
76
|
-
readonly OPTIMISM_SEPOLIA: 10005;
|
|
77
|
-
readonly HOLESKY: 10006;
|
|
78
|
-
readonly POLYGON_SEPOLIA: 10007;
|
|
79
|
-
readonly SEI_ATLANTIC_2: 10066;
|
|
80
|
-
readonly STARKNET_SEPOLIA: 50001;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
declare const WORMHOLE_CHAIN_IDS_FLAT: {
|
|
84
|
-
readonly SOLANA: 1;
|
|
85
|
-
readonly ETHEREUM: 2;
|
|
86
|
-
readonly TERRA: 3;
|
|
87
|
-
readonly BSC: 4;
|
|
88
|
-
readonly POLYGON: 5;
|
|
89
|
-
readonly AVALANCHE: 6;
|
|
90
|
-
readonly OASIS: 7;
|
|
91
|
-
readonly ALGORAND: 8;
|
|
92
|
-
readonly AURORA: 9;
|
|
93
|
-
readonly FANTOM: 10;
|
|
94
|
-
readonly KARURA: 11;
|
|
95
|
-
readonly ACALA: 12;
|
|
96
|
-
readonly KLAYTN: 13;
|
|
97
|
-
readonly CELO: 14;
|
|
98
|
-
readonly NEAR: 15;
|
|
99
|
-
readonly MOONBEAM: 16;
|
|
100
|
-
readonly NEON: 17;
|
|
101
|
-
readonly TERRA2: 18;
|
|
102
|
-
readonly INJECTIVE: 19;
|
|
103
|
-
readonly OSMOSIS: 20;
|
|
104
|
-
readonly SUI: 21;
|
|
105
|
-
readonly APTOS: 22;
|
|
106
|
-
readonly ARBITRUM: 23;
|
|
107
|
-
readonly OPTIMISM: 24;
|
|
108
|
-
readonly GNOSIS: 25;
|
|
109
|
-
readonly PYTHNET: 26;
|
|
110
|
-
readonly XPLA: 28;
|
|
111
|
-
readonly BASE: 30;
|
|
112
|
-
readonly SEI: 32;
|
|
113
|
-
readonly ROOTSTOCK: 33;
|
|
114
|
-
readonly SCROLL: 34;
|
|
115
|
-
readonly MANTLE: 35;
|
|
116
|
-
readonly BLAST: 36;
|
|
117
|
-
readonly XLAYER: 37;
|
|
118
|
-
readonly LINEA: 38;
|
|
119
|
-
readonly BERACHAIN: 39;
|
|
120
|
-
readonly SEIEVM: 40;
|
|
121
|
-
readonly SOLANA_DEVNET: 1;
|
|
122
|
-
readonly GOERLI: 2;
|
|
123
|
-
readonly BSC_TESTNET: 4;
|
|
124
|
-
readonly POLYGON_MUMBAI: 5;
|
|
125
|
-
readonly AVALANCHE_FUJI: 6;
|
|
126
|
-
readonly FANTOM_TESTNET: 10;
|
|
127
|
-
readonly CELO_ALFAJORES: 14;
|
|
128
|
-
readonly MOONBASE_ALPHA: 16;
|
|
129
|
-
readonly SUI_TESTNET: 21;
|
|
130
|
-
readonly APTOS_TESTNET: 22;
|
|
131
|
-
readonly ARBITRUM_SEPOLIA: 10003;
|
|
132
|
-
readonly BASE_SEPOLIA: 10004;
|
|
133
|
-
readonly OPTIMISM_SEPOLIA: 10005;
|
|
134
|
-
readonly POLYGON_SEPOLIA: 10007;
|
|
135
|
-
readonly HOLESKY: 10006;
|
|
136
|
-
readonly STARKNET_SEPOLIA: 50001;
|
|
137
|
-
};
|
|
138
|
-
declare const TESTNET_CHAINS: Record<string, ChainConfig>;
|
|
139
|
-
declare const MAINNET_CHAINS: Record<string, ChainConfig>;
|
|
140
|
-
declare const WORMHOLE_API: {
|
|
141
|
-
readonly MAINNET: "https://api.wormholescan.io";
|
|
142
|
-
readonly TESTNET: "https://api.testnet.wormholescan.io";
|
|
143
|
-
readonly GUARDIAN_RPC_MAINNET: "https://wormhole-v2-mainnet-api.certus.one";
|
|
144
|
-
readonly GUARDIAN_RPC_TESTNET: "https://wormhole-v2-testnet-api.certus.one";
|
|
145
|
-
};
|
|
146
|
-
declare const HUB_ABI: readonly ["function authenticateAndDispatch((bytes authenticatorData, string clientDataJSON, uint256 challengeIndex, uint256 typeIndex, uint256 r, uint256 s) auth, uint256 publicKeyX, uint256 publicKeyY, uint16 targetChain, bytes actionPayload) external payable returns (uint64 sequence)", "function authenticateRawAndDispatch(uint256 r, uint256 s, bytes32 messageHash, uint256 publicKeyX, uint256 publicKeyY, uint16 targetChain, bytes actionPayload, uint256 nonce) external payable returns (uint64 sequence)", "function getNonce(bytes32 userKeyHash) external view returns (uint256)", "function encodeTransferAction(address token, address recipient, uint256 amount) external pure returns (bytes)", "function encodeExecuteAction(address target, uint256 value, bytes data) external pure returns (bytes)", "function encodeBridgeAction(bytes32 token, uint256 amount, uint16 targetChain, bytes32 recipient) external pure returns (bytes)", "function messageFee() external view returns (uint256)", "event Dispatched(bytes32 indexed userKeyHash, uint16 targetChain, uint256 nonce, uint64 sequence, bytes actionPayload)"];
|
|
147
|
-
declare const VAULT_FACTORY_ABI: readonly ["function createVault(bytes32 userKeyHash) external returns (address)", "function getVault(bytes32 userKeyHash) external view returns (address)", "function vaultExists(bytes32 userKeyHash) external view returns (bool)", "event VaultCreated(bytes32 indexed userKeyHash, address vault)"];
|
|
148
|
-
declare const VAULT_ABI: readonly ["function execute(address target, uint256 value, bytes data) external returns (bytes)", "function executeFromHub(bytes32 vaaHash, uint16 emitterChain, bytes32 emitterAddress, bytes payload) external", "function owner() external view returns (bytes32)", "function hub() external view returns (address)", "receive() external payable"];
|
|
149
|
-
|
|
150
|
-
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 };
|