Struct cardano_serialization_lib::DataCost
source · pub struct DataCost(_);
Implementations§
source§impl DataCost
impl DataCost
sourcepub fn new_coins_per_word(coins_per_word: &Coin) -> DataCost
👎Deprecated since 11.0.0: Since babbage era we should use coins per byte. Use .new_coins_per_byte
instead.
pub fn new_coins_per_word(coins_per_word: &Coin) -> DataCost
.new_coins_per_byte
instead.!!! DEPRECATED !!!
Since babbage era we should use coins per byte. Use .new_coins_per_byte
instead.
Examples found in repository?
More examples
src/utils.rs (line 1441)
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448
pub fn min_ada_required(
assets: &Value,
has_data_hash: bool, // whether the output includes a data hash
coins_per_utxo_word: &BigNum, // protocol parameter (in lovelace)
) -> Result<BigNum, JsError> {
let data_cost = DataCost::new_coins_per_word(coins_per_utxo_word);
let mut calc = MinOutputAdaCalculator::new_empty(&data_cost)?;
calc.set_amount(assets);
if has_data_hash {
calc.set_data_hash(&fake_data_hash(0));
}
calc.calculate_ada()
}
sourcepub fn new_coins_per_byte(coins_per_byte: &Coin) -> DataCost
pub fn new_coins_per_byte(coins_per_byte: &Coin) -> DataCost
sourcepub fn coins_per_byte(&self) -> Coin
pub fn coins_per_byte(&self) -> Coin
Trait Implementations§
source§impl Ord for DataCost
impl Ord for DataCost
source§impl PartialEq<DataCost> for DataCost
impl PartialEq<DataCost> for DataCost
source§impl PartialOrd<DataCost> for DataCost
impl PartialOrd<DataCost> for DataCost
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more