Creates a new `SequencerClient` for the given URL with the given headers This expects headers in the form: `header=value`
(
sequencer_endpoint: impl Into<String>,
headers: Vec<String>,
)
| 64 | /// |
| 65 | /// This expects headers in the form: `header=value` |
| 66 | pub async fn new_with_headers( |
| 67 | sequencer_endpoint: impl Into<String>, |
| 68 | headers: Vec<String>, |
| 69 | ) -> Result<Self, Error> { |
| 70 | let sequencer_endpoint = sequencer_endpoint.into(); |
| 71 | let endpoint = BuiltInConnectionString::from_str(&sequencer_endpoint)?; |
| 72 | if matches!(&endpoint, BuiltInConnectionString::Http(_)) { |
| 73 | Self::new_http_with_headers(sequencer_endpoint, headers) |
| 74 | } else { |
| 75 | let client = ClientBuilder::default().connect_with(endpoint).await?; |
| 76 | let inner = SequencerClientInner::new(sequencer_endpoint, client); |
| 77 | Ok(Self { inner: Arc::new(inner) }) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /// Creates an HTTP sequencer client synchronously, with optional `header=value` headers. |
| 82 | /// |