@dexterai/vault 0.4.2 → 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.
@@ -394,4 +394,175 @@ declare function deriveVaultPda(supabaseUserId: Uint8Array): {
394
394
  bump: number;
395
395
  };
396
396
 
397
- export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicFromIdentityParams, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicFromIdentity, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigId, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
397
+ /**
398
+ * LockedClaim instruction builders — the claim lifecycle.
399
+ * Mirrors the on-chain Anchor structs in
400
+ * programs/dexter-vault/src/instructions/{lock_voucher,settle_locked_voucher,
401
+ * transfer_lock_ownership,recover_abandoned_lock}.rs. Account ordering is
402
+ * consensus-critical and MUST match the program exactly.
403
+ */
404
+
405
+ interface TransferLockOwnershipParams {
406
+ claimPda: PublicKey;
407
+ currentHolder: PublicKey;
408
+ newHolder: PublicKey;
409
+ }
410
+ /**
411
+ * Account order MUST match the on-chain struct:
412
+ * [0] claim (writable)
413
+ * [1] current_holder (signer)
414
+ * Data: discriminator || new_holder (32-byte pubkey).
415
+ */
416
+ declare function buildTransferLockOwnershipInstruction(p: TransferLockOwnershipParams): TransactionInstruction;
417
+ interface SettleLockedVoucherParams {
418
+ swigAddress: PublicKey;
419
+ claimPda: PublicKey;
420
+ vaultPda: PublicKey;
421
+ holder: PublicKey;
422
+ dexterAuthority: PublicKey;
423
+ }
424
+ /**
425
+ * Account order MUST match the on-chain struct:
426
+ * [0] swig (readonly, == vault.swig_address)
427
+ * [1] swig_wallet_address (readonly, PDA derived from swig)
428
+ * [2] claim (writable)
429
+ * [3] vault (writable)
430
+ * [4] holder (signer — the current claim holder collecting)
431
+ * [5] dexter_authority (signer)
432
+ * Data: discriminator only (SettleLockedVoucherArgs is empty).
433
+ */
434
+ declare function buildSettleLockedVoucherInstruction(p: SettleLockedVoucherParams): TransactionInstruction;
435
+ interface RecoverAbandonedLockParams {
436
+ claimPda: PublicKey;
437
+ vaultPda: PublicKey;
438
+ clientDataJSON: Uint8Array;
439
+ authenticatorData: Uint8Array;
440
+ }
441
+ /**
442
+ * Account order MUST match the on-chain struct:
443
+ * [0] claim (writable)
444
+ * [1] vault (writable)
445
+ * [2] instructions_sysvar (readonly)
446
+ * Data: discriminator || vec(client_data_json) || vec(authenticator_data).
447
+ */
448
+ declare function buildRecoverAbandonedLockInstruction(p: RecoverAbandonedLockParams): TransactionInstruction;
449
+ /** LockedClaim PDA: [LOCKED_CLAIM_SEED, vault, voucher_hash] under the vault program. */
450
+ declare function deriveLockedClaimPda(vaultPda: PublicKey, voucherHash: Uint8Array): PublicKey;
451
+ interface LockVoucherParams {
452
+ vaultPda: PublicKey;
453
+ vaultUsdcAta: PublicKey;
454
+ swigAddress: PublicKey;
455
+ sellerHolder: PublicKey;
456
+ dexterAuthority: PublicKey;
457
+ payer: PublicKey;
458
+ channelId: Uint8Array;
459
+ cumulativeAmount: bigint;
460
+ sequenceNumber: number;
461
+ voucherHash: Uint8Array;
462
+ maturityAt: bigint | null;
463
+ holderRecoveryAt: bigint | null;
464
+ }
465
+ /**
466
+ * Account order MUST match the on-chain struct:
467
+ * [0] vault (writable)
468
+ * [1] vault_usdc_ata (readonly)
469
+ * [2] swig (readonly)
470
+ * [3] swig_wallet_address (readonly, PDA)
471
+ * [4] claim (writable, PDA [LOCKED_CLAIM_SEED, vault, voucher_hash])
472
+ * [5] seller_holder (signer)
473
+ * [6] dexter_authority (signer)
474
+ * [7] payer (signer, writable)
475
+ * [8] system_program (readonly)
476
+ * [9] instructions_sysvar (readonly)
477
+ * Data: disc || channel_id(32) || cumulative(u64) || sequence(u32)
478
+ * || voucher_hash(32) || option_i64(maturity_at) || option_i64(holder_recovery_at)
479
+ */
480
+ declare function buildLockVoucherInstruction(p: LockVoucherParams): TransactionInstruction;
481
+
482
+ /**
483
+ * Credit-L2 instruction builders — the standby-credit lifecycle.
484
+ * Mirrors the on-chain Anchor structs in
485
+ * programs/dexter-vault/src/instructions/{open_standby,draw_credit,repay_credit,
486
+ * seize_collateral,migrate_v4_to_v5}.rs. Account ordering is consensus-critical
487
+ * and MUST match the program exactly.
488
+ */
489
+
490
+ interface OpenStandbyParams {
491
+ vaultPda: PublicKey;
492
+ financierSwig: PublicKey;
493
+ cap: bigint;
494
+ clientDataJSON: Uint8Array;
495
+ authenticatorData: Uint8Array;
496
+ }
497
+ /**
498
+ * Account order MUST match the on-chain struct:
499
+ * [0] vault (writable)
500
+ * [1] financier_swig (readonly)
501
+ * [2] instructions_sysvar (readonly)
502
+ * Data: disc || cap(u64) || vec(client_data_json) || vec(authenticator_data).
503
+ */
504
+ declare function buildOpenStandbyInstruction(p: OpenStandbyParams): TransactionInstruction;
505
+ interface DrawCreditParams {
506
+ financierSwig: PublicKey;
507
+ vaultPda: PublicKey;
508
+ dexterAuthority: PublicKey;
509
+ amount: bigint;
510
+ recoveryWindowSeconds: bigint;
511
+ }
512
+ /**
513
+ * Account order MUST match the on-chain struct:
514
+ * [0] financier_swig (readonly)
515
+ * [1] financier_swig_wallet_address (readonly, PDA derived from financier_swig)
516
+ * [2] vault (writable)
517
+ * [3] dexter_authority (signer)
518
+ * [4] instructions_sysvar (readonly)
519
+ * Data: disc || amount(u64) || recovery_window_seconds(i64).
520
+ */
521
+ declare function buildDrawCreditInstruction(p: DrawCreditParams): TransactionInstruction;
522
+ interface RepayCreditParams {
523
+ swigAddress: PublicKey;
524
+ vaultPda: PublicKey;
525
+ dexterAuthority: PublicKey;
526
+ amount: bigint;
527
+ }
528
+ /**
529
+ * Account order MUST match the on-chain struct:
530
+ * [0] swig (readonly, the USER's swig)
531
+ * [1] swig_wallet_address (readonly, PDA derived from swig)
532
+ * [2] vault (writable)
533
+ * [3] dexter_authority (signer)
534
+ * [4] instructions_sysvar (readonly)
535
+ * Data: disc || amount(u64).
536
+ */
537
+ declare function buildRepayCreditInstruction(p: RepayCreditParams): TransactionInstruction;
538
+ interface SeizeCollateralParams {
539
+ swigAddress: PublicKey;
540
+ vaultPda: PublicKey;
541
+ dexterAuthority: PublicKey;
542
+ }
543
+ /**
544
+ * Account order MUST match the on-chain struct:
545
+ * [0] swig (readonly, the USER's swig)
546
+ * [1] swig_wallet_address (readonly, PDA derived from swig)
547
+ * [2] vault (writable)
548
+ * [3] dexter_authority (signer)
549
+ * [4] instructions_sysvar (readonly)
550
+ * Data: discriminator only (SeizeCollateralArgs is empty).
551
+ */
552
+ declare function buildSeizeCollateralInstruction(p: SeizeCollateralParams): TransactionInstruction;
553
+ interface MigrateV4ToV5Params {
554
+ vaultPda: PublicKey;
555
+ dexterAuthority: PublicKey;
556
+ payer: PublicKey;
557
+ }
558
+ /**
559
+ * Account order MUST match the on-chain struct:
560
+ * [0] vault (writable, AccountInfo validated in-handler)
561
+ * [1] dexter_authority (signer)
562
+ * [2] payer (signer, writable)
563
+ * [3] system_program (readonly)
564
+ * Data: discriminator only (MigrateV4ToV5Args is empty).
565
+ */
566
+ declare function buildMigrateV4ToV5Instruction(p: MigrateV4ToV5Params): TransactionInstruction;
567
+
568
+ export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicFromIdentityParams, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type DrawCreditParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type LockVoucherParams, type MigrateV4ToV5Params, type OpenStandbyParams, type ProvePasskeyParams, type RecoverAbandonedLockParams, type RepayCreditParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SeizeCollateralParams, type SetSwigParams, type SettleLockedVoucherParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, type TransferLockOwnershipParams, buildDrawCreditInstruction, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildLockVoucherInstruction, buildMigrateV4ToV5Instruction, buildOpenStandbyInstruction, buildProvePasskeyInstruction, buildRecoverAbandonedLockInstruction, buildRegisterSessionKeyInstruction, buildRepayCreditInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSeizeCollateralInstruction, buildSetSwigAtomicFromIdentity, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleLockedVoucherInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, buildTransferLockOwnershipInstruction, deriveLockedClaimPda, deriveSwigId, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
@@ -394,4 +394,175 @@ declare function deriveVaultPda(supabaseUserId: Uint8Array): {
394
394
  bump: number;
395
395
  };
396
396
 
397
- export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicFromIdentityParams, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type ProvePasskeyParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SetSwigParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildProvePasskeyInstruction, buildRegisterSessionKeyInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSetSwigAtomicFromIdentity, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, deriveSwigId, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };
397
+ /**
398
+ * LockedClaim instruction builders — the claim lifecycle.
399
+ * Mirrors the on-chain Anchor structs in
400
+ * programs/dexter-vault/src/instructions/{lock_voucher,settle_locked_voucher,
401
+ * transfer_lock_ownership,recover_abandoned_lock}.rs. Account ordering is
402
+ * consensus-critical and MUST match the program exactly.
403
+ */
404
+
405
+ interface TransferLockOwnershipParams {
406
+ claimPda: PublicKey;
407
+ currentHolder: PublicKey;
408
+ newHolder: PublicKey;
409
+ }
410
+ /**
411
+ * Account order MUST match the on-chain struct:
412
+ * [0] claim (writable)
413
+ * [1] current_holder (signer)
414
+ * Data: discriminator || new_holder (32-byte pubkey).
415
+ */
416
+ declare function buildTransferLockOwnershipInstruction(p: TransferLockOwnershipParams): TransactionInstruction;
417
+ interface SettleLockedVoucherParams {
418
+ swigAddress: PublicKey;
419
+ claimPda: PublicKey;
420
+ vaultPda: PublicKey;
421
+ holder: PublicKey;
422
+ dexterAuthority: PublicKey;
423
+ }
424
+ /**
425
+ * Account order MUST match the on-chain struct:
426
+ * [0] swig (readonly, == vault.swig_address)
427
+ * [1] swig_wallet_address (readonly, PDA derived from swig)
428
+ * [2] claim (writable)
429
+ * [3] vault (writable)
430
+ * [4] holder (signer — the current claim holder collecting)
431
+ * [5] dexter_authority (signer)
432
+ * Data: discriminator only (SettleLockedVoucherArgs is empty).
433
+ */
434
+ declare function buildSettleLockedVoucherInstruction(p: SettleLockedVoucherParams): TransactionInstruction;
435
+ interface RecoverAbandonedLockParams {
436
+ claimPda: PublicKey;
437
+ vaultPda: PublicKey;
438
+ clientDataJSON: Uint8Array;
439
+ authenticatorData: Uint8Array;
440
+ }
441
+ /**
442
+ * Account order MUST match the on-chain struct:
443
+ * [0] claim (writable)
444
+ * [1] vault (writable)
445
+ * [2] instructions_sysvar (readonly)
446
+ * Data: discriminator || vec(client_data_json) || vec(authenticator_data).
447
+ */
448
+ declare function buildRecoverAbandonedLockInstruction(p: RecoverAbandonedLockParams): TransactionInstruction;
449
+ /** LockedClaim PDA: [LOCKED_CLAIM_SEED, vault, voucher_hash] under the vault program. */
450
+ declare function deriveLockedClaimPda(vaultPda: PublicKey, voucherHash: Uint8Array): PublicKey;
451
+ interface LockVoucherParams {
452
+ vaultPda: PublicKey;
453
+ vaultUsdcAta: PublicKey;
454
+ swigAddress: PublicKey;
455
+ sellerHolder: PublicKey;
456
+ dexterAuthority: PublicKey;
457
+ payer: PublicKey;
458
+ channelId: Uint8Array;
459
+ cumulativeAmount: bigint;
460
+ sequenceNumber: number;
461
+ voucherHash: Uint8Array;
462
+ maturityAt: bigint | null;
463
+ holderRecoveryAt: bigint | null;
464
+ }
465
+ /**
466
+ * Account order MUST match the on-chain struct:
467
+ * [0] vault (writable)
468
+ * [1] vault_usdc_ata (readonly)
469
+ * [2] swig (readonly)
470
+ * [3] swig_wallet_address (readonly, PDA)
471
+ * [4] claim (writable, PDA [LOCKED_CLAIM_SEED, vault, voucher_hash])
472
+ * [5] seller_holder (signer)
473
+ * [6] dexter_authority (signer)
474
+ * [7] payer (signer, writable)
475
+ * [8] system_program (readonly)
476
+ * [9] instructions_sysvar (readonly)
477
+ * Data: disc || channel_id(32) || cumulative(u64) || sequence(u32)
478
+ * || voucher_hash(32) || option_i64(maturity_at) || option_i64(holder_recovery_at)
479
+ */
480
+ declare function buildLockVoucherInstruction(p: LockVoucherParams): TransactionInstruction;
481
+
482
+ /**
483
+ * Credit-L2 instruction builders — the standby-credit lifecycle.
484
+ * Mirrors the on-chain Anchor structs in
485
+ * programs/dexter-vault/src/instructions/{open_standby,draw_credit,repay_credit,
486
+ * seize_collateral,migrate_v4_to_v5}.rs. Account ordering is consensus-critical
487
+ * and MUST match the program exactly.
488
+ */
489
+
490
+ interface OpenStandbyParams {
491
+ vaultPda: PublicKey;
492
+ financierSwig: PublicKey;
493
+ cap: bigint;
494
+ clientDataJSON: Uint8Array;
495
+ authenticatorData: Uint8Array;
496
+ }
497
+ /**
498
+ * Account order MUST match the on-chain struct:
499
+ * [0] vault (writable)
500
+ * [1] financier_swig (readonly)
501
+ * [2] instructions_sysvar (readonly)
502
+ * Data: disc || cap(u64) || vec(client_data_json) || vec(authenticator_data).
503
+ */
504
+ declare function buildOpenStandbyInstruction(p: OpenStandbyParams): TransactionInstruction;
505
+ interface DrawCreditParams {
506
+ financierSwig: PublicKey;
507
+ vaultPda: PublicKey;
508
+ dexterAuthority: PublicKey;
509
+ amount: bigint;
510
+ recoveryWindowSeconds: bigint;
511
+ }
512
+ /**
513
+ * Account order MUST match the on-chain struct:
514
+ * [0] financier_swig (readonly)
515
+ * [1] financier_swig_wallet_address (readonly, PDA derived from financier_swig)
516
+ * [2] vault (writable)
517
+ * [3] dexter_authority (signer)
518
+ * [4] instructions_sysvar (readonly)
519
+ * Data: disc || amount(u64) || recovery_window_seconds(i64).
520
+ */
521
+ declare function buildDrawCreditInstruction(p: DrawCreditParams): TransactionInstruction;
522
+ interface RepayCreditParams {
523
+ swigAddress: PublicKey;
524
+ vaultPda: PublicKey;
525
+ dexterAuthority: PublicKey;
526
+ amount: bigint;
527
+ }
528
+ /**
529
+ * Account order MUST match the on-chain struct:
530
+ * [0] swig (readonly, the USER's swig)
531
+ * [1] swig_wallet_address (readonly, PDA derived from swig)
532
+ * [2] vault (writable)
533
+ * [3] dexter_authority (signer)
534
+ * [4] instructions_sysvar (readonly)
535
+ * Data: disc || amount(u64).
536
+ */
537
+ declare function buildRepayCreditInstruction(p: RepayCreditParams): TransactionInstruction;
538
+ interface SeizeCollateralParams {
539
+ swigAddress: PublicKey;
540
+ vaultPda: PublicKey;
541
+ dexterAuthority: PublicKey;
542
+ }
543
+ /**
544
+ * Account order MUST match the on-chain struct:
545
+ * [0] swig (readonly, the USER's swig)
546
+ * [1] swig_wallet_address (readonly, PDA derived from swig)
547
+ * [2] vault (writable)
548
+ * [3] dexter_authority (signer)
549
+ * [4] instructions_sysvar (readonly)
550
+ * Data: discriminator only (SeizeCollateralArgs is empty).
551
+ */
552
+ declare function buildSeizeCollateralInstruction(p: SeizeCollateralParams): TransactionInstruction;
553
+ interface MigrateV4ToV5Params {
554
+ vaultPda: PublicKey;
555
+ dexterAuthority: PublicKey;
556
+ payer: PublicKey;
557
+ }
558
+ /**
559
+ * Account order MUST match the on-chain struct:
560
+ * [0] vault (writable, AccountInfo validated in-handler)
561
+ * [1] dexter_authority (signer)
562
+ * [2] payer (signer, writable)
563
+ * [3] system_program (readonly)
564
+ * Data: discriminator only (MigrateV4ToV5Args is empty).
565
+ */
566
+ declare function buildMigrateV4ToV5Instruction(p: MigrateV4ToV5Params): TransactionInstruction;
567
+
568
+ export { type BuildRegisterSessionKeyArgs, type BuildRevokeSessionKeyArgs, type BuildSetSwigAtomicFromIdentityParams, type BuildSetSwigAtomicParams, type BuildSwigCreationBundleParams, type DrawCreditParams, type FinalizeWithdrawalParams, type ForceReleaseParams, type InitializeVaultParams, type LockVoucherParams, type MigrateV4ToV5Params, type OpenStandbyParams, type ProvePasskeyParams, type RecoverAbandonedLockParams, type RepayCreditParams, type RequestWithdrawalParams, type RotateDexterAuthorityParams, type RotatePasskeyParams, SET_SWIG_ATOMIC_DISCRIMINATOR, SWIG_PROGRAM_EXEC_MARKERS, SWIG_PROGRAM_EXEC_PREFIX, SWIG_PROGRAM_EXEC_PREFIX_SETTLE_TAB, type SeizeCollateralParams, type SetSwigParams, type SettleLockedVoucherParams, type SettleTabVoucherParams, type SettleVoucherParams, type SwigCreationBundleOutput, type SwigOwnershipCheck, type TransferLockOwnershipParams, buildDrawCreditInstruction, buildFinalizeWithdrawalInstruction, buildForceReleaseInstruction, buildInitializeVaultInstruction, buildLockVoucherInstruction, buildMigrateV4ToV5Instruction, buildOpenStandbyInstruction, buildProvePasskeyInstruction, buildRecoverAbandonedLockInstruction, buildRegisterSessionKeyInstruction, buildRepayCreditInstruction, buildRequestWithdrawalInstruction, buildRevokeSessionKeyInstruction, buildRotateDexterAuthorityInstruction, buildRotatePasskeyInstruction, buildSeizeCollateralInstruction, buildSetSwigAtomicFromIdentity, buildSetSwigAtomicInstruction, buildSetSwigInstruction, buildSettleLockedVoucherInstruction, buildSettleTabVoucherInstruction, buildSettleVoucherInstruction, buildSwigCreationBundle, buildTransferLockOwnershipInstruction, deriveLockedClaimPda, deriveSwigId, deriveSwigWalletAddress, deriveVaultPda, expectedSwigAddressFor, verifySwigIsOurs };