Skip to content

Expiry & Reclaim

Both escrow types give the depositor a way to recover funds that are never released — but the rules differ.

Two-party reclaim

A two-party deposit can be reclaimed by the depositor at any time while it's unclaimed. There is no expiry: until the claim authority claims it, the depositor (or their sponsor) can call reclaim to pull the tokens back and close the deposit.

ruby
program.reclaim(
  payer:           depositor,            # depositor or sponsor
  mint:            mint_address,
  depositor:       depositor.address,
  claim_authority: claim_authority.address
)

Mediated expiry

A mediated escrow is normally resolved by the mediator. To protect the depositor if the mediator becomes unavailable, the deposit can carry an optional expiry — a Unix timestamp set at deposit time:

ruby
program.mediated_deposit(
  payer:       depositor,
  mint:        mint_address,
  depositor:   depositor,
  id:,
  mediator:    mediator.address,
  beneficiary: beneficiary.address,
  amount:      1_000_000,
  expires_at:  some_future_unix_timestamp
)

The expiry must be in the future at deposit time. Once the on-chain clock passes it, the depositor can recover the funds without the mediator via mediated_reclaim:

ruby
program.mediated_reclaim(
  payer:     depositor,
  mint:      mint_address,
  depositor: depositor,
  id:
)

Rules

  • No expiry set → only the mediator can ever distribute the funds (via mediated release). mediated_reclaim is rejected.
  • Expiry set, not yet passed → the mediator can still release; the depositor must wait. mediated_reclaim before the timestamp is rejected.
  • Expiry set and passed → the depositor may mediated_reclaim. The mediator can still release too, until one of them closes the deposit.

The on-chain clock (the Solana Clock sysvar) is the reference, not wall-clock time. The expires_at value is stored on the MediatedEscrowDeposit account (see Account Types) and is nil when no expiry was set.

Built on Solace