Skip to content

Reclaim ​

Returns an unclaimed two-party escrow deposit to the depositor. The program moves the escrowed tokens from the vault back to the depositor's associated token account and closes the EscrowDeposit. The fee payer may be the depositor or the recorded sponsor — no separate authority signature is needed beyond the fee payer.

There is no expiry: a deposit can be reclaimed any time before it's claimed (see Expiry & Reclaim).

Program method — reclaim ​

Derives the escrow PDA, the vault, and the depositor's associated token account, then builds, signs (payer), and sends.

ParameterTypeRequiredDefaultDescription
payerKeypairyes—The fee payer — the depositor or the sponsor; the only signer.
mint#to_syes—The escrowed mint.
depositor#to_syes—The original depositor; receives the returned tokens (its ATA is derived).
claim_authority#to_syes—The authority the deposit is keyed by; used to derive the escrow PDA.
token_program_idStringnolegacy SPL TokenToken program that owns the mint.

Plus the shared sign: / execute: controls and Solace::Transaction return — see Conventions.

ruby
tx = program.reclaim(
  payer:           depositor,
  mint:            mint_address,
  depositor:       depositor.address,
  claim_authority: claim_authority.address
)
connection.wait_for_confirmed_signature { tx.signature }

Composer — ZarTrustlessEscrowReclaimComposer ​

The escrow PDA, vault, and depositor token account must be resolved first.

ParameterTypeRequiredDefaultDescription
mint#to_syes—The escrowed mint.
depositor#to_syes—The original depositor (receives the tokens).
depositor_token_account#to_syes—The depositor's destination token account (ATA).
escrow_deposit#to_syes—The EscrowDeposit PDA — from get_escrow_deposit_address.
program_token_account#to_syes—The vault PDA — from get_vault_address.
fee_payer#to_s · Keypairyes—Fee payer (depositor or sponsor); writable signer.
claim_authority#to_syes—Authority used to derive the escrow PDA.
program_id#to_snomainnet PROGRAM_IDThe escrow program id.
token_program_id#to_snolegacy SPL TokenToken program that owns the mint.
ruby
escrow_deposit, = program.get_escrow_deposit_address(claim_authority: claim_authority.address)
vault,          = program.get_vault_address(mint: mint_address)
depositor_ata,  = Solace::Programs::AssociatedTokenAccount.get_address(
  owner: depositor.address, mint: mint_address
)

composer = Solace::Composers::ZarTrustlessEscrowReclaimComposer.new(
  mint:                    mint_address,
  depositor:               depositor.address,
  depositor_token_account: depositor_ata,
  escrow_deposit:          escrow_deposit,
  program_token_account:   vault,
  fee_payer:               depositor.address,
  claim_authority:         claim_authority.address
)

tx = Solace::TransactionComposer.new(connection:)
                                .add_instruction(composer)
                                .set_fee_payer(depositor)
                                .compose_transaction

tx.sign(depositor)
connection.send_transaction(tx.serialize)

Low-level instruction (advanced) ​

ReclaimInstruction.build encodes the raw instruction.

  • Discriminator: [105, 179, 220, 94, 121, 140, 144, 24]
  • Encodes (data): pubkey(claim_authority)
  • Accounts (in order): mint · depositor · depositor_token_account (writable) · escrow_deposit (writable) · program_token_account (writable) · fee_payer (writable signer) · system_program · token_program · associated_token_program.
ParameterTypeRequiredDescription
claim_authority#to_syesAuthority used to derive the escrow PDA; encoded into data.
mint_indexIntegeryesIndex of the mint.
depositor_indexIntegeryesIndex of the depositor.
depositor_token_account_indexIntegeryesIndex of the depositor's token account.
escrow_deposit_indexIntegeryesIndex of the EscrowDeposit PDA.
program_token_account_indexIntegeryesIndex of the vault.
fee_payer_indexIntegeryesIndex of the fee payer.
system_program_indexIntegeryesIndex of the System program.
token_program_indexIntegeryesIndex of the token program.
associated_token_program_indexIntegeryesIndex of the Associated Token Account program.
program_indexIntegeryesIndex of the escrow program.

Built on Solace