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:
Tadeo Hepperle
2023-04-17 10:40:48 +02:00
committed by GitHub
parent e642740081
commit 2997b1bdc3
7 changed files with 138 additions and 69 deletions
+5 -4
View File
@@ -3,6 +3,7 @@
// see LICENSE for license details.
use crate::{client::OnlineClientT, error::Error, Config};
use codec::Decode;
use derivative::Derivative;
use std::{future::Future, marker::PhantomData};
@@ -32,21 +33,21 @@ where
Client: OnlineClientT<T>,
{
/// Execute a raw runtime API call.
pub fn call_raw<'a>(
pub fn call_raw<'a, Res: Decode>(
&self,
function: &'a str,
call_parameters: Option<&'a [u8]>,
) -> impl Future<Output = Result<Vec<u8>, Error>> + 'a {
) -> impl Future<Output = Result<Res, Error>> + 'a {
let client = self.client.clone();
let block_hash = self.block_hash;
// Ensure that the returned future doesn't have a lifetime tied to api.runtime_api(),
// which is a temporary thing we'll be throwing away quickly:
async move {
let data = client
let data: Res = client
.rpc()
.state_call(function, call_parameters, Some(block_hash))
.await?;
Ok(data.0)
Ok(data)
}
}
}