pub struct TransactionBody { /* private fields */ }
Implementations§
source§impl TransactionBody
impl TransactionBody
pub fn from_bytes(bytes: Vec<u8>) -> Result<TransactionBody, DeserializeError>
source§impl TransactionBody
impl TransactionBody
pub fn from_hex(hex_str: &str) -> Result<TransactionBody, DeserializeError>
source§impl TransactionBody
impl TransactionBody
pub fn inputs(&self) -> TransactionInputs
pub fn outputs(&self) -> TransactionOutputs
pub fn fee(&self) -> Coin
sourcepub fn ttl(&self) -> Result<Option<u32>, JsError>
👎Deprecated since 10.1.0: Possible boundary error. Use ttl_bignum instead
pub fn ttl(&self) -> Result<Option<u32>, JsError>
!!! DEPRECATED !!! Returns a Slot32 (u32) value in case the underlying original BigNum (u64) value is within the limits. Otherwise will just raise an error.
pub fn ttl_bignum(&self) -> Option<BigNum>
sourcepub fn set_ttl(&mut self, ttl: &BigNum)
pub fn set_ttl(&mut self, ttl: &BigNum)
Examples found in repository?
525 526 527 528 529 530 531 532 533 534 535 536
pub fn new(
inputs: &TransactionInputs,
outputs: &TransactionOutputs,
fee: &Coin,
ttl: Option<Slot32>,
) -> Self {
let mut tx = Self::new_tx_body(inputs, outputs, fee);
if let Some(slot32) = ttl {
tx.set_ttl(&to_bignum(slot32 as u64));
}
tx
}
pub fn remove_ttl(&mut self)
pub fn set_certs(&mut self, certs: &Certificates)
pub fn certs(&self) -> Option<Certificates>
pub fn set_withdrawals(&mut self, withdrawals: &Withdrawals)
pub fn withdrawals(&self) -> Option<Withdrawals>
pub fn set_update(&mut self, update: &Update)
pub fn update(&self) -> Option<Update>
pub fn set_auxiliary_data_hash(
&mut self,
auxiliary_data_hash: &AuxiliaryDataHash
)
pub fn auxiliary_data_hash(&self) -> Option<AuxiliaryDataHash>
sourcepub fn set_validity_start_interval(&mut self, validity_start_interval: u32)
👎Deprecated since 10.1.0: Underlying value capacity of slot (BigNum u64) bigger then Slot32. Use set_validity_start_interval_bignum instead.
pub fn set_validity_start_interval(&mut self, validity_start_interval: u32)
!!! DEPRECATED !!! Uses outdated slot number format.
pub fn set_validity_start_interval_bignum(
&mut self,
validity_start_interval: BigNum
)
pub fn validity_start_interval_bignum(&self) -> Option<BigNum>
sourcepub fn validity_start_interval(&self) -> Result<Option<u32>, JsError>
👎Deprecated since 10.1.0: Possible boundary error. Use validity_start_interval_bignum instead
pub fn validity_start_interval(&self) -> Result<Option<u32>, JsError>
!!! DEPRECATED !!!
Returns a Option.validity_start_interval_bignum
instead.
pub fn set_mint(&mut self, mint: &Mint)
sourcepub fn multiassets(&self) -> Option<Mint>
👎Deprecated since 10.0.0: Weird naming. Use .mint()
pub fn multiassets(&self) -> Option<Mint>
.mint()
This function returns the mint value of the transaction
Use .mint()
instead.
pub fn set_reference_inputs(&mut self, reference_inputs: &TransactionInputs)
pub fn reference_inputs(&self) -> Option<TransactionInputs>
pub fn set_script_data_hash(&mut self, script_data_hash: &ScriptDataHash)
pub fn script_data_hash(&self) -> Option<ScriptDataHash>
pub fn set_collateral(&mut self, collateral: &TransactionInputs)
pub fn collateral(&self) -> Option<TransactionInputs>
pub fn set_required_signers(&mut self, required_signers: &RequiredSigners)
pub fn required_signers(&self) -> Option<RequiredSigners>
pub fn set_network_id(&mut self, network_id: &NetworkId)
pub fn network_id(&self) -> Option<NetworkId>
pub fn set_collateral_return(&mut self, collateral_return: &TransactionOutput)
pub fn collateral_return(&self) -> Option<TransactionOutput>
pub fn set_total_collateral(&mut self, total_collateral: &Coin)
pub fn total_collateral(&self) -> Option<Coin>
sourcepub fn new(
inputs: &TransactionInputs,
outputs: &TransactionOutputs,
fee: &Coin,
ttl: Option<u32>
) -> Self
👎Deprecated since 10.1.0: Underlying value capacity of ttl (BigNum u64) bigger then Slot32. Use new_tx_body instead.
pub fn new(
inputs: &TransactionInputs,
outputs: &TransactionOutputs,
fee: &Coin,
ttl: Option<u32>
) -> Self
!!! DEPRECATED !!!
This constructor uses outdated slot number format for the ttl value.
Use .new_tx_body
and then .set_ttl
instead
Examples found in repository?
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
pub(crate) fn create_tx(&self, asset_groups: &AssetCategorizer, utxos: &TransactionUnspentOutputs)
-> Result<Transaction, JsError> {
let mut outputs = Vec::new();
for proposal in &self.tx_output_proposals {
outputs.push(proposal.create_output(asset_groups, &self.used_utoxs)?);
}
let mut inputs = Vec::new();
for utxo in &self.used_utoxs {
inputs.push(utxos.0[utxo.0].input.clone());
}
let body = TransactionBody::new(
&TransactionInputs(inputs),
&TransactionOutputs(outputs),
&self.fee,
None,
);
let tx = Transaction::new(
&body,
&self.witnesses_calculator.create_mock_witnesses_set(),
None,
);
Ok(tx)
}
sourcepub fn new_tx_body(
inputs: &TransactionInputs,
outputs: &TransactionOutputs,
fee: &Coin
) -> Self
pub fn new_tx_body(
inputs: &TransactionInputs,
outputs: &TransactionOutputs,
fee: &Coin
) -> Self
Returns a new TransactionBody. In the new version of “new” we removed optional ttl for support it by wasm_bingen. Your can use “set_ttl” and “remove_ttl” to set a new value for ttl or set it as None.
Examples found in repository?
525 526 527 528 529 530 531 532 533 534 535 536
pub fn new(
inputs: &TransactionInputs,
outputs: &TransactionOutputs,
fee: &Coin,
ttl: Option<Slot32>,
) -> Self {
let mut tx = Self::new_tx_body(inputs, outputs, fee);
if let Some(slot32) = ttl {
tx.set_ttl(&to_bignum(slot32 as u64));
}
tx
}
Trait Implementations§
source§impl Clone for TransactionBody
impl Clone for TransactionBody
source§fn clone(&self) -> TransactionBody
fn clone(&self) -> TransactionBody
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TransactionBody
impl Debug for TransactionBody
source§impl<'de> Deserialize<'de> for TransactionBody
impl<'de> Deserialize<'de> for TransactionBody
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Deserialize for TransactionBody
impl Deserialize for TransactionBody
fn deserialize<R: BufRead + Seek>(
raw: &mut Deserializer<R>
) -> Result<Self, DeserializeError>
source§impl JsonSchema for TransactionBody
impl JsonSchema for TransactionBody
source§fn schema_name() -> String
fn schema_name() -> String
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq<TransactionBody> for TransactionBody
impl PartialEq<TransactionBody> for TransactionBody
source§fn eq(&self, other: &TransactionBody) -> bool
fn eq(&self, other: &TransactionBody) -> bool
self
and other
values to be equal, and is used
by ==
.