@@ -176,8 +176,10 @@ pub struct TransactionBuilderConfigBuilder {
176176 prefer_pure_change : bool ,
177177}
178178
179- impl Default for TransactionBuilderConfigBuilder {
180- fn default ( ) -> Self {
179+ #[ wasm_bindgen]
180+ impl TransactionBuilderConfigBuilder {
181+
182+ pub fn new ( ) -> Self {
181183 Self {
182184 fee_algo : None ,
183185 pool_deposit : None ,
@@ -188,42 +190,40 @@ impl Default for TransactionBuilderConfigBuilder {
188190 prefer_pure_change : false ,
189191 }
190192 }
191- }
192193
193- impl TransactionBuilderConfigBuilder {
194- pub fn fee_algo ( & mut self , fee_algo : fees:: LinearFee ) -> & mut Self {
194+ pub fn fee_algo ( & mut self , fee_algo : fees:: LinearFee ) -> Self {
195195 self . fee_algo = Some ( fee_algo) ;
196- self
196+ self . clone ( )
197197 }
198198
199- pub fn pool_deposit ( & mut self , pool_deposit : BigNum ) -> & mut Self {
199+ pub fn pool_deposit ( & mut self , pool_deposit : BigNum ) -> Self {
200200 self . pool_deposit = Some ( pool_deposit) ;
201- self
201+ self . clone ( )
202202 }
203203
204- pub fn key_deposit ( & mut self , key_deposit : BigNum ) -> & mut Self {
204+ pub fn key_deposit ( & mut self , key_deposit : BigNum ) -> Self {
205205 self . key_deposit = Some ( key_deposit) ;
206- self
206+ self . clone ( )
207207 }
208208
209- pub fn max_value_size ( & mut self , max_value_size : u32 ) -> & mut Self {
209+ pub fn max_value_size ( & mut self , max_value_size : u32 ) -> Self {
210210 self . max_value_size = Some ( max_value_size) ;
211- self
211+ self . clone ( )
212212 }
213213
214- pub fn max_tx_size ( & mut self , max_tx_size : u32 ) -> & mut Self {
214+ pub fn max_tx_size ( & mut self , max_tx_size : u32 ) -> Self {
215215 self . max_tx_size = Some ( max_tx_size) ;
216- self
216+ self . clone ( )
217217 }
218218
219- pub fn coins_per_utxo_word ( & mut self , coins_per_utxo_word : Coin ) -> & mut Self {
219+ pub fn coins_per_utxo_word ( & mut self , coins_per_utxo_word : Coin ) -> Self {
220220 self . coins_per_utxo_word = Some ( coins_per_utxo_word) ;
221- self
221+ self . clone ( )
222222 }
223223
224- pub fn prefer_pure_change ( & mut self , prefer_pure_change : bool ) -> & mut Self {
224+ pub fn prefer_pure_change ( & mut self , prefer_pure_change : bool ) -> Self {
225225 self . prefer_pure_change = prefer_pure_change;
226- self
226+ self . clone ( )
227227 }
228228
229229 pub fn build ( & self ) -> Result < TransactionBuilderConfig , JsError > {
@@ -1090,7 +1090,7 @@ mod tests {
10901090 max_val_size : u32 ,
10911091 coins_per_utxo_word : u64 ,
10921092 ) -> TransactionBuilder {
1093- let cfg = TransactionBuilderConfigBuilder :: default ( )
1093+ let cfg = TransactionBuilderConfigBuilder :: new ( )
10941094 . fee_algo ( linear_fee. clone ( ) )
10951095 . pool_deposit ( to_bignum ( pool_deposit) )
10961096 . key_deposit ( to_bignum ( key_deposit) )
@@ -1129,7 +1129,7 @@ mod tests {
11291129 }
11301130
11311131 fn create_tx_builder_with_fee_and_pure_change ( linear_fee : & LinearFee ) -> TransactionBuilder {
1132- TransactionBuilder :: new ( & TransactionBuilderConfigBuilder :: default ( )
1132+ TransactionBuilder :: new ( & TransactionBuilderConfigBuilder :: new ( )
11331133 . fee_algo ( linear_fee. clone ( ) )
11341134 . pool_deposit ( to_bignum ( 1 ) )
11351135 . key_deposit ( to_bignum ( 1 ) )
@@ -2549,7 +2549,7 @@ mod tests {
25492549 fn tx_builder_cip2_random_improve_when_using_all_available_inputs ( ) {
25502550 // we have a = 1 to test increasing fees when more inputs are added
25512551 let linear_fee = LinearFee :: new ( & to_bignum ( 1 ) , & to_bignum ( 0 ) ) ;
2552- let cfg = TransactionBuilderConfigBuilder :: default ( )
2552+ let cfg = TransactionBuilderConfigBuilder :: new ( )
25532553 . fee_algo ( linear_fee)
25542554 . pool_deposit ( to_bignum ( 0 ) )
25552555 . key_deposit ( to_bignum ( 0 ) )
@@ -2576,7 +2576,7 @@ mod tests {
25762576 fn tx_builder_cip2_random_improve_adds_enough_for_fees ( ) {
25772577 // we have a = 1 to test increasing fees when more inputs are added
25782578 let linear_fee = LinearFee :: new ( & to_bignum ( 1 ) , & to_bignum ( 0 ) ) ;
2579- let cfg = TransactionBuilderConfigBuilder :: default ( )
2579+ let cfg = TransactionBuilderConfigBuilder :: new ( )
25802580 . fee_algo ( linear_fee)
25812581 . pool_deposit ( to_bignum ( 0 ) )
25822582 . key_deposit ( to_bignum ( 0 ) )
0 commit comments