pub struct BootstrapWitnesses(_);
Implementations§
source§impl BootstrapWitnesses
impl BootstrapWitnesses
sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
src/tx_builder/batch_tools/witnesses_calculator.rs (line 106)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
pub(super) fn create_mock_witnesses_set(&self) -> TransactionWitnessSet {
let fake_key_root = fake_private_key();
let raw_key_public = fake_raw_key_public();
let fake_sig = fake_raw_key_sig();
// recall: this includes keys for input, certs and withdrawals
let vkeys = match self.vkeys_count {
0 => None,
x => {
let fake_vkey_witness = Vkeywitness::new(&Vkey::new(&raw_key_public), &fake_sig);
let mut result = Vkeywitnesses::new();
for _i in 0..x {
result.add(&fake_vkey_witness.clone());
}
Some(result)
}
};
let bootstrap_keys = match self.boostrap_count {
0 => None,
_x => {
let mut result = BootstrapWitnesses::new();
for boostrap_address in &self.bootsraps {
// picking icarus over daedalus for fake witness generation shouldn't matter
result.add(&make_icarus_bootstrap_witness(
&TransactionHash::from([0u8; TransactionHash::BYTE_COUNT]),
boostrap_address,
&fake_key_root,
));
}
Some(result)
}
};
TransactionWitnessSet {
vkeys,
native_scripts: None,
bootstraps: bootstrap_keys,
plutus_scripts: None,
plutus_data: None,
redeemers: None,
}
}
More examples
src/tx_builder.rs (line 119)
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
fn fake_full_tx(
tx_builder: &TransactionBuilder,
body: TransactionBody,
) -> Result<Transaction, JsError> {
let fake_key_root = fake_private_key();
let raw_key_public = fake_raw_key_public();
let fake_sig = fake_raw_key_sig();
// recall: this includes keys for input, certs and withdrawals
let vkeys = match count_needed_vkeys(tx_builder) {
0 => None,
x => {
let fake_vkey_witness = Vkeywitness::new(&Vkey::new(&raw_key_public), &fake_sig);
let mut result = Vkeywitnesses::new();
for _i in 0..x {
result.add(&fake_vkey_witness.clone());
}
Some(result)
}
};
let bootstraps = get_bootstraps(&tx_builder.inputs);
let bootstrap_keys = match bootstraps.len() {
0 => None,
_x => {
let mut result = BootstrapWitnesses::new();
for addr in bootstraps {
// picking icarus over daedalus for fake witness generation shouldn't matter
result.add(&make_icarus_bootstrap_witness(
&TransactionHash::from([0u8; TransactionHash::BYTE_COUNT]),
&ByronAddress::from_bytes(addr.clone()).unwrap(),
&fake_key_root,
));
}
Some(result)
}
};
let (plutus_scripts, plutus_data, redeemers) = {
if let Some(s) = tx_builder.get_combined_plutus_scripts() {
let (s, d, r) = s.collect();
(Some(s), d, Some(r))
} else {
(None, None, None)
}
};
let witness_set = TransactionWitnessSet {
vkeys,
native_scripts: tx_builder.get_combined_native_scripts(),
bootstraps: bootstrap_keys,
plutus_scripts,
plutus_data,
redeemers,
};
Ok(Transaction {
body,
witness_set,
is_valid: true,
auxiliary_data: tx_builder.auxiliary_data.clone(),
})
}
pub fn len(&self) -> usize
pub fn get(&self, index: usize) -> BootstrapWitness
sourcepub fn add(&mut self, elem: &BootstrapWitness)
pub fn add(&mut self, elem: &BootstrapWitness)
Examples found in repository?
src/tx_builder/batch_tools/witnesses_calculator.rs (lines 109-113)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
pub(super) fn create_mock_witnesses_set(&self) -> TransactionWitnessSet {
let fake_key_root = fake_private_key();
let raw_key_public = fake_raw_key_public();
let fake_sig = fake_raw_key_sig();
// recall: this includes keys for input, certs and withdrawals
let vkeys = match self.vkeys_count {
0 => None,
x => {
let fake_vkey_witness = Vkeywitness::new(&Vkey::new(&raw_key_public), &fake_sig);
let mut result = Vkeywitnesses::new();
for _i in 0..x {
result.add(&fake_vkey_witness.clone());
}
Some(result)
}
};
let bootstrap_keys = match self.boostrap_count {
0 => None,
_x => {
let mut result = BootstrapWitnesses::new();
for boostrap_address in &self.bootsraps {
// picking icarus over daedalus for fake witness generation shouldn't matter
result.add(&make_icarus_bootstrap_witness(
&TransactionHash::from([0u8; TransactionHash::BYTE_COUNT]),
boostrap_address,
&fake_key_root,
));
}
Some(result)
}
};
TransactionWitnessSet {
vkeys,
native_scripts: None,
bootstraps: bootstrap_keys,
plutus_scripts: None,
plutus_data: None,
redeemers: None,
}
}
More examples
src/tx_builder.rs (lines 122-126)
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
fn fake_full_tx(
tx_builder: &TransactionBuilder,
body: TransactionBody,
) -> Result<Transaction, JsError> {
let fake_key_root = fake_private_key();
let raw_key_public = fake_raw_key_public();
let fake_sig = fake_raw_key_sig();
// recall: this includes keys for input, certs and withdrawals
let vkeys = match count_needed_vkeys(tx_builder) {
0 => None,
x => {
let fake_vkey_witness = Vkeywitness::new(&Vkey::new(&raw_key_public), &fake_sig);
let mut result = Vkeywitnesses::new();
for _i in 0..x {
result.add(&fake_vkey_witness.clone());
}
Some(result)
}
};
let bootstraps = get_bootstraps(&tx_builder.inputs);
let bootstrap_keys = match bootstraps.len() {
0 => None,
_x => {
let mut result = BootstrapWitnesses::new();
for addr in bootstraps {
// picking icarus over daedalus for fake witness generation shouldn't matter
result.add(&make_icarus_bootstrap_witness(
&TransactionHash::from([0u8; TransactionHash::BYTE_COUNT]),
&ByronAddress::from_bytes(addr.clone()).unwrap(),
&fake_key_root,
));
}
Some(result)
}
};
let (plutus_scripts, plutus_data, redeemers) = {
if let Some(s) = tx_builder.get_combined_plutus_scripts() {
let (s, d, r) = s.collect();
(Some(s), d, Some(r))
} else {
(None, None, None)
}
};
let witness_set = TransactionWitnessSet {
vkeys,
native_scripts: tx_builder.get_combined_native_scripts(),
bootstraps: bootstrap_keys,
plutus_scripts,
plutus_data,
redeemers,
};
Ok(Transaction {
body,
witness_set,
is_valid: true,
auxiliary_data: tx_builder.auxiliary_data.clone(),
})
}
Trait Implementations§
source§impl Clone for BootstrapWitnesses
impl Clone for BootstrapWitnesses
source§fn clone(&self) -> BootstrapWitnesses
fn clone(&self) -> BootstrapWitnesses
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BootstrapWitnesses
impl Debug for BootstrapWitnesses
source§impl<'de> Deserialize<'de> for BootstrapWitnesses
impl<'de> Deserialize<'de> for BootstrapWitnesses
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Deserialize for BootstrapWitnesses
impl Deserialize for BootstrapWitnesses
fn deserialize<R: BufRead + Seek>(
raw: &mut Deserializer<R>
) -> Result<Self, DeserializeError>
source§impl JsonSchema for BootstrapWitnesses
impl JsonSchema for BootstrapWitnesses
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl PartialEq<BootstrapWitnesses> for BootstrapWitnesses
impl PartialEq<BootstrapWitnesses> for BootstrapWitnesses
source§fn eq(&self, other: &BootstrapWitnesses) -> bool
fn eq(&self, other: &BootstrapWitnesses) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.