mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Partial fee estimates for SubmittableExtrinsic (#910)
* add partial_fee estimation to submittable extrinsic * add integration test * make functions immune to doctest * add doc test * inline encoded_with_len, fix tests * fix test fmt * remove unused imoort * Bump h2 from 0.3.16 to 0.3.17 (#911) Bumps [h2](https://github.com/hyperium/h2) from 0.3.16 to 0.3.17. - [Release notes](https://github.com/hyperium/h2/releases) - [Changelog](https://github.com/hyperium/h2/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/h2/compare/v0.3.16...v0.3.17) --- updated-dependencies: - dependency-name: h2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * call_raw returns Res: Decode * remove import * remove struct --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
+13
-28
@@ -31,16 +31,19 @@
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use frame_metadata::RuntimeMetadataPrefixed;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{error::Error, utils::PhantomDataSendSync, Config, Metadata};
|
||||
|
||||
use super::{
|
||||
rpc_params,
|
||||
types::{self, ChainHeadEvent, FollowEvent},
|
||||
RpcClient, RpcClientT, Subscription,
|
||||
};
|
||||
use crate::{error::Error, utils::PhantomDataSendSync, Config, Metadata};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_metadata::RuntimeMetadataPrefixed;
|
||||
use serde::Serialize;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Client for substrate rpc interfaces
|
||||
pub struct Rpc<T: Config> {
|
||||
@@ -151,25 +154,6 @@ impl<T: Config> Rpc<T> {
|
||||
Ok(metadata)
|
||||
}
|
||||
|
||||
/// Execute a runtime API call.
|
||||
pub async fn call(
|
||||
&self,
|
||||
function: String,
|
||||
call_parameters: Option<&[u8]>,
|
||||
at: Option<T::Hash>,
|
||||
) -> Result<types::Bytes, Error> {
|
||||
let call_parameters = call_parameters.unwrap_or_default();
|
||||
|
||||
let bytes: types::Bytes = self
|
||||
.client
|
||||
.request(
|
||||
"state_call",
|
||||
rpc_params![function, to_hex(call_parameters), at],
|
||||
)
|
||||
.await?;
|
||||
Ok(bytes)
|
||||
}
|
||||
|
||||
/// Fetch system properties
|
||||
pub async fn system_properties(&self) -> Result<types::SystemProperties, Error> {
|
||||
self.client
|
||||
@@ -364,14 +348,13 @@ impl<T: Config> Rpc<T> {
|
||||
}
|
||||
|
||||
/// Execute a runtime API call.
|
||||
pub async fn state_call(
|
||||
pub async fn state_call<Res: Decode>(
|
||||
&self,
|
||||
function: &str,
|
||||
call_parameters: Option<&[u8]>,
|
||||
at: Option<T::Hash>,
|
||||
) -> Result<types::Bytes, Error> {
|
||||
) -> Result<Res, Error> {
|
||||
let call_parameters = call_parameters.unwrap_or_default();
|
||||
|
||||
let bytes: types::Bytes = self
|
||||
.client
|
||||
.request(
|
||||
@@ -379,7 +362,9 @@ impl<T: Config> Rpc<T> {
|
||||
rpc_params![function, to_hex(call_parameters), at],
|
||||
)
|
||||
.await?;
|
||||
Ok(bytes)
|
||||
let cursor = &mut &bytes[..];
|
||||
let res: Res = Decode::decode(cursor)?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// Create and submit an extrinsic and return a subscription to the events triggered.
|
||||
|
||||
Reference in New Issue
Block a user