fn submit_new_transaction(
    libra: &JsonRpcLibraInterface,
    time_service: &RealTimeService,
    account_key: &Ed25519PrivateKey,
    account_address: AccountAddress,
    script: Script,
) -> anyhow::Result<(AccountAddress, u64)> {
    let account_pubkey = account_key.public_key();
    let sequence_number = libra.retrieve_sequence_number(account_address)?;
    let expiration_time = time_service.now() + constants::TXN_EXPIRATION_SECS;
    let raw_txn = RawTransaction::new_script(
        account_address,
        sequence_number,
        script,
        constants::MAX_GAS_AMOUNT,
        constants::GAS_UNIT_PRICE,
        constants::GAS_CURRENCY_CODE.to_owned(),
        Duration::from_secs(expiration_time),
        ChainId::test(),
    );

    // Sign and submit the transaction
    let signature = account_key.sign(&raw_txn);
    let signed_txn = SignedTransaction::new(raw_txn, account_pubkey, signature);
    libra.submit_transaction(Transaction::UserTransaction(signed_txn))?;
    Ok((account_address, sequence_number))
}
/// Submits a transaction, and returns appropriate account and sequence number for verification
Submits a transaction, and returns appropriate account and sequence number for verification
Submits a transaction and returns appropriate account and sequence number for verification
fn submit_new_transaction(
    libra: &JsonRpcLibraInterface,
    time_service: &RealTimeService,
    account_key: &Ed25519PrivateKey,
    account_address: AccountAddress,
    script: Script,
) -> anyhow::Result<(AccountAddress, u64)> {
    let account_pubkey = account_key.public_key();
    let sequence_number = libra.retrieve_sequence_number(account_address)?;
    let expiration_time = time_service.now() + constants::TXN_EXPIRATION_SECS;
    let raw_txn = RawTransaction::new_script(
        account_address,
        sequence_number,
        script,
        constants::MAX_GAS_AMOUNT,
        constants::GAS_UNIT_PRICE,
        constants::GAS_CURRENCY_CODE.to_owned(),
        Duration::from_secs(expiration_time),
        ChainId::test(),
    );
    // Sign and submit the transaction
    let signature = account_key.sign(&raw_txn);
    let signed_txn = SignedTransaction::new(raw_txn, account_pubkey, signature);
    libra.submit_transaction(Transaction::UserTransaction(signed_txn))?;
    Ok((account_address, sequence_number))
}
fn submit_new_transaction ( libra : & JsonRpcLibraInterface , time_service : & RealTimeService , account_key : & Ed25519PrivateKey , account_address : AccountAddress , script : Script , ) -> anyhow :: Result < ( AccountAddress , u64 ) > { let account_pubkey = account_key . public_key ( ) ; let sequence_number = libra . retrieve_sequence_number ( account_address ) ? ; let expiration_time = time_service . now ( ) + constants :: TXN_EXPIRATION_SECS ; let raw_txn = RawTransaction :: new_script ( account_address , sequence_number , script , constants :: MAX_GAS_AMOUNT , constants :: GAS_UNIT_PRICE , constants :: GAS_CURRENCY_CODE . to_owned ( ) , Duration :: from_secs ( expiration_time ) , ChainId :: test ( ) , ) ; // Sign and submit the transaction let signature = account_key . sign ( & raw_txn ) ; let signed_txn = SignedTransaction :: new ( raw_txn , account_pubkey , signature ) ; libra . submit_transaction ( Transaction :: UserTransaction ( signed_txn ) ) ? ; Ok ( ( account_address , sequence_number ) ) }
Submits a transaction, and returns appropriate account and sequence number for verification
Submits a transaction and returns appropriate account and sequence number for verification
libra
&JsonRpcLibraInterface
time_service
&RealTimeService
account_key
&Ed25519PrivateKey
account_address
AccountAddress
script
Script
libra
&JsonRpcLibraInterface
time_service
&RealTimeService
account_key
&Ed25519PrivateKey
account_address
AccountAddress
script
Script