TransactionBuilder

Struct TransactionBuilder 

Source
pub struct TransactionBuilder {}

Implementations§

Source§

impl TransactionBuilder

Source

pub fn build_create_with_fee_payer_proof( fee_payer: TnPubkey, start_slot: u64, fee_payer_state_proof: &StateProof, ) -> Result<Transaction>

Build balance transfer transaction

Source

pub fn build_transfer( fee_payer: TnPubkey, program: TnPubkey, to_account: TnPubkey, amount: u64, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build balance transfer transaction for EOA program (tn_eoa_program.c)

This creates a transaction that calls the TRANSFER instruction of the EOA program, which transfers balance from one account to another.

§Arguments
  • fee_payer - The account paying the transaction fee (also the from_account for the transfer)
  • program - The EOA program pubkey (typically EOA_PROGRAM constant = all zeros)
  • to_account - The destination account receiving the transfer
  • amount - The amount to transfer
  • fee - Transaction fee
  • nonce - Account nonce
  • start_slot - Starting slot for transaction validity
Source

pub fn build_create_account( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, seed: &str, state_proof: Option<&[u8]>, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build regular account creation transaction (with optional state proof)

Source

pub fn build_create_ephemeral_account( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, seed: &[u8; 32], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build account creation transaction

Source

pub fn build_resize_account( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, new_size: u64, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build account resize transaction

Source

pub fn build_compress_account( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, state_proof: &[u8], fee: u64, nonce: u64, start_slot: u64, account_size: u32, ) -> Result<Transaction>

Build account compression transaction

Source

pub fn build_decompress_account( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, account_data: &[u8], state_proof: &[u8], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build account decompression transaction

Source

pub fn build_write_data( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, offset: u16, data: &[u8], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build data write transaction

Source§

impl TransactionBuilder

Source

pub fn build_uploader_create( fee_payer: TnPubkey, uploader_program: TnPubkey, meta_account: TnPubkey, buffer_account: TnPubkey, buffer_size: u32, expected_hash: [u8; 32], seed: &[u8], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build uploader program CREATE transaction

Source

pub fn build_uploader_write( fee_payer: TnPubkey, uploader_program: TnPubkey, meta_account: TnPubkey, buffer_account: TnPubkey, data: &[u8], offset: u32, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build uploader program WRITE transaction

Source

pub fn build_uploader_finalize( fee_payer: TnPubkey, uploader_program: TnPubkey, meta_account: TnPubkey, buffer_account: TnPubkey, buffer_size: u32, expected_hash: [u8; 32], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build uploader program FINALIZE transaction

Source

pub fn build_uploader_destroy( fee_payer: TnPubkey, uploader_program: TnPubkey, meta_account: TnPubkey, buffer_account: TnPubkey, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build uploader program DESTROY transaction

Source

pub fn build_manager_create( fee_payer: TnPubkey, manager_program: TnPubkey, meta_account: TnPubkey, program_account: TnPubkey, srcbuf_account: TnPubkey, authority_account: TnPubkey, srcbuf_offset: u32, srcbuf_size: u32, seed: &[u8], is_ephemeral: bool, meta_proof: Option<&[u8]>, program_proof: Option<&[u8]>, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build manager program CREATE transaction

Source

pub fn build_manager_upgrade( fee_payer: TnPubkey, manager_program: TnPubkey, meta_account: TnPubkey, program_account: TnPubkey, srcbuf_account: TnPubkey, srcbuf_offset: u32, srcbuf_size: u32, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build manager program UPGRADE transaction

Source

pub fn build_manager_set_pause( fee_payer: TnPubkey, manager_program: TnPubkey, meta_account: TnPubkey, program_account: TnPubkey, is_paused: bool, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build manager program SET_PAUSE transaction

Source

pub fn build_manager_simple( fee_payer: TnPubkey, manager_program: TnPubkey, meta_account: TnPubkey, program_account: TnPubkey, instruction_type: u8, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build manager program simple transactions (DESTROY, FINALIZE, CLAIM_AUTHORITY)

Source

pub fn build_manager_set_authority( fee_payer: TnPubkey, manager_program: TnPubkey, meta_account: TnPubkey, program_account: TnPubkey, authority_candidate: [u8; 32], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build manager program SET_AUTHORITY transaction

Source

pub fn build_test_uploader_create( fee_payer: TnPubkey, test_uploader_program: TnPubkey, target_account: TnPubkey, account_sz: u32, seed: &[u8], is_ephemeral: bool, state_proof: Option<&[u8]>, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build test uploader program CREATE transaction

Source

pub fn build_test_uploader_write( fee_payer: TnPubkey, test_uploader_program: TnPubkey, target_account: TnPubkey, offset: u32, data: &[u8], fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build test uploader program WRITE transaction

Source

pub fn build_decompress2( fee_payer: TnPubkey, program: TnPubkey, target_account: TnPubkey, meta_account: TnPubkey, data_account: TnPubkey, data_offset: u32, state_proof: &[u8], fee: u64, nonce: u64, start_slot: u64, data_sz: u32, ) -> Result<Transaction>

Build account decompression transaction using DECOMPRESS2 (separate meta and data accounts)

Source§

impl TransactionBuilder

Source

pub fn build_token_initialize_mint( fee_payer: TnPubkey, token_program: TnPubkey, mint_account: TnPubkey, mint_authority: TnPubkey, freeze_authority: Option<TnPubkey>, decimals: u8, ticker: &str, seed: [u8; 32], state_proof: Vec<u8>, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program InitializeMint transaction

Source

pub fn build_token_initialize_account( fee_payer: TnPubkey, token_program: TnPubkey, token_account: TnPubkey, mint_account: TnPubkey, owner: TnPubkey, seed: [u8; 32], state_proof: Vec<u8>, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program InitializeAccount transaction

Source

pub fn build_token_transfer( fee_payer: TnPubkey, token_program: TnPubkey, source_account: TnPubkey, dest_account: TnPubkey, _authority: TnPubkey, amount: u64, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program Transfer transaction

Source

pub fn build_token_mint_to( fee_payer: TnPubkey, token_program: TnPubkey, mint_account: TnPubkey, dest_account: TnPubkey, authority: TnPubkey, amount: u64, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program MintTo transaction

Source

pub fn build_token_burn( fee_payer: TnPubkey, token_program: TnPubkey, token_account: TnPubkey, mint_account: TnPubkey, authority: TnPubkey, amount: u64, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program Burn transaction

Source

pub fn build_token_freeze_account( fee_payer: TnPubkey, token_program: TnPubkey, token_account: TnPubkey, mint_account: TnPubkey, authority: TnPubkey, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program FreezeAccount transaction

Source

pub fn build_token_thaw_account( fee_payer: TnPubkey, token_program: TnPubkey, token_account: TnPubkey, mint_account: TnPubkey, authority: TnPubkey, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program ThawAccount transaction

Source

pub fn build_token_close_account( fee_payer: TnPubkey, token_program: TnPubkey, token_account: TnPubkey, destination: TnPubkey, authority: TnPubkey, fee: u64, nonce: u64, start_slot: u64, ) -> Result<Transaction>

Build token program CloseAccount transaction

Trait Implementations§

Source§

impl Clone for TransactionBuilder

Source§

fn clone(&self) -> TransactionBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransactionBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more