|
15 | 15 | mod representations; |
16 | 16 | mod types; |
17 | 17 |
|
18 | | -use stacks_common::address::{AddressHashMode, C32_ADDRESS_VERSION_TESTNET_SINGLESIG}; |
19 | | -use stacks_common::types::chainstate::{StacksAddress, StacksPrivateKey, StacksPublicKey}; |
20 | | - |
21 | | -use crate::errors::CodecError; |
22 | | -use crate::types::{PrincipalData, StandardPrincipalData, Value}; |
23 | | -use crate::{version_string, BUILD_TYPE}; |
24 | | - |
25 | | -impl Value { |
26 | | - pub fn list_from(list_data: Vec<Value>) -> Result<Value, CodecError> { |
27 | | - Value::cons_list_unsanitized(list_data) |
28 | | - } |
29 | | -} |
30 | | - |
31 | | -// Implement PartialEq for testing and simple equality checks by comparing the |
32 | | -// string representations of each error. This avoids requiring all wrapped |
33 | | -// fields (like `std::io::Error`) to implement PartialEq. |
34 | | -impl PartialEq for CodecError { |
35 | | - fn eq(&self, other: &Self) -> bool { |
36 | | - self.to_string() == other.to_string() |
37 | | - } |
38 | | -} |
39 | | - |
40 | | -impl From<&StacksPrivateKey> for StandardPrincipalData { |
41 | | - fn from(o: &StacksPrivateKey) -> StandardPrincipalData { |
42 | | - let stacks_addr = StacksAddress::from_public_keys( |
43 | | - C32_ADDRESS_VERSION_TESTNET_SINGLESIG, |
44 | | - &AddressHashMode::SerializeP2PKH, |
45 | | - 1, |
46 | | - &vec![StacksPublicKey::from_private(o)], |
47 | | - ) |
48 | | - .unwrap(); |
49 | | - StandardPrincipalData::from(stacks_addr) |
50 | | - } |
51 | | -} |
52 | | - |
53 | | -impl From<&StacksPrivateKey> for PrincipalData { |
54 | | - fn from(o: &StacksPrivateKey) -> PrincipalData { |
55 | | - PrincipalData::Standard(StandardPrincipalData::from(o)) |
56 | | - } |
57 | | -} |
58 | | - |
59 | | -impl From<&StacksPrivateKey> for Value { |
60 | | - fn from(o: &StacksPrivateKey) -> Value { |
61 | | - Value::from(StandardPrincipalData::from(o)) |
62 | | - } |
63 | | -} |
| 18 | +use crate::{BUILD_TYPE, version_string}; |
64 | 19 |
|
65 | 20 | #[test] |
66 | 21 | fn test_version_string_basic_no_env() { |
|
0 commit comments