Skip to content

Claim

Releases a two-party escrow deposit to a claimant. The claim authority (a required signer) authorizes the transfer; the program moves the escrowed tokens from the vault to the claimant's associated token account and closes the EscrowDeposit, returning its rent to the fee payer.

Program method — claim

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

ParameterTypeRequiredDefaultDescription
payerKeypairyesThe fee payer; co-signs. Receives the closed deposit's rent.
mint#to_syesThe escrowed mint.
claim_authorityKeypairyesThe deposit's claim authority; co-signs.
claimant#to_syesRecipient of the released tokens (its ATA is derived).
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.claim(
  payer:           claim_authority,
  mint:            mint_address,
  claim_authority: claim_authority,
  claimant:        claimant.address
)
connection.wait_for_confirmed_signature { tx.signature }

Composer — ZarTrustlessEscrowClaimComposer

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

ParameterTypeRequiredDefaultDescription
mint#to_syesThe escrowed mint.
claim_authority#to_syesThe claim authority (readonly signer).
claimant#to_syesRecipient of the released tokens.
claimant_token_account#to_syesThe claimant's destination token account (ATA).
escrow_deposit#to_syesThe EscrowDeposit PDA — from get_escrow_deposit_address.
program_token_account#to_syesThe vault PDA — from get_vault_address.
fee_payer#to_s · KeypairyesFee payer; writable signer.
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)
claimant_ata,   = Solace::Programs::AssociatedTokenAccount.get_address(
  owner: claimant.address, mint: mint_address
)

composer = Solace::Composers::ZarTrustlessEscrowClaimComposer.new(
  mint:                   mint_address,
  claim_authority:        claim_authority.address,
  claimant:               claimant.address,
  claimant_token_account: claimant_ata,
  escrow_deposit:         escrow_deposit,
  program_token_account:  vault,
  fee_payer:              claim_authority.address
)

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

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

Low-level instruction (advanced)

ClaimInstruction.build encodes the raw instruction.

  • Discriminator: [62, 198, 214, 193, 213, 159, 108, 210]
  • Encodes (data): discriminator only — no arguments.
  • Accounts (in order): mint · claim_authority (readonly signer) · claimant · claimant_token_account (writable) · escrow_deposit (writable) · program_token_account (writable) · fee_payer (writable signer) · system_program · token_program · associated_token_program.
ParameterTypeRequiredDescription
mint_indexIntegeryesIndex of the mint.
claim_authority_indexIntegeryesIndex of the claim authority.
claimant_indexIntegeryesIndex of the claimant.
claimant_token_account_indexIntegeryesIndex of the claimant'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