Mediated Reclaim
Reclaims an expired mediated escrow back to the depositor, without the mediator. The program moves the escrowed tokens from the vault to the depositor's associated token account and closes the MediatedEscrowDeposit, returning its rent to the depositor.
This only works when the deposit was created with an expires_at and the on-chain clock has passed it. With no expiry set, only the mediator can ever distribute the funds — see Expiry & Reclaim.
Program method — mediated_reclaim
Derives the mediated escrow PDA, the vault, and the depositor's associated token account, then builds, signs (payer + depositor), and sends.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
payer | Keypair | yes | — | The fee payer; co-signs. |
mint | #to_s | yes | — | The escrowed mint. |
depositor | Keypair | yes | — | The depositor; co-signs. Receives the returned tokens and rent. |
id | #to_s | yes | — | The unique id the escrow was created with. |
token_program_id | String | no | legacy SPL Token | Token program that owns the mint. |
Plus the shared sign: / execute: controls and Solace::Transaction return — see Conventions.
tx = program.mediated_reclaim(
payer: depositor,
mint: mint_address,
depositor: depositor,
id:
)
connection.wait_for_confirmed_signature { tx.signature }Composer — ZarTrustlessEscrowMediatedReclaimComposer
The mediated escrow PDA, vault, and depositor token account must be resolved first.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
mint | #to_s | yes | — | The escrowed mint. |
depositor | #to_s | yes | — | The depositor (writable signer; receives tokens + rent). |
depositor_token_account | #to_s | yes | — | The depositor's destination token account (ATA). |
mediated_escrow_deposit | #to_s | yes | — | The MediatedEscrowDeposit PDA. |
program_token_account | #to_s | yes | — | The vault PDA. |
fee_payer | #to_s · Keypair | yes | — | Fee payer; writable signer. |
id | #to_s | yes | — | The unique id the escrow was created with. |
program_id | #to_s | no | mainnet PROGRAM_ID | The escrow program id. |
token_program_id | #to_s | no | legacy SPL Token | Token program that owns the mint. |
mediated_escrow, = program.get_mediated_escrow_deposit_address(id:)
vault, = program.get_vault_address(mint: mint_address)
depositor_ata, = Solace::Programs::AssociatedTokenAccount.get_address(
owner: depositor.address, mint: mint_address
)
composer = Solace::Composers::ZarTrustlessEscrowMediatedReclaimComposer.new(
mint: mint_address,
depositor: depositor.address,
depositor_token_account: depositor_ata,
mediated_escrow_deposit: mediated_escrow,
program_token_account: vault,
fee_payer: depositor.address,
id:
)
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)
MediatedReclaimInstruction.build encodes the raw instruction.
- Discriminator:
[192, 255, 211, 122, 12, 11, 191, 146] - Encodes (
data):pubkey(id) - Accounts (in order):
mint·depositor(writable signer) ·depositor_token_account(writable) ·mediated_escrow_deposit(writable) ·program_token_account(writable) ·fee_payer(writable signer) ·system_program·token_program·associated_token_program.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | #to_s | yes | Unique id; encoded into data. |
mint_index | Integer | yes | Index of the mint. |
depositor_index | Integer | yes | Index of the depositor. |
depositor_token_account_index | Integer | yes | Index of the depositor's token account. |
mediated_escrow_deposit_index | Integer | yes | Index of the MediatedEscrowDeposit PDA. |
program_token_account_index | Integer | yes | Index of the vault. |
fee_payer_index | Integer | yes | Index of the fee payer. |
system_program_index | Integer | yes | Index of the System program. |
token_program_index | Integer | yes | Index of the token program. |
associated_token_program_index | Integer | yes | Index of the Associated Token Account program. |
program_index | Integer | yes | Index of the escrow program. |