Description
Some invoice payment flows require holding funds in escrow (locked until delivery confirmation) before releasing them to recipients. The SDK has no escrow primitive — callers use claimable balances ad-hoc without lifecycle management. An escrow vault manager should wrap the create-hold-release pattern using claimable balances with time-lock predicates, coordinating with invoice status to trigger release automatically.
Technical Context
Add src/escrowVaultManager.ts. Builds on src/claimableBalanceFallback.ts and src/predicateBuilder.ts. Adds EscrowVault, EscrowStatus, and EscrowReleaseCondition to src/types.ts. Integrates with src/poller.ts to monitor delivery confirmation events. Release is triggered by src/client.ts confirmDelivery() method. Emits escrowFunded, escrowReleased, and escrowExpired via src/events.ts.
Acceptance Criteria
Description
Some invoice payment flows require holding funds in escrow (locked until delivery confirmation) before releasing them to recipients. The SDK has no escrow primitive — callers use claimable balances ad-hoc without lifecycle management. An escrow vault manager should wrap the create-hold-release pattern using claimable balances with time-lock predicates, coordinating with invoice status to trigger release automatically.
Technical Context
Add
src/escrowVaultManager.ts. Builds onsrc/claimableBalanceFallback.tsandsrc/predicateBuilder.ts. AddsEscrowVault,EscrowStatus, andEscrowReleaseConditiontosrc/types.ts. Integrates withsrc/poller.tsto monitor delivery confirmation events. Release is triggered bysrc/client.tsconfirmDelivery()method. EmitsescrowFunded,escrowReleased, andescrowExpiredviasrc/events.ts.Acceptance Criteria
EscrowVaultManager.create(invoiceId, amount, asset, holdUntil): Promise<EscrowVault>creates a claimable balance with an absolute-time predicate and returns the vault recordEscrowVaultManager.release(vaultId, recipientId): Promise<TransactionResult>claims the balance on behalf of the recipient after the hold periodEscrowVaultManager.getStatus(vaultId): Promise<EscrowStatus>returns the current state:holding | released | expiredescrowExpiredwhen the hold predicate window closes without release and the SDK detects the balance is claimable by anyoneescrowReleasedevent fires afterrelease()call