pub fn transaction_to(
        &mut self,
        block0_hash: &Hash,
        fees: &LinearFee,
        address: Address,
        value: Value,
    ) -> Result<Fragment> {
        use chain_impl_mockchain::txbuilder::{TransactionBuilder, TransactionFinalizer};

        let mut txbuilder = TransactionBuilder::no_payload();

        txbuilder.add_output(address.into(), value.into());

        let output_policy = match &mut self.inner {
            Inner::Account(account) => account
                .add_input(&mut txbuilder, fees)
                .chain_err(|| "Cannot get inputs from the account")?,
            Inner::UTxO(_utxo) => unimplemented!(),
        };

        let (_, tx) = txbuilder
            .seal_with_output_policy(fees, output_policy)
            .chain_err(|| "Cannot finalize the transaction")?;
        let mut finalizer = TransactionFinalizer::new(tx.replace_extra(None));

        let sign_data = finalizer.get_tx_sign_data_hash();

        let witness = match &mut self.inner {
            Inner::Account(account) => account
                .mk_witness(block0_hash, &sign_data)
                .chain_err(|| "Cannot create witness from account")?,
            Inner::UTxO(_utxo) => unimplemented!(),
        };

        finalizer
            .set_witness(0, witness)
            .chain_err(|| "Cannot add witness")?;

        finalizer
            .to_fragment()
            .chain_err(|| "Cannot generate the finalized transaction")
    }
/// simple function to create a transaction with only one output to the given
/// address and of the given Value.
///
simple function to create a transaction with only one output to the given
address and of the given Value.
simple function to create a transaction with only one output to the given address and of the given Value .
pub fn transaction_to(
        &mut self,
        block0_hash: &Hash,
        fees: &LinearFee,
        address: Address,
        value: Value,
    ) -> Result<Fragment> {
        use chain_impl_mockchain::txbuilder::{TransactionBuilder, TransactionFinalizer};
        let mut txbuilder = TransactionBuilder::no_payload();
        txbuilder.add_output(address.into(), value.into());
        let output_policy = match &mut self.inner {
            Inner::Account(account) => account
                .add_input(&mut txbuilder, fees)
                .chain_err(|| "Cannot get inputs from the account")?,
            Inner::UTxO(_utxo) => unimplemented!(),
        };
        let (_, tx) = txbuilder
            .seal_with_output_policy(fees, output_policy)
            .chain_err(|| "Cannot finalize the transaction")?;
        let mut finalizer = TransactionFinalizer::new(tx.replace_extra(None));
        let sign_data = finalizer.get_tx_sign_data_hash();
        let witness = match &mut self.inner {
            Inner::Account(account) => account
                .mk_witness(block0_hash, &sign_data)
                .chain_err(|| "Cannot create witness from account")?,
            Inner::UTxO(_utxo) => unimplemented!(),
        };
        finalizer
            .set_witness(0, witness)
            .chain_err(|| "Cannot add witness")?;
        finalizer
            .to_fragment()
            .chain_err(|| "Cannot generate the finalized transaction")
    }
pub fn transaction_to ( & mut self , block0_hash : & Hash , fees : & LinearFee , address : Address , value : Value , ) -> Result < Fragment > { use chain_impl_mockchain :: txbuilder :: { TransactionBuilder , TransactionFinalizer } ; let mut txbuilder = TransactionBuilder :: no_payload ( ) ; txbuilder . add_output ( address . into ( ) , value . into ( ) ) ; let output_policy = match & mut self . inner { Inner :: Account ( account ) => account . add_input ( & mut txbuilder , fees ) . chain_err ( | | " " ) ? , Inner :: UTxO ( _utxo ) => unimplemented ! ( ) , } ; let ( _ , tx ) = txbuilder . seal_with_output_policy ( fees , output_policy ) . chain_err ( | | " " ) ? ; let mut finalizer = TransactionFinalizer :: new ( tx . replace_extra ( None ) ) ; let sign_data = finalizer . get_tx_sign_data_hash ( ) ; let witness = match & mut self . inner { Inner :: Account ( account ) => account . mk_witness ( block0_hash , & sign_data ) . chain_err ( | | " " ) ? , Inner :: UTxO ( _utxo ) => unimplemented ! ( ) , } ; finalizer . set_witness ( 0 , witness ) . chain_err ( | | " " ) ? ; finalizer . to_fragment ( ) . chain_err ( | | " " ) }
simple function to create a transaction with only one output to the given
address and of the given Value.
simple function to create a transaction with only one output to the given address and of the given Value .
&mut self
block0_hash
&Hash
fees
&LinearFee
address
Address
value
Value
&mut self
block0_hash
&Hash
fees
&LinearFee
address
Address
value
Value