@veridex/sdk 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +212 -0
- package/dist/chains/aptos/index.d.mts +140 -0
- package/dist/chains/aptos/index.d.ts +140 -0
- package/dist/chains/aptos/index.js +563 -0
- package/dist/chains/aptos/index.js.map +1 -0
- package/dist/chains/aptos/index.mjs +536 -0
- package/dist/chains/aptos/index.mjs.map +1 -0
- package/dist/chains/evm/index.d.mts +5 -0
- package/dist/chains/evm/index.d.ts +5 -0
- package/dist/chains/evm/index.js +1233 -0
- package/dist/chains/evm/index.js.map +1 -0
- package/dist/chains/evm/index.mjs +1205 -0
- package/dist/chains/evm/index.mjs.map +1 -0
- package/dist/chains/solana/index.d.mts +116 -0
- package/dist/chains/solana/index.d.ts +116 -0
- package/dist/chains/solana/index.js +513 -0
- package/dist/chains/solana/index.js.map +1 -0
- package/dist/chains/solana/index.mjs +491 -0
- package/dist/chains/solana/index.mjs.map +1 -0
- package/dist/chains/starknet/index.d.mts +172 -0
- package/dist/chains/starknet/index.d.ts +172 -0
- package/dist/chains/starknet/index.js +534 -0
- package/dist/chains/starknet/index.js.map +1 -0
- package/dist/chains/starknet/index.mjs +507 -0
- package/dist/chains/starknet/index.mjs.map +1 -0
- package/dist/chains/sui/index.d.mts +182 -0
- package/dist/chains/sui/index.d.ts +182 -0
- package/dist/chains/sui/index.js +560 -0
- package/dist/chains/sui/index.js.map +1 -0
- package/dist/chains/sui/index.mjs +533 -0
- package/dist/chains/sui/index.mjs.map +1 -0
- package/dist/constants.d.mts +150 -0
- package/dist/constants.d.ts +150 -0
- package/dist/constants.js +430 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +392 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/index-0NXfbk0z.d.ts +637 -0
- package/dist/index-D0dLVjTA.d.mts +637 -0
- package/dist/index.d.mts +3101 -0
- package/dist/index.d.ts +3101 -0
- package/dist/index.js +13186 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13011 -0
- package/dist/index.mjs.map +1 -0
- package/dist/payload.d.mts +125 -0
- package/dist/payload.d.ts +125 -0
- package/dist/payload.js +315 -0
- package/dist/payload.js.map +1 -0
- package/dist/payload.mjs +269 -0
- package/dist/payload.mjs.map +1 -0
- package/dist/queries/index.d.mts +148 -0
- package/dist/queries/index.d.ts +148 -0
- package/dist/queries/index.js +1533 -0
- package/dist/queries/index.js.map +1 -0
- package/dist/queries/index.mjs +1508 -0
- package/dist/queries/index.mjs.map +1 -0
- package/dist/types-ChIsqCiw.d.mts +565 -0
- package/dist/types-ChIsqCiw.d.ts +565 -0
- package/dist/types-FJL7j6gQ.d.mts +172 -0
- package/dist/types-FJL7j6gQ.d.ts +172 -0
- package/dist/types.d.mts +407 -0
- package/dist/types.d.ts +407 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/dist/types.mjs +1 -0
- package/dist/types.mjs.map +1 -0
- package/dist/utils.d.mts +81 -0
- package/dist/utils.d.ts +81 -0
- package/dist/utils.js +430 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +390 -0
- package/dist/utils.mjs.map +1 -0
- package/dist/wormhole.d.mts +167 -0
- package/dist/wormhole.d.ts +167 -0
- package/dist/wormhole.js +468 -0
- package/dist/wormhole.js.map +1 -0
- package/dist/wormhole.mjs +422 -0
- package/dist/wormhole.mjs.map +1 -0
- package/package.json +151 -0
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Veridex Protocol SDK - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
interface VeridexConfig {
|
|
5
|
+
hubChainId: number;
|
|
6
|
+
hubRpcUrl: string;
|
|
7
|
+
hubContractAddress: string;
|
|
8
|
+
relayerUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ChainConfig {
|
|
11
|
+
name: string;
|
|
12
|
+
chainId: number;
|
|
13
|
+
wormholeChainId: number;
|
|
14
|
+
hubChainId?: number;
|
|
15
|
+
rpcUrl: string;
|
|
16
|
+
explorerUrl: string;
|
|
17
|
+
isEvm: boolean;
|
|
18
|
+
contracts: {
|
|
19
|
+
hub?: string;
|
|
20
|
+
vaultFactory?: string;
|
|
21
|
+
vaultImplementation?: string;
|
|
22
|
+
wormholeCoreBridge: string;
|
|
23
|
+
tokenBridge?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface PasskeyCredential {
|
|
27
|
+
credentialId: string;
|
|
28
|
+
publicKeyX: bigint;
|
|
29
|
+
publicKeyY: bigint;
|
|
30
|
+
keyHash: string;
|
|
31
|
+
}
|
|
32
|
+
interface WebAuthnSignature {
|
|
33
|
+
authenticatorData: string;
|
|
34
|
+
clientDataJSON: string;
|
|
35
|
+
challengeIndex: number;
|
|
36
|
+
typeIndex: number;
|
|
37
|
+
r: bigint;
|
|
38
|
+
s: bigint;
|
|
39
|
+
}
|
|
40
|
+
interface TransferParams {
|
|
41
|
+
targetChain: number;
|
|
42
|
+
token: string;
|
|
43
|
+
recipient: string;
|
|
44
|
+
amount: bigint;
|
|
45
|
+
}
|
|
46
|
+
interface ExecuteParams {
|
|
47
|
+
targetChain: number;
|
|
48
|
+
target: string;
|
|
49
|
+
value: bigint;
|
|
50
|
+
data: string;
|
|
51
|
+
}
|
|
52
|
+
interface BridgeParams {
|
|
53
|
+
sourceChain: number;
|
|
54
|
+
token: string;
|
|
55
|
+
amount: bigint;
|
|
56
|
+
destinationChain: number;
|
|
57
|
+
recipient: string;
|
|
58
|
+
}
|
|
59
|
+
interface DispatchResult {
|
|
60
|
+
transactionHash: string;
|
|
61
|
+
sequence: bigint;
|
|
62
|
+
userKeyHash: string;
|
|
63
|
+
targetChain: number;
|
|
64
|
+
}
|
|
65
|
+
interface TransferAction {
|
|
66
|
+
type: 'transfer';
|
|
67
|
+
token: string;
|
|
68
|
+
recipient: string;
|
|
69
|
+
amount: bigint;
|
|
70
|
+
}
|
|
71
|
+
interface BridgeAction {
|
|
72
|
+
type: 'bridge';
|
|
73
|
+
token: string;
|
|
74
|
+
amount: bigint;
|
|
75
|
+
targetChain: number;
|
|
76
|
+
recipient: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Wormhole Query proof for optimistic execution
|
|
80
|
+
* Allows ~5-7 second latency vs ~120+ seconds for VAA
|
|
81
|
+
*/
|
|
82
|
+
interface QueryProof {
|
|
83
|
+
/** Raw query response bytes from Wormhole Guardians */
|
|
84
|
+
queryResponse: string;
|
|
85
|
+
/** Guardian signatures (13/19 quorum) */
|
|
86
|
+
signatures: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* User preference for execution path
|
|
90
|
+
*/
|
|
91
|
+
type ExecutionPath = 'query' | 'vaa' | 'auto';
|
|
92
|
+
/**
|
|
93
|
+
* Result from query-based submission
|
|
94
|
+
*/
|
|
95
|
+
interface QuerySubmissionResult {
|
|
96
|
+
/** Whether submission succeeded */
|
|
97
|
+
success: boolean;
|
|
98
|
+
/** Transaction hash on spoke chain */
|
|
99
|
+
txHash?: string;
|
|
100
|
+
/** Execution path used ('query' or 'vaa') */
|
|
101
|
+
path: ExecutionPath;
|
|
102
|
+
/** Latency in milliseconds */
|
|
103
|
+
latencyMs?: number;
|
|
104
|
+
/** Error message if failed */
|
|
105
|
+
error?: string;
|
|
106
|
+
/** Whether fallback to VAA was triggered */
|
|
107
|
+
fellBack?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Session key structure for temporary authentication
|
|
111
|
+
* Enables native L1 speed for repeat transactions without biometric auth
|
|
112
|
+
*/
|
|
113
|
+
interface SessionKey {
|
|
114
|
+
/** Hash of the temporary session public key */
|
|
115
|
+
sessionKeyHash: string;
|
|
116
|
+
/** Unix timestamp when session expires */
|
|
117
|
+
expiry: number;
|
|
118
|
+
/** Maximum transaction value for this session (0 = unlimited) */
|
|
119
|
+
maxValue: bigint;
|
|
120
|
+
/** Whether session was manually revoked */
|
|
121
|
+
revoked: boolean;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Result from session validation query
|
|
125
|
+
*/
|
|
126
|
+
interface SessionValidationResult {
|
|
127
|
+
/** Whether session is currently active */
|
|
128
|
+
active: boolean;
|
|
129
|
+
/** Session expiry timestamp (0 if inactive) */
|
|
130
|
+
expiry: number;
|
|
131
|
+
/** Maximum transaction value (0 if inactive) */
|
|
132
|
+
maxValue: bigint;
|
|
133
|
+
/** Index in sessions array */
|
|
134
|
+
sessionIndex: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Parameters for registering a new session
|
|
138
|
+
*/
|
|
139
|
+
interface RegisterSessionParams {
|
|
140
|
+
/** Signature for Passkey authentication */
|
|
141
|
+
signature: WebAuthnSignature;
|
|
142
|
+
/** User's Passkey public key X coordinate */
|
|
143
|
+
publicKeyX: bigint;
|
|
144
|
+
/** User's Passkey public key Y coordinate */
|
|
145
|
+
publicKeyY: bigint;
|
|
146
|
+
/** Hash of the temporary session public key */
|
|
147
|
+
sessionKeyHash: string;
|
|
148
|
+
/** Session duration in seconds (max 24 hours) */
|
|
149
|
+
duration: number;
|
|
150
|
+
/** Maximum transaction value (0 = unlimited) */
|
|
151
|
+
maxValue: bigint;
|
|
152
|
+
/** Whether to require user verification */
|
|
153
|
+
requireUV: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Parameters for revoking a session
|
|
157
|
+
*/
|
|
158
|
+
interface RevokeSessionParams {
|
|
159
|
+
/** Signature for Passkey authentication */
|
|
160
|
+
signature: WebAuthnSignature;
|
|
161
|
+
/** User's Passkey public key X coordinate */
|
|
162
|
+
publicKeyX: bigint;
|
|
163
|
+
/** User's Passkey public key Y coordinate */
|
|
164
|
+
publicKeyY: bigint;
|
|
165
|
+
/** Hash of the session key to revoke */
|
|
166
|
+
sessionKeyHash: string;
|
|
167
|
+
/** Whether to require user verification */
|
|
168
|
+
requireUV: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Identity state for multi-key management
|
|
172
|
+
* First passkey registered becomes the immutable identity root
|
|
173
|
+
*/
|
|
174
|
+
interface IdentityState {
|
|
175
|
+
/** Identity key hash (first passkey's keyHash) */
|
|
176
|
+
identity: string;
|
|
177
|
+
/** Number of authorized keys */
|
|
178
|
+
keyCount: number;
|
|
179
|
+
/** Maximum allowed keys per identity */
|
|
180
|
+
maxKeys: number;
|
|
181
|
+
/** Whether the specified key is the root identity */
|
|
182
|
+
isRoot: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Result from registering a backup passkey
|
|
186
|
+
*/
|
|
187
|
+
interface AddBackupKeyResult {
|
|
188
|
+
/** Transaction hash on Hub chain */
|
|
189
|
+
transactionHash: string;
|
|
190
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
191
|
+
sequence: bigint;
|
|
192
|
+
/** The identity the key was added to */
|
|
193
|
+
identity: string;
|
|
194
|
+
/** The new key hash that was added */
|
|
195
|
+
newKeyHash: string;
|
|
196
|
+
/** Total number of keys after addition */
|
|
197
|
+
keyCount: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Result from removing a passkey
|
|
201
|
+
*/
|
|
202
|
+
interface RemoveKeyResult {
|
|
203
|
+
/** Transaction hash on Hub chain */
|
|
204
|
+
transactionHash: string;
|
|
205
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
206
|
+
sequence: bigint;
|
|
207
|
+
/** The identity the key was removed from */
|
|
208
|
+
identity: string;
|
|
209
|
+
/** The key hash that was removed */
|
|
210
|
+
removedKeyHash: string;
|
|
211
|
+
/** Remaining number of keys after removal */
|
|
212
|
+
keyCount: number;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Authorized key information
|
|
216
|
+
*/
|
|
217
|
+
interface AuthorizedKey {
|
|
218
|
+
/** Key hash of the authorized passkey */
|
|
219
|
+
keyHash: string;
|
|
220
|
+
/** Whether this key is the root identity key */
|
|
221
|
+
isRoot: boolean;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Guardian configuration for an identity
|
|
225
|
+
*/
|
|
226
|
+
interface GuardianConfig {
|
|
227
|
+
/** Array of guardian key hashes */
|
|
228
|
+
guardians: string[];
|
|
229
|
+
/** Required approvals for recovery (M-of-N) */
|
|
230
|
+
threshold: bigint;
|
|
231
|
+
/** Whether guardians have been configured */
|
|
232
|
+
isConfigured: boolean;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Recovery status for an identity
|
|
236
|
+
*/
|
|
237
|
+
interface RecoveryStatus {
|
|
238
|
+
/** Whether a recovery is currently active */
|
|
239
|
+
isActive: boolean;
|
|
240
|
+
/** Proposed new owner key hash */
|
|
241
|
+
newOwnerKeyHash: string;
|
|
242
|
+
/** Timestamp when recovery was initiated */
|
|
243
|
+
initiatedAt: bigint;
|
|
244
|
+
/** Current number of guardian approvals */
|
|
245
|
+
approvalCount: bigint;
|
|
246
|
+
/** Required approvals for recovery */
|
|
247
|
+
threshold: bigint;
|
|
248
|
+
/** Timestamp when recovery can be executed (after timelock) */
|
|
249
|
+
canExecuteAt: bigint;
|
|
250
|
+
/** Timestamp when recovery expires */
|
|
251
|
+
expiresAt: bigint;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Result from setting up guardians
|
|
255
|
+
*/
|
|
256
|
+
interface SetupGuardiansResult {
|
|
257
|
+
/** Transaction hash on Hub chain */
|
|
258
|
+
transactionHash: string;
|
|
259
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
260
|
+
sequence: bigint;
|
|
261
|
+
/** The identity guardians were set up for */
|
|
262
|
+
identity: string;
|
|
263
|
+
/** Array of guardian key hashes */
|
|
264
|
+
guardians: string[];
|
|
265
|
+
/** Required approvals for recovery */
|
|
266
|
+
threshold: bigint;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Result from adding a guardian
|
|
270
|
+
*/
|
|
271
|
+
interface AddGuardianResult {
|
|
272
|
+
/** Transaction hash on Hub chain */
|
|
273
|
+
transactionHash: string;
|
|
274
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
275
|
+
sequence: bigint;
|
|
276
|
+
/** The identity the guardian was added to */
|
|
277
|
+
identity: string;
|
|
278
|
+
/** The guardian key hash that was added */
|
|
279
|
+
guardianKeyHash: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Result from removing a guardian
|
|
283
|
+
*/
|
|
284
|
+
interface RemoveGuardianResult {
|
|
285
|
+
/** Transaction hash on Hub chain */
|
|
286
|
+
transactionHash: string;
|
|
287
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
288
|
+
sequence: bigint;
|
|
289
|
+
/** The identity the guardian was removed from */
|
|
290
|
+
identity: string;
|
|
291
|
+
/** The guardian key hash that was removed */
|
|
292
|
+
guardianKeyHash: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Result from initiating recovery
|
|
296
|
+
*/
|
|
297
|
+
interface InitiateRecoveryResult {
|
|
298
|
+
/** Transaction hash on Hub chain */
|
|
299
|
+
transactionHash: string;
|
|
300
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
301
|
+
sequence: bigint;
|
|
302
|
+
/** The identity being recovered */
|
|
303
|
+
identity: string;
|
|
304
|
+
/** Proposed new owner key hash */
|
|
305
|
+
newOwnerKeyHash: string;
|
|
306
|
+
/** Timestamp when recovery can be executed */
|
|
307
|
+
canExecuteAt: bigint;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Result from approving recovery
|
|
311
|
+
*/
|
|
312
|
+
interface ApproveRecoveryResult {
|
|
313
|
+
/** Transaction hash on Hub chain */
|
|
314
|
+
transactionHash: string;
|
|
315
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
316
|
+
sequence: bigint;
|
|
317
|
+
/** The identity being recovered */
|
|
318
|
+
identity: string;
|
|
319
|
+
/** The guardian who approved */
|
|
320
|
+
guardianKeyHash: string;
|
|
321
|
+
/** Current approval count */
|
|
322
|
+
approvalCount: bigint;
|
|
323
|
+
/** Required approvals */
|
|
324
|
+
threshold: bigint;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Result from executing recovery
|
|
328
|
+
*/
|
|
329
|
+
interface ExecuteRecoveryResult {
|
|
330
|
+
/** Transaction hash on Hub chain */
|
|
331
|
+
transactionHash: string;
|
|
332
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
333
|
+
sequence: bigint;
|
|
334
|
+
/** The identity that was recovered */
|
|
335
|
+
identity: string;
|
|
336
|
+
/** The new owner key hash */
|
|
337
|
+
newOwnerKeyHash: string;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Result from cancelling recovery
|
|
341
|
+
*/
|
|
342
|
+
interface CancelRecoveryResult {
|
|
343
|
+
/** Transaction hash on Hub chain */
|
|
344
|
+
transactionHash: string;
|
|
345
|
+
/** Wormhole sequence number for cross-chain sync */
|
|
346
|
+
sequence: bigint;
|
|
347
|
+
/** The identity whose recovery was cancelled */
|
|
348
|
+
identity: string;
|
|
349
|
+
}
|
|
350
|
+
interface ExecuteAction {
|
|
351
|
+
type: 'execute';
|
|
352
|
+
target: string;
|
|
353
|
+
value: bigint;
|
|
354
|
+
data: string;
|
|
355
|
+
}
|
|
356
|
+
interface ConfigAction {
|
|
357
|
+
type: 'config';
|
|
358
|
+
configType: number;
|
|
359
|
+
configData: string;
|
|
360
|
+
}
|
|
361
|
+
type ActionPayload = TransferAction | BridgeAction | ExecuteAction | ConfigAction | {
|
|
362
|
+
type: string;
|
|
363
|
+
raw: string;
|
|
364
|
+
};
|
|
365
|
+
interface VAA {
|
|
366
|
+
version: number;
|
|
367
|
+
guardianSetIndex: number;
|
|
368
|
+
signatures: VAASignature[];
|
|
369
|
+
timestamp: number;
|
|
370
|
+
nonce: number;
|
|
371
|
+
emitterChain: number;
|
|
372
|
+
emitterAddress: string;
|
|
373
|
+
sequence: bigint;
|
|
374
|
+
consistencyLevel: number;
|
|
375
|
+
payload: string;
|
|
376
|
+
hash: string;
|
|
377
|
+
}
|
|
378
|
+
interface VAASignature {
|
|
379
|
+
guardianIndex: number;
|
|
380
|
+
signature: string;
|
|
381
|
+
}
|
|
382
|
+
interface VeridexPayload {
|
|
383
|
+
version: number;
|
|
384
|
+
userKeyHash: string;
|
|
385
|
+
targetChain: number;
|
|
386
|
+
nonce: bigint;
|
|
387
|
+
publicKeyX: bigint;
|
|
388
|
+
publicKeyY: bigint;
|
|
389
|
+
actionPayload: string;
|
|
390
|
+
}
|
|
391
|
+
interface VaultInfo {
|
|
392
|
+
address: string;
|
|
393
|
+
ownerKeyHash: string;
|
|
394
|
+
chain: string;
|
|
395
|
+
wormholeChainId: number;
|
|
396
|
+
}
|
|
397
|
+
interface TestResult {
|
|
398
|
+
success: boolean;
|
|
399
|
+
sourceChain: string;
|
|
400
|
+
targetChain: string;
|
|
401
|
+
txHash?: string;
|
|
402
|
+
vaaSequence?: bigint;
|
|
403
|
+
error?: string;
|
|
404
|
+
duration?: number;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export type { ActionPayload, AddBackupKeyResult, AddGuardianResult, ApproveRecoveryResult, AuthorizedKey, BridgeAction, BridgeParams, CancelRecoveryResult, ChainConfig, ConfigAction, DispatchResult, ExecuteAction, ExecuteParams, ExecuteRecoveryResult, ExecutionPath, GuardianConfig, IdentityState, InitiateRecoveryResult, PasskeyCredential, QueryProof, QuerySubmissionResult, RecoveryStatus, RegisterSessionParams, RemoveGuardianResult, RemoveKeyResult, RevokeSessionParams, SessionKey, SessionValidationResult, SetupGuardiansResult, TestResult, TransferAction, TransferParams, VAA, VAASignature, VaultInfo, VeridexConfig, VeridexPayload, WebAuthnSignature };
|