feat(txbuilder): allow cloning of relevant structs (#558)
Co-authored-by: logicalmechanism <logicalmechanism@protonmail.com>
This commit is contained in:
parent
cfc840f1b2
commit
2864ff45a9
3 changed files with 10 additions and 12 deletions
|
|
@ -16,8 +16,6 @@ use pallas::{
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
use hex::FromHex;
|
use hex::FromHex;
|
||||||
|
|
||||||
use hex::FromHex;
|
|
||||||
|
|
||||||
async fn do_localstate_query(client: &mut NodeClient) {
|
async fn do_localstate_query(client: &mut NodeClient) {
|
||||||
let client = client.statequery();
|
let client = client.statequery();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||||
pub mod model;
|
pub mod model;
|
||||||
pub mod serialise;
|
pub mod serialise;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum TransactionStatus {
|
pub enum TransactionStatus {
|
||||||
#[default]
|
#[default]
|
||||||
|
|
@ -11,10 +11,10 @@ pub enum TransactionStatus {
|
||||||
Built,
|
Built,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Debug)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
pub struct Bytes32(pub [u8; 32]);
|
pub struct Bytes32(pub [u8; 32]);
|
||||||
|
|
||||||
#[derive(Hash, PartialEq, Eq, Debug)]
|
#[derive(Hash, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct Bytes64(pub [u8; 64]);
|
pub struct Bytes64(pub [u8; 64]);
|
||||||
|
|
||||||
type PublicKey = Bytes32;
|
type PublicKey = Bytes32;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use super::{
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Don't make wrapper types public
|
// TODO: Don't make wrapper types public
|
||||||
#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct StagingTransaction {
|
pub struct StagingTransaction {
|
||||||
pub version: String,
|
pub version: String,
|
||||||
pub status: TransactionStatus,
|
pub status: TransactionStatus,
|
||||||
|
|
@ -375,7 +375,7 @@ impl StagingTransaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Don't want our wrapper types in fields public
|
// TODO: Don't want our wrapper types in fields public
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Hash)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Hash, Clone)]
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub tx_hash: TxHash,
|
pub tx_hash: TxHash,
|
||||||
pub txo_index: u64,
|
pub txo_index: u64,
|
||||||
|
|
@ -547,7 +547,7 @@ pub struct Datum {
|
||||||
pub bytes: DatumBytes,
|
pub bytes: DatumBytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Debug)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
pub enum RedeemerPurpose {
|
pub enum RedeemerPurpose {
|
||||||
Spend(Input),
|
Spend(Input),
|
||||||
Mint(PolicyId),
|
Mint(PolicyId),
|
||||||
|
|
@ -555,13 +555,13 @@ pub enum RedeemerPurpose {
|
||||||
// Cert TODO
|
// Cert TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct ExUnits {
|
pub struct ExUnits {
|
||||||
pub mem: u64,
|
pub mem: u64,
|
||||||
pub steps: u64,
|
pub steps: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Clone)]
|
||||||
pub struct Redeemers(HashMap<RedeemerPurpose, (Bytes, Option<ExUnits>)>);
|
pub struct Redeemers(HashMap<RedeemerPurpose, (Bytes, Option<ExUnits>)>);
|
||||||
|
|
||||||
impl Deref for Redeemers {
|
impl Deref for Redeemers {
|
||||||
|
|
@ -595,14 +595,14 @@ impl From<PallasAddress> for Address {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum BuilderEra {
|
pub enum BuilderEra {
|
||||||
Babbage,
|
Babbage,
|
||||||
Conway,
|
Conway,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct BuiltTransaction {
|
pub struct BuiltTransaction {
|
||||||
pub version: String,
|
pub version: String,
|
||||||
pub era: BuilderEra,
|
pub era: BuilderEra,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue