Struct flow_sdk::transaction::TransactionHeaderBuilder[][src]

pub struct TransactionHeaderBuilder { /* fields omitted */ }
Expand description

A builder for TransactionHeaders.

Implementations

A builder for a transaction header.

use cadence_json::ValueRef;
const SCRIPT: &str = r#"
    transaction(greeting: String) {
       let guest: Address

       prepare(authorizer: AuthAccount) {
           self.guest = authorizer.address
       }

       execute {
           log(greeting.concat(",").concat(guest.toString()))
       }
    }
"#;

let argument = ValueRef::String("Hello");

let header = TransactionHeaderBuilder::new().script_static(SCRIPT).argument(&argument);

assert_eq!(header.build(), TransactionHeader {
    script: SCRIPT.into(),
    arguments: vec![serde_json::to_vec(&argument).unwrap().into_boxed_slice()]
})

Creates a new builder for TransactionHeaders.

Sets the script of the transaction.

Sets the script of the transaction.

Clone the script into the builder. Do not use this if you have owned instances or static reference.

Adds an argument to the transaction header.

Adds arguments to the transaction header.

Builds a transaction header, assuming the script was set.

Shorthand for self.build().into_party_builder().

Builds a transaction header, returning Err(self) if the script was not set.

Trait Implementations

Returns the “default value” for a type. 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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Wrap the input message T in a tonic::Request

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more