MCPcopy Create free account
hub / github.com/Lightprotocol/light-protocol-v1 / transact

Function transact

program/tests/onchain.rs:543–723  ·  view source on GitHub ↗
(
    program_id: &Pubkey,
    signer_pubkey: &Pubkey,
    signer_keypair: &Keypair,
    tmp_storage_pda_pubkey: &Pubkey,
    user_pda_token_pubkey: &Pubkey,
    merkle_tree_pda_pubkey: &Pubkey,
    m

Source from the content-addressed store, hash-verified

541}
542
543async fn transact(
544 program_id: &Pubkey,
545 signer_pubkey: &Pubkey,
546 signer_keypair: &Keypair,
547 tmp_storage_pda_pubkey: &Pubkey,
548 user_pda_token_pubkey: &Pubkey,
549 merkle_tree_pda_pubkey: &Pubkey,
550 merkle_tree_pda_token_pubkey: &Pubkey,
551 expected_authority_pubkey: &Pubkey,
552 nullifier_pubkeys: &Vec<Pubkey>,
553 two_leaves_pda_pubkey: &Pubkey,
554 relayer_pda_token_pubkey_option: Option<&Pubkey>,
555 recipient_pubkey_option: Option<&Pubkey>,
556 ix_data: Vec<u8>,
557 program_context: &mut ProgramTestContext,
558 accounts_vector: &mut std::vec::Vec<(
559 &solana_program::pubkey::Pubkey,
560 usize,
561 std::option::Option<std::vec::Vec<u8>>,
562 )>,
563 token_accounts: &mut Vec<(&Pubkey, &Pubkey, u64)>,
564 separator: u8,
565 amount: Option<u64>,
566 wsol_acc: Option<Pubkey>,
567) -> Result<ProgramTestContext> {
568 /*
569 *
570 *
571 * Send data to chain and initialize tmp_storage_account
572 *
573 *
574 */
575
576 //sends bytes (public inputs and proof)
577 let mut transaction = Transaction::new_with_payer(
578 &[Instruction::new_with_bincode(
579 *program_id,
580 &[ix_data[8..].to_vec(), vec![separator]].concat(),
581 vec![
582 AccountMeta::new(*signer_pubkey, false),
583 AccountMeta::new(*tmp_storage_pda_pubkey, false),
584 AccountMeta::new_readonly(solana_program::system_program::id(), false),
585 AccountMeta::new_readonly(sysvar::rent::id(), false),
586 ],
587 )],
588 Some(&signer_pubkey),
589 );
590 transaction.sign(&[signer_keypair], program_context.last_blockhash);
591 program_context
592 .banks_client
593 .process_transaction(transaction)
594 .await
595 .unwrap();
596 //panic!("only first tx adjusted yet");
597 /*
598 *
599 *
600 * check merkle root

Calls 5

compute_prepared_inputsFunction · 0.85
compute_miller_outputFunction · 0.85
update_merkle_treeFunction · 0.85
last_txFunction · 0.85

Tested by

no test coverage detected