15
15
16
16
use std:: net:: { IpAddr , Ipv4Addr , SocketAddr } ;
17
17
18
+ use clarity:: vm:: database:: { ClarityDeserializable , STXBalance } ;
18
19
use clarity:: vm:: types:: { QualifiedContractIdentifier , StacksAddressExtensions , TypeSignature } ;
19
20
use clarity:: vm:: { ClarityName , ContractName , Value } ;
20
21
use stacks_common:: codec:: StacksMessageCodec ;
@@ -149,7 +150,7 @@ fn test_try_make_response() {
149
150
Some ( 1 )
150
151
) ;
151
152
152
- let resp = response. decode_data_var_response ( ) . unwrap ( ) ;
153
+ let resp = response. decode_clarity_marf_response ( ) . unwrap ( ) ;
153
154
assert_eq ! ( resp. data, "0x0000000000000000000000000000000000" ) ;
154
155
assert ! ( resp. marf_proof. is_some( ) ) ;
155
156
@@ -165,7 +166,7 @@ fn test_try_make_response() {
165
166
Some ( 1 )
166
167
) ;
167
168
168
- let resp = response. decode_data_var_response ( ) . unwrap ( ) ;
169
+ let resp = response. decode_clarity_marf_response ( ) . unwrap ( ) ;
169
170
assert_eq ! ( resp. data, "0x0100000000000000000000000000000001" ) ;
170
171
assert ! ( resp. marf_proof. is_some( ) ) ;
171
172
@@ -189,15 +190,16 @@ fn test_try_make_response() {
189
190
let ( preamble, body) = response. destruct ( ) ;
190
191
assert_eq ! ( preamble. status_code, 404 ) ;
191
192
192
- // vm-account blaance
193
+ // vm-account balance
193
194
let response = responses. remove ( 0 ) ;
194
195
debug ! (
195
196
"Response:\n {}\n " ,
196
197
std:: str :: from_utf8( & response. try_serialize( ) . unwrap( ) ) . unwrap( )
197
198
) ;
198
199
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( ) ) ;
200
+ let resp = response. decode_clarity_marf_response ( ) . unwrap ( ) ;
201
+ let balance = STXBalance :: deserialize ( & resp. data [ 2 ..] ) . unwrap ( ) ;
202
+
203
+ assert_eq ! ( balance. amount_unlocked( ) , 1_000_000_000 ) ;
204
+ assert_eq ! ( balance. amount_locked( ) , 0 ) ;
203
205
}
0 commit comments