|
| 1 | +use crate::types::{object::Version, Address, ObjectDigest, ObjectId}; |
| 2 | + |
| 3 | +use super::{Command, TransactionExpiration}; |
| 4 | + |
| 5 | +// A potentially Unresolved user transaction |
| 6 | +#[cfg_attr( |
| 7 | + feature = "serde", |
| 8 | + derive(serde_derive::Serialize, serde_derive::Deserialize) |
| 9 | +)] |
| 10 | +pub struct UnresolvedTransaction { |
| 11 | + #[cfg_attr(feature = "serde", serde(flatten))] |
| 12 | + pub ptb: UnresolvedProgrammableTransaction, |
| 13 | + pub sender: Address, |
| 14 | + pub gas_payment: Option<UnresolvedGasPayment>, |
| 15 | + pub expiration: TransactionExpiration, |
| 16 | +} |
| 17 | + |
| 18 | +#[cfg_attr( |
| 19 | + feature = "serde", |
| 20 | + derive(serde_derive::Serialize, serde_derive::Deserialize) |
| 21 | +)] |
| 22 | +pub struct UnresolvedProgrammableTransaction { |
| 23 | + pub inputs: Vec<UnresolvedInputArgument>, |
| 24 | + pub commands: Vec<Command>, |
| 25 | +} |
| 26 | + |
| 27 | +#[cfg_attr( |
| 28 | + feature = "serde", |
| 29 | + derive(serde_derive::Serialize, serde_derive::Deserialize) |
| 30 | +)] |
| 31 | +pub struct UnresolvedGasPayment { |
| 32 | + pub objects: Vec<UnresolvedObjectReference>, |
| 33 | + pub owner: Address, |
| 34 | + #[cfg_attr( |
| 35 | + feature = "serde", |
| 36 | + serde(with = "crate::_serde::OptionReadableDisplay") |
| 37 | + )] |
| 38 | + pub price: Option<u64>, |
| 39 | + #[cfg_attr( |
| 40 | + feature = "serde", |
| 41 | + serde(with = "crate::_serde::OptionReadableDisplay") |
| 42 | + )] |
| 43 | + pub budget: Option<u64>, |
| 44 | +} |
| 45 | + |
| 46 | +#[cfg_attr( |
| 47 | + feature = "serde", |
| 48 | + derive(serde_derive::Serialize, serde_derive::Deserialize) |
| 49 | +)] |
| 50 | +pub struct UnresolvedObjectReference { |
| 51 | + pub object_id: ObjectId, |
| 52 | + #[cfg_attr( |
| 53 | + feature = "serde", |
| 54 | + serde(with = "crate::_serde::OptionReadableDisplay") |
| 55 | + )] |
| 56 | + pub version: Option<Version>, |
| 57 | + pub digest: Option<ObjectDigest>, |
| 58 | +} |
| 59 | + |
| 60 | +#[cfg_attr( |
| 61 | + feature = "serde", |
| 62 | + derive(serde_derive::Serialize, serde_derive::Deserialize) |
| 63 | +)] |
| 64 | +pub enum UnresolvedInputArgument { |
| 65 | + // contains no structs or objects |
| 66 | + Pure { |
| 67 | + #[cfg_attr( |
| 68 | + feature = "serde", |
| 69 | + serde(with = "::serde_with::As::<::serde_with::Bytes>") |
| 70 | + )] |
| 71 | + value: Vec<u8>, |
| 72 | + }, |
| 73 | + // A Move object, either immutable, or owned mutable. |
| 74 | + ImmutableOrOwned(UnresolvedObjectReference), |
| 75 | + // A Move object that's shared. |
| 76 | + // SharedObject::mutable controls whether caller asks for a mutable reference to shared object. |
| 77 | + Shared { |
| 78 | + object_id: ObjectId, |
| 79 | + #[cfg_attr( |
| 80 | + feature = "serde", |
| 81 | + serde(with = "crate::_serde::OptionReadableDisplay") |
| 82 | + )] |
| 83 | + initial_shared_version: Option<u64>, |
| 84 | + mutable: Option<bool>, |
| 85 | + }, |
| 86 | + // A Move object that can be received in this transaction. |
| 87 | + Receiving(UnresolvedObjectReference), |
| 88 | +} |
0 commit comments