numbat_wasm_debug/
tx_input.rs1use crate::display_util::*;
2use alloc::vec::Vec;
3use numbat_wasm::types::{Address, H256};
4use num_bigint::BigUint;
5use std::fmt;
6
7#[derive(Clone, Debug)]
8pub struct TxInput {
9 pub from: Address,
10 pub to: Address,
11 pub call_value: BigUint,
12 pub dcdt_value: BigUint,
13 pub dcdt_token_identifier: Vec<u8>,
14 pub func_name: Vec<u8>,
15 pub args: Vec<Vec<u8>>,
16 pub gas_limit: u64,
17 pub gas_price: u64,
18 pub tx_hash: H256,
19}
20
21impl fmt::Display for TxInput {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 write!(f, "TxInput {{ func: {}, args: {:?}, call_value: {}, dcdt_token_identifier: {:?}, dcdt_value: {:?}, from: 0x{}, to: 0x{}\n}}",
24 String::from_utf8(self.func_name.clone()).unwrap(),
25 self.args,
26 self.call_value,
27 self.dcdt_token_identifier,
28 self.dcdt_value,
29 address_hex(&self.from),
30 address_hex(&self.to))
31 }
32}
33
34impl TxInput {
35 pub fn add_arg(&mut self, arg: Vec<u8>) {
36 self.args.push(arg);
37 }
38}