wallet_utils_contract/
lib.rs

1mod error;
2pub mod v1;
3
4pub use crate::error::Error;
5use platform_value::{Identifier, IdentifierBytes32};
6use platform_version::version::PlatformVersion;
7use serde_json::Value;
8
9pub const ID_BYTES: [u8; 32] = [
10    92, 20, 14, 101, 92, 2, 101, 187, 194, 168, 8, 113, 109, 225, 132, 121, 133, 19, 89, 24, 173,
11    81, 205, 253, 11, 118, 102, 75, 169, 91, 163, 124,
12];
13
14pub const OWNER_ID_BYTES: [u8; 32] = [0; 32];
15
16pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES));
17pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES));
18pub fn load_definitions(platform_version: &PlatformVersion) -> Result<Option<Value>, Error> {
19    match platform_version.system_data_contracts.withdrawals {
20        1 => Ok(None),
21        version => Err(Error::UnknownVersionMismatch {
22            method: "wallet_contract::load_definitions".to_string(),
23            known_versions: vec![1],
24            received: version,
25        }),
26    }
27}
28pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result<Value, Error> {
29    match platform_version.system_data_contracts.withdrawals {
30        1 => v1::load_documents_schemas(),
31        version => Err(Error::UnknownVersionMismatch {
32            method: "wallet_contract::load_documents_schemas".to_string(),
33            known_versions: vec![1],
34            received: version,
35        }),
36    }
37}