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.1.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(15);
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.1.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)]
458#[allow(elided_named_lifetimes)]
459impl Client {
460    #[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"]
461    pub async fn experimental_changes<'a>(
462        &'a self,
463        body: &'a types::JsonRpcRequestForExperimentalChanges,
464    ) -> Result<
465        ResponseValue<types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcError>,
466        Error<()>,
467    > {
468        let url = format!("{}/", self.baseurl,);
469        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
470        header_map.append(
471            ::reqwest::header::HeaderName::from_static("api-version"),
472            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
473        );
474        #[allow(unused_mut)]
475        let mut request = self
476            .client
477            .post(url)
478            .header(
479                ::reqwest::header::ACCEPT,
480                ::reqwest::header::HeaderValue::from_static("application/json"),
481            )
482            .json(&body)
483            .headers(header_map)
484            .build()?;
485        let info = OperationInfo {
486            operation_id: "experimental_changes",
487        };
488        self.pre(&mut request, &info).await?;
489        let result = self.exec(request, &info).await;
490        self.post(&result, &info).await?;
491        let response = result?;
492        match response.status().as_u16() {
493            200u16 => ResponseValue::from_response(response).await,
494            _ => Err(Error::UnexpectedResponse(response)),
495        }
496    }
497    #[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"]
498    pub async fn experimental_changes_in_block<'a>(
499        &'a self,
500        body: &'a types::JsonRpcRequestForExperimentalChangesInBlock,
501    ) -> Result<
502        ResponseValue<types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcError>,
503        Error<()>,
504    > {
505        let url = format!("{}/", self.baseurl,);
506        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
507        header_map.append(
508            ::reqwest::header::HeaderName::from_static("api-version"),
509            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
510        );
511        #[allow(unused_mut)]
512        let mut request = self
513            .client
514            .post(url)
515            .header(
516                ::reqwest::header::ACCEPT,
517                ::reqwest::header::HeaderValue::from_static("application/json"),
518            )
519            .json(&body)
520            .headers(header_map)
521            .build()?;
522        let info = OperationInfo {
523            operation_id: "experimental_changes_in_block",
524        };
525        self.pre(&mut request, &info).await?;
526        let result = self.exec(request, &info).await;
527        self.post(&result, &info).await?;
528        let response = result?;
529        match response.status().as_u16() {
530            200u16 => ResponseValue::from_response(response).await,
531            _ => Err(Error::UnexpectedResponse(response)),
532        }
533    }
534    #[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"]
535    pub async fn experimental_congestion_level<'a>(
536        &'a self,
537        body: &'a types::JsonRpcRequestForExperimentalCongestionLevel,
538    ) -> Result<
539        ResponseValue<types::JsonRpcResponseForRpcCongestionLevelResponseAndRpcError>,
540        Error<()>,
541    > {
542        let url = format!("{}/", self.baseurl,);
543        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
544        header_map.append(
545            ::reqwest::header::HeaderName::from_static("api-version"),
546            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
547        );
548        #[allow(unused_mut)]
549        let mut request = self
550            .client
551            .post(url)
552            .header(
553                ::reqwest::header::ACCEPT,
554                ::reqwest::header::HeaderValue::from_static("application/json"),
555            )
556            .json(&body)
557            .headers(header_map)
558            .build()?;
559        let info = OperationInfo {
560            operation_id: "experimental_congestion_level",
561        };
562        self.pre(&mut request, &info).await?;
563        let result = self.exec(request, &info).await;
564        self.post(&result, &info).await?;
565        let response = result?;
566        match response.status().as_u16() {
567            200u16 => ResponseValue::from_response(response).await,
568            _ => Err(Error::UnexpectedResponse(response)),
569        }
570    }
571    #[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"]
572    pub async fn experimental_genesis_config<'a>(
573        &'a self,
574        body: &'a types::JsonRpcRequestForExperimentalGenesisConfig,
575    ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndRpcError>, Error<()>> {
576        let url = format!("{}/", self.baseurl,);
577        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
578        header_map.append(
579            ::reqwest::header::HeaderName::from_static("api-version"),
580            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
581        );
582        #[allow(unused_mut)]
583        let mut request = self
584            .client
585            .post(url)
586            .header(
587                ::reqwest::header::ACCEPT,
588                ::reqwest::header::HeaderValue::from_static("application/json"),
589            )
590            .json(&body)
591            .headers(header_map)
592            .build()?;
593        let info = OperationInfo {
594            operation_id: "experimental_genesis_config",
595        };
596        self.pre(&mut request, &info).await?;
597        let result = self.exec(request, &info).await;
598        self.post(&result, &info).await?;
599        let response = result?;
600        match response.status().as_u16() {
601            200u16 => ResponseValue::from_response(response).await,
602            _ => Err(Error::UnexpectedResponse(response)),
603        }
604    }
605    #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_block_proof`\n\n"]
606    pub async fn experimental_light_client_block_proof<'a>(
607        &'a self,
608        body: &'a types::JsonRpcRequestForExperimentalLightClientBlockProof,
609    ) -> Result<
610        ResponseValue<types::JsonRpcResponseForRpcLightClientBlockProofResponseAndRpcError>,
611        Error<()>,
612    > {
613        let url = format!("{}/", self.baseurl,);
614        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
615        header_map.append(
616            ::reqwest::header::HeaderName::from_static("api-version"),
617            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
618        );
619        #[allow(unused_mut)]
620        let mut request = self
621            .client
622            .post(url)
623            .header(
624                ::reqwest::header::ACCEPT,
625                ::reqwest::header::HeaderValue::from_static("application/json"),
626            )
627            .json(&body)
628            .headers(header_map)
629            .build()?;
630        let info = OperationInfo {
631            operation_id: "experimental_light_client_block_proof",
632        };
633        self.pre(&mut request, &info).await?;
634        let result = self.exec(request, &info).await;
635        self.post(&result, &info).await?;
636        let response = result?;
637        match response.status().as_u16() {
638            200u16 => ResponseValue::from_response(response).await,
639            _ => Err(Error::UnexpectedResponse(response)),
640        }
641    }
642    #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_proof`\n\n"]
643    pub async fn experimental_light_client_proof<'a>(
644        &'a self,
645        body: &'a types::JsonRpcRequestForExperimentalLightClientProof,
646    ) -> Result<
647        ResponseValue<types::JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcError>,
648        Error<()>,
649    > {
650        let url = format!("{}/", self.baseurl,);
651        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
652        header_map.append(
653            ::reqwest::header::HeaderName::from_static("api-version"),
654            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
655        );
656        #[allow(unused_mut)]
657        let mut request = self
658            .client
659            .post(url)
660            .header(
661                ::reqwest::header::ACCEPT,
662                ::reqwest::header::HeaderValue::from_static("application/json"),
663            )
664            .json(&body)
665            .headers(header_map)
666            .build()?;
667        let info = OperationInfo {
668            operation_id: "experimental_light_client_proof",
669        };
670        self.pre(&mut request, &info).await?;
671        let result = self.exec(request, &info).await;
672        self.post(&result, &info).await?;
673        let response = result?;
674        match response.status().as_u16() {
675            200u16 => ResponseValue::from_response(response).await,
676            _ => Err(Error::UnexpectedResponse(response)),
677        }
678    }
679    #[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"]
680    pub async fn experimental_maintenance_windows<'a>(
681        &'a self,
682        body: &'a types::JsonRpcRequestForExperimentalMaintenanceWindows,
683    ) -> Result<ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcError>, Error<()>>
684    {
685        let url = format!("{}/", self.baseurl,);
686        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
687        header_map.append(
688            ::reqwest::header::HeaderName::from_static("api-version"),
689            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
690        );
691        #[allow(unused_mut)]
692        let mut request = self
693            .client
694            .post(url)
695            .header(
696                ::reqwest::header::ACCEPT,
697                ::reqwest::header::HeaderValue::from_static("application/json"),
698            )
699            .json(&body)
700            .headers(header_map)
701            .build()?;
702        let info = OperationInfo {
703            operation_id: "experimental_maintenance_windows",
704        };
705        self.pre(&mut request, &info).await?;
706        let result = self.exec(request, &info).await;
707        self.post(&result, &info).await?;
708        let response = result?;
709        match response.status().as_u16() {
710            200u16 => ResponseValue::from_response(response).await,
711            _ => Err(Error::UnexpectedResponse(response)),
712        }
713    }
714    #[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"]
715    pub async fn experimental_protocol_config<'a>(
716        &'a self,
717        body: &'a types::JsonRpcRequestForExperimentalProtocolConfig,
718    ) -> Result<
719        ResponseValue<types::JsonRpcResponseForRpcProtocolConfigResponseAndRpcError>,
720        Error<()>,
721    > {
722        let url = format!("{}/", self.baseurl,);
723        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
724        header_map.append(
725            ::reqwest::header::HeaderName::from_static("api-version"),
726            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
727        );
728        #[allow(unused_mut)]
729        let mut request = self
730            .client
731            .post(url)
732            .header(
733                ::reqwest::header::ACCEPT,
734                ::reqwest::header::HeaderValue::from_static("application/json"),
735            )
736            .json(&body)
737            .headers(header_map)
738            .build()?;
739        let info = OperationInfo {
740            operation_id: "experimental_protocol_config",
741        };
742        self.pre(&mut request, &info).await?;
743        let result = self.exec(request, &info).await;
744        self.post(&result, &info).await?;
745        let response = result?;
746        match response.status().as_u16() {
747            200u16 => ResponseValue::from_response(response).await,
748            _ => Err(Error::UnexpectedResponse(response)),
749        }
750    }
751    #[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"]
752    pub async fn experimental_receipt<'a>(
753        &'a self,
754        body: &'a types::JsonRpcRequestForExperimentalReceipt,
755    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcReceiptResponseAndRpcError>, Error<()>>
756    {
757        let url = format!("{}/", self.baseurl,);
758        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
759        header_map.append(
760            ::reqwest::header::HeaderName::from_static("api-version"),
761            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
762        );
763        #[allow(unused_mut)]
764        let mut request = self
765            .client
766            .post(url)
767            .header(
768                ::reqwest::header::ACCEPT,
769                ::reqwest::header::HeaderValue::from_static("application/json"),
770            )
771            .json(&body)
772            .headers(header_map)
773            .build()?;
774        let info = OperationInfo {
775            operation_id: "experimental_receipt",
776        };
777        self.pre(&mut request, &info).await?;
778        let result = self.exec(request, &info).await;
779        self.post(&result, &info).await?;
780        let response = result?;
781        match response.status().as_u16() {
782            200u16 => ResponseValue::from_response(response).await,
783            _ => Err(Error::UnexpectedResponse(response)),
784        }
785    }
786    #[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"]
787    pub async fn experimental_split_storage_info<'a>(
788        &'a self,
789        body: &'a types::JsonRpcRequestForExperimentalSplitStorageInfo,
790    ) -> Result<
791        ResponseValue<types::JsonRpcResponseForRpcSplitStorageInfoResponseAndRpcError>,
792        Error<()>,
793    > {
794        let url = format!("{}/", self.baseurl,);
795        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
796        header_map.append(
797            ::reqwest::header::HeaderName::from_static("api-version"),
798            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
799        );
800        #[allow(unused_mut)]
801        let mut request = self
802            .client
803            .post(url)
804            .header(
805                ::reqwest::header::ACCEPT,
806                ::reqwest::header::HeaderValue::from_static("application/json"),
807            )
808            .json(&body)
809            .headers(header_map)
810            .build()?;
811        let info = OperationInfo {
812            operation_id: "experimental_split_storage_info",
813        };
814        self.pre(&mut request, &info).await?;
815        let result = self.exec(request, &info).await;
816        self.post(&result, &info).await?;
817        let response = result?;
818        match response.status().as_u16() {
819            200u16 => ResponseValue::from_response(response).await,
820            _ => Err(Error::UnexpectedResponse(response)),
821        }
822    }
823    #[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"]
824    pub async fn experimental_tx_status<'a>(
825        &'a self,
826        body: &'a types::JsonRpcRequestForExperimentalTxStatus,
827    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
828    {
829        let url = format!("{}/", self.baseurl,);
830        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
831        header_map.append(
832            ::reqwest::header::HeaderName::from_static("api-version"),
833            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
834        );
835        #[allow(unused_mut)]
836        let mut request = self
837            .client
838            .post(url)
839            .header(
840                ::reqwest::header::ACCEPT,
841                ::reqwest::header::HeaderValue::from_static("application/json"),
842            )
843            .json(&body)
844            .headers(header_map)
845            .build()?;
846        let info = OperationInfo {
847            operation_id: "experimental_tx_status",
848        };
849        self.pre(&mut request, &info).await?;
850        let result = self.exec(request, &info).await;
851        self.post(&result, &info).await?;
852        let response = result?;
853        match response.status().as_u16() {
854            200u16 => ResponseValue::from_response(response).await,
855            _ => Err(Error::UnexpectedResponse(response)),
856        }
857    }
858    #[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"]
859    pub async fn experimental_validators_ordered<'a>(
860        &'a self,
861        body: &'a types::JsonRpcRequestForExperimentalValidatorsOrdered,
862    ) -> Result<
863        ResponseValue<types::JsonRpcResponseForArrayOfValidatorStakeViewAndRpcError>,
864        Error<()>,
865    > {
866        let url = format!("{}/", self.baseurl,);
867        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
868        header_map.append(
869            ::reqwest::header::HeaderName::from_static("api-version"),
870            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
871        );
872        #[allow(unused_mut)]
873        let mut request = self
874            .client
875            .post(url)
876            .header(
877                ::reqwest::header::ACCEPT,
878                ::reqwest::header::HeaderValue::from_static("application/json"),
879            )
880            .json(&body)
881            .headers(header_map)
882            .build()?;
883        let info = OperationInfo {
884            operation_id: "experimental_validators_ordered",
885        };
886        self.pre(&mut request, &info).await?;
887        let result = self.exec(request, &info).await;
888        self.post(&result, &info).await?;
889        let response = result?;
890        match response.status().as_u16() {
891            200u16 => ResponseValue::from_response(response).await,
892            _ => Err(Error::UnexpectedResponse(response)),
893        }
894    }
895    #[doc = "Returns block details for given height or hash\n\nSends a `POST` request to `/block`\n\n"]
896    pub async fn block<'a>(
897        &'a self,
898        body: &'a types::JsonRpcRequestForBlock,
899    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcBlockResponseAndRpcError>, Error<()>>
900    {
901        let url = format!("{}/", self.baseurl,);
902        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
903        header_map.append(
904            ::reqwest::header::HeaderName::from_static("api-version"),
905            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
906        );
907        #[allow(unused_mut)]
908        let mut request = self
909            .client
910            .post(url)
911            .header(
912                ::reqwest::header::ACCEPT,
913                ::reqwest::header::HeaderValue::from_static("application/json"),
914            )
915            .json(&body)
916            .headers(header_map)
917            .build()?;
918        let info = OperationInfo {
919            operation_id: "block",
920        };
921        self.pre(&mut request, &info).await?;
922        let result = self.exec(request, &info).await;
923        self.post(&result, &info).await?;
924        let response = result?;
925        match response.status().as_u16() {
926            200u16 => ResponseValue::from_response(response).await,
927            _ => Err(Error::UnexpectedResponse(response)),
928        }
929    }
930    #[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"]
931    pub async fn block_effects<'a>(
932        &'a self,
933        body: &'a types::JsonRpcRequestForBlockEffects,
934    ) -> Result<
935        ResponseValue<types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcError>,
936        Error<()>,
937    > {
938        let url = format!("{}/", self.baseurl,);
939        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
940        header_map.append(
941            ::reqwest::header::HeaderName::from_static("api-version"),
942            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
943        );
944        #[allow(unused_mut)]
945        let mut request = self
946            .client
947            .post(url)
948            .header(
949                ::reqwest::header::ACCEPT,
950                ::reqwest::header::HeaderValue::from_static("application/json"),
951            )
952            .json(&body)
953            .headers(header_map)
954            .build()?;
955        let info = OperationInfo {
956            operation_id: "block_effects",
957        };
958        self.pre(&mut request, &info).await?;
959        let result = self.exec(request, &info).await;
960        self.post(&result, &info).await?;
961        let response = result?;
962        match response.status().as_u16() {
963            200u16 => ResponseValue::from_response(response).await,
964            _ => Err(Error::UnexpectedResponse(response)),
965        }
966    }
967    #[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"]
968    pub async fn broadcast_tx_async<'a>(
969        &'a self,
970        body: &'a types::JsonRpcRequestForBroadcastTxAsync,
971    ) -> Result<ResponseValue<types::JsonRpcResponseForCryptoHashAndRpcError>, Error<()>> {
972        let url = format!("{}/", self.baseurl,);
973        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
974        header_map.append(
975            ::reqwest::header::HeaderName::from_static("api-version"),
976            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
977        );
978        #[allow(unused_mut)]
979        let mut request = self
980            .client
981            .post(url)
982            .header(
983                ::reqwest::header::ACCEPT,
984                ::reqwest::header::HeaderValue::from_static("application/json"),
985            )
986            .json(&body)
987            .headers(header_map)
988            .build()?;
989        let info = OperationInfo {
990            operation_id: "broadcast_tx_async",
991        };
992        self.pre(&mut request, &info).await?;
993        let result = self.exec(request, &info).await;
994        self.post(&result, &info).await?;
995        let response = result?;
996        match response.status().as_u16() {
997            200u16 => ResponseValue::from_response(response).await,
998            _ => Err(Error::UnexpectedResponse(response)),
999        }
1000    }
1001    #[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"]
1002    pub async fn broadcast_tx_commit<'a>(
1003        &'a self,
1004        body: &'a types::JsonRpcRequestForBroadcastTxCommit,
1005    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
1006    {
1007        let url = format!("{}/", self.baseurl,);
1008        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1009        header_map.append(
1010            ::reqwest::header::HeaderName::from_static("api-version"),
1011            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1012        );
1013        #[allow(unused_mut)]
1014        let mut request = self
1015            .client
1016            .post(url)
1017            .header(
1018                ::reqwest::header::ACCEPT,
1019                ::reqwest::header::HeaderValue::from_static("application/json"),
1020            )
1021            .json(&body)
1022            .headers(header_map)
1023            .build()?;
1024        let info = OperationInfo {
1025            operation_id: "broadcast_tx_commit",
1026        };
1027        self.pre(&mut request, &info).await?;
1028        let result = self.exec(request, &info).await;
1029        self.post(&result, &info).await?;
1030        let response = result?;
1031        match response.status().as_u16() {
1032            200u16 => ResponseValue::from_response(response).await,
1033            _ => Err(Error::UnexpectedResponse(response)),
1034        }
1035    }
1036    #[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"]
1037    pub async fn changes<'a>(
1038        &'a self,
1039        body: &'a types::JsonRpcRequestForChanges,
1040    ) -> Result<
1041        ResponseValue<types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcError>,
1042        Error<()>,
1043    > {
1044        let url = format!("{}/", self.baseurl,);
1045        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1046        header_map.append(
1047            ::reqwest::header::HeaderName::from_static("api-version"),
1048            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1049        );
1050        #[allow(unused_mut)]
1051        let mut request = self
1052            .client
1053            .post(url)
1054            .header(
1055                ::reqwest::header::ACCEPT,
1056                ::reqwest::header::HeaderValue::from_static("application/json"),
1057            )
1058            .json(&body)
1059            .headers(header_map)
1060            .build()?;
1061        let info = OperationInfo {
1062            operation_id: "changes",
1063        };
1064        self.pre(&mut request, &info).await?;
1065        let result = self.exec(request, &info).await;
1066        self.post(&result, &info).await?;
1067        let response = result?;
1068        match response.status().as_u16() {
1069            200u16 => ResponseValue::from_response(response).await,
1070            _ => Err(Error::UnexpectedResponse(response)),
1071        }
1072    }
1073    #[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"]
1074    pub async fn chunk<'a>(
1075        &'a self,
1076        body: &'a types::JsonRpcRequestForChunk,
1077    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcChunkResponseAndRpcError>, Error<()>>
1078    {
1079        let url = format!("{}/", self.baseurl,);
1080        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1081        header_map.append(
1082            ::reqwest::header::HeaderName::from_static("api-version"),
1083            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1084        );
1085        #[allow(unused_mut)]
1086        let mut request = self
1087            .client
1088            .post(url)
1089            .header(
1090                ::reqwest::header::ACCEPT,
1091                ::reqwest::header::HeaderValue::from_static("application/json"),
1092            )
1093            .json(&body)
1094            .headers(header_map)
1095            .build()?;
1096        let info = OperationInfo {
1097            operation_id: "chunk",
1098        };
1099        self.pre(&mut request, &info).await?;
1100        let result = self.exec(request, &info).await;
1101        self.post(&result, &info).await?;
1102        let response = result?;
1103        match response.status().as_u16() {
1104            200u16 => ResponseValue::from_response(response).await,
1105            _ => Err(Error::UnexpectedResponse(response)),
1106        }
1107    }
1108    #[doc = "Queries client node configuration\n\nSends a `POST` request to `/client_config`\n\n"]
1109    pub async fn client_config<'a>(
1110        &'a self,
1111        body: &'a types::JsonRpcRequestForClientConfig,
1112    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcClientConfigResponseAndRpcError>, Error<()>>
1113    {
1114        let url = format!("{}/", self.baseurl,);
1115        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1116        header_map.append(
1117            ::reqwest::header::HeaderName::from_static("api-version"),
1118            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1119        );
1120        #[allow(unused_mut)]
1121        let mut request = self
1122            .client
1123            .post(url)
1124            .header(
1125                ::reqwest::header::ACCEPT,
1126                ::reqwest::header::HeaderValue::from_static("application/json"),
1127            )
1128            .json(&body)
1129            .headers(header_map)
1130            .build()?;
1131        let info = OperationInfo {
1132            operation_id: "client_config",
1133        };
1134        self.pre(&mut request, &info).await?;
1135        let result = self.exec(request, &info).await;
1136        self.post(&result, &info).await?;
1137        let response = result?;
1138        match response.status().as_u16() {
1139            200u16 => ResponseValue::from_response(response).await,
1140            _ => Err(Error::UnexpectedResponse(response)),
1141        }
1142    }
1143    #[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"]
1144    pub async fn gas_price<'a>(
1145        &'a self,
1146        body: &'a types::JsonRpcRequestForGasPrice,
1147    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcGasPriceResponseAndRpcError>, Error<()>>
1148    {
1149        let url = format!("{}/", self.baseurl,);
1150        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1151        header_map.append(
1152            ::reqwest::header::HeaderName::from_static("api-version"),
1153            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1154        );
1155        #[allow(unused_mut)]
1156        let mut request = self
1157            .client
1158            .post(url)
1159            .header(
1160                ::reqwest::header::ACCEPT,
1161                ::reqwest::header::HeaderValue::from_static("application/json"),
1162            )
1163            .json(&body)
1164            .headers(header_map)
1165            .build()?;
1166        let info = OperationInfo {
1167            operation_id: "gas_price",
1168        };
1169        self.pre(&mut request, &info).await?;
1170        let result = self.exec(request, &info).await;
1171        self.post(&result, &info).await?;
1172        let response = result?;
1173        match response.status().as_u16() {
1174            200u16 => ResponseValue::from_response(response).await,
1175            _ => Err(Error::UnexpectedResponse(response)),
1176        }
1177    }
1178    #[doc = "Get initial state and parameters for the genesis block\n\nSends a `POST` request to `/genesis_config`\n\n"]
1179    pub async fn genesis_config<'a>(
1180        &'a self,
1181        body: &'a types::JsonRpcRequestForGenesisConfig,
1182    ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndRpcError>, Error<()>> {
1183        let url = format!("{}/", self.baseurl,);
1184        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1185        header_map.append(
1186            ::reqwest::header::HeaderName::from_static("api-version"),
1187            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1188        );
1189        #[allow(unused_mut)]
1190        let mut request = self
1191            .client
1192            .post(url)
1193            .header(
1194                ::reqwest::header::ACCEPT,
1195                ::reqwest::header::HeaderValue::from_static("application/json"),
1196            )
1197            .json(&body)
1198            .headers(header_map)
1199            .build()?;
1200        let info = OperationInfo {
1201            operation_id: "genesis_config",
1202        };
1203        self.pre(&mut request, &info).await?;
1204        let result = self.exec(request, &info).await;
1205        self.post(&result, &info).await?;
1206        let response = result?;
1207        match response.status().as_u16() {
1208            200u16 => ResponseValue::from_response(response).await,
1209            _ => Err(Error::UnexpectedResponse(response)),
1210        }
1211    }
1212    #[doc = "Returns the current health status of the RPC node the client connects to.\n\nSends a `POST` request to `/health`\n\n"]
1213    pub async fn health<'a>(
1214        &'a self,
1215        body: &'a types::JsonRpcRequestForHealth,
1216    ) -> Result<
1217        ResponseValue<types::JsonRpcResponseForNullableRpcHealthResponseAndRpcError>,
1218        Error<()>,
1219    > {
1220        let url = format!("{}/", self.baseurl,);
1221        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1222        header_map.append(
1223            ::reqwest::header::HeaderName::from_static("api-version"),
1224            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1225        );
1226        #[allow(unused_mut)]
1227        let mut request = self
1228            .client
1229            .post(url)
1230            .header(
1231                ::reqwest::header::ACCEPT,
1232                ::reqwest::header::HeaderValue::from_static("application/json"),
1233            )
1234            .json(&body)
1235            .headers(header_map)
1236            .build()?;
1237        let info = OperationInfo {
1238            operation_id: "health",
1239        };
1240        self.pre(&mut request, &info).await?;
1241        let result = self.exec(request, &info).await;
1242        self.post(&result, &info).await?;
1243        let response = result?;
1244        match response.status().as_u16() {
1245            200u16 => ResponseValue::from_response(response).await,
1246            _ => Err(Error::UnexpectedResponse(response)),
1247        }
1248    }
1249    #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/light_client_proof`\n\n"]
1250    pub async fn light_client_proof<'a>(
1251        &'a self,
1252        body: &'a types::JsonRpcRequestForLightClientProof,
1253    ) -> Result<
1254        ResponseValue<types::JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcError>,
1255        Error<()>,
1256    > {
1257        let url = format!("{}/", self.baseurl,);
1258        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1259        header_map.append(
1260            ::reqwest::header::HeaderName::from_static("api-version"),
1261            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1262        );
1263        #[allow(unused_mut)]
1264        let mut request = self
1265            .client
1266            .post(url)
1267            .header(
1268                ::reqwest::header::ACCEPT,
1269                ::reqwest::header::HeaderValue::from_static("application/json"),
1270            )
1271            .json(&body)
1272            .headers(header_map)
1273            .build()?;
1274        let info = OperationInfo {
1275            operation_id: "light_client_proof",
1276        };
1277        self.pre(&mut request, &info).await?;
1278        let result = self.exec(request, &info).await;
1279        self.post(&result, &info).await?;
1280        let response = result?;
1281        match response.status().as_u16() {
1282            200u16 => ResponseValue::from_response(response).await,
1283            _ => Err(Error::UnexpectedResponse(response)),
1284        }
1285    }
1286    #[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"]
1287    pub async fn maintenance_windows<'a>(
1288        &'a self,
1289        body: &'a types::JsonRpcRequestForMaintenanceWindows,
1290    ) -> Result<ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcError>, Error<()>>
1291    {
1292        let url = format!("{}/", self.baseurl,);
1293        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1294        header_map.append(
1295            ::reqwest::header::HeaderName::from_static("api-version"),
1296            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1297        );
1298        #[allow(unused_mut)]
1299        let mut request = self
1300            .client
1301            .post(url)
1302            .header(
1303                ::reqwest::header::ACCEPT,
1304                ::reqwest::header::HeaderValue::from_static("application/json"),
1305            )
1306            .json(&body)
1307            .headers(header_map)
1308            .build()?;
1309        let info = OperationInfo {
1310            operation_id: "maintenance_windows",
1311        };
1312        self.pre(&mut request, &info).await?;
1313        let result = self.exec(request, &info).await;
1314        self.post(&result, &info).await?;
1315        let response = result?;
1316        match response.status().as_u16() {
1317            200u16 => ResponseValue::from_response(response).await,
1318            _ => Err(Error::UnexpectedResponse(response)),
1319        }
1320    }
1321    #[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"]
1322    pub async fn network_info<'a>(
1323        &'a self,
1324        body: &'a types::JsonRpcRequestForNetworkInfo,
1325    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcNetworkInfoResponseAndRpcError>, Error<()>>
1326    {
1327        let url = format!("{}/", self.baseurl,);
1328        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1329        header_map.append(
1330            ::reqwest::header::HeaderName::from_static("api-version"),
1331            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1332        );
1333        #[allow(unused_mut)]
1334        let mut request = self
1335            .client
1336            .post(url)
1337            .header(
1338                ::reqwest::header::ACCEPT,
1339                ::reqwest::header::HeaderValue::from_static("application/json"),
1340            )
1341            .json(&body)
1342            .headers(header_map)
1343            .build()?;
1344        let info = OperationInfo {
1345            operation_id: "network_info",
1346        };
1347        self.pre(&mut request, &info).await?;
1348        let result = self.exec(request, &info).await;
1349        self.post(&result, &info).await?;
1350        let response = result?;
1351        match response.status().as_u16() {
1352            200u16 => ResponseValue::from_response(response).await,
1353            _ => Err(Error::UnexpectedResponse(response)),
1354        }
1355    }
1356    #[doc = "Returns the next light client block.\n\nSends a `POST` request to `/next_light_client_block`\n\n"]
1357    pub async fn next_light_client_block<'a>(
1358        &'a self,
1359        body: &'a types::JsonRpcRequestForNextLightClientBlock,
1360    ) -> Result<
1361        ResponseValue<types::JsonRpcResponseForRpcLightClientNextBlockResponseAndRpcError>,
1362        Error<()>,
1363    > {
1364        let url = format!("{}/", self.baseurl,);
1365        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1366        header_map.append(
1367            ::reqwest::header::HeaderName::from_static("api-version"),
1368            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1369        );
1370        #[allow(unused_mut)]
1371        let mut request = self
1372            .client
1373            .post(url)
1374            .header(
1375                ::reqwest::header::ACCEPT,
1376                ::reqwest::header::HeaderValue::from_static("application/json"),
1377            )
1378            .json(&body)
1379            .headers(header_map)
1380            .build()?;
1381        let info = OperationInfo {
1382            operation_id: "next_light_client_block",
1383        };
1384        self.pre(&mut request, &info).await?;
1385        let result = self.exec(request, &info).await;
1386        self.post(&result, &info).await?;
1387        let response = result?;
1388        match response.status().as_u16() {
1389            200u16 => ResponseValue::from_response(response).await,
1390            _ => Err(Error::UnexpectedResponse(response)),
1391        }
1392    }
1393    #[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"]
1394    pub async fn query<'a>(
1395        &'a self,
1396        body: &'a types::JsonRpcRequestForQuery,
1397    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcQueryResponseAndRpcError>, Error<()>>
1398    {
1399        let url = format!("{}/", self.baseurl,);
1400        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1401        header_map.append(
1402            ::reqwest::header::HeaderName::from_static("api-version"),
1403            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1404        );
1405        #[allow(unused_mut)]
1406        let mut request = self
1407            .client
1408            .post(url)
1409            .header(
1410                ::reqwest::header::ACCEPT,
1411                ::reqwest::header::HeaderValue::from_static("application/json"),
1412            )
1413            .json(&body)
1414            .headers(header_map)
1415            .build()?;
1416        let info = OperationInfo {
1417            operation_id: "query",
1418        };
1419        self.pre(&mut request, &info).await?;
1420        let result = self.exec(request, &info).await;
1421        self.post(&result, &info).await?;
1422        let response = result?;
1423        match response.status().as_u16() {
1424            200u16 => ResponseValue::from_response(response).await,
1425            _ => Err(Error::UnexpectedResponse(response)),
1426        }
1427    }
1428    #[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"]
1429    pub async fn send_tx<'a>(
1430        &'a self,
1431        body: &'a types::JsonRpcRequestForSendTx,
1432    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
1433    {
1434        let url = format!("{}/", self.baseurl,);
1435        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1436        header_map.append(
1437            ::reqwest::header::HeaderName::from_static("api-version"),
1438            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1439        );
1440        #[allow(unused_mut)]
1441        let mut request = self
1442            .client
1443            .post(url)
1444            .header(
1445                ::reqwest::header::ACCEPT,
1446                ::reqwest::header::HeaderValue::from_static("application/json"),
1447            )
1448            .json(&body)
1449            .headers(header_map)
1450            .build()?;
1451        let info = OperationInfo {
1452            operation_id: "send_tx",
1453        };
1454        self.pre(&mut request, &info).await?;
1455        let result = self.exec(request, &info).await;
1456        self.post(&result, &info).await?;
1457        let response = result?;
1458        match response.status().as_u16() {
1459            200u16 => ResponseValue::from_response(response).await,
1460            _ => Err(Error::UnexpectedResponse(response)),
1461        }
1462    }
1463    #[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"]
1464    pub async fn status<'a>(
1465        &'a self,
1466        body: &'a types::JsonRpcRequestForStatus,
1467    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcStatusResponseAndRpcError>, Error<()>>
1468    {
1469        let url = format!("{}/", self.baseurl,);
1470        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1471        header_map.append(
1472            ::reqwest::header::HeaderName::from_static("api-version"),
1473            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1474        );
1475        #[allow(unused_mut)]
1476        let mut request = self
1477            .client
1478            .post(url)
1479            .header(
1480                ::reqwest::header::ACCEPT,
1481                ::reqwest::header::HeaderValue::from_static("application/json"),
1482            )
1483            .json(&body)
1484            .headers(header_map)
1485            .build()?;
1486        let info = OperationInfo {
1487            operation_id: "status",
1488        };
1489        self.pre(&mut request, &info).await?;
1490        let result = self.exec(request, &info).await;
1491        self.post(&result, &info).await?;
1492        let response = result?;
1493        match response.status().as_u16() {
1494            200u16 => ResponseValue::from_response(response).await,
1495            _ => Err(Error::UnexpectedResponse(response)),
1496        }
1497    }
1498    #[doc = "Queries status of a transaction by hash and returns the final transaction result.\n\nSends a `POST` request to `/tx`\n\n"]
1499    pub async fn tx<'a>(
1500        &'a self,
1501        body: &'a types::JsonRpcRequestForTx,
1502    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcError>, Error<()>>
1503    {
1504        let url = format!("{}/", self.baseurl,);
1505        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1506        header_map.append(
1507            ::reqwest::header::HeaderName::from_static("api-version"),
1508            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1509        );
1510        #[allow(unused_mut)]
1511        let mut request = self
1512            .client
1513            .post(url)
1514            .header(
1515                ::reqwest::header::ACCEPT,
1516                ::reqwest::header::HeaderValue::from_static("application/json"),
1517            )
1518            .json(&body)
1519            .headers(header_map)
1520            .build()?;
1521        let info = OperationInfo { operation_id: "tx" };
1522        self.pre(&mut request, &info).await?;
1523        let result = self.exec(request, &info).await;
1524        self.post(&result, &info).await?;
1525        let response = result?;
1526        match response.status().as_u16() {
1527            200u16 => ResponseValue::from_response(response).await,
1528            _ => Err(Error::UnexpectedResponse(response)),
1529        }
1530    }
1531    #[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"]
1532    pub async fn validators<'a>(
1533        &'a self,
1534        body: &'a types::JsonRpcRequestForValidators,
1535    ) -> Result<ResponseValue<types::JsonRpcResponseForRpcValidatorResponseAndRpcError>, Error<()>>
1536    {
1537        let url = format!("{}/", self.baseurl,);
1538        let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1539        header_map.append(
1540            ::reqwest::header::HeaderName::from_static("api-version"),
1541            ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1542        );
1543        #[allow(unused_mut)]
1544        let mut request = self
1545            .client
1546            .post(url)
1547            .header(
1548                ::reqwest::header::ACCEPT,
1549                ::reqwest::header::HeaderValue::from_static("application/json"),
1550            )
1551            .json(&body)
1552            .headers(header_map)
1553            .build()?;
1554        let info = OperationInfo {
1555            operation_id: "validators",
1556        };
1557        self.pre(&mut request, &info).await?;
1558        let result = self.exec(request, &info).await;
1559        self.post(&result, &info).await?;
1560        let response = result?;
1561        match response.status().as_u16() {
1562            200u16 => ResponseValue::from_response(response).await,
1563            _ => Err(Error::UnexpectedResponse(response)),
1564        }
1565    }
1566}
1567#[doc = r" Items consumers will typically use such as the Client."]
1568pub mod prelude {
1569    #[allow(unused_imports)]
1570    pub use super::Client;
1571}