Skip to content

Commit

Permalink
get account data
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteStochastic committed Mar 24, 2022
1 parent 49db417 commit 99df2bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
11 changes: 6 additions & 5 deletions src/app/test_executive/payments_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
}
in
let%bind { nonce = sender_current_nonce; _ } =
Network.Node.must_get_balance ~logger untimed_node_b
Network.Node.must_get_account_data ~logger untimed_node_b
~public_key:sender_pub_key
in
let user_command_input =
Expand Down Expand Up @@ -146,11 +146,11 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
"check that the account balances are what we expect after the previous \
txn"
(let%bind { total_balance = node_b_balance; _ } =
Network.Node.must_get_balance ~logger untimed_node_b
Network.Node.must_get_account_data ~logger untimed_node_b
~public_key:sender_pub_key
in
let%bind { total_balance = node_a_balance; _ } =
Network.Node.must_get_balance ~logger untimed_node_a
Network.Node.must_get_account_data ~logger untimed_node_a
~public_key:receiver_pub_key
in
let node_a_expected =
Expand All @@ -168,7 +168,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
(Currency.Amount.of_int 30_000_000_000_000)
test_constants.coinbase_amount
|> Option.value_exn )
amount
( Currency.Amount.add amount (Currency.Amount.of_fee fee)
|> Option.value_exn )
|> Option.value_exn
in
[%log info] "coinbase_amount: %s"
Expand All @@ -191,7 +192,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
(Currency.Balance.to_amount node_a_balance)
node_a_expected
(* node_b is the sender *)
(* node_b_balance <= (30_000_000_000_000 + possible_coinbase_reward) - txn_amount *)
(* node_b_balance <= (30_000_000_000_000 + possible_coinbase_reward) - (txn_amount + txn_fee) *)
&& Currency.Amount.( <= )
(Currency.Balance.to_amount node_b_balance)
node_b_expected
Expand Down
17 changes: 7 additions & 10 deletions src/lib/integration_test_cloud_engine/kubernetes_network.ml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ module Node = struct
}
|}]

module Get_balance =
module Get_account_data =
[%graphql
{|
query ($public_key: PublicKey) {
Expand Down Expand Up @@ -309,10 +309,10 @@ module Node = struct
let must_get_best_chain ~logger t =
get_best_chain ~logger t |> Deferred.bind ~f:Malleable_error.or_hard_error

type get_balance_result =
type account_data =
{ nonce : Unsigned.uint32; total_balance : Currency.Balance.t }

let get_balance ~logger t ~public_key =
let get_account_data ~logger t ~public_key =
let open Deferred.Or_error.Let_syntax in
[%log info] "Getting account balance"
~metadata:
Expand All @@ -321,7 +321,7 @@ module Node = struct
(* let pk = Mina_base.Account_id.public_key account_id in *)
(* let token = Mina_base.Account_id.token_id account_id in *)
let get_balance_obj =
Graphql.Get_balance.make
Graphql.Get_account_data.make
~public_key:(Graphql_lib.Encoders.public_key public_key)
(* ~token:(Graphql_lib.Encoders.token token) *)
()
Expand All @@ -344,8 +344,8 @@ module Node = struct
; total_balance = acc#balance#total
}

let must_get_balance ~logger t ~public_key =
get_balance ~logger t ~public_key
let must_get_account_data ~logger t ~public_key =
get_account_data ~logger t ~public_key
|> Deferred.bind ~f:Malleable_error.or_hard_error

type signed_command_result =
Expand Down Expand Up @@ -468,10 +468,7 @@ module Node = struct
~rawSignature:raw_signature ()
in
[%log info] "send_payment_obj via with $variables "
~metadata:
[ (* ("query", (Yojson.Safe.from_string ( String.substr_replace_all send_payment_obj#query ~pattern:"\"" ~with_:"`") ) ) *)
("variables", send_payment_obj#variables)
] ;
~metadata:[ ("variables", send_payment_obj#variables) ] ;
exec_graphql_request ~logger ~node:t
~query_name:"Send_payment_with_raw_sig_graphql" send_payment_obj
in
Expand Down
10 changes: 5 additions & 5 deletions src/lib/integration_test_lib/intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,20 @@ module Engine = struct
-> fee:Currency.Fee.t
-> signed_command_result Malleable_error.t

type get_balance_result =
type account_data =
{ nonce : Unsigned.uint32; total_balance : Currency.Balance.t }

val get_balance :
val get_account_data :
logger:Logger.t
-> t
-> public_key:Signature_lib.Public_key.Compressed.t
-> get_balance_result Async_kernel.Deferred.Or_error.t
-> account_data Async_kernel.Deferred.Or_error.t

val must_get_balance :
val must_get_account_data :
logger:Logger.t
-> t
-> public_key:Signature_lib.Public_key.Compressed.t
-> get_balance_result Malleable_error.t
-> account_data Malleable_error.t

val get_peer_id :
logger:Logger.t
Expand Down

0 comments on commit 99df2bb

Please sign in to comment.