pub struct BootstrapWitnesses(_);

Implementations§

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
Hide additional 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(),
    })
}
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
Hide additional 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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
The name of the generated JSON Schema. Read more
Generates a JSON Schema for this type. Read more
Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.