@@ -210,14 +210,14 @@ pub struct TransactionBuilderConfig {
210210 key_deposit : Coin , // protocol parameter
211211 max_value_size : u32 , // protocol parameter
212212 max_tx_size : u32 , // protocol parameter
213- coins_per_utxo_byte : Coin , // protocol parameter
213+ data_cost : DataCost , // protocol parameter
214214 ex_unit_prices : Option < ExUnitPrices > , // protocol parameter
215215 prefer_pure_change : bool ,
216216}
217217
218218impl TransactionBuilderConfig {
219219 fn utxo_cost ( & self ) -> DataCost {
220- DataCost :: new_coins_per_byte ( & self . coins_per_utxo_byte )
220+ self . data_cost . clone ( )
221221 }
222222}
223223
@@ -229,7 +229,7 @@ pub struct TransactionBuilderConfigBuilder {
229229 key_deposit : Option < Coin > , // protocol parameter
230230 max_value_size : Option < u32 > , // protocol parameter
231231 max_tx_size : Option < u32 > , // protocol parameter
232- coins_per_utxo_byte : Option < Coin > , // protocol parameter
232+ data_cost : Option < DataCost > , // protocol parameter
233233 ex_unit_prices : Option < ExUnitPrices > , // protocol parameter
234234 prefer_pure_change : bool ,
235235}
@@ -243,7 +243,7 @@ impl TransactionBuilderConfigBuilder {
243243 key_deposit : None ,
244244 max_value_size : None ,
245245 max_tx_size : None ,
246- coins_per_utxo_byte : None ,
246+ data_cost : None ,
247247 ex_unit_prices : None ,
248248 prefer_pure_change : false ,
249249 }
@@ -262,14 +262,14 @@ impl TransactionBuilderConfigBuilder {
262262 note = "Since babbage era cardano nodes use coins per byte. Use '.coins_per_utxo_byte' instead."
263263 ) ]
264264 pub fn coins_per_utxo_word ( & self , coins_per_utxo_word : & Coin ) -> Self {
265- self . coins_per_utxo_byte (
266- & DataCost :: new_coins_per_word ( coins_per_utxo_word) . coins_per_byte ( ) ,
267- )
265+ let mut cfg = self . clone ( ) ;
266+ cfg . data_cost = Some ( DataCost :: new_coins_per_word ( coins_per_utxo_word) ) ;
267+ cfg
268268 }
269269
270270 pub fn coins_per_utxo_byte ( & self , coins_per_utxo_byte : & Coin ) -> Self {
271271 let mut cfg = self . clone ( ) ;
272- cfg. coins_per_utxo_byte = Some ( coins_per_utxo_byte . clone ( ) ) ;
272+ cfg. data_cost = Some ( DataCost :: new_coins_per_byte ( coins_per_utxo_byte ) ) ;
273273 cfg
274274 }
275275
@@ -327,8 +327,8 @@ impl TransactionBuilderConfigBuilder {
327327 max_tx_size : cfg
328328 . max_tx_size
329329 . ok_or ( JsError :: from_str ( "uninitialized field: max_tx_size" ) ) ?,
330- coins_per_utxo_byte : cfg. coins_per_utxo_byte . ok_or ( JsError :: from_str (
331- "uninitialized field: coins_per_utxo_byte" ,
330+ data_cost : cfg. data_cost . ok_or ( JsError :: from_str (
331+ "uninitialized field: coins_per_utxo_byte or coins_per_utxo_word " ,
332332 ) ) ?,
333333 ex_unit_prices : cfg. ex_unit_prices ,
334334 prefer_pure_change : cfg. prefer_pure_change ,
@@ -1844,10 +1844,7 @@ impl TransactionBuilder {
18441844mod tests {
18451845 use super :: output_builder:: TransactionOutputBuilder ;
18461846 use super :: * ;
1847- use crate :: fakes:: {
1848- fake_base_address, fake_bytes_32, fake_key_hash, fake_tx_hash, fake_tx_input,
1849- fake_tx_input2, fake_value, fake_value2,
1850- } ;
1847+ use crate :: fakes:: { fake_base_address, fake_bytes_32, fake_key_hash, fake_policy_id, fake_tx_hash, fake_tx_input, fake_tx_input2, fake_value, fake_value2} ;
18511848 use crate :: tx_builder_constants:: TxBuilderConstants ;
18521849 use fees:: * ;
18531850
@@ -3561,9 +3558,9 @@ mod tests {
35613558
35623559 fn create_multiasset ( ) -> ( MultiAsset , [ ScriptHash ; 3 ] , [ AssetName ; 3 ] ) {
35633560 let policy_ids = [
3564- PolicyID :: from ( [ 0u8 ; 28 ] ) ,
3565- PolicyID :: from ( [ 1u8 ; 28 ] ) ,
3566- PolicyID :: from ( [ 2u8 ; 28 ] ) ,
3561+ fake_policy_id ( 0 ) ,
3562+ fake_policy_id ( 1 ) ,
3563+ fake_policy_id ( 2 ) ,
35673564 ] ;
35683565 let names = [
35693566 AssetName :: new ( vec ! [ 99u8 ; 32 ] ) . unwrap ( ) ,
0 commit comments