Class: Solace::ZarTrustlessEscrow::Instructions::MediatedReleaseInstruction
- Inherits:
-
Object
- Object
- Solace::ZarTrustlessEscrow::Instructions::MediatedReleaseInstruction
- Defined in:
- lib/solace/zar_trustless_escrow/instructions/mediated_release_instruction.rb
Overview
Encoder for the ‘mediated_release` instruction: the mediator releases a MediatedEscrowDeposit to the recipient (depositor or beneficiary) and closes the deposit, sending rent to the rent collector.
Constant Summary collapse
- DISCRIMINATOR =
8-byte Anchor discriminator: SHA256(“global:mediated_release”).
[154, 204, 22, 195, 162, 179, 197, 181].freeze
Class Method Summary collapse
-
.build(id:, mint_index:, mediator_index:, recipient_index:, recipient_token_account_index:, mediated_escrow_deposit_index:, program_token_account_index:, rent_collector_index:, fee_payer_index:, system_program_index:, token_program_index:, associated_token_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Solace::Instruction for ‘mediated_release`.
-
.data(id:) ⇒ Array<Integer>
Encodes the MediatedReleaseArgs struct in Borsh format.
Class Method Details
.build(id:, mint_index:, mediator_index:, recipient_index:, recipient_token_account_index:, mediated_escrow_deposit_index:, program_token_account_index:, rent_collector_index:, fee_payer_index:, system_program_index:, token_program_index:, associated_token_program_index:, program_index:) ⇒ Solace::Instruction
Builds a Solace::Instruction for ‘mediated_release`.
Account indices are in the on-chain order:
mint, mediator, recipient, recipient_token_account,
mediated_escrow_deposit, program_token_account, rent_collector,
fee_payer, system_program, token_program, associated_token_program.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/solace/zar_trustless_escrow/instructions/mediated_release_instruction.rb', line 21 def self.build( id:, mint_index:, mediator_index:, recipient_index:, recipient_token_account_index:, mediated_escrow_deposit_index:, program_token_account_index:, rent_collector_index:, fee_payer_index:, system_program_index:, token_program_index:, associated_token_program_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [ mint_index, mediator_index, recipient_index, recipient_token_account_index, mediated_escrow_deposit_index, program_token_account_index, rent_collector_index, fee_payer_index, system_program_index, token_program_index, associated_token_program_index ] ix.data = data(id:) end end |
.data(id:) ⇒ Array<Integer>
Encodes the MediatedReleaseArgs struct in Borsh format.
59 60 61 |
# File 'lib/solace/zar_trustless_escrow/instructions/mediated_release_instruction.rb', line 59 def self.data(id:) DISCRIMINATOR + Solace::Utils::Codecs.encode_pubkey(id) end |