|
15 | 15 |
|
16 | 16 | use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
17 | 17 |
|
18 |
| -use clarity::vm::types::{QualifiedContractIdentifier, StacksAddressExtensions}; |
19 |
| -use clarity::vm::{ClarityName, ContractName}; |
| 18 | +use clarity::vm::types::{QualifiedContractIdentifier, StacksAddressExtensions, TypeSignature}; |
| 19 | +use clarity::vm::{ClarityName, ContractName, Value}; |
20 | 20 | use stacks_common::codec::StacksMessageCodec;
|
21 | 21 | use stacks_common::types::chainstate::{StacksAddress, TrieHash};
|
22 | 22 | use stacks_common::types::net::PeerHost;
|
@@ -126,6 +126,15 @@ fn test_try_make_response() {
|
126 | 126 | );
|
127 | 127 | requests.push(request);
|
128 | 128 |
|
| 129 | + // query vm-account balance |
| 130 | + let request = StacksHttpRequest::new_getclaritymarf( |
| 131 | + addr.into(), |
| 132 | + TrieHash::from_key("vm-account::ST2DS4MSWSGJ3W9FBC6BVT0Y92S345HY8N3T6AV7R::19"), |
| 133 | + TipRequest::UseLatestAnchoredTip, |
| 134 | + true, |
| 135 | + ); |
| 136 | + requests.push(request); |
| 137 | + |
129 | 138 | let mut responses = test_rpc(function_name!(), requests);
|
130 | 139 |
|
131 | 140 | // existing data
|
@@ -179,4 +188,16 @@ fn test_try_make_response() {
|
179 | 188 |
|
180 | 189 | let (preamble, body) = response.destruct();
|
181 | 190 | assert_eq!(preamble.status_code, 404);
|
| 191 | + |
| 192 | + // vm-account blaance |
| 193 | + let response = responses.remove(0); |
| 194 | + debug!( |
| 195 | + "Response:\n{}\n", |
| 196 | + std::str::from_utf8(&response.try_serialize().unwrap()).unwrap() |
| 197 | + ); |
| 198 | + |
| 199 | + let resp = response.decode_data_var_response().unwrap(); |
| 200 | + let balance = Value::try_deserialize_hex(&resp.data[2..], &TypeSignature::IntType, false); |
| 201 | + assert_eq!(balance, Ok(Value::Int(256_000_000_000))); |
| 202 | + assert!(resp.marf_proof.is_some()); |
182 | 203 | }
|
0 commit comments