1pub use near_openapi_types as types;
407#[allow(unused_imports)]
408use progenitor_client::{encode_path, ClientHooks, OperationInfo, RequestBuilderExt};
409#[allow(unused_imports)]
410pub use progenitor_client::{ByteStream, ClientInfo, Error, ResponseValue};
411#[derive(Clone, Debug)]
412#[doc = "Client for NEAR Protocol JSON RPC API\n\nVersion: 1.2.2"]
413pub struct Client {
414 pub(crate) baseurl: String,
415 pub(crate) client: reqwest::Client,
416}
417impl Client {
418 #[doc = r" Create a new client."]
419 #[doc = r""]
420 #[doc = r" `baseurl` is the base URL provided to the internal"]
421 #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
422 #[doc = r" as well as port and a path stem if applicable."]
423 pub fn new(baseurl: &str) -> Self {
424 #[cfg(not(target_arch = "wasm32"))]
425 let client = {
426 let dur = ::std::time::Duration::from_secs(15u64);
427 reqwest::ClientBuilder::new()
428 .connect_timeout(dur)
429 .timeout(dur)
430 };
431 #[cfg(target_arch = "wasm32")]
432 let client = reqwest::ClientBuilder::new();
433 Self::new_with_client(baseurl, client.build().unwrap())
434 }
435 #[doc = r" Construct a new client with an existing `reqwest::Client`,"]
436 #[doc = r" allowing more control over its configuration."]
437 #[doc = r""]
438 #[doc = r" `baseurl` is the base URL provided to the internal"]
439 #[doc = r" `reqwest::Client`, and should include a scheme and hostname,"]
440 #[doc = r" as well as port and a path stem if applicable."]
441 pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self {
442 Self {
443 baseurl: baseurl.to_string(),
444 client,
445 }
446 }
447}
448impl ClientInfo<()> for Client {
449 fn api_version() -> &'static str {
450 "1.2.2"
451 }
452 fn baseurl(&self) -> &str {
453 self.baseurl.as_str()
454 }
455 fn client(&self) -> &reqwest::Client {
456 &self.client
457 }
458 fn inner(&self) -> &() {
459 &()
460 }
461}
462impl ClientHooks<()> for &Client {}
463#[allow(clippy::all)]
464impl Client {
465 #[doc = "Calls a view function on a contract and returns the result.\n\nSends a `POST` request to `/EXPERIMENTAL_call_function`\n\n"]
466 pub async fn experimental_call_function<'a>(
467 &'a self,
468 body: &'a types::JsonRpcRequestForExperimentalCallFunction,
469 ) -> Result<
470 ResponseValue<types::JsonRpcResponseForRpcCallFunctionResponseAndRpcCallFunctionError>,
471 Error<()>,
472 > {
473 let url = format!("{}/", self.baseurl,);
474 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
475 header_map.append(
476 ::reqwest::header::HeaderName::from_static("api-version"),
477 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
478 );
479 #[allow(unused_mut)]
480 let mut request = self
481 .client
482 .post(url)
483 .header(
484 ::reqwest::header::ACCEPT,
485 ::reqwest::header::HeaderValue::from_static("application/json"),
486 )
487 .json(&body)
488 .headers(header_map)
489 .build()?;
490 let info = OperationInfo {
491 operation_id: "experimental_call_function",
492 };
493 self.pre(&mut request, &info).await?;
494 let result = self.exec(request, &info).await;
495 self.post(&result, &info).await?;
496 let response = result?;
497 match response.status().as_u16() {
498 200u16 => ResponseValue::from_response(response).await,
499 _ => Err(Error::UnexpectedResponse(response)),
500 }
501 }
502 #[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"]
503 pub async fn experimental_changes<'a>(
504 &'a self,
505 body: &'a types::JsonRpcRequestForExperimentalChanges,
506 ) -> Result<
507 ResponseValue<
508 types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
509 >,
510 Error<()>,
511 > {
512 let url = format!("{}/", self.baseurl,);
513 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
514 header_map.append(
515 ::reqwest::header::HeaderName::from_static("api-version"),
516 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
517 );
518 #[allow(unused_mut)]
519 let mut request = self
520 .client
521 .post(url)
522 .header(
523 ::reqwest::header::ACCEPT,
524 ::reqwest::header::HeaderValue::from_static("application/json"),
525 )
526 .json(&body)
527 .headers(header_map)
528 .build()?;
529 let info = OperationInfo {
530 operation_id: "experimental_changes",
531 };
532 self.pre(&mut request, &info).await?;
533 let result = self.exec(request, &info).await;
534 self.post(&result, &info).await?;
535 let response = result?;
536 match response.status().as_u16() {
537 200u16 => ResponseValue::from_response(response).await,
538 _ => Err(Error::UnexpectedResponse(response)),
539 }
540 }
541 #[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"]
542 pub async fn experimental_changes_in_block<'a>(
543 &'a self,
544 body: &'a types::JsonRpcRequestForExperimentalChangesInBlock,
545 ) -> Result<
546 ResponseValue<
547 types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
548 >,
549 Error<()>,
550 > {
551 let url = format!("{}/", self.baseurl,);
552 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
553 header_map.append(
554 ::reqwest::header::HeaderName::from_static("api-version"),
555 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
556 );
557 #[allow(unused_mut)]
558 let mut request = self
559 .client
560 .post(url)
561 .header(
562 ::reqwest::header::ACCEPT,
563 ::reqwest::header::HeaderValue::from_static("application/json"),
564 )
565 .json(&body)
566 .headers(header_map)
567 .build()?;
568 let info = OperationInfo {
569 operation_id: "experimental_changes_in_block",
570 };
571 self.pre(&mut request, &info).await?;
572 let result = self.exec(request, &info).await;
573 self.post(&result, &info).await?;
574 let response = result?;
575 match response.status().as_u16() {
576 200u16 => ResponseValue::from_response(response).await,
577 _ => Err(Error::UnexpectedResponse(response)),
578 }
579 }
580 #[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"]
581 pub async fn experimental_congestion_level<'a>(
582 &'a self,
583 body: &'a types::JsonRpcRequestForExperimentalCongestionLevel,
584 ) -> Result<
585 ResponseValue<types::JsonRpcResponseForRpcCongestionLevelResponseAndRpcChunkError>,
586 Error<()>,
587 > {
588 let url = format!("{}/", self.baseurl,);
589 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
590 header_map.append(
591 ::reqwest::header::HeaderName::from_static("api-version"),
592 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
593 );
594 #[allow(unused_mut)]
595 let mut request = self
596 .client
597 .post(url)
598 .header(
599 ::reqwest::header::ACCEPT,
600 ::reqwest::header::HeaderValue::from_static("application/json"),
601 )
602 .json(&body)
603 .headers(header_map)
604 .build()?;
605 let info = OperationInfo {
606 operation_id: "experimental_congestion_level",
607 };
608 self.pre(&mut request, &info).await?;
609 let result = self.exec(request, &info).await;
610 self.post(&result, &info).await?;
611 let response = result?;
612 match response.status().as_u16() {
613 200u16 => ResponseValue::from_response(response).await,
614 _ => Err(Error::UnexpectedResponse(response)),
615 }
616 }
617 #[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"]
618 pub async fn experimental_genesis_config<'a>(
619 &'a self,
620 body: &'a types::JsonRpcRequestForExperimentalGenesisConfig,
621 ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndGenesisConfigError>, Error<()>>
622 {
623 let url = format!("{}/", self.baseurl,);
624 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
625 header_map.append(
626 ::reqwest::header::HeaderName::from_static("api-version"),
627 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
628 );
629 #[allow(unused_mut)]
630 let mut request = self
631 .client
632 .post(url)
633 .header(
634 ::reqwest::header::ACCEPT,
635 ::reqwest::header::HeaderValue::from_static("application/json"),
636 )
637 .json(&body)
638 .headers(header_map)
639 .build()?;
640 let info = OperationInfo {
641 operation_id: "experimental_genesis_config",
642 };
643 self.pre(&mut request, &info).await?;
644 let result = self.exec(request, &info).await;
645 self.post(&result, &info).await?;
646 let response = result?;
647 match response.status().as_u16() {
648 200u16 => ResponseValue::from_response(response).await,
649 _ => Err(Error::UnexpectedResponse(response)),
650 }
651 }
652 #[doc = "Returns the proofs for a transaction execution.\n\nSends a `POST` request to `/EXPERIMENTAL_light_client_block_proof`\n\n"]
653 pub async fn experimental_light_client_block_proof<'a>(
654 &'a self,
655 body: &'a types::JsonRpcRequestForExperimentalLightClientBlockProof,
656 ) -> Result<
657 ResponseValue<
658 types::JsonRpcResponseForRpcLightClientBlockProofResponseAndRpcLightClientProofError,
659 >,
660 Error<()>,
661 > {
662 let url = format!("{}/", self.baseurl,);
663 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
664 header_map.append(
665 ::reqwest::header::HeaderName::from_static("api-version"),
666 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
667 );
668 #[allow(unused_mut)]
669 let mut request = self
670 .client
671 .post(url)
672 .header(
673 ::reqwest::header::ACCEPT,
674 ::reqwest::header::HeaderValue::from_static("application/json"),
675 )
676 .json(&body)
677 .headers(header_map)
678 .build()?;
679 let info = OperationInfo {
680 operation_id: "experimental_light_client_block_proof",
681 };
682 self.pre(&mut request, &info).await?;
683 let result = self.exec(request, &info).await;
684 self.post(&result, &info).await?;
685 let response = result?;
686 match response.status().as_u16() {
687 200u16 => ResponseValue::from_response(response).await,
688 _ => Err(Error::UnexpectedResponse(response)),
689 }
690 }
691 #[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 < () > , >{
692 let url = format!("{}/", self.baseurl,);
693 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
694 header_map.append(
695 ::reqwest::header::HeaderName::from_static("api-version"),
696 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
697 );
698 #[allow(unused_mut)]
699 let mut request = self
700 .client
701 .post(url)
702 .header(
703 ::reqwest::header::ACCEPT,
704 ::reqwest::header::HeaderValue::from_static("application/json"),
705 )
706 .json(&body)
707 .headers(header_map)
708 .build()?;
709 let info = OperationInfo {
710 operation_id: "experimental_light_client_proof",
711 };
712 self.pre(&mut request, &info).await?;
713 let result = self.exec(request, &info).await;
714 self.post(&result, &info).await?;
715 let response = result?;
716 match response.status().as_u16() {
717 200u16 => ResponseValue::from_response(response).await,
718 _ => Err(Error::UnexpectedResponse(response)),
719 }
720 }
721 #[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"]
722 pub async fn experimental_maintenance_windows<'a>(
723 &'a self,
724 body: &'a types::JsonRpcRequestForExperimentalMaintenanceWindows,
725 ) -> Result<
726 ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError>,
727 Error<()>,
728 > {
729 let url = format!("{}/", self.baseurl,);
730 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
731 header_map.append(
732 ::reqwest::header::HeaderName::from_static("api-version"),
733 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
734 );
735 #[allow(unused_mut)]
736 let mut request = self
737 .client
738 .post(url)
739 .header(
740 ::reqwest::header::ACCEPT,
741 ::reqwest::header::HeaderValue::from_static("application/json"),
742 )
743 .json(&body)
744 .headers(header_map)
745 .build()?;
746 let info = OperationInfo {
747 operation_id: "experimental_maintenance_windows",
748 };
749 self.pre(&mut request, &info).await?;
750 let result = self.exec(request, &info).await;
751 self.post(&result, &info).await?;
752 let response = result?;
753 match response.status().as_u16() {
754 200u16 => ResponseValue::from_response(response).await,
755 _ => Err(Error::UnexpectedResponse(response)),
756 }
757 }
758 #[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"]
759 pub async fn experimental_protocol_config<'a>(
760 &'a self,
761 body: &'a types::JsonRpcRequestForExperimentalProtocolConfig,
762 ) -> Result<
763 ResponseValue<types::JsonRpcResponseForRpcProtocolConfigResponseAndRpcProtocolConfigError>,
764 Error<()>,
765 > {
766 let url = format!("{}/", self.baseurl,);
767 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
768 header_map.append(
769 ::reqwest::header::HeaderName::from_static("api-version"),
770 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
771 );
772 #[allow(unused_mut)]
773 let mut request = self
774 .client
775 .post(url)
776 .header(
777 ::reqwest::header::ACCEPT,
778 ::reqwest::header::HeaderValue::from_static("application/json"),
779 )
780 .json(&body)
781 .headers(header_map)
782 .build()?;
783 let info = OperationInfo {
784 operation_id: "experimental_protocol_config",
785 };
786 self.pre(&mut request, &info).await?;
787 let result = self.exec(request, &info).await;
788 self.post(&result, &info).await?;
789 let response = result?;
790 match response.status().as_u16() {
791 200u16 => ResponseValue::from_response(response).await,
792 _ => Err(Error::UnexpectedResponse(response)),
793 }
794 }
795 #[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"]
796 pub async fn experimental_receipt<'a>(
797 &'a self,
798 body: &'a types::JsonRpcRequestForExperimentalReceipt,
799 ) -> Result<
800 ResponseValue<types::JsonRpcResponseForRpcReceiptResponseAndRpcReceiptError>,
801 Error<()>,
802 > {
803 let url = format!("{}/", self.baseurl,);
804 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
805 header_map.append(
806 ::reqwest::header::HeaderName::from_static("api-version"),
807 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
808 );
809 #[allow(unused_mut)]
810 let mut request = self
811 .client
812 .post(url)
813 .header(
814 ::reqwest::header::ACCEPT,
815 ::reqwest::header::HeaderValue::from_static("application/json"),
816 )
817 .json(&body)
818 .headers(header_map)
819 .build()?;
820 let info = OperationInfo {
821 operation_id: "experimental_receipt",
822 };
823 self.pre(&mut request, &info).await?;
824 let result = self.exec(request, &info).await;
825 self.post(&result, &info).await?;
826 let response = result?;
827 match response.status().as_u16() {
828 200u16 => ResponseValue::from_response(response).await,
829 _ => Err(Error::UnexpectedResponse(response)),
830 }
831 }
832 #[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"]
833 pub async fn experimental_split_storage_info<'a>(
834 &'a self,
835 body: &'a types::JsonRpcRequestForExperimentalSplitStorageInfo,
836 ) -> Result<
837 ResponseValue<
838 types::JsonRpcResponseForRpcSplitStorageInfoResponseAndRpcSplitStorageInfoError,
839 >,
840 Error<()>,
841 > {
842 let url = format!("{}/", self.baseurl,);
843 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
844 header_map.append(
845 ::reqwest::header::HeaderName::from_static("api-version"),
846 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
847 );
848 #[allow(unused_mut)]
849 let mut request = self
850 .client
851 .post(url)
852 .header(
853 ::reqwest::header::ACCEPT,
854 ::reqwest::header::HeaderValue::from_static("application/json"),
855 )
856 .json(&body)
857 .headers(header_map)
858 .build()?;
859 let info = OperationInfo {
860 operation_id: "experimental_split_storage_info",
861 };
862 self.pre(&mut request, &info).await?;
863 let result = self.exec(request, &info).await;
864 self.post(&result, &info).await?;
865 let response = result?;
866 match response.status().as_u16() {
867 200u16 => ResponseValue::from_response(response).await,
868 _ => Err(Error::UnexpectedResponse(response)),
869 }
870 }
871 #[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"]
872 pub async fn experimental_tx_status<'a>(
873 &'a self,
874 body: &'a types::JsonRpcRequestForExperimentalTxStatus,
875 ) -> Result<
876 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
877 Error<()>,
878 > {
879 let url = format!("{}/", self.baseurl,);
880 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
881 header_map.append(
882 ::reqwest::header::HeaderName::from_static("api-version"),
883 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
884 );
885 #[allow(unused_mut)]
886 let mut request = self
887 .client
888 .post(url)
889 .header(
890 ::reqwest::header::ACCEPT,
891 ::reqwest::header::HeaderValue::from_static("application/json"),
892 )
893 .json(&body)
894 .headers(header_map)
895 .build()?;
896 let info = OperationInfo {
897 operation_id: "experimental_tx_status",
898 };
899 self.pre(&mut request, &info).await?;
900 let result = self.exec(request, &info).await;
901 self.post(&result, &info).await?;
902 let response = result?;
903 match response.status().as_u16() {
904 200u16 => ResponseValue::from_response(response).await,
905 _ => Err(Error::UnexpectedResponse(response)),
906 }
907 }
908 #[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"]
909 pub async fn experimental_validators_ordered<'a>(
910 &'a self,
911 body: &'a types::JsonRpcRequestForExperimentalValidatorsOrdered,
912 ) -> Result<
913 ResponseValue<types::JsonRpcResponseForArrayOfValidatorStakeViewAndRpcValidatorError>,
914 Error<()>,
915 > {
916 let url = format!("{}/", self.baseurl,);
917 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
918 header_map.append(
919 ::reqwest::header::HeaderName::from_static("api-version"),
920 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
921 );
922 #[allow(unused_mut)]
923 let mut request = self
924 .client
925 .post(url)
926 .header(
927 ::reqwest::header::ACCEPT,
928 ::reqwest::header::HeaderValue::from_static("application/json"),
929 )
930 .json(&body)
931 .headers(header_map)
932 .build()?;
933 let info = OperationInfo {
934 operation_id: "experimental_validators_ordered",
935 };
936 self.pre(&mut request, &info).await?;
937 let result = self.exec(request, &info).await;
938 self.post(&result, &info).await?;
939 let response = result?;
940 match response.status().as_u16() {
941 200u16 => ResponseValue::from_response(response).await,
942 _ => Err(Error::UnexpectedResponse(response)),
943 }
944 }
945 #[doc = "Returns information about a single access key for given account.\n\nSends a `POST` request to `/EXPERIMENTAL_view_access_key`\n\n"]
946 pub async fn experimental_view_access_key<'a>(
947 &'a self,
948 body: &'a types::JsonRpcRequestForExperimentalViewAccessKey,
949 ) -> Result<
950 ResponseValue<types::JsonRpcResponseForRpcViewAccessKeyResponseAndRpcViewAccessKeyError>,
951 Error<()>,
952 > {
953 let url = format!("{}/", self.baseurl,);
954 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
955 header_map.append(
956 ::reqwest::header::HeaderName::from_static("api-version"),
957 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
958 );
959 #[allow(unused_mut)]
960 let mut request = self
961 .client
962 .post(url)
963 .header(
964 ::reqwest::header::ACCEPT,
965 ::reqwest::header::HeaderValue::from_static("application/json"),
966 )
967 .json(&body)
968 .headers(header_map)
969 .build()?;
970 let info = OperationInfo {
971 operation_id: "experimental_view_access_key",
972 };
973 self.pre(&mut request, &info).await?;
974 let result = self.exec(request, &info).await;
975 self.post(&result, &info).await?;
976 let response = result?;
977 match response.status().as_u16() {
978 200u16 => ResponseValue::from_response(response).await,
979 _ => Err(Error::UnexpectedResponse(response)),
980 }
981 }
982 #[doc = "Returns all access keys for a given account.\n\nSends a `POST` request to `/EXPERIMENTAL_view_access_key_list`\n\n"]
983 pub async fn experimental_view_access_key_list<'a>(
984 &'a self,
985 body: &'a types::JsonRpcRequestForExperimentalViewAccessKeyList,
986 ) -> Result<
987 ResponseValue<
988 types::JsonRpcResponseForRpcViewAccessKeyListResponseAndRpcViewAccessKeyListError,
989 >,
990 Error<()>,
991 > {
992 let url = format!("{}/", self.baseurl,);
993 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
994 header_map.append(
995 ::reqwest::header::HeaderName::from_static("api-version"),
996 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
997 );
998 #[allow(unused_mut)]
999 let mut request = self
1000 .client
1001 .post(url)
1002 .header(
1003 ::reqwest::header::ACCEPT,
1004 ::reqwest::header::HeaderValue::from_static("application/json"),
1005 )
1006 .json(&body)
1007 .headers(header_map)
1008 .build()?;
1009 let info = OperationInfo {
1010 operation_id: "experimental_view_access_key_list",
1011 };
1012 self.pre(&mut request, &info).await?;
1013 let result = self.exec(request, &info).await;
1014 self.post(&result, &info).await?;
1015 let response = result?;
1016 match response.status().as_u16() {
1017 200u16 => ResponseValue::from_response(response).await,
1018 _ => Err(Error::UnexpectedResponse(response)),
1019 }
1020 }
1021 #[doc = "Returns information about an account for given account_id.\n\nSends a `POST` request to `/EXPERIMENTAL_view_account`\n\n"]
1022 pub async fn experimental_view_account<'a>(
1023 &'a self,
1024 body: &'a types::JsonRpcRequestForExperimentalViewAccount,
1025 ) -> Result<
1026 ResponseValue<types::JsonRpcResponseForRpcViewAccountResponseAndRpcViewAccountError>,
1027 Error<()>,
1028 > {
1029 let url = format!("{}/", self.baseurl,);
1030 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1031 header_map.append(
1032 ::reqwest::header::HeaderName::from_static("api-version"),
1033 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1034 );
1035 #[allow(unused_mut)]
1036 let mut request = self
1037 .client
1038 .post(url)
1039 .header(
1040 ::reqwest::header::ACCEPT,
1041 ::reqwest::header::HeaderValue::from_static("application/json"),
1042 )
1043 .json(&body)
1044 .headers(header_map)
1045 .build()?;
1046 let info = OperationInfo {
1047 operation_id: "experimental_view_account",
1048 };
1049 self.pre(&mut request, &info).await?;
1050 let result = self.exec(request, &info).await;
1051 self.post(&result, &info).await?;
1052 let response = result?;
1053 match response.status().as_u16() {
1054 200u16 => ResponseValue::from_response(response).await,
1055 _ => Err(Error::UnexpectedResponse(response)),
1056 }
1057 }
1058 #[doc = "Returns the contract code (Wasm binary) deployed to the account.\n\nSends a `POST` request to `/EXPERIMENTAL_view_code`\n\n"]
1059 pub async fn experimental_view_code<'a>(
1060 &'a self,
1061 body: &'a types::JsonRpcRequestForExperimentalViewCode,
1062 ) -> Result<
1063 ResponseValue<types::JsonRpcResponseForRpcViewCodeResponseAndRpcViewCodeError>,
1064 Error<()>,
1065 > {
1066 let url = format!("{}/", self.baseurl,);
1067 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1068 header_map.append(
1069 ::reqwest::header::HeaderName::from_static("api-version"),
1070 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1071 );
1072 #[allow(unused_mut)]
1073 let mut request = self
1074 .client
1075 .post(url)
1076 .header(
1077 ::reqwest::header::ACCEPT,
1078 ::reqwest::header::HeaderValue::from_static("application/json"),
1079 )
1080 .json(&body)
1081 .headers(header_map)
1082 .build()?;
1083 let info = OperationInfo {
1084 operation_id: "experimental_view_code",
1085 };
1086 self.pre(&mut request, &info).await?;
1087 let result = self.exec(request, &info).await;
1088 self.post(&result, &info).await?;
1089 let response = result?;
1090 match response.status().as_u16() {
1091 200u16 => ResponseValue::from_response(response).await,
1092 _ => Err(Error::UnexpectedResponse(response)),
1093 }
1094 }
1095 #[doc = "Returns information about a single gas key for given account.\n\nSends a `POST` request to `/EXPERIMENTAL_view_gas_key`\n\n"]
1096 pub async fn experimental_view_gas_key<'a>(
1097 &'a self,
1098 body: &'a types::JsonRpcRequestForExperimentalViewGasKey,
1099 ) -> Result<
1100 ResponseValue<types::JsonRpcResponseForRpcViewGasKeyResponseAndRpcViewGasKeyError>,
1101 Error<()>,
1102 > {
1103 let url = format!("{}/", self.baseurl,);
1104 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1105 header_map.append(
1106 ::reqwest::header::HeaderName::from_static("api-version"),
1107 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1108 );
1109 #[allow(unused_mut)]
1110 let mut request = self
1111 .client
1112 .post(url)
1113 .header(
1114 ::reqwest::header::ACCEPT,
1115 ::reqwest::header::HeaderValue::from_static("application/json"),
1116 )
1117 .json(&body)
1118 .headers(header_map)
1119 .build()?;
1120 let info = OperationInfo {
1121 operation_id: "experimental_view_gas_key",
1122 };
1123 self.pre(&mut request, &info).await?;
1124 let result = self.exec(request, &info).await;
1125 self.post(&result, &info).await?;
1126 let response = result?;
1127 match response.status().as_u16() {
1128 200u16 => ResponseValue::from_response(response).await,
1129 _ => Err(Error::UnexpectedResponse(response)),
1130 }
1131 }
1132 #[doc = "Returns all gas keys for a given account.\n\nSends a `POST` request to `/EXPERIMENTAL_view_gas_key_list`\n\n"]
1133 pub async fn experimental_view_gas_key_list<'a>(
1134 &'a self,
1135 body: &'a types::JsonRpcRequestForExperimentalViewGasKeyList,
1136 ) -> Result<
1137 ResponseValue<types::JsonRpcResponseForRpcViewGasKeyListResponseAndRpcViewGasKeyListError>,
1138 Error<()>,
1139 > {
1140 let url = format!("{}/", self.baseurl,);
1141 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1142 header_map.append(
1143 ::reqwest::header::HeaderName::from_static("api-version"),
1144 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1145 );
1146 #[allow(unused_mut)]
1147 let mut request = self
1148 .client
1149 .post(url)
1150 .header(
1151 ::reqwest::header::ACCEPT,
1152 ::reqwest::header::HeaderValue::from_static("application/json"),
1153 )
1154 .json(&body)
1155 .headers(header_map)
1156 .build()?;
1157 let info = OperationInfo {
1158 operation_id: "experimental_view_gas_key_list",
1159 };
1160 self.pre(&mut request, &info).await?;
1161 let result = self.exec(request, &info).await;
1162 self.post(&result, &info).await?;
1163 let response = result?;
1164 match response.status().as_u16() {
1165 200u16 => ResponseValue::from_response(response).await,
1166 _ => Err(Error::UnexpectedResponse(response)),
1167 }
1168 }
1169 #[doc = "Returns the state (key-value pairs) of a contract based on the key prefix.\n\nSends a `POST` request to `/EXPERIMENTAL_view_state`\n\n"]
1170 pub async fn experimental_view_state<'a>(
1171 &'a self,
1172 body: &'a types::JsonRpcRequestForExperimentalViewState,
1173 ) -> Result<
1174 ResponseValue<types::JsonRpcResponseForRpcViewStateResponseAndRpcViewStateError>,
1175 Error<()>,
1176 > {
1177 let url = format!("{}/", self.baseurl,);
1178 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1179 header_map.append(
1180 ::reqwest::header::HeaderName::from_static("api-version"),
1181 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1182 );
1183 #[allow(unused_mut)]
1184 let mut request = self
1185 .client
1186 .post(url)
1187 .header(
1188 ::reqwest::header::ACCEPT,
1189 ::reqwest::header::HeaderValue::from_static("application/json"),
1190 )
1191 .json(&body)
1192 .headers(header_map)
1193 .build()?;
1194 let info = OperationInfo {
1195 operation_id: "experimental_view_state",
1196 };
1197 self.pre(&mut request, &info).await?;
1198 let result = self.exec(request, &info).await;
1199 self.post(&result, &info).await?;
1200 let response = result?;
1201 match response.status().as_u16() {
1202 200u16 => ResponseValue::from_response(response).await,
1203 _ => Err(Error::UnexpectedResponse(response)),
1204 }
1205 }
1206 #[doc = "Returns block details for given height or hash\n\nSends a `POST` request to `/block`\n\n"]
1207 pub async fn block<'a>(
1208 &'a self,
1209 body: &'a types::JsonRpcRequestForBlock,
1210 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcBlockResponseAndRpcBlockError>, Error<()>>
1211 {
1212 let url = format!("{}/", self.baseurl,);
1213 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1214 header_map.append(
1215 ::reqwest::header::HeaderName::from_static("api-version"),
1216 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1217 );
1218 #[allow(unused_mut)]
1219 let mut request = self
1220 .client
1221 .post(url)
1222 .header(
1223 ::reqwest::header::ACCEPT,
1224 ::reqwest::header::HeaderValue::from_static("application/json"),
1225 )
1226 .json(&body)
1227 .headers(header_map)
1228 .build()?;
1229 let info = OperationInfo {
1230 operation_id: "block",
1231 };
1232 self.pre(&mut request, &info).await?;
1233 let result = self.exec(request, &info).await;
1234 self.post(&result, &info).await?;
1235 let response = result?;
1236 match response.status().as_u16() {
1237 200u16 => ResponseValue::from_response(response).await,
1238 _ => Err(Error::UnexpectedResponse(response)),
1239 }
1240 }
1241 #[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"]
1242 pub async fn block_effects<'a>(
1243 &'a self,
1244 body: &'a types::JsonRpcRequestForBlockEffects,
1245 ) -> Result<
1246 ResponseValue<
1247 types::JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
1248 >,
1249 Error<()>,
1250 > {
1251 let url = format!("{}/", self.baseurl,);
1252 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1253 header_map.append(
1254 ::reqwest::header::HeaderName::from_static("api-version"),
1255 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1256 );
1257 #[allow(unused_mut)]
1258 let mut request = self
1259 .client
1260 .post(url)
1261 .header(
1262 ::reqwest::header::ACCEPT,
1263 ::reqwest::header::HeaderValue::from_static("application/json"),
1264 )
1265 .json(&body)
1266 .headers(header_map)
1267 .build()?;
1268 let info = OperationInfo {
1269 operation_id: "block_effects",
1270 };
1271 self.pre(&mut request, &info).await?;
1272 let result = self.exec(request, &info).await;
1273 self.post(&result, &info).await?;
1274 let response = result?;
1275 match response.status().as_u16() {
1276 200u16 => ResponseValue::from_response(response).await,
1277 _ => Err(Error::UnexpectedResponse(response)),
1278 }
1279 }
1280 #[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"]
1281 pub async fn broadcast_tx_async<'a>(
1282 &'a self,
1283 body: &'a types::JsonRpcRequestForBroadcastTxAsync,
1284 ) -> Result<ResponseValue<types::JsonRpcResponseForCryptoHashAndRpcTransactionError>, Error<()>>
1285 {
1286 let url = format!("{}/", self.baseurl,);
1287 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1288 header_map.append(
1289 ::reqwest::header::HeaderName::from_static("api-version"),
1290 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1291 );
1292 #[allow(unused_mut)]
1293 let mut request = self
1294 .client
1295 .post(url)
1296 .header(
1297 ::reqwest::header::ACCEPT,
1298 ::reqwest::header::HeaderValue::from_static("application/json"),
1299 )
1300 .json(&body)
1301 .headers(header_map)
1302 .build()?;
1303 let info = OperationInfo {
1304 operation_id: "broadcast_tx_async",
1305 };
1306 self.pre(&mut request, &info).await?;
1307 let result = self.exec(request, &info).await;
1308 self.post(&result, &info).await?;
1309 let response = result?;
1310 match response.status().as_u16() {
1311 200u16 => ResponseValue::from_response(response).await,
1312 _ => Err(Error::UnexpectedResponse(response)),
1313 }
1314 }
1315 #[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"]
1316 pub async fn broadcast_tx_commit<'a>(
1317 &'a self,
1318 body: &'a types::JsonRpcRequestForBroadcastTxCommit,
1319 ) -> Result<
1320 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1321 Error<()>,
1322 > {
1323 let url = format!("{}/", self.baseurl,);
1324 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1325 header_map.append(
1326 ::reqwest::header::HeaderName::from_static("api-version"),
1327 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1328 );
1329 #[allow(unused_mut)]
1330 let mut request = self
1331 .client
1332 .post(url)
1333 .header(
1334 ::reqwest::header::ACCEPT,
1335 ::reqwest::header::HeaderValue::from_static("application/json"),
1336 )
1337 .json(&body)
1338 .headers(header_map)
1339 .build()?;
1340 let info = OperationInfo {
1341 operation_id: "broadcast_tx_commit",
1342 };
1343 self.pre(&mut request, &info).await?;
1344 let result = self.exec(request, &info).await;
1345 self.post(&result, &info).await?;
1346 let response = result?;
1347 match response.status().as_u16() {
1348 200u16 => ResponseValue::from_response(response).await,
1349 _ => Err(Error::UnexpectedResponse(response)),
1350 }
1351 }
1352 #[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"]
1353 pub async fn changes<'a>(
1354 &'a self,
1355 body: &'a types::JsonRpcRequestForChanges,
1356 ) -> Result<
1357 ResponseValue<
1358 types::JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
1359 >,
1360 Error<()>,
1361 > {
1362 let url = format!("{}/", self.baseurl,);
1363 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1364 header_map.append(
1365 ::reqwest::header::HeaderName::from_static("api-version"),
1366 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1367 );
1368 #[allow(unused_mut)]
1369 let mut request = self
1370 .client
1371 .post(url)
1372 .header(
1373 ::reqwest::header::ACCEPT,
1374 ::reqwest::header::HeaderValue::from_static("application/json"),
1375 )
1376 .json(&body)
1377 .headers(header_map)
1378 .build()?;
1379 let info = OperationInfo {
1380 operation_id: "changes",
1381 };
1382 self.pre(&mut request, &info).await?;
1383 let result = self.exec(request, &info).await;
1384 self.post(&result, &info).await?;
1385 let response = result?;
1386 match response.status().as_u16() {
1387 200u16 => ResponseValue::from_response(response).await,
1388 _ => Err(Error::UnexpectedResponse(response)),
1389 }
1390 }
1391 #[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"]
1392 pub async fn chunk<'a>(
1393 &'a self,
1394 body: &'a types::JsonRpcRequestForChunk,
1395 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcChunkResponseAndRpcChunkError>, Error<()>>
1396 {
1397 let url = format!("{}/", self.baseurl,);
1398 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1399 header_map.append(
1400 ::reqwest::header::HeaderName::from_static("api-version"),
1401 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1402 );
1403 #[allow(unused_mut)]
1404 let mut request = self
1405 .client
1406 .post(url)
1407 .header(
1408 ::reqwest::header::ACCEPT,
1409 ::reqwest::header::HeaderValue::from_static("application/json"),
1410 )
1411 .json(&body)
1412 .headers(header_map)
1413 .build()?;
1414 let info = OperationInfo {
1415 operation_id: "chunk",
1416 };
1417 self.pre(&mut request, &info).await?;
1418 let result = self.exec(request, &info).await;
1419 self.post(&result, &info).await?;
1420 let response = result?;
1421 match response.status().as_u16() {
1422 200u16 => ResponseValue::from_response(response).await,
1423 _ => Err(Error::UnexpectedResponse(response)),
1424 }
1425 }
1426 #[doc = "Queries client node configuration\n\nSends a `POST` request to `/client_config`\n\n"]
1427 pub async fn client_config<'a>(
1428 &'a self,
1429 body: &'a types::JsonRpcRequestForClientConfig,
1430 ) -> Result<
1431 ResponseValue<types::JsonRpcResponseForRpcClientConfigResponseAndRpcClientConfigError>,
1432 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: "client_config",
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 = "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"]
1464 pub async fn gas_price<'a>(
1465 &'a self,
1466 body: &'a types::JsonRpcRequestForGasPrice,
1467 ) -> Result<
1468 ResponseValue<types::JsonRpcResponseForRpcGasPriceResponseAndRpcGasPriceError>,
1469 Error<()>,
1470 > {
1471 let url = format!("{}/", self.baseurl,);
1472 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1473 header_map.append(
1474 ::reqwest::header::HeaderName::from_static("api-version"),
1475 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1476 );
1477 #[allow(unused_mut)]
1478 let mut request = self
1479 .client
1480 .post(url)
1481 .header(
1482 ::reqwest::header::ACCEPT,
1483 ::reqwest::header::HeaderValue::from_static("application/json"),
1484 )
1485 .json(&body)
1486 .headers(header_map)
1487 .build()?;
1488 let info = OperationInfo {
1489 operation_id: "gas_price",
1490 };
1491 self.pre(&mut request, &info).await?;
1492 let result = self.exec(request, &info).await;
1493 self.post(&result, &info).await?;
1494 let response = result?;
1495 match response.status().as_u16() {
1496 200u16 => ResponseValue::from_response(response).await,
1497 _ => Err(Error::UnexpectedResponse(response)),
1498 }
1499 }
1500 #[doc = "Get initial state and parameters for the genesis block\n\nSends a `POST` request to `/genesis_config`\n\n"]
1501 pub async fn genesis_config<'a>(
1502 &'a self,
1503 body: &'a types::JsonRpcRequestForGenesisConfig,
1504 ) -> Result<ResponseValue<types::JsonRpcResponseForGenesisConfigAndGenesisConfigError>, Error<()>>
1505 {
1506 let url = format!("{}/", self.baseurl,);
1507 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1508 header_map.append(
1509 ::reqwest::header::HeaderName::from_static("api-version"),
1510 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1511 );
1512 #[allow(unused_mut)]
1513 let mut request = self
1514 .client
1515 .post(url)
1516 .header(
1517 ::reqwest::header::ACCEPT,
1518 ::reqwest::header::HeaderValue::from_static("application/json"),
1519 )
1520 .json(&body)
1521 .headers(header_map)
1522 .build()?;
1523 let info = OperationInfo {
1524 operation_id: "genesis_config",
1525 };
1526 self.pre(&mut request, &info).await?;
1527 let result = self.exec(request, &info).await;
1528 self.post(&result, &info).await?;
1529 let response = result?;
1530 match response.status().as_u16() {
1531 200u16 => ResponseValue::from_response(response).await,
1532 _ => Err(Error::UnexpectedResponse(response)),
1533 }
1534 }
1535 #[doc = "Returns the current health status of the RPC node the client connects to.\n\nSends a `POST` request to `/health`\n\n"]
1536 pub async fn health<'a>(
1537 &'a self,
1538 body: &'a types::JsonRpcRequestForHealth,
1539 ) -> Result<
1540 ResponseValue<types::JsonRpcResponseForNullableRpcHealthResponseAndRpcStatusError>,
1541 Error<()>,
1542 > {
1543 let url = format!("{}/", self.baseurl,);
1544 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1545 header_map.append(
1546 ::reqwest::header::HeaderName::from_static("api-version"),
1547 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1548 );
1549 #[allow(unused_mut)]
1550 let mut request = self
1551 .client
1552 .post(url)
1553 .header(
1554 ::reqwest::header::ACCEPT,
1555 ::reqwest::header::HeaderValue::from_static("application/json"),
1556 )
1557 .json(&body)
1558 .headers(header_map)
1559 .build()?;
1560 let info = OperationInfo {
1561 operation_id: "health",
1562 };
1563 self.pre(&mut request, &info).await?;
1564 let result = self.exec(request, &info).await;
1565 self.post(&result, &info).await?;
1566 let response = result?;
1567 match response.status().as_u16() {
1568 200u16 => ResponseValue::from_response(response).await,
1569 _ => Err(Error::UnexpectedResponse(response)),
1570 }
1571 }
1572 #[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 < () > , >{
1573 let url = format!("{}/", self.baseurl,);
1574 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1575 header_map.append(
1576 ::reqwest::header::HeaderName::from_static("api-version"),
1577 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1578 );
1579 #[allow(unused_mut)]
1580 let mut request = self
1581 .client
1582 .post(url)
1583 .header(
1584 ::reqwest::header::ACCEPT,
1585 ::reqwest::header::HeaderValue::from_static("application/json"),
1586 )
1587 .json(&body)
1588 .headers(header_map)
1589 .build()?;
1590 let info = OperationInfo {
1591 operation_id: "light_client_proof",
1592 };
1593 self.pre(&mut request, &info).await?;
1594 let result = self.exec(request, &info).await;
1595 self.post(&result, &info).await?;
1596 let response = result?;
1597 match response.status().as_u16() {
1598 200u16 => ResponseValue::from_response(response).await,
1599 _ => Err(Error::UnexpectedResponse(response)),
1600 }
1601 }
1602 #[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"]
1603 pub async fn maintenance_windows<'a>(
1604 &'a self,
1605 body: &'a types::JsonRpcRequestForMaintenanceWindows,
1606 ) -> Result<
1607 ResponseValue<types::JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError>,
1608 Error<()>,
1609 > {
1610 let url = format!("{}/", self.baseurl,);
1611 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1612 header_map.append(
1613 ::reqwest::header::HeaderName::from_static("api-version"),
1614 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1615 );
1616 #[allow(unused_mut)]
1617 let mut request = self
1618 .client
1619 .post(url)
1620 .header(
1621 ::reqwest::header::ACCEPT,
1622 ::reqwest::header::HeaderValue::from_static("application/json"),
1623 )
1624 .json(&body)
1625 .headers(header_map)
1626 .build()?;
1627 let info = OperationInfo {
1628 operation_id: "maintenance_windows",
1629 };
1630 self.pre(&mut request, &info).await?;
1631 let result = self.exec(request, &info).await;
1632 self.post(&result, &info).await?;
1633 let response = result?;
1634 match response.status().as_u16() {
1635 200u16 => ResponseValue::from_response(response).await,
1636 _ => Err(Error::UnexpectedResponse(response)),
1637 }
1638 }
1639 #[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"]
1640 pub async fn network_info<'a>(
1641 &'a self,
1642 body: &'a types::JsonRpcRequestForNetworkInfo,
1643 ) -> Result<
1644 ResponseValue<types::JsonRpcResponseForRpcNetworkInfoResponseAndRpcNetworkInfoError>,
1645 Error<()>,
1646 > {
1647 let url = format!("{}/", self.baseurl,);
1648 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1649 header_map.append(
1650 ::reqwest::header::HeaderName::from_static("api-version"),
1651 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1652 );
1653 #[allow(unused_mut)]
1654 let mut request = self
1655 .client
1656 .post(url)
1657 .header(
1658 ::reqwest::header::ACCEPT,
1659 ::reqwest::header::HeaderValue::from_static("application/json"),
1660 )
1661 .json(&body)
1662 .headers(header_map)
1663 .build()?;
1664 let info = OperationInfo {
1665 operation_id: "network_info",
1666 };
1667 self.pre(&mut request, &info).await?;
1668 let result = self.exec(request, &info).await;
1669 self.post(&result, &info).await?;
1670 let response = result?;
1671 match response.status().as_u16() {
1672 200u16 => ResponseValue::from_response(response).await,
1673 _ => Err(Error::UnexpectedResponse(response)),
1674 }
1675 }
1676 #[doc = "Returns the next light client block.\n\nSends a `POST` request to `/next_light_client_block`\n\n"]
1677 pub async fn next_light_client_block<'a>(
1678 &'a self,
1679 body: &'a types::JsonRpcRequestForNextLightClientBlock,
1680 ) -> Result<
1681 ResponseValue<
1682 types::JsonRpcResponseForRpcLightClientNextBlockResponseAndRpcLightClientNextBlockError,
1683 >,
1684 Error<()>,
1685 > {
1686 let url = format!("{}/", self.baseurl,);
1687 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1688 header_map.append(
1689 ::reqwest::header::HeaderName::from_static("api-version"),
1690 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1691 );
1692 #[allow(unused_mut)]
1693 let mut request = self
1694 .client
1695 .post(url)
1696 .header(
1697 ::reqwest::header::ACCEPT,
1698 ::reqwest::header::HeaderValue::from_static("application/json"),
1699 )
1700 .json(&body)
1701 .headers(header_map)
1702 .build()?;
1703 let info = OperationInfo {
1704 operation_id: "next_light_client_block",
1705 };
1706 self.pre(&mut request, &info).await?;
1707 let result = self.exec(request, &info).await;
1708 self.post(&result, &info).await?;
1709 let response = result?;
1710 match response.status().as_u16() {
1711 200u16 => ResponseValue::from_response(response).await,
1712 _ => Err(Error::UnexpectedResponse(response)),
1713 }
1714 }
1715 #[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"]
1716 pub async fn query<'a>(
1717 &'a self,
1718 body: &'a types::JsonRpcRequestForQuery,
1719 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcQueryResponseAndRpcQueryError>, Error<()>>
1720 {
1721 let url = format!("{}/", self.baseurl,);
1722 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1723 header_map.append(
1724 ::reqwest::header::HeaderName::from_static("api-version"),
1725 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1726 );
1727 #[allow(unused_mut)]
1728 let mut request = self
1729 .client
1730 .post(url)
1731 .header(
1732 ::reqwest::header::ACCEPT,
1733 ::reqwest::header::HeaderValue::from_static("application/json"),
1734 )
1735 .json(&body)
1736 .headers(header_map)
1737 .build()?;
1738 let info = OperationInfo {
1739 operation_id: "query",
1740 };
1741 self.pre(&mut request, &info).await?;
1742 let result = self.exec(request, &info).await;
1743 self.post(&result, &info).await?;
1744 let response = result?;
1745 match response.status().as_u16() {
1746 200u16 => ResponseValue::from_response(response).await,
1747 _ => Err(Error::UnexpectedResponse(response)),
1748 }
1749 }
1750 #[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"]
1751 pub async fn send_tx<'a>(
1752 &'a self,
1753 body: &'a types::JsonRpcRequestForSendTx,
1754 ) -> Result<
1755 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1756 Error<()>,
1757 > {
1758 let url = format!("{}/", self.baseurl,);
1759 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1760 header_map.append(
1761 ::reqwest::header::HeaderName::from_static("api-version"),
1762 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1763 );
1764 #[allow(unused_mut)]
1765 let mut request = self
1766 .client
1767 .post(url)
1768 .header(
1769 ::reqwest::header::ACCEPT,
1770 ::reqwest::header::HeaderValue::from_static("application/json"),
1771 )
1772 .json(&body)
1773 .headers(header_map)
1774 .build()?;
1775 let info = OperationInfo {
1776 operation_id: "send_tx",
1777 };
1778 self.pre(&mut request, &info).await?;
1779 let result = self.exec(request, &info).await;
1780 self.post(&result, &info).await?;
1781 let response = result?;
1782 match response.status().as_u16() {
1783 200u16 => ResponseValue::from_response(response).await,
1784 _ => Err(Error::UnexpectedResponse(response)),
1785 }
1786 }
1787 #[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"]
1788 pub async fn status<'a>(
1789 &'a self,
1790 body: &'a types::JsonRpcRequestForStatus,
1791 ) -> Result<ResponseValue<types::JsonRpcResponseForRpcStatusResponseAndRpcStatusError>, Error<()>>
1792 {
1793 let url = format!("{}/", self.baseurl,);
1794 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1795 header_map.append(
1796 ::reqwest::header::HeaderName::from_static("api-version"),
1797 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1798 );
1799 #[allow(unused_mut)]
1800 let mut request = self
1801 .client
1802 .post(url)
1803 .header(
1804 ::reqwest::header::ACCEPT,
1805 ::reqwest::header::HeaderValue::from_static("application/json"),
1806 )
1807 .json(&body)
1808 .headers(header_map)
1809 .build()?;
1810 let info = OperationInfo {
1811 operation_id: "status",
1812 };
1813 self.pre(&mut request, &info).await?;
1814 let result = self.exec(request, &info).await;
1815 self.post(&result, &info).await?;
1816 let response = result?;
1817 match response.status().as_u16() {
1818 200u16 => ResponseValue::from_response(response).await,
1819 _ => Err(Error::UnexpectedResponse(response)),
1820 }
1821 }
1822 #[doc = "Queries status of a transaction by hash and returns the final transaction result.\n\nSends a `POST` request to `/tx`\n\n"]
1823 pub async fn tx<'a>(
1824 &'a self,
1825 body: &'a types::JsonRpcRequestForTx,
1826 ) -> Result<
1827 ResponseValue<types::JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError>,
1828 Error<()>,
1829 > {
1830 let url = format!("{}/", self.baseurl,);
1831 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1832 header_map.append(
1833 ::reqwest::header::HeaderName::from_static("api-version"),
1834 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1835 );
1836 #[allow(unused_mut)]
1837 let mut request = self
1838 .client
1839 .post(url)
1840 .header(
1841 ::reqwest::header::ACCEPT,
1842 ::reqwest::header::HeaderValue::from_static("application/json"),
1843 )
1844 .json(&body)
1845 .headers(header_map)
1846 .build()?;
1847 let info = OperationInfo { operation_id: "tx" };
1848 self.pre(&mut request, &info).await?;
1849 let result = self.exec(request, &info).await;
1850 self.post(&result, &info).await?;
1851 let response = result?;
1852 match response.status().as_u16() {
1853 200u16 => ResponseValue::from_response(response).await,
1854 _ => Err(Error::UnexpectedResponse(response)),
1855 }
1856 }
1857 #[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"]
1858 pub async fn validators<'a>(
1859 &'a self,
1860 body: &'a types::JsonRpcRequestForValidators,
1861 ) -> Result<
1862 ResponseValue<types::JsonRpcResponseForRpcValidatorResponseAndRpcValidatorError>,
1863 Error<()>,
1864 > {
1865 let url = format!("{}/", self.baseurl,);
1866 let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
1867 header_map.append(
1868 ::reqwest::header::HeaderName::from_static("api-version"),
1869 ::reqwest::header::HeaderValue::from_static(Self::api_version()),
1870 );
1871 #[allow(unused_mut)]
1872 let mut request = self
1873 .client
1874 .post(url)
1875 .header(
1876 ::reqwest::header::ACCEPT,
1877 ::reqwest::header::HeaderValue::from_static("application/json"),
1878 )
1879 .json(&body)
1880 .headers(header_map)
1881 .build()?;
1882 let info = OperationInfo {
1883 operation_id: "validators",
1884 };
1885 self.pre(&mut request, &info).await?;
1886 let result = self.exec(request, &info).await;
1887 self.post(&result, &info).await?;
1888 let response = result?;
1889 match response.status().as_u16() {
1890 200u16 => ResponseValue::from_response(response).await,
1891 _ => Err(Error::UnexpectedResponse(response)),
1892 }
1893 }
1894}
1895#[doc = r" Items consumers will typically use such as the Client."]
1896pub mod prelude {
1897 #[allow(unused_imports)]
1898 pub use super::Client;
1899}