Mediated Release
Releases a mediated escrow to a recipient — either the depositor or the beneficiary. The mediator (a required signer) authorizes the transfer; the program moves the escrowed tokens from the vault to the recipient's associated token account, closes the MediatedEscrowDeposit, and sends its rent to the rent collector.
The recipient must be either the deposit's depositor or its beneficiary — the program rejects any other account.
Program method — mediated_release
Derives the mediated escrow PDA, the vault, and the recipient's associated token account, then builds, signs (payer + mediator), and sends.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
payer | Keypair | yes | — | The fee payer; co-signs. |
mint | #to_s | yes | — | The escrowed mint. |
mediator | Keypair | yes | — | The deposit's mediator; co-signs. |
recipient | #to_s | yes | — | The depositor or beneficiary receiving the tokens (its ATA is derived). |
rent_collector | #to_s | yes | — | Account that receives the closed-account rent. Must match the deposit's rent collector (the mediator, if none was set). |
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_release(
payer: mediator,
mint: mint_address,
mediator: mediator,
recipient: beneficiary.address,
rent_collector: mediator.address,
id:
)
connection.wait_for_confirmed_signature { tx.signature }TIP
The deposit records who the rent collector is (defaulting to the mediator). To fill it from chain, fetch the deposit first: program.fetch_mediated_escrow_deposit(address:).rent_collector — see PDA Derivation & Fetchers.
Composer — ZarTrustlessEscrowMediatedReleaseComposer
The mediated escrow PDA, vault, and recipient token account must be resolved first.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
mint | #to_s | yes | — | The escrowed mint. |
mediator | #to_s | yes | — | The mediator (readonly signer). |
recipient | #to_s | yes | — | Depositor or beneficiary receiving the tokens. |
recipient_token_account | #to_s | yes | — | The recipient's destination token account (ATA). |
mediated_escrow_deposit | #to_s | yes | — | The MediatedEscrowDeposit PDA. |
program_token_account | #to_s | yes | — | The vault PDA. |
rent_collector | #to_s | yes | — | Receives the closed-account rent. |
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)
recipient_ata, = Solace::Programs::AssociatedTokenAccount.get_address(
owner: beneficiary.address, mint: mint_address
)
composer = Solace::Composers::ZarTrustlessEscrowMediatedReleaseComposer.new(
mint: mint_address,
mediator: mediator.address,
recipient: beneficiary.address,
recipient_token_account: recipient_ata,
mediated_escrow_deposit: mediated_escrow,
program_token_account: vault,
rent_collector: mediator.address,
fee_payer: mediator.address,
id:
)
tx = Solace::TransactionComposer.new(connection:)
.add_instruction(composer)
.set_fee_payer(mediator)
.compose_transaction
tx.sign(mediator)
connection.send_transaction(tx.serialize)Low-level instruction (advanced)
MediatedReleaseInstruction.build encodes the raw instruction.
- Discriminator:
[154, 204, 22, 195, 162, 179, 197, 181] - Encodes (
data):pubkey(id) - Accounts (in order):
mint·mediator(readonly signer) ·recipient·recipient_token_account(writable) ·mediated_escrow_deposit(writable) ·program_token_account(writable) ·rent_collector(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. |
mediator_index | Integer | yes | Index of the mediator. |
recipient_index | Integer | yes | Index of the recipient. |
recipient_token_account_index | Integer | yes | Index of the recipient's token account. |
mediated_escrow_deposit_index | Integer | yes | Index of the MediatedEscrowDeposit PDA. |
program_token_account_index | Integer | yes | Index of the vault. |
rent_collector_index | Integer | yes | Index of the rent collector. |
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. |