near_openapi_client/
lib.rs

1//!# near-openapi-client
2
3//!
4
5//!Progenitor-generated client of NEAR JSON RPC API
6
7//!
8
9//!Consists of two crates:
10
11//! - near-openapi-client - client to connect to the API, generated by progenitor
12
13//! - near-openapi-types - types used by client
14
15//!
16
17//!### Usage example:
18
19//!
20
21//!Add near-openapi-client to your project dependencies:
22
23//!```
24
25//!cargo add near-openapi-client
26
27//!```
28
29//!
30
31//!Use the client to get latest block info:
32
33//!```rust
34
35//!use near_openapi_client as client;
36
37//!
38
39//!// Setup client
40
41//!const NEAR_RPC_URL_REMOTE: &str = "https://archival-rpc.mainnet.near.org";
42
43//!let client_remote = client::Client::new(NEAR_RPC_URL_LOCAL);
44
45//!
46
47//!// Construct request
48
49//!let payload_block_final = client::types::JsonRpcRequestForBlock {
50
51//!    id: String::from("dontcare"),
52
53//!    jsonrpc: String::from("2.0"),
54
55//!    method: client::types::JsonRpcRequestForBlockMethod::Block,
56
57//!    params: client::types::RpcBlockRequest::Finality(client::types::Finality::Final),
58
59//!};
60
61//!
62
63//!// Make the request, get the response
64
65//!let block_final: client::types::JsonRpcResponseForRpcBlockResponseAndRpcError =
66
67//!    client_local.block(&payload_block_final).await?.into_inner();
68
69//!println!("block_final: {:#?}", block_final);
70
71//!```
72
73//!
74
75//!<details>
76
77//!
78
79//!<summary>Example response</summary>
80
81//!
82
83//!```
84
85//!response for block_final: Variant0 {
86
87//!    id: "dontcare",
88
89//!    jsonrpc: "2.0",
90
91//!    result: RpcBlockResponse {
92
93//!        author: AccountId(
94
95//!            "test.near",
96
97//!        ),
98
99//!        chunks: [
100
101//!            ChunkHeaderView {
102
103//!                balance_burnt: "0",
104
105//!                bandwidth_requests: Some(
106
107//!                    V1(
108
109//!                        BandwidthRequestsV1 {
110
111//!                            requests: [],
112
113//!                        },
114
115//!                    ),
116
117//!                ),
118
119//!                chunk_hash: CryptoHash(
120
121//!                    "59srn1AQyCxqhXuURBGomupX8tCEj25XXFW15YZDgnM6",
122
123//!                ),
124
125//!                congestion_info: Some(
126
127//!                    CongestionInfoView {
128
129//!                        allowed_shard: 0,
130
131//!                        buffered_receipts_gas: "0",
132
133//!                        delayed_receipts_gas: "0",
134
135//!                        receipt_bytes: 0,
136
137//!                    },
138
139//!                ),
140
141//!                encoded_length: 8,
142
143//!                encoded_merkle_root: CryptoHash(
144
145//!                    "79Bt7ivt9Qhp3c6dJYnueaTyPVweYxZRpQHASRRAiyuy",
146
147//!                ),
148
149//!                gas_limit: 1000000000000000,
150
151//!                gas_used: 0,
152
153//!                height_created: 6,
154
155//!                height_included: 6,
156
157//!                outcome_root: CryptoHash(
158
159//!                    "11111111111111111111111111111111",
160
161//!                ),
162
163//!                outgoing_receipts_root: CryptoHash(
164
165//!                    "H4Rd6SGeEBTbxkitsCdzfu9xL9HtZ2eHoPCQXUeZ6bW4",
166
167//!                ),
168
169//!                prev_block_hash: CryptoHash(
170
171//!                    "DeJY83ZJbakCtkwe9J8RTE9TEAybp4E1GFCVrdki8Z6c",
172
173//!                ),
174
175//!                prev_state_root: CryptoHash(
176
177//!                    "7t7WeJdAzh9qmKLHfVRboDZupfAjfy9FC3onAN1LRnyp",
178
179//!                ),
180
181//!                rent_paid: "0",
182
183//!                shard_id: ShardId(
184
185//!                    0,
186
187//!                ),
188
189//!                signature: Signature(
190
191//!                    "ed25519:5G8UWLLuVk3WvQTnSHmT7EQoCz521EaaxQ8f5mgNVxJjFW7o9VFfxuG6D5bNfCjmoTVWbc9WrUbXg2L11iGWQw2g",
192
193//!                ),
194
195//!                tx_root: CryptoHash(
196
197//!                    "11111111111111111111111111111111",
198
199//!                ),
200
201//!                validator_proposals: [],
202
203//!                validator_reward: "0",
204
205//!            },
206
207//!        ],
208
209//!        header: BlockHeaderView {
210
211//!            approvals: [
212
213//!                Some(
214
215//!                    Signature(
216
217//!                        "ed25519:4GobVKSiiRfwMBrukNeCLbiUQLAzVprFCSn5jDVqA8zm6oR9H8EudEogsBAedBqJKF8vXhohSC5Kfnsdw2XMXMw6",
218
219//!                    ),
220
221//!                ),
222
223//!            ],
224
225//!            block_body_hash: Some(
226
227//!                CryptoHash(
228
229//!                    "CjDTJC25qznGymgHiUrDwSgaqsme3deDNj3ftPWFfBew",
230
231//!                ),
232
233//!            ),
234
235//!            block_merkle_root: CryptoHash(
236
237//!                "EXTvaXuYTcvEd8KnWjhruX9NYNCTbXJrwfzEJAnELBds",
238
239//!            ),
240
241//!            block_ordinal: Some(
242
243//!                7,
244
245//!            ),
246
247//!            challenges_result: [],
248
249//!            challenges_root: CryptoHash(
250
251//!                "11111111111111111111111111111111",
252
253//!            ),
254
255//!            chunk_endorsements: Some(
256
257//!                [
258
259//!                    [
260
261//!                        1,
262
263//!                    ],
264
265//!                ],
266
267//!            ),
268
269//!            chunk_headers_root: CryptoHash(
270
271//!                "6fPXKHJce8krAwsXfdMgsSgmUd5CgcJBpBFKBhb7QT2j",
272
273//!            ),
274
275//!            chunk_mask: [
276
277//!                true,
278
279//!            ],
280
281//!            chunk_receipts_root: CryptoHash(
282
283//!                "9ETNjrt6MkwTgSVMMbpukfxRshSD1avBUUa4R4NuqwHv",
284
285//!            ),
286
287//!            chunk_tx_root: CryptoHash(
288
289//!                "7tkzFg8RHBmMw1ncRJZCCZAizgq4rwCftTKYLce8RU8t",
290
291//!            ),
292
293//!            chunks_included: 1,
294
295//!            epoch_id: CryptoHash(
296
297//!                "11111111111111111111111111111111",
298
299//!            ),
300
301//!            epoch_sync_data_hash: None,
302
303//!            gas_price: "100000000",
304
305//!            hash: CryptoHash(
306
307//!                "8UgWEvtdVcEu6uYBFboZKDoLsWk5DC5tz656fW3BA4ZL",
308
309//!            ),
310
311//!            height: 6,
312
313//!            last_ds_final_block: CryptoHash(
314
315//!                "DeJY83ZJbakCtkwe9J8RTE9TEAybp4E1GFCVrdki8Z6c",
316
317//!            ),
318
319//!            last_final_block: CryptoHash(
320
321//!                "AMu9bpsii9wjFukjFc5cMaBNCNDvmiz4Z7AmwBAMcDLh",
322
323//!            ),
324
325//!            latest_protocol_version: 78,
326
327//!            next_bp_hash: CryptoHash(
328
329//!                "ChxUrwNyJDYA9PbecbLq1KBvkj2mEW3nvzXHC244X2rT",
330
331//!            ),
332
333//!            next_epoch_id: CryptoHash(
334
335//!                "GsJ8x5msDUv7Zz4LgCxoqzeyWKvNT2sHdFyEdR3vZrCZ",
336
337//!            ),
338
339//!            outcome_root: CryptoHash(
340
341//!                "7tkzFg8RHBmMw1ncRJZCCZAizgq4rwCftTKYLce8RU8t",
342
343//!            ),
344
345//!            prev_hash: CryptoHash(
346
347//!                "DeJY83ZJbakCtkwe9J8RTE9TEAybp4E1GFCVrdki8Z6c",
348
349//!            ),
350
351//!            prev_height: Some(
352
353//!                5,
354
355//!            ),
356
357//!            prev_state_root: CryptoHash(
358
359//!                "9wppbHBR63GhoJWW3ti6qhD5AAEmiNr1DKWQq9kLwrHM",
360
361//!            ),
362
363//!            random_value: CryptoHash(
364
365//!                "6MypYizcvSPkaxgd7cXAgGfHo8TsnmouzLtCHnGASbKe",
366
367//!            ),
368
369//!            rent_paid: "0",
370
371//!            signature: Signature(
372
373//!                "ed25519:3jHUhecrkNYoTDrQ8jARWco8vCNCdrwPewZrv1HQeTE5tQj78fjAYkJbgeFo8wcyi6maTFFYRNdHQ8nrmFa1Pjc",
374
375//!            ),
376
377//!            timestamp: 1750759979825366257,
378
379//!            timestamp_nanosec: "1750759979825366257",
380
381//!            total_supply: "2050000000000000000000000000000000",
382
383//!            validator_proposals: [],
384
385//!            validator_reward: "0",
386
387//!        },
388
389//!    },
390
391//!}
392
393//!```
394
395//!
396
397//!</details>
398
399//!
400pub use near_openapi_types as types;
401#[allow(unused_imports)]
402use progenitor_client::{encode_path, ClientHooks, OperationInfo, RequestBuilderExt};
403#[allow(unused_imports)]
404pub use progenitor_client::{ByteStream, ClientInfo, Error, ResponseValue};
405#[derive(Clone, Debug)]
406#[doc = "Client for NEAR Protocol JSON RPC API\n\nVersion: 1.2.2"]
407pub struct Client {
408    pub(crate) baseurl: String,
409    pub(crate) client: reqwest::Client,
410}
411impl Client {
412    #[doc = r" Create a new client."]
413    #[doc = r""]
414    #[doc = r" `baseurl` is the base URL provided to the internal"]
415    #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
416    #[doc = r" as well as port and a path stem if applicable."]
417    pub fn new(baseurl: &str) -> Self {
418        #[cfg(not(target_arch = "wasm32"))]
419        let client = {
420            let dur = ::std::time::Duration::from_secs(15u64);
421            reqwest::ClientBuilder::new()
422                .connect_timeout(dur)
423                .timeout(dur)
424        };
425        #[cfg(target_arch = "wasm32")]
426        let client = reqwest::ClientBuilder::new();
427        Self::new_with_client(baseurl, client.build().unwrap())
428    }
429    #[doc = r" Construct a new client with an existing `reqwest::Client`,"]
430    #[doc = r" allowing more control over its configuration."]
431    #[doc = r""]
432    #[doc = r" `baseurl` is the base URL provided to the internal"]
433    #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
434    #[doc = r" as well as port and a path stem if applicable."]
435    pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
436        Self {
437            baseurl: baseurl.to_string(),
438            client,
439        }
440    }
441}
442impl ClientInfo<()> for Client {
443    fn api_version() -> &'static str {
444        "1.2.2"
445    }
446    fn baseurl(&self) -> &str {
447        self.baseurl.as_str()
448    }
449    fn client(&self) -> &reqwest::Client {
450        &self.client
451    }
452    fn inner(&self) -> &() {
453        &()
454    }
455}
456impl ClientHooks<()> for &Client {}
457#[allow(clippy::all)]
458impl Client {
459    #[doc = "[Deprecated] Returns changes for a given account, contract or contract code for given block height or hash. Consider using changes instead.\n\nSends a `POST` request to `/EXPERIMENTAL_changes`\n\n"]
460    pub async fn experimental_changes<'a>(
461        &'a self,
462        body: &'a types::JsonRpcRequestForExperimentalChanges,
463    ) -> Result<
464        ResponseValue<
465            types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
466        >,
467        Error<()>,
468    > {
469        let url = format!("{}/", self.baseurl,);
470        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
471        header_map.append(
472            ::reqwest::header::HeaderName::from_static("api-version"),
473            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
474        );
475        #[allow(unused_mut)]
476        let mut request = self
477            .client
478            .post(url)
479            .header(
480                ::reqwest::header::ACCEPT,
481                ::reqwest::header::HeaderValue::from_static("application/json"),
482            )
483            .json(&body)
484            .headers(header_map)
485            .build()?;
486        let info = OperationInfo {
487            operation_id: "experimental_changes",
488        };
489        self.pre(&mut request, &info).await?;
490        let result = self.exec(request, &info).await;
491        self.post(&result, &info).await?;
492        let response = result?;
493        match response.status().as_u16() {
494            200u16 => ResponseValue::from_response(response).await,
495            _ => Err(Error::UnexpectedResponse(response)),
496        }
497    }
498    #[doc = "[Deprecated] Returns changes in block for given block height or hash over all transactions for all the types. Includes changes like account_touched, access_key_touched, data_touched, contract_code_touched. Consider using block_effects instead\n\nSends a `POST` request to `/EXPERIMENTAL_changes_in_block`\n\n"]
499    pub async fn experimental_changes_in_block<'a>(
500        &'a self,
501        body: &'a types::JsonRpcRequestForExperimentalChangesInBlock,
502    ) -> Result<
503        ResponseValue<
504            types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
505        >,
506        Error<()>,
507    > {
508        let url = format!("{}/", self.baseurl,);
509        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
510        header_map.append(
511            ::reqwest::header::HeaderName::from_static("api-version"),
512            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
513        );
514        #[allow(unused_mut)]
515        let mut request = self
516            .client
517            .post(url)
518            .header(
519                ::reqwest::header::ACCEPT,
520                ::reqwest::header::HeaderValue::from_static("application/json"),
521            )
522            .json(&body)
523            .headers(header_map)
524            .build()?;
525        let info = OperationInfo {
526            operation_id: "experimental_changes_in_block",
527        };
528        self.pre(&mut request, &info).await?;
529        let result = self.exec(request, &info).await;
530        self.post(&result, &info).await?;
531        let response = result?;
532        match response.status().as_u16() {
533            200u16 => ResponseValue::from_response(response).await,
534            _ => Err(Error::UnexpectedResponse(response)),
535        }
536    }
537    #[doc = "Queries the congestion level of a shard. More info about congestion [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)\n\nSends a `POST` request to `/EXPERIMENTAL_congestion_level`\n\n"]
538    pub async fn experimental_congestion_level<'a>(
539        &'a self,
540        body: &'a types::JsonRpcRequestForExperimentalCongestionLevel,
541    ) -> Result<
542        ResponseValue<types::JsonRpcResponseForRpcCongestionLevelResponseAndRpcChunkError>,
543        Error<()>,
544    > {
545        let url = format!("{}/", self.baseurl,);
546        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
547        header_map.append(
548            ::reqwest::header::HeaderName::from_static("api-version"),
549            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
550        );
551        #[allow(unused_mut)]
552        let mut request = self
553            .client
554            .post(url)
555            .header(
556                ::reqwest::header::ACCEPT,
557                ::reqwest::header::HeaderValue::from_static("application/json"),
558            )
559            .json(&body)
560            .headers(header_map)
561            .build()?;
562        let info = OperationInfo {
563            operation_id: "experimental_congestion_level",
564        };
565        self.pre(&mut request, &info).await?;
566        let result = self.exec(request, &info).await;
567        self.post(&result, &info).await?;
568        let response = result?;
569        match response.status().as_u16() {
570            200u16 => ResponseValue::from_response(response).await,
571            _ => Err(Error::UnexpectedResponse(response)),
572        }
573    }
574    #[doc = "[Deprecated] Get initial state and parameters for the genesis block. Consider genesis_config instead.\n\nSends a `POST` request to `/EXPERIMENTAL_genesis_config`\n\n"]
575    pub async fn experimental_genesis_config<'a>(
576        &'a self,
577        body: &'a types::JsonRpcRequestForExperimentalGenesisConfig,
578    ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndGenesisConfigError>, Error<()>>
579    {
580        let url = format!("{}/", self.baseurl,);
581        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
582        header_map.append(
583            ::reqwest::header::HeaderName::from_static("api-version"),
584            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
585        );
586        #[allow(unused_mut)]
587        let mut request = self
588            .client
589            .post(url)
590            .header(
591                ::reqwest::header::ACCEPT,
592                ::reqwest::header::HeaderValue::from_static("application/json"),
593            )
594            .json(&body)
595            .headers(header_map)
596            .build()?;
597        let info = OperationInfo {
598            operation_id: "experimental_genesis_config",
599        };
600        self.pre(&mut request, &info).await?;
601        let result = self.exec(request, &info).await;
602        self.post(&result, &info).await?;
603        let response = result?;
604        match response.status().as_u16() {
605            200u16 => ResponseValue::from_response(response).await,
606            _ => Err(Error::UnexpectedResponse(response)),
607        }
608    }
609    #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_block_proof`\n\n"]
610    pub async fn experimental_light_client_block_proof<'a>(
611        &'a self,
612        body: &'a types::JsonRpcRequestForExperimentalLightClientBlockProof,
613    ) -> Result<
614        ResponseValue<
615            types::JsonRpcResponseForRpcLightClientBlockProofResponseAndRpcLightClientProofError,
616        >,
617        Error<()>,
618    > {
619        let url = format!("{}/", self.baseurl,);
620        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
621        header_map.append(
622            ::reqwest::header::HeaderName::from_static("api-version"),
623            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
624        );
625        #[allow(unused_mut)]
626        let mut request = self
627            .client
628            .post(url)
629            .header(
630                ::reqwest::header::ACCEPT,
631                ::reqwest::header::HeaderValue::from_static("application/json"),
632            )
633            .json(&body)
634            .headers(header_map)
635            .build()?;
636        let info = OperationInfo {
637            operation_id: "experimental_light_client_block_proof",
638        };
639        self.pre(&mut request, &info).await?;
640        let result = self.exec(request, &info).await;
641        self.post(&result, &info).await?;
642        let response = result?;
643        match response.status().as_u16() {
644            200u16 => ResponseValue::from_response(response).await,
645            _ => Err(Error::UnexpectedResponse(response)),
646        }
647    }
648    #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_proof`\n\n"]    pub async fn experimental_light_client_proof < 'a > (& 'a self , body : & 'a types :: JsonRpcRequestForExperimentalLightClientProof) -> Result < ResponseValue < types :: JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcLightClientProofError > , Error < () > , >{
649        let url = format!("{}/", self.baseurl,);
650        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
651        header_map.append(
652            ::reqwest::header::HeaderName::from_static("api-version"),
653            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
654        );
655        #[allow(unused_mut)]
656        let mut request = self
657            .client
658            .post(url)
659            .header(
660                ::reqwest::header::ACCEPT,
661                ::reqwest::header::HeaderValue::from_static("application/json"),
662            )
663            .json(&body)
664            .headers(header_map)
665            .build()?;
666        let info = OperationInfo {
667            operation_id: "experimental_light_client_proof",
668        };
669        self.pre(&mut request, &info).await?;
670        let result = self.exec(request, &info).await;
671        self.post(&result, &info).await?;
672        let response = result?;
673        match response.status().as_u16() {
674            200u16 => ResponseValue::from_response(response).await,
675            _ => Err(Error::UnexpectedResponse(response)),
676        }
677    }
678    #[doc = "[Deprecated] Returns the future windows for maintenance in current epoch for the specified account. In the maintenance windows, the node will not be block producer or chunk producer. Consider using maintenance_windows instead.\n\nSends a `POST` request to `/EXPERIMENTAL_maintenance_windows`\n\n"]
679    pub async fn experimental_maintenance_windows<'a>(
680        &'a self,
681        body: &'a types::JsonRpcRequestForExperimentalMaintenanceWindows,
682    ) -> Result<
683        ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError>,
684        Error<()>,
685    > {
686        let url = format!("{}/", self.baseurl,);
687        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
688        header_map.append(
689            ::reqwest::header::HeaderName::from_static("api-version"),
690            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
691        );
692        #[allow(unused_mut)]
693        let mut request = self
694            .client
695            .post(url)
696            .header(
697                ::reqwest::header::ACCEPT,
698                ::reqwest::header::HeaderValue::from_static("application/json"),
699            )
700            .json(&body)
701            .headers(header_map)
702            .build()?;
703        let info = OperationInfo {
704            operation_id: "experimental_maintenance_windows",
705        };
706        self.pre(&mut request, &info).await?;
707        let result = self.exec(request, &info).await;
708        self.post(&result, &info).await?;
709        let response = result?;
710        match response.status().as_u16() {
711            200u16 => ResponseValue::from_response(response).await,
712            _ => Err(Error::UnexpectedResponse(response)),
713        }
714    }
715    #[doc = "A configuration that defines the protocol-level parameters such as gas/storage costs, limits, feature flags, other settings\n\nSends a `POST` request to `/EXPERIMENTAL_protocol_config`\n\n"]
716    pub async fn experimental_protocol_config<'a>(
717        &'a self,
718        body: &'a types::JsonRpcRequestForExperimentalProtocolConfig,
719    ) -> Result<
720        ResponseValue<types::JsonRpcResponseForRpcProtocolConfigResponseAndRpcProtocolConfigError>,
721        Error<()>,
722    > {
723        let url = format!("{}/", self.baseurl,);
724        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
725        header_map.append(
726            ::reqwest::header::HeaderName::from_static("api-version"),
727            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
728        );
729        #[allow(unused_mut)]
730        let mut request = self
731            .client
732            .post(url)
733            .header(
734                ::reqwest::header::ACCEPT,
735                ::reqwest::header::HeaderValue::from_static("application/json"),
736            )
737            .json(&body)
738            .headers(header_map)
739            .build()?;
740        let info = OperationInfo {
741            operation_id: "experimental_protocol_config",
742        };
743        self.pre(&mut request, &info).await?;
744        let result = self.exec(request, &info).await;
745        self.post(&result, &info).await?;
746        let response = result?;
747        match response.status().as_u16() {
748            200u16 => ResponseValue::from_response(response).await,
749            _ => Err(Error::UnexpectedResponse(response)),
750        }
751    }
752    #[doc = "Fetches a receipt by its ID (as is, without a status or execution outcome)\n\nSends a `POST` request to `/EXPERIMENTAL_receipt`\n\n"]
753    pub async fn experimental_receipt<'a>(
754        &'a self,
755        body: &'a types::JsonRpcRequestForExperimentalReceipt,
756    ) -> Result<
757        ResponseValue<types::JsonRpcResponseForRpcReceiptResponseAndRpcReceiptError>,
758        Error<()>,
759    > {
760        let url = format!("{}/", self.baseurl,);
761        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
762        header_map.append(
763            ::reqwest::header::HeaderName::from_static("api-version"),
764            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
765        );
766        #[allow(unused_mut)]
767        let mut request = self
768            .client
769            .post(url)
770            .header(
771                ::reqwest::header::ACCEPT,
772                ::reqwest::header::HeaderValue::from_static("application/json"),
773            )
774            .json(&body)
775            .headers(header_map)
776            .build()?;
777        let info = OperationInfo {
778            operation_id: "experimental_receipt",
779        };
780        self.pre(&mut request, &info).await?;
781        let result = self.exec(request, &info).await;
782        self.post(&result, &info).await?;
783        let response = result?;
784        match response.status().as_u16() {
785            200u16 => ResponseValue::from_response(response).await,
786            _ => Err(Error::UnexpectedResponse(response)),
787        }
788    }
789    #[doc = "Contains the split storage information. More info on split storage [here](https://near-nodes.io/archival/split-storage-archival)\n\nSends a `POST` request to `/EXPERIMENTAL_split_storage_info`\n\n"]
790    pub async fn experimental_split_storage_info<'a>(
791        &'a self,
792        body: &'a types::JsonRpcRequestForExperimentalSplitStorageInfo,
793    ) -> Result<
794        ResponseValue<
795            types::JsonRpcResponseForRpcSplitStorageInfoResponseAndRpcSplitStorageInfoError,
796        >,
797        Error<()>,
798    > {
799        let url = format!("{}/", self.baseurl,);
800        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
801        header_map.append(
802            ::reqwest::header::HeaderName::from_static("api-version"),
803            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
804        );
805        #[allow(unused_mut)]
806        let mut request = self
807            .client
808            .post(url)
809            .header(
810                ::reqwest::header::ACCEPT,
811                ::reqwest::header::HeaderValue::from_static("application/json"),
812            )
813            .json(&body)
814            .headers(header_map)
815            .build()?;
816        let info = OperationInfo {
817            operation_id: "experimental_split_storage_info",
818        };
819        self.pre(&mut request, &info).await?;
820        let result = self.exec(request, &info).await;
821        self.post(&result, &info).await?;
822        let response = result?;
823        match response.status().as_u16() {
824            200u16 => ResponseValue::from_response(response).await,
825            _ => Err(Error::UnexpectedResponse(response)),
826        }
827    }
828    #[doc = "Queries status of a transaction by hash, returning the final transaction result and details of all receipts.\n\nSends a `POST` request to `/EXPERIMENTAL_tx_status`\n\n"]
829    pub async fn experimental_tx_status<'a>(
830        &'a self,
831        body: &'a types::JsonRpcRequestForExperimentalTxStatus,
832    ) -> Result<
833        ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
834        Error<()>,
835    > {
836        let url = format!("{}/", self.baseurl,);
837        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
838        header_map.append(
839            ::reqwest::header::HeaderName::from_static("api-version"),
840            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
841        );
842        #[allow(unused_mut)]
843        let mut request = self
844            .client
845            .post(url)
846            .header(
847                ::reqwest::header::ACCEPT,
848                ::reqwest::header::HeaderValue::from_static("application/json"),
849            )
850            .json(&body)
851            .headers(header_map)
852            .build()?;
853        let info = OperationInfo {
854            operation_id: "experimental_tx_status",
855        };
856        self.pre(&mut request, &info).await?;
857        let result = self.exec(request, &info).await;
858        self.post(&result, &info).await?;
859        let response = result?;
860        match response.status().as_u16() {
861            200u16 => ResponseValue::from_response(response).await,
862            _ => Err(Error::UnexpectedResponse(response)),
863        }
864    }
865    #[doc = "Returns the current epoch validators ordered in the block producer order with repetition. This endpoint is solely used for bridge currently and is not intended for other external use cases.\n\nSends a `POST` request to `/EXPERIMENTAL_validators_ordered`\n\n"]
866    pub async fn experimental_validators_ordered<'a>(
867        &'a self,
868        body: &'a types::JsonRpcRequestForExperimentalValidatorsOrdered,
869    ) -> Result<
870        ResponseValue<types::JsonRpcResponseForArrayOfValidatorStakeViewAndRpcValidatorError>,
871        Error<()>,
872    > {
873        let url = format!("{}/", self.baseurl,);
874        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
875        header_map.append(
876            ::reqwest::header::HeaderName::from_static("api-version"),
877            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
878        );
879        #[allow(unused_mut)]
880        let mut request = self
881            .client
882            .post(url)
883            .header(
884                ::reqwest::header::ACCEPT,
885                ::reqwest::header::HeaderValue::from_static("application/json"),
886            )
887            .json(&body)
888            .headers(header_map)
889            .build()?;
890        let info = OperationInfo {
891            operation_id: "experimental_validators_ordered",
892        };
893        self.pre(&mut request, &info).await?;
894        let result = self.exec(request, &info).await;
895        self.post(&result, &info).await?;
896        let response = result?;
897        match response.status().as_u16() {
898            200u16 => ResponseValue::from_response(response).await,
899            _ => Err(Error::UnexpectedResponse(response)),
900        }
901    }
902    #[doc = "Returns block details for given height or hash\n\nSends a `POST` request to `/block`\n\n"]
903    pub async fn block<'a>(
904        &'a self,
905        body: &'a types::JsonRpcRequestForBlock,
906    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcBlockResponseAndRpcBlockError>, Error<()>>
907    {
908        let url = format!("{}/", self.baseurl,);
909        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
910        header_map.append(
911            ::reqwest::header::HeaderName::from_static("api-version"),
912            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
913        );
914        #[allow(unused_mut)]
915        let mut request = self
916            .client
917            .post(url)
918            .header(
919                ::reqwest::header::ACCEPT,
920                ::reqwest::header::HeaderValue::from_static("application/json"),
921            )
922            .json(&body)
923            .headers(header_map)
924            .build()?;
925        let info = OperationInfo {
926            operation_id: "block",
927        };
928        self.pre(&mut request, &info).await?;
929        let result = self.exec(request, &info).await;
930        self.post(&result, &info).await?;
931        let response = result?;
932        match response.status().as_u16() {
933            200u16 => ResponseValue::from_response(response).await,
934            _ => Err(Error::UnexpectedResponse(response)),
935        }
936    }
937    #[doc = "Returns changes in block for given block height or hash over all transactions for all the types. Includes changes like account_touched, access_key_touched, data_touched, contract_code_touched.\n\nSends a `POST` request to `/block_effects`\n\n"]
938    pub async fn block_effects<'a>(
939        &'a self,
940        body: &'a types::JsonRpcRequestForBlockEffects,
941    ) -> Result<
942        ResponseValue<
943            types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
944        >,
945        Error<()>,
946    > {
947        let url = format!("{}/", self.baseurl,);
948        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
949        header_map.append(
950            ::reqwest::header::HeaderName::from_static("api-version"),
951            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
952        );
953        #[allow(unused_mut)]
954        let mut request = self
955            .client
956            .post(url)
957            .header(
958                ::reqwest::header::ACCEPT,
959                ::reqwest::header::HeaderValue::from_static("application/json"),
960            )
961            .json(&body)
962            .headers(header_map)
963            .build()?;
964        let info = OperationInfo {
965            operation_id: "block_effects",
966        };
967        self.pre(&mut request, &info).await?;
968        let result = self.exec(request, &info).await;
969        self.post(&result, &info).await?;
970        let response = result?;
971        match response.status().as_u16() {
972            200u16 => ResponseValue::from_response(response).await,
973            _ => Err(Error::UnexpectedResponse(response)),
974        }
975    }
976    #[doc = "[Deprecated] Sends a transaction and immediately returns transaction hash. Consider using send_tx instead.\n\nSends a `POST` request to `/broadcast_tx_async`\n\n"]
977    pub async fn broadcast_tx_async<'a>(
978        &'a self,
979        body: &'a types::JsonRpcRequestForBroadcastTxAsync,
980    ) -> Result<ResponseValue<types::JsonRpcResponseForCryptoHashAndRpcTransactionError>, Error<()>>
981    {
982        let url = format!("{}/", self.baseurl,);
983        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
984        header_map.append(
985            ::reqwest::header::HeaderName::from_static("api-version"),
986            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
987        );
988        #[allow(unused_mut)]
989        let mut request = self
990            .client
991            .post(url)
992            .header(
993                ::reqwest::header::ACCEPT,
994                ::reqwest::header::HeaderValue::from_static("application/json"),
995            )
996            .json(&body)
997            .headers(header_map)
998            .build()?;
999        let info = OperationInfo {
1000            operation_id: "broadcast_tx_async",
1001        };
1002        self.pre(&mut request, &info).await?;
1003        let result = self.exec(request, &info).await;
1004        self.post(&result, &info).await?;
1005        let response = result?;
1006        match response.status().as_u16() {
1007            200u16 => ResponseValue::from_response(response).await,
1008            _ => Err(Error::UnexpectedResponse(response)),
1009        }
1010    }
1011    #[doc = "[Deprecated] Sends a transaction and waits until transaction is fully complete. (Has a 10 second timeout). Consider using send_tx instead.\n\nSends a `POST` request to `/broadcast_tx_commit`\n\n"]
1012    pub async fn broadcast_tx_commit<'a>(
1013        &'a self,
1014        body: &'a types::JsonRpcRequestForBroadcastTxCommit,
1015    ) -> Result<
1016        ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1017        Error<()>,
1018    > {
1019        let url = format!("{}/", self.baseurl,);
1020        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1021        header_map.append(
1022            ::reqwest::header::HeaderName::from_static("api-version"),
1023            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1024        );
1025        #[allow(unused_mut)]
1026        let mut request = self
1027            .client
1028            .post(url)
1029            .header(
1030                ::reqwest::header::ACCEPT,
1031                ::reqwest::header::HeaderValue::from_static("application/json"),
1032            )
1033            .json(&body)
1034            .headers(header_map)
1035            .build()?;
1036        let info = OperationInfo {
1037            operation_id: "broadcast_tx_commit",
1038        };
1039        self.pre(&mut request, &info).await?;
1040        let result = self.exec(request, &info).await;
1041        self.post(&result, &info).await?;
1042        let response = result?;
1043        match response.status().as_u16() {
1044            200u16 => ResponseValue::from_response(response).await,
1045            _ => Err(Error::UnexpectedResponse(response)),
1046        }
1047    }
1048    #[doc = "Returns changes for a given account, contract or contract code for given block height or hash.\n\nSends a `POST` request to `/changes`\n\n"]
1049    pub async fn changes<'a>(
1050        &'a self,
1051        body: &'a types::JsonRpcRequestForChanges,
1052    ) -> Result<
1053        ResponseValue<
1054            types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
1055        >,
1056        Error<()>,
1057    > {
1058        let url = format!("{}/", self.baseurl,);
1059        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1060        header_map.append(
1061            ::reqwest::header::HeaderName::from_static("api-version"),
1062            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1063        );
1064        #[allow(unused_mut)]
1065        let mut request = self
1066            .client
1067            .post(url)
1068            .header(
1069                ::reqwest::header::ACCEPT,
1070                ::reqwest::header::HeaderValue::from_static("application/json"),
1071            )
1072            .json(&body)
1073            .headers(header_map)
1074            .build()?;
1075        let info = OperationInfo {
1076            operation_id: "changes",
1077        };
1078        self.pre(&mut request, &info).await?;
1079        let result = self.exec(request, &info).await;
1080        self.post(&result, &info).await?;
1081        let response = result?;
1082        match response.status().as_u16() {
1083            200u16 => ResponseValue::from_response(response).await,
1084            _ => Err(Error::UnexpectedResponse(response)),
1085        }
1086    }
1087    #[doc = "Returns details of a specific chunk. You can run a block details query to get a valid chunk hash.\n\nSends a `POST` request to `/chunk`\n\n"]
1088    pub async fn chunk<'a>(
1089        &'a self,
1090        body: &'a types::JsonRpcRequestForChunk,
1091    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcChunkResponseAndRpcChunkError>, Error<()>>
1092    {
1093        let url = format!("{}/", self.baseurl,);
1094        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1095        header_map.append(
1096            ::reqwest::header::HeaderName::from_static("api-version"),
1097            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1098        );
1099        #[allow(unused_mut)]
1100        let mut request = self
1101            .client
1102            .post(url)
1103            .header(
1104                ::reqwest::header::ACCEPT,
1105                ::reqwest::header::HeaderValue::from_static("application/json"),
1106            )
1107            .json(&body)
1108            .headers(header_map)
1109            .build()?;
1110        let info = OperationInfo {
1111            operation_id: "chunk",
1112        };
1113        self.pre(&mut request, &info).await?;
1114        let result = self.exec(request, &info).await;
1115        self.post(&result, &info).await?;
1116        let response = result?;
1117        match response.status().as_u16() {
1118            200u16 => ResponseValue::from_response(response).await,
1119            _ => Err(Error::UnexpectedResponse(response)),
1120        }
1121    }
1122    #[doc = "Queries client node configuration\n\nSends a `POST` request to `/client_config`\n\n"]
1123    pub async fn client_config<'a>(
1124        &'a self,
1125        body: &'a types::JsonRpcRequestForClientConfig,
1126    ) -> Result<
1127        ResponseValue<types::JsonRpcResponseForRpcClientConfigResponseAndRpcClientConfigError>,
1128        Error<()>,
1129    > {
1130        let url = format!("{}/", self.baseurl,);
1131        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1132        header_map.append(
1133            ::reqwest::header::HeaderName::from_static("api-version"),
1134            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1135        );
1136        #[allow(unused_mut)]
1137        let mut request = self
1138            .client
1139            .post(url)
1140            .header(
1141                ::reqwest::header::ACCEPT,
1142                ::reqwest::header::HeaderValue::from_static("application/json"),
1143            )
1144            .json(&body)
1145            .headers(header_map)
1146            .build()?;
1147        let info = OperationInfo {
1148            operation_id: "client_config",
1149        };
1150        self.pre(&mut request, &info).await?;
1151        let result = self.exec(request, &info).await;
1152        self.post(&result, &info).await?;
1153        let response = result?;
1154        match response.status().as_u16() {
1155            200u16 => ResponseValue::from_response(response).await,
1156            _ => Err(Error::UnexpectedResponse(response)),
1157        }
1158    }
1159    #[doc = "Returns gas price for a specific block_height or block_hash. Using [null] will return the most recent block's gas price.\n\nSends a `POST` request to `/gas_price`\n\n"]
1160    pub async fn gas_price<'a>(
1161        &'a self,
1162        body: &'a types::JsonRpcRequestForGasPrice,
1163    ) -> Result<
1164        ResponseValue<types::JsonRpcResponseForRpcGasPriceResponseAndRpcGasPriceError>,
1165        Error<()>,
1166    > {
1167        let url = format!("{}/", self.baseurl,);
1168        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1169        header_map.append(
1170            ::reqwest::header::HeaderName::from_static("api-version"),
1171            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1172        );
1173        #[allow(unused_mut)]
1174        let mut request = self
1175            .client
1176            .post(url)
1177            .header(
1178                ::reqwest::header::ACCEPT,
1179                ::reqwest::header::HeaderValue::from_static("application/json"),
1180            )
1181            .json(&body)
1182            .headers(header_map)
1183            .build()?;
1184        let info = OperationInfo {
1185            operation_id: "gas_price",
1186        };
1187        self.pre(&mut request, &info).await?;
1188        let result = self.exec(request, &info).await;
1189        self.post(&result, &info).await?;
1190        let response = result?;
1191        match response.status().as_u16() {
1192            200u16 => ResponseValue::from_response(response).await,
1193            _ => Err(Error::UnexpectedResponse(response)),
1194        }
1195    }
1196    #[doc = "Get initial state and parameters for the genesis block\n\nSends a `POST` request to `/genesis_config`\n\n"]
1197    pub async fn genesis_config<'a>(
1198        &'a self,
1199        body: &'a types::JsonRpcRequestForGenesisConfig,
1200    ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndGenesisConfigError>, Error<()>>
1201    {
1202        let url = format!("{}/", self.baseurl,);
1203        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1204        header_map.append(
1205            ::reqwest::header::HeaderName::from_static("api-version"),
1206            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1207        );
1208        #[allow(unused_mut)]
1209        let mut request = self
1210            .client
1211            .post(url)
1212            .header(
1213                ::reqwest::header::ACCEPT,
1214                ::reqwest::header::HeaderValue::from_static("application/json"),
1215            )
1216            .json(&body)
1217            .headers(header_map)
1218            .build()?;
1219        let info = OperationInfo {
1220            operation_id: "genesis_config",
1221        };
1222        self.pre(&mut request, &info).await?;
1223        let result = self.exec(request, &info).await;
1224        self.post(&result, &info).await?;
1225        let response = result?;
1226        match response.status().as_u16() {
1227            200u16 => ResponseValue::from_response(response).await,
1228            _ => Err(Error::UnexpectedResponse(response)),
1229        }
1230    }
1231    #[doc = "Returns the current health status of the RPC node the client connects to.\n\nSends a `POST` request to `/health`\n\n"]
1232    pub async fn health<'a>(
1233        &'a self,
1234        body: &'a types::JsonRpcRequestForHealth,
1235    ) -> Result<
1236        ResponseValue<types::JsonRpcResponseForNullableRpcHealthResponseAndRpcStatusError>,
1237        Error<()>,
1238    > {
1239        let url = format!("{}/", self.baseurl,);
1240        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1241        header_map.append(
1242            ::reqwest::header::HeaderName::from_static("api-version"),
1243            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1244        );
1245        #[allow(unused_mut)]
1246        let mut request = self
1247            .client
1248            .post(url)
1249            .header(
1250                ::reqwest::header::ACCEPT,
1251                ::reqwest::header::HeaderValue::from_static("application/json"),
1252            )
1253            .json(&body)
1254            .headers(header_map)
1255            .build()?;
1256        let info = OperationInfo {
1257            operation_id: "health",
1258        };
1259        self.pre(&mut request, &info).await?;
1260        let result = self.exec(request, &info).await;
1261        self.post(&result, &info).await?;
1262        let response = result?;
1263        match response.status().as_u16() {
1264            200u16 => ResponseValue::from_response(response).await,
1265            _ => Err(Error::UnexpectedResponse(response)),
1266        }
1267    }
1268    #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/light_client_proof`\n\n"]    pub async fn light_client_proof < 'a > (& 'a self , body : & 'a types :: JsonRpcRequestForLightClientProof) -> Result < ResponseValue < types :: JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcLightClientProofError > , Error < () > , >{
1269        let url = format!("{}/", self.baseurl,);
1270        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1271        header_map.append(
1272            ::reqwest::header::HeaderName::from_static("api-version"),
1273            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1274        );
1275        #[allow(unused_mut)]
1276        let mut request = self
1277            .client
1278            .post(url)
1279            .header(
1280                ::reqwest::header::ACCEPT,
1281                ::reqwest::header::HeaderValue::from_static("application/json"),
1282            )
1283            .json(&body)
1284            .headers(header_map)
1285            .build()?;
1286        let info = OperationInfo {
1287            operation_id: "light_client_proof",
1288        };
1289        self.pre(&mut request, &info).await?;
1290        let result = self.exec(request, &info).await;
1291        self.post(&result, &info).await?;
1292        let response = result?;
1293        match response.status().as_u16() {
1294            200u16 => ResponseValue::from_response(response).await,
1295            _ => Err(Error::UnexpectedResponse(response)),
1296        }
1297    }
1298    #[doc = "Returns the future windows for maintenance in current epoch for the specified account. In the maintenance windows, the node will not be block producer or chunk producer.\n\nSends a `POST` request to `/maintenance_windows`\n\n"]
1299    pub async fn maintenance_windows<'a>(
1300        &'a self,
1301        body: &'a types::JsonRpcRequestForMaintenanceWindows,
1302    ) -> Result<
1303        ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError>,
1304        Error<()>,
1305    > {
1306        let url = format!("{}/", self.baseurl,);
1307        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1308        header_map.append(
1309            ::reqwest::header::HeaderName::from_static("api-version"),
1310            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1311        );
1312        #[allow(unused_mut)]
1313        let mut request = self
1314            .client
1315            .post(url)
1316            .header(
1317                ::reqwest::header::ACCEPT,
1318                ::reqwest::header::HeaderValue::from_static("application/json"),
1319            )
1320            .json(&body)
1321            .headers(header_map)
1322            .build()?;
1323        let info = OperationInfo {
1324            operation_id: "maintenance_windows",
1325        };
1326        self.pre(&mut request, &info).await?;
1327        let result = self.exec(request, &info).await;
1328        self.post(&result, &info).await?;
1329        let response = result?;
1330        match response.status().as_u16() {
1331            200u16 => ResponseValue::from_response(response).await,
1332            _ => Err(Error::UnexpectedResponse(response)),
1333        }
1334    }
1335    #[doc = "Queries the current state of node network connections. This includes information about active peers, transmitted data, known producers, etc.\n\nSends a `POST` request to `/network_info`\n\n"]
1336    pub async fn network_info<'a>(
1337        &'a self,
1338        body: &'a types::JsonRpcRequestForNetworkInfo,
1339    ) -> Result<
1340        ResponseValue<types::JsonRpcResponseForRpcNetworkInfoResponseAndRpcNetworkInfoError>,
1341        Error<()>,
1342    > {
1343        let url = format!("{}/", self.baseurl,);
1344        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1345        header_map.append(
1346            ::reqwest::header::HeaderName::from_static("api-version"),
1347            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1348        );
1349        #[allow(unused_mut)]
1350        let mut request = self
1351            .client
1352            .post(url)
1353            .header(
1354                ::reqwest::header::ACCEPT,
1355                ::reqwest::header::HeaderValue::from_static("application/json"),
1356            )
1357            .json(&body)
1358            .headers(header_map)
1359            .build()?;
1360        let info = OperationInfo {
1361            operation_id: "network_info",
1362        };
1363        self.pre(&mut request, &info).await?;
1364        let result = self.exec(request, &info).await;
1365        self.post(&result, &info).await?;
1366        let response = result?;
1367        match response.status().as_u16() {
1368            200u16 => ResponseValue::from_response(response).await,
1369            _ => Err(Error::UnexpectedResponse(response)),
1370        }
1371    }
1372    #[doc = "Returns the next light client block.\n\nSends a `POST` request to `/next_light_client_block`\n\n"]
1373    pub async fn next_light_client_block<'a>(
1374        &'a self,
1375        body: &'a types::JsonRpcRequestForNextLightClientBlock,
1376    ) -> Result<
1377        ResponseValue<
1378            types::JsonRpcResponseForRpcLightClientNextBlockResponseAndRpcLightClientNextBlockError,
1379        >,
1380        Error<()>,
1381    > {
1382        let url = format!("{}/", self.baseurl,);
1383        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1384        header_map.append(
1385            ::reqwest::header::HeaderName::from_static("api-version"),
1386            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1387        );
1388        #[allow(unused_mut)]
1389        let mut request = self
1390            .client
1391            .post(url)
1392            .header(
1393                ::reqwest::header::ACCEPT,
1394                ::reqwest::header::HeaderValue::from_static("application/json"),
1395            )
1396            .json(&body)
1397            .headers(header_map)
1398            .build()?;
1399        let info = OperationInfo {
1400            operation_id: "next_light_client_block",
1401        };
1402        self.pre(&mut request, &info).await?;
1403        let result = self.exec(request, &info).await;
1404        self.post(&result, &info).await?;
1405        let response = result?;
1406        match response.status().as_u16() {
1407            200u16 => ResponseValue::from_response(response).await,
1408            _ => Err(Error::UnexpectedResponse(response)),
1409        }
1410    }
1411    #[doc = "This module allows you to make generic requests to the network.\n\nThe `RpcQueryRequest` struct takes in a [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html) and a [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).\n\nThe `BlockReference` enum allows you to specify a block by `Finality`, `BlockId` or `SyncCheckpoint`.\n\nThe `QueryRequest` enum provides multiple variants for performing the following actions:\n - View an account's details\n - View a contract's code\n - View the state of an account\n - View the `AccessKey` of an account\n - View the `AccessKeyList` of an account\n - Call a function in a contract deployed on the network.\n\nSends a `POST` request to `/query`\n\n"]
1412    pub async fn query<'a>(
1413        &'a self,
1414        body: &'a types::JsonRpcRequestForQuery,
1415    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcQueryResponseAndRpcQueryError>, Error<()>>
1416    {
1417        let url = format!("{}/", self.baseurl,);
1418        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1419        header_map.append(
1420            ::reqwest::header::HeaderName::from_static("api-version"),
1421            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1422        );
1423        #[allow(unused_mut)]
1424        let mut request = self
1425            .client
1426            .post(url)
1427            .header(
1428                ::reqwest::header::ACCEPT,
1429                ::reqwest::header::HeaderValue::from_static("application/json"),
1430            )
1431            .json(&body)
1432            .headers(header_map)
1433            .build()?;
1434        let info = OperationInfo {
1435            operation_id: "query",
1436        };
1437        self.pre(&mut request, &info).await?;
1438        let result = self.exec(request, &info).await;
1439        self.post(&result, &info).await?;
1440        let response = result?;
1441        match response.status().as_u16() {
1442            200u16 => ResponseValue::from_response(response).await,
1443            _ => Err(Error::UnexpectedResponse(response)),
1444        }
1445    }
1446    #[doc = "Sends transaction. Returns the guaranteed execution status and the results the blockchain can provide at the moment.\n\nSends a `POST` request to `/send_tx`\n\n"]
1447    pub async fn send_tx<'a>(
1448        &'a self,
1449        body: &'a types::JsonRpcRequestForSendTx,
1450    ) -> Result<
1451        ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1452        Error<()>,
1453    > {
1454        let url = format!("{}/", self.baseurl,);
1455        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1456        header_map.append(
1457            ::reqwest::header::HeaderName::from_static("api-version"),
1458            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1459        );
1460        #[allow(unused_mut)]
1461        let mut request = self
1462            .client
1463            .post(url)
1464            .header(
1465                ::reqwest::header::ACCEPT,
1466                ::reqwest::header::HeaderValue::from_static("application/json"),
1467            )
1468            .json(&body)
1469            .headers(header_map)
1470            .build()?;
1471        let info = OperationInfo {
1472            operation_id: "send_tx",
1473        };
1474        self.pre(&mut request, &info).await?;
1475        let result = self.exec(request, &info).await;
1476        self.post(&result, &info).await?;
1477        let response = result?;
1478        match response.status().as_u16() {
1479            200u16 => ResponseValue::from_response(response).await,
1480            _ => Err(Error::UnexpectedResponse(response)),
1481        }
1482    }
1483    #[doc = "Requests the status of the connected RPC node. This includes information about sync status, nearcore node version, protocol version, the current set of validators, etc.\n\nSends a `POST` request to `/status`\n\n"]
1484    pub async fn status<'a>(
1485        &'a self,
1486        body: &'a types::JsonRpcRequestForStatus,
1487    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcStatusResponseAndRpcStatusError>, Error<()>>
1488    {
1489        let url = format!("{}/", self.baseurl,);
1490        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1491        header_map.append(
1492            ::reqwest::header::HeaderName::from_static("api-version"),
1493            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1494        );
1495        #[allow(unused_mut)]
1496        let mut request = self
1497            .client
1498            .post(url)
1499            .header(
1500                ::reqwest::header::ACCEPT,
1501                ::reqwest::header::HeaderValue::from_static("application/json"),
1502            )
1503            .json(&body)
1504            .headers(header_map)
1505            .build()?;
1506        let info = OperationInfo {
1507            operation_id: "status",
1508        };
1509        self.pre(&mut request, &info).await?;
1510        let result = self.exec(request, &info).await;
1511        self.post(&result, &info).await?;
1512        let response = result?;
1513        match response.status().as_u16() {
1514            200u16 => ResponseValue::from_response(response).await,
1515            _ => Err(Error::UnexpectedResponse(response)),
1516        }
1517    }
1518    #[doc = "Queries status of a transaction by hash and returns the final transaction result.\n\nSends a `POST` request to `/tx`\n\n"]
1519    pub async fn tx<'a>(
1520        &'a self,
1521        body: &'a types::JsonRpcRequestForTx,
1522    ) -> Result<
1523        ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1524        Error<()>,
1525    > {
1526        let url = format!("{}/", self.baseurl,);
1527        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1528        header_map.append(
1529            ::reqwest::header::HeaderName::from_static("api-version"),
1530            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1531        );
1532        #[allow(unused_mut)]
1533        let mut request = self
1534            .client
1535            .post(url)
1536            .header(
1537                ::reqwest::header::ACCEPT,
1538                ::reqwest::header::HeaderValue::from_static("application/json"),
1539            )
1540            .json(&body)
1541            .headers(header_map)
1542            .build()?;
1543        let info = OperationInfo { operation_id: "tx" };
1544        self.pre(&mut request, &info).await?;
1545        let result = self.exec(request, &info).await;
1546        self.post(&result, &info).await?;
1547        let response = result?;
1548        match response.status().as_u16() {
1549            200u16 => ResponseValue::from_response(response).await,
1550            _ => Err(Error::UnexpectedResponse(response)),
1551        }
1552    }
1553    #[doc = "Queries active validators on the network. Returns details and the state of validation on the blockchain.\n\nSends a `POST` request to `/validators`\n\n"]
1554    pub async fn validators<'a>(
1555        &'a self,
1556        body: &'a types::JsonRpcRequestForValidators,
1557    ) -> Result<
1558        ResponseValue<types::JsonRpcResponseForRpcValidatorResponseAndRpcValidatorError>,
1559        Error<()>,
1560    > {
1561        let url = format!("{}/", self.baseurl,);
1562        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1563        header_map.append(
1564            ::reqwest::header::HeaderName::from_static("api-version"),
1565            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1566        );
1567        #[allow(unused_mut)]
1568        let mut request = self
1569            .client
1570            .post(url)
1571            .header(
1572                ::reqwest::header::ACCEPT,
1573                ::reqwest::header::HeaderValue::from_static("application/json"),
1574            )
1575            .json(&body)
1576            .headers(header_map)
1577            .build()?;
1578        let info = OperationInfo {
1579            operation_id: "validators",
1580        };
1581        self.pre(&mut request, &info).await?;
1582        let result = self.exec(request, &info).await;
1583        self.post(&result, &info).await?;
1584        let response = result?;
1585        match response.status().as_u16() {
1586            200u16 => ResponseValue::from_response(response).await,
1587            _ => Err(Error::UnexpectedResponse(response)),
1588        }
1589    }
1590}
1591#[doc = r" Items consumers will typically use such as the Client."]
1592pub mod prelude {
1593    #[allow(unused_imports)]
1594    pub use super::Client;
1595}