neo3/neo_builder/transaction/
contract_parameters_context.rs

1use std::collections::HashMap;
2
3use crate::ContractParameter;
4use serde::{Deserialize, Serialize};
5
6#[derive(Serialize, Deserialize, Debug)]
7pub struct ContractParametersContext {
8	pub type_: String,
9	pub hash: String,
10	pub data: String,
11	pub items: HashMap<String, ContextItem>,
12	pub network: u32,
13}
14
15impl ContractParametersContext {
16	pub fn new(
17		hash: String,
18		data: String,
19		items: Option<HashMap<String, ContextItem>>,
20		network: u32,
21	) -> Self {
22		Self {
23			type_: "Neo.Network.P2P.Payloads.Transaction".to_string(),
24			hash,
25			data,
26			items: items.unwrap_or_default(),
27			network,
28		}
29	}
30}
31
32#[derive(Serialize, Deserialize, Debug)]
33pub struct ContextItem {
34	pub script: String,
35	pub parameters: Option<Vec<ContractParameter>>,
36	pub signatures: HashMap<String, String>,
37}
38
39impl ContextItem {
40	pub fn new(
41		script: String,
42		parameters: Option<Vec<ContractParameter>>,
43		signatures: Option<HashMap<String, String>>,
44	) -> Self {
45		Self { script, parameters, signatures: signatures.unwrap_or_default() }
46	}
47}