@veil-cash/sdk 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -27,6 +27,7 @@ export interface NetworkAddresses {
27
27
  usdcPool: `0x${string}`;
28
28
  usdcQueue: `0x${string}`;
29
29
  usdcToken: `0x${string}`;
30
+ forwarderFactory: `0x${string}`;
30
31
  chainId: number;
31
32
  relayUrl: string;
32
33
  }
@@ -308,3 +309,136 @@ export interface UtxoSelectionResult {
308
309
  /** Change amount to return to sender (wei) */
309
310
  changeAmount: bigint;
310
311
  }
312
+
313
+ // =============================================================================
314
+ // Subaccount Types
315
+ // =============================================================================
316
+
317
+ /**
318
+ * Supported subaccount assets
319
+ */
320
+ export type SubaccountAsset = 'eth' | 'usdc';
321
+
322
+ /**
323
+ * Deterministically derived subaccount slot metadata
324
+ */
325
+ export interface SubaccountSlot {
326
+ slot: number;
327
+ childOwner: `0x${string}`;
328
+ childDepositKey: string;
329
+ salt: `0x${string}`;
330
+ forwarderAddress: `0x${string}`;
331
+ }
332
+
333
+ /**
334
+ * Relay-backed forwarder deploy request
335
+ */
336
+ export interface SubaccountDeployRequest {
337
+ rootPrivateKey: `0x${string}`;
338
+ slot: number;
339
+ relayUrl?: string;
340
+ rpcUrl?: string;
341
+ }
342
+
343
+ /**
344
+ * Relay-backed forwarder sweep request
345
+ */
346
+ export interface SubaccountSweepRequest {
347
+ forwarderAddress: `0x${string}`;
348
+ asset: SubaccountAsset;
349
+ relayUrl?: string;
350
+ }
351
+
352
+ /**
353
+ * Relay response for subaccount deploy/sweep operations
354
+ */
355
+ export interface SubaccountRelayResult {
356
+ success: boolean;
357
+ transactionHash: string;
358
+ blockNumber: string;
359
+ gasUsed: string;
360
+ status: string;
361
+ network: string;
362
+ }
363
+
364
+ /**
365
+ * Human-readable and wei-denominated balance
366
+ */
367
+ export interface SubaccountAssetBalance {
368
+ balance: string;
369
+ balanceWei: string;
370
+ }
371
+
372
+ /**
373
+ * Forwarder wallet balances for both supported assets
374
+ */
375
+ export interface SubaccountBalances {
376
+ eth: SubaccountAssetBalance;
377
+ usdc: SubaccountAssetBalance;
378
+ }
379
+
380
+ /**
381
+ * Queue status for a specific asset
382
+ */
383
+ export interface SubaccountQueueStatus {
384
+ asset: SubaccountAsset;
385
+ queueBalance: string;
386
+ queueBalanceWei: string;
387
+ pendingCount: number;
388
+ pendingDeposits: PendingDeposit[];
389
+ }
390
+
391
+ /**
392
+ * Combined subaccount status result
393
+ */
394
+ export interface SubaccountStatusResult {
395
+ slot: SubaccountSlot;
396
+ deployed: boolean;
397
+ balances: SubaccountBalances;
398
+ queues: {
399
+ eth: SubaccountQueueStatus;
400
+ usdc: SubaccountQueueStatus;
401
+ };
402
+ }
403
+
404
+ /**
405
+ * Typed data for forwarder withdraw signing
406
+ */
407
+ export interface SubaccountWithdrawTypedData {
408
+ domain: {
409
+ name: 'VeilForwarder';
410
+ version: string;
411
+ chainId: number;
412
+ verifyingContract: `0x${string}`;
413
+ };
414
+ types: {
415
+ Withdraw: Array<{
416
+ name: 'token' | 'to' | 'amount' | 'nonce' | 'deadline';
417
+ type: 'address' | 'uint256';
418
+ }>;
419
+ };
420
+ primaryType: 'Withdraw';
421
+ message: {
422
+ token: `0x${string}`;
423
+ to: `0x${string}`;
424
+ amount: bigint;
425
+ nonce: bigint;
426
+ deadline: bigint;
427
+ };
428
+ }
429
+
430
+ /**
431
+ * Built recovery transaction and signing metadata
432
+ */
433
+ export interface SubaccountRecoveryResult {
434
+ transaction: TransactionData;
435
+ forwarderAddress: `0x${string}`;
436
+ asset: SubaccountAsset;
437
+ amount: string;
438
+ amountWei: string;
439
+ nonce: string;
440
+ deadline: string;
441
+ recipient: `0x${string}`;
442
+ tokenAddress: `0x${string}`;
443
+ signature: `0x${string}`;
444
+ }