1
1
use super :: * ;
2
2
use crate :: IguanaPrivKey ;
3
- use common:: block_on;
3
+ use common:: { block_on, block_on_f01 } ;
4
4
use mm2_core:: mm_ctx:: MmCtxBuilder ;
5
5
6
6
cfg_native ! (
@@ -191,18 +191,16 @@ fn test_wait_for_payment_spend_timeout() {
191
191
184 , 42 , 106 ,
192
192
] ;
193
193
194
- assert ! ( coin
195
- . wait_for_htlc_tx_spend( WaitForHTLCTxSpendArgs {
196
- tx_bytes: & tx_bytes,
197
- secret_hash: & [ ] ,
198
- wait_until,
199
- from_block,
200
- swap_contract_address: & coin. swap_contract_address( ) ,
201
- check_every: TAKER_PAYMENT_SPEND_SEARCH_INTERVAL ,
202
- watcher_reward: false
203
- } )
204
- . wait( )
205
- . is_err( ) ) ;
194
+ assert ! ( block_on_f01( coin. wait_for_htlc_tx_spend( WaitForHTLCTxSpendArgs {
195
+ tx_bytes: & tx_bytes,
196
+ secret_hash: & [ ] ,
197
+ wait_until,
198
+ from_block,
199
+ swap_contract_address: & coin. swap_contract_address( ) ,
200
+ check_every: TAKER_PAYMENT_SPEND_SEARCH_INTERVAL ,
201
+ watcher_reward: false
202
+ } ) )
203
+ . is_err( ) ) ;
206
204
}
207
205
208
206
#[ cfg( not( target_arch = "wasm32" ) ) ]
@@ -229,7 +227,7 @@ fn test_withdraw_impl_manual_fee() {
229
227
memo : None ,
230
228
ibc_source_channel : None ,
231
229
} ;
232
- coin. get_balance ( ) . wait ( ) . unwrap ( ) ;
230
+ block_on_f01 ( coin. get_balance ( ) ) . unwrap ( ) ;
233
231
234
232
let tx_details = block_on ( withdraw_impl ( coin, withdraw_req) ) . unwrap ( ) ;
235
233
let expected = Some (
@@ -278,7 +276,7 @@ fn test_withdraw_impl_fee_details() {
278
276
memo : None ,
279
277
ibc_source_channel : None ,
280
278
} ;
281
- coin. get_balance ( ) . wait ( ) . unwrap ( ) ;
279
+ block_on_f01 ( coin. get_balance ( ) ) . unwrap ( ) ;
282
280
283
281
let tx_details = block_on ( withdraw_impl ( coin, withdraw_req) ) . unwrap ( ) ;
284
282
let expected = Some (
@@ -486,10 +484,8 @@ fn get_receiver_trade_preimage() {
486
484
paid_from_trading_vol : false ,
487
485
} ;
488
486
489
- let actual = coin
490
- . get_receiver_trade_fee ( FeeApproxStage :: WithoutApprox )
491
- . wait ( )
492
- . expect ( "!get_sender_trade_fee" ) ;
487
+ let actual =
488
+ block_on_f01 ( coin. get_receiver_trade_fee ( FeeApproxStage :: WithoutApprox ) ) . expect ( "!get_sender_trade_fee" ) ;
493
489
assert_eq ! ( actual, expected_fee) ;
494
490
}
495
491
@@ -595,7 +591,9 @@ fn validate_dex_fee_invalid_sender_eth() {
595
591
min_block_number : 0 ,
596
592
uuid : & [ ] ,
597
593
} ;
598
- let error = coin. validate_fee ( validate_fee_args) . wait ( ) . unwrap_err ( ) . into_inner ( ) ;
594
+ let error = block_on_f01 ( coin. validate_fee ( validate_fee_args) )
595
+ . unwrap_err ( )
596
+ . into_inner ( ) ;
599
597
match error {
600
598
ValidatePaymentError :: WrongPaymentTx ( err) => assert ! ( err. contains( "was sent from wrong address" ) ) ,
601
599
_ => panic ! ( "Expected `WrongPaymentTx` wrong sender address, found {:?}" , error) ,
@@ -631,7 +629,9 @@ fn validate_dex_fee_invalid_sender_erc() {
631
629
min_block_number : 0 ,
632
630
uuid : & [ ] ,
633
631
} ;
634
- let error = coin. validate_fee ( validate_fee_args) . wait ( ) . unwrap_err ( ) . into_inner ( ) ;
632
+ let error = block_on_f01 ( coin. validate_fee ( validate_fee_args) )
633
+ . unwrap_err ( )
634
+ . into_inner ( ) ;
635
635
match error {
636
636
ValidatePaymentError :: WrongPaymentTx ( err) => assert ! ( err. contains( "was sent from wrong address" ) ) ,
637
637
_ => panic ! ( "Expected `WrongPaymentTx` wrong sender address, found {:?}" , error) ,
@@ -671,7 +671,9 @@ fn validate_dex_fee_eth_confirmed_before_min_block() {
671
671
min_block_number : 11784793 ,
672
672
uuid : & [ ] ,
673
673
} ;
674
- let error = coin. validate_fee ( validate_fee_args) . wait ( ) . unwrap_err ( ) . into_inner ( ) ;
674
+ let error = block_on_f01 ( coin. validate_fee ( validate_fee_args) )
675
+ . unwrap_err ( )
676
+ . into_inner ( ) ;
675
677
match error {
676
678
ValidatePaymentError :: WrongPaymentTx ( err) => assert ! ( err. contains( "confirmed before min_block" ) ) ,
677
679
_ => panic ! ( "Expected `WrongPaymentTx` early confirmation, found {:?}" , error) ,
@@ -710,7 +712,9 @@ fn validate_dex_fee_erc_confirmed_before_min_block() {
710
712
min_block_number : 11823975 ,
711
713
uuid : & [ ] ,
712
714
} ;
713
- let error = coin. validate_fee ( validate_fee_args) . wait ( ) . unwrap_err ( ) . into_inner ( ) ;
715
+ let error = block_on_f01 ( coin. validate_fee ( validate_fee_args) )
716
+ . unwrap_err ( )
717
+ . into_inner ( ) ;
714
718
match error {
715
719
ValidatePaymentError :: WrongPaymentTx ( err) => assert ! ( err. contains( "confirmed before min_block" ) ) ,
716
720
_ => panic ! ( "Expected `WrongPaymentTx` early confirmation, found {:?}" , error) ,
@@ -834,9 +838,7 @@ fn polygon_check_if_my_payment_sent() {
834
838
amount : & BigDecimal :: default ( ) ,
835
839
payment_instructions : & None ,
836
840
} ;
837
- let my_payment = coin
838
- . check_if_my_payment_sent ( if_my_payment_sent_args)
839
- . wait ( )
841
+ let my_payment = block_on_f01 ( coin. check_if_my_payment_sent ( if_my_payment_sent_args) )
840
842
. unwrap ( )
841
843
. unwrap ( ) ;
842
844
let expected_hash = BytesJson :: from ( "69a20008cea0c15ee483b5bbdff942752634aa072dfd2ff715fe87eec302de11" ) ;
0 commit comments