From aee8c0cb498710aab2a60a89e2e44540636b27ff Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Cornilleau Date: Wed, 2 Apr 2025 12:42:45 +0200 Subject: [PATCH] Tezlink/tezt: update balance test to use octez-client --- etherlink/tezt/tests/evm_sequencer.ml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index f428cbb08f3f..a21944561ea8 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -559,23 +559,19 @@ let test_tezlink_balance = register_tezlink_test ~title:"Test of the balance rpc" ~tags:["evm"; "rpc"; "balance"] - @@ fun {sequencer; _} _protocol -> + @@ fun {sequencer; client; _} _protocol -> (* call the balance rpc and parse the result *) - let rpc_balance () = - let path = - sf - "/tezlink/chains/main/blocks/head/context/contracts/%s/balance" - Constant.bootstrap1.public_key_hash - in - let* res = - Curl.get_raw ~args:["-v"] (Evm_node.endpoint sequencer ^ path) - |> Runnable.run - in - return @@ JSON.parse ~origin:"curl_balance" res + let endpoint = + Client.( + Foreign_endpoint + Endpoint. + {(Evm_node.rpc_endpoint_record sequencer) with path = "/tezlink"}) in - let* res = rpc_balance () in - Check.(JSON.(res |> as_int = 1) int ~error_msg:"Expected %R but got %L") ; + let* res = + Client.get_balance_for ~endpoint ~account:Constant.bootstrap1.alias client + in + Check.((Tez.to_mutez res = 1) int ~error_msg:"Expected %R but got %L") ; unit let test_tezlink_version = -- GitLab