mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
subxt-core compiles to no std again
This commit is contained in:
@@ -9,14 +9,14 @@ use crate::{config::Config, metadata::Metadata};
|
||||
|
||||
#[derive(Derivative)]
|
||||
#[derivative(Debug(bound = ""))]
|
||||
pub struct MinimalClient<C: Config> {
|
||||
pub struct ClientBase<C: Config> {
|
||||
pub genesis_hash: C::Hash,
|
||||
pub runtime_version: RuntimeVersion,
|
||||
pub metadata: Metadata,
|
||||
marker: core::marker::PhantomData<C>,
|
||||
}
|
||||
|
||||
impl<C: Config> MinimalClient<C> {
|
||||
impl<C: Config> ClientBase<C> {
|
||||
pub fn metadata(&self) -> Metadata {
|
||||
self.metadata.clone()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//! [`crate::config::DefaultExtrinsicParams`] provides a general-purpose
|
||||
//! implementation of this that will work in many cases.
|
||||
|
||||
use crate::client::MinimalClient;
|
||||
use crate::client::ClientBase;
|
||||
|
||||
use super::Config;
|
||||
use crate::prelude::*;
|
||||
@@ -71,7 +71,7 @@ pub trait ExtrinsicParams<T: Config>: ExtrinsicParamsEncoder + Sized + 'static {
|
||||
/// Construct a new instance of our [`ExtrinsicParams`].
|
||||
fn new(
|
||||
nonce: u64,
|
||||
client: &MinimalClient<T>,
|
||||
client: &ClientBase<T>,
|
||||
other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError>;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
use super::extrinsic_params::{ExtrinsicParams, ExtrinsicParamsEncoder, ExtrinsicParamsError};
|
||||
use super::Config;
|
||||
use crate::client::MinimalClient;
|
||||
use crate::client::ClientBase;
|
||||
use crate::prelude::*;
|
||||
use crate::utils::Era;
|
||||
use borrow::ToOwned;
|
||||
@@ -45,7 +45,7 @@ impl<T: Config> ExtrinsicParams<T> for CheckSpecVersion {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
client: &MinimalClient<T>,
|
||||
client: &ClientBase<T>,
|
||||
_other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(CheckSpecVersion(client.runtime_version().spec_version))
|
||||
@@ -73,7 +73,7 @@ impl<T: Config> ExtrinsicParams<T> for CheckNonce {
|
||||
|
||||
fn new(
|
||||
nonce: u64,
|
||||
_client: &MinimalClient<T>,
|
||||
_client: &ClientBase<T>,
|
||||
_other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(CheckNonce(Compact(nonce)))
|
||||
@@ -101,7 +101,7 @@ impl<T: Config> ExtrinsicParams<T> for CheckTxVersion {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
client: &MinimalClient<T>,
|
||||
client: &ClientBase<T>,
|
||||
_other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(CheckTxVersion(client.runtime_version().transaction_version))
|
||||
@@ -129,7 +129,7 @@ impl<T: Config> ExtrinsicParams<T> for CheckGenesis<T> {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
client: &MinimalClient<T>,
|
||||
client: &ClientBase<T>,
|
||||
_other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(CheckGenesis(client.genesis_hash()))
|
||||
@@ -195,7 +195,7 @@ impl<T: Config> ExtrinsicParams<T> for CheckMortality<T> {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
client: &MinimalClient<T>,
|
||||
client: &ClientBase<T>,
|
||||
other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(CheckMortality {
|
||||
@@ -286,7 +286,7 @@ impl<T: Config> ExtrinsicParams<T> for ChargeAssetTxPayment<T> {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
_client: &MinimalClient<T>,
|
||||
_client: &ClientBase<T>,
|
||||
other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(ChargeAssetTxPayment {
|
||||
@@ -344,7 +344,7 @@ impl<T: Config> ExtrinsicParams<T> for ChargeTransactionPayment {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
_client: &MinimalClient<T>,
|
||||
_client: &ClientBase<T>,
|
||||
other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(ChargeTransactionPayment {
|
||||
@@ -388,7 +388,7 @@ macro_rules! impl_tuples {
|
||||
|
||||
fn new(
|
||||
nonce: u64,
|
||||
client: &MinimalClient<T>,
|
||||
client: &ClientBase<T>,
|
||||
other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
let metadata = client.metadata();
|
||||
|
||||
@@ -15,7 +15,6 @@ mod wrapper_opaque;
|
||||
|
||||
use codec::{Compact, Decode, Encode};
|
||||
use derivative::Derivative;
|
||||
use url::Url;
|
||||
|
||||
pub use account_id::AccountId32;
|
||||
use borrow::ToOwned;
|
||||
@@ -50,22 +49,6 @@ pub(crate) fn strip_compact_prefix(bytes: &[u8]) -> Result<(u64, &[u8]), codec::
|
||||
Ok((val.0, *cursor))
|
||||
}
|
||||
|
||||
/// A URL is considered secure if it uses a secure scheme ("https" or "wss") or is referring to localhost.
|
||||
///
|
||||
/// Returns an error if the the string could not be parsed into a URL.
|
||||
pub fn url_is_secure(url: &str) -> Result<bool, url::ParseError> {
|
||||
let url = Url::parse(url)?;
|
||||
|
||||
let secure_scheme = url.scheme() == "https" || url.scheme() == "wss";
|
||||
let is_localhost = url.host().is_some_and(|e| match e {
|
||||
url::Host::Domain(e) => e == "localhost",
|
||||
url::Host::Ipv4(e) => e.is_loopback(),
|
||||
url::Host::Ipv6(e) => e.is_loopback(),
|
||||
});
|
||||
|
||||
Ok(secure_scheme || is_localhost)
|
||||
}
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
/// A version of [`core::marker::PhantomData`] that is also Send and Sync (which is fine
|
||||
|
||||
Reference in New Issue
Block a user