Skip to content

Commit 51ac7e0

Browse files
committed
add a manual test for v2 swaps via walletconnect
1 parent 1ecae08 commit 51ac7e0

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

mm2src/mm2_main/tests/mm2_tests/wallet_connect_tests.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use serde_json::json;
1010

1111
#[cfg(not(target_arch = "wasm32"))]
1212
/// Perform a swap using WalletConnect protocol with two tBTC (testnet4) coins.
13-
async fn perform_walletconnect_swap() {
13+
async fn perform_walletconnect_swap(use_swaps_proto_v2: bool) {
1414
let walletconnect_namespaces = json!({
1515
"required_namespaces": {
1616
"bip122": {
@@ -66,7 +66,10 @@ async fn perform_walletconnect_swap() {
6666
let trading_pair = (coins[0]["coin"].as_str().unwrap(), coins[1]["coin"].as_str().unwrap());
6767
let coins = json!(coins);
6868

69-
let bob_conf = Mm2TestConfForSwap::bob_conf_with_policy(&Mm2InitPrivKeyPolicy::GlobalHDAccount, &coins);
69+
let mut bob_conf = Mm2TestConfForSwap::bob_conf_with_policy(&Mm2InitPrivKeyPolicy::GlobalHDAccount, &coins);
70+
if use_swaps_proto_v2 {
71+
bob_conf.conf["use_trading_proto_v2"] = true.into();
72+
}
7073
// Uncomment to test the refund case. The quickest way to test both refunds is to reject signing TakerPaymentSpend (the 4th signing prompt).
7174
// This will force the taker to refund himself and after sometime the maker will also refund himself because he can't spend the TakerPayment anymore (as it's already refunded).
7275
// Note that you need to run the test with `--features custom-swap-locktime` to enable the custom `payment_locktime` feature.
@@ -79,11 +82,14 @@ async fn perform_walletconnect_swap() {
7982
log!("Bob log path: {}", mm_bob.log_path.display());
8083
Timer::sleep(2.).await;
8184

82-
let alice_conf = Mm2TestConfForSwap::alice_conf_with_policy(
85+
let mut alice_conf = Mm2TestConfForSwap::alice_conf_with_policy(
8386
&Mm2InitPrivKeyPolicy::GlobalHDAccount,
8487
&coins,
8588
&mm_bob.my_seed_addr(),
8689
);
90+
if use_swaps_proto_v2 {
91+
alice_conf.conf["use_trading_proto_v2"] = true.into();
92+
}
8793
// Uncomment to test the refund case
8894
// alice_conf.conf["payment_locktime"] = (1 * 60).into();
8995
let mut mm_alice = MarketMakerIt::start_async(alice_conf.conf, alice_conf.rpc_password, None)
@@ -138,6 +144,12 @@ async fn perform_walletconnect_swap() {
138144

139145
#[test]
140146
#[ignore]
141-
fn test_walletconnect_swap() {
142-
block_on(perform_walletconnect_swap());
147+
fn test_walletconnect_swap_v1() {
148+
block_on(perform_walletconnect_swap(false));
149+
}
150+
151+
#[test]
152+
#[ignore]
153+
fn test_walletconnect_swap_v2() {
154+
block_on(perform_walletconnect_swap(true));
143155
}

0 commit comments

Comments
 (0)