mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 17:18:03 +00:00
broken commit, prelude but no replacement of all std types
This commit is contained in:
Generated
+20
@@ -2343,6 +2343,12 @@ version = "0.2.152"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
|
||||
|
||||
[[package]]
|
||||
name = "libc_alloc"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a835c038b748123287f9fb1743d565e7c635879997f43c345a18a026690364e"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.8"
|
||||
@@ -2541,6 +2547,19 @@ version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65"
|
||||
|
||||
[[package]]
|
||||
name = "no-std-tests"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"libc",
|
||||
"libc_alloc",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"subxt",
|
||||
"subxt-metadata",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodrop"
|
||||
version = "0.1.14"
|
||||
@@ -4367,6 +4386,7 @@ dependencies = [
|
||||
"base58",
|
||||
"bitvec",
|
||||
"blake2",
|
||||
"cfg-if",
|
||||
"derivative",
|
||||
"either",
|
||||
"frame-metadata 16.0.0",
|
||||
|
||||
+3
-1
@@ -7,12 +7,13 @@ members = [
|
||||
"testing/test-runtime",
|
||||
"testing/integration-tests",
|
||||
"testing/ui-tests",
|
||||
"testing/no-std-tests",
|
||||
"testing/generate-custom-metadata",
|
||||
"macro",
|
||||
"metadata",
|
||||
"signer",
|
||||
"subxt",
|
||||
"scripts/artifacts"
|
||||
"scripts/artifacts",
|
||||
]
|
||||
|
||||
# We exclude any crates that would depend on non mutually
|
||||
@@ -56,6 +57,7 @@ assert_matches = "1.5.0"
|
||||
base58 = { version = "0.2.0" }
|
||||
bitvec = { version = "1", default-features = false }
|
||||
blake2 = { version = "0.10.6", default-features = false }
|
||||
cfg-if = "1.0"
|
||||
clap = { version = "4.4.16", features = ["derive", "cargo"] }
|
||||
criterion = "0.4"
|
||||
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false }
|
||||
|
||||
+6
-8
@@ -20,16 +20,13 @@ workspace = true
|
||||
[features]
|
||||
# For dev and documentation reasons we enable more features than are often desired.
|
||||
# it's recommended to use `--no-default-features` and then select what you need.
|
||||
default = ["jsonrpsee", "native"]
|
||||
default = ["std", "jsonrpsee", "native"]
|
||||
|
||||
std = ["bitvec/std"]
|
||||
|
||||
# Enable this for native (ie non web/wasm builds).
|
||||
# Exactly 1 of "web" and "native" is expected.
|
||||
native = [
|
||||
"jsonrpsee?/async-client",
|
||||
"jsonrpsee?/client-ws-transport-native-tls",
|
||||
"subxt-lightclient?/native",
|
||||
"tokio-util"
|
||||
]
|
||||
native = ["jsonrpsee?/async-client", "jsonrpsee?/client-ws-transport-native-tls", "subxt-lightclient?/native", "tokio-util"]
|
||||
|
||||
# Enable this for web/wasm builds.
|
||||
# Exactly 1 of "web" and "native" is expected.
|
||||
@@ -55,6 +52,7 @@ unstable-light-client = ["subxt-lightclient", "tokio-stream"]
|
||||
|
||||
[dependencies]
|
||||
async-trait = { workspace = true }
|
||||
cfg-if = { workspace = true }
|
||||
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] }
|
||||
scale-info = { workspace = true }
|
||||
scale-value = { workspace = true }
|
||||
@@ -68,7 +66,7 @@ serde_json = { workspace = true, features = ["raw_value"] }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
frame-metadata = { workspace = true }
|
||||
derivative = { workspace = true }
|
||||
derivative = { workspace = true, features = ["use_core"] }
|
||||
either = { workspace = true }
|
||||
|
||||
# Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256:
|
||||
|
||||
@@ -13,6 +13,7 @@ use crate::backend::{
|
||||
TransactionStatus,
|
||||
};
|
||||
use crate::{config::Header, Config, Error};
|
||||
use crate::prelude::*;
|
||||
use async_trait::async_trait;
|
||||
use futures::{future, future::Either, stream, Future, FutureExt, Stream, StreamExt};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use crate::backend::rpc::{rpc_params, RpcClient, RpcSubscription};
|
||||
use crate::metadata::Metadata;
|
||||
use crate::{Config, Error};
|
||||
use crate::prelude::*;
|
||||
use codec::Decode;
|
||||
use derivative::Derivative;
|
||||
use primitive_types::U256;
|
||||
|
||||
@@ -13,6 +13,7 @@ pub mod unstable;
|
||||
use crate::error::Error;
|
||||
use crate::metadata::Metadata;
|
||||
use crate::Config;
|
||||
use crate::prelude::*;
|
||||
use async_trait::async_trait;
|
||||
use codec::{Decode, Encode};
|
||||
use futures::{Stream, StreamExt};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use super::{RawRpcFuture, RawRpcSubscription, RpcClientT};
|
||||
use crate::error::RpcError;
|
||||
use crate::prelude::*;
|
||||
use futures::stream::{StreamExt, TryStreamExt};
|
||||
use jsonrpsee::{
|
||||
core::{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use super::{RawRpcSubscription, RpcClientT};
|
||||
use crate::error::Error;
|
||||
use crate::prelude::*;
|
||||
use futures::{Stream, StreamExt};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use serde_json::value::RawValue;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::error::RpcError;
|
||||
use crate::prelude::*;
|
||||
use futures::Stream;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use super::rpc_methods::{FollowEvent, UnstableRpcMethods};
|
||||
use crate::config::Config;
|
||||
use crate::error::Error;
|
||||
use crate::prelude::*;
|
||||
use futures::{FutureExt, Stream, StreamExt};
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
@@ -6,6 +6,7 @@ use super::follow_stream_unpin::{BlockRef, FollowStreamMsg, FollowStreamUnpin};
|
||||
use crate::backend::unstable::rpc_methods::{FollowEvent, Initialized, RuntimeEvent};
|
||||
use crate::config::BlockHash;
|
||||
use crate::error::Error;
|
||||
use crate::prelude::*;
|
||||
use futures::stream::{Stream, StreamExt};
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
use std::ops::DerefMut;
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::backend::unstable::rpc_methods::{
|
||||
};
|
||||
use crate::config::{BlockHash, Config};
|
||||
use crate::error::Error;
|
||||
use crate::prelude::*;
|
||||
use futures::stream::{FuturesUnordered, Stream, StreamExt};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::future::Future;
|
||||
|
||||
@@ -28,6 +28,7 @@ use crate::backend::{
|
||||
use crate::config::BlockHash;
|
||||
use crate::error::{Error, RpcError};
|
||||
use crate::Config;
|
||||
use crate::prelude::*;
|
||||
use async_trait::async_trait;
|
||||
use follow_stream_driver::{FollowStreamDriver, FollowStreamDriverHandle};
|
||||
use futures::{Stream, StreamExt};
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
use crate::backend::rpc::{rpc_params, RpcClient, RpcSubscription};
|
||||
use crate::config::BlockHash;
|
||||
use crate::{Config, Error};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use futures::{Stream, StreamExt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -9,6 +9,7 @@ use super::rpc_methods::{
|
||||
};
|
||||
use crate::config::Config;
|
||||
use crate::error::{Error, RpcError};
|
||||
use crate::prelude::*;
|
||||
use futures::{FutureExt, Stream, StreamExt};
|
||||
use std::collections::VecDeque;
|
||||
use std::future::Future;
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::{
|
||||
events,
|
||||
runtime_api::RuntimeApi,
|
||||
storage::Storage,
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::{
|
||||
config::Config,
|
||||
error::{BlockError, Error},
|
||||
utils::PhantomDataSendSync,
|
||||
prelude::*,
|
||||
};
|
||||
use derivative::Derivative;
|
||||
use futures::StreamExt;
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
metadata::types::PalletMetadata,
|
||||
Metadata,
|
||||
};
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::config::signed_extensions::{
|
||||
ChargeAssetTxPayment, ChargeTransactionPayment, CheckNonce,
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::client::RawLightClient;
|
||||
use crate::macros::{cfg_jsonrpsee_native, cfg_jsonrpsee_web};
|
||||
use crate::utils::validate_url_is_secure;
|
||||
use crate::{config::Config, error::Error, OnlineClient};
|
||||
use crate::prelude::*;
|
||||
use std::num::NonZeroU32;
|
||||
use subxt_lightclient::{smoldot, AddedChain};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ use crate::{
|
||||
tx::TxClient,
|
||||
OnlineClient,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
pub use builder::{LightClientBuilder, RawLightClientBuilder};
|
||||
use derivative::Derivative;
|
||||
use subxt_lightclient::LightClientRpcError;
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::{
|
||||
backend::rpc::{RawRpcFuture, RawRpcSubscription, RpcClientT},
|
||||
error::{Error, RpcError},
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use futures::StreamExt;
|
||||
use serde_json::value::RawValue;
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::{
|
||||
events::EventsClient, runtime_api::RuntimeApiClient, storage::StorageClient, tx::TxClient,
|
||||
Config, Metadata,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -17,6 +17,7 @@ use crate::{
|
||||
tx::TxClient,
|
||||
Config, Metadata,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use futures::future;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
//! implementation of this that will work in many cases.
|
||||
|
||||
use crate::{client::OfflineClientT, Config};
|
||||
use crate::prelude::*;
|
||||
use core::fmt::Debug;
|
||||
|
||||
/// An error that can be emitted when trying to construct an instance of [`ExtrinsicParams`],
|
||||
|
||||
@@ -16,6 +16,7 @@ pub mod signed_extensions;
|
||||
pub mod substrate;
|
||||
|
||||
use crate::macros::cfg_substrate_compat;
|
||||
use crate::prelude::*;
|
||||
use codec::{Decode, Encode};
|
||||
use core::fmt::Debug;
|
||||
use scale_decode::DecodeAsType;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
use super::extrinsic_params::{ExtrinsicParams, ExtrinsicParamsEncoder, ExtrinsicParamsError};
|
||||
use crate::utils::Era;
|
||||
use crate::{client::OfflineClientT, Config};
|
||||
use crate::prelude::*;
|
||||
use codec::{Compact, Encode};
|
||||
use core::fmt::Debug;
|
||||
use derivative::Derivative;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{dynamic::DecodedValueThunk, metadata::DecodeWithMetadata};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use std::borrow::Cow;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::{
|
||||
metadata::DecodeWithMetadata,
|
||||
Config,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
|
||||
/// A client for accessing constants.
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::marker::PhantomData;
|
||||
|
||||
use crate::dynamic::DecodedValueThunk;
|
||||
use crate::metadata::DecodeWithMetadata;
|
||||
use crate::prelude::*;
|
||||
|
||||
/// This represents the address of a custom value in in the metadata.
|
||||
/// Anything, that implements the [CustomValueAddress] trait can be used, to fetch
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::custom_values::custom_value_address::{CustomValueAddress, Yes};
|
||||
use crate::error::MetadataError;
|
||||
use crate::metadata::DecodeWithMetadata;
|
||||
use crate::{Config, Error};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
|
||||
/// A client for accessing custom values stored in the metadata.
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::{
|
||||
metadata::{DecodeWithMetadata, Metadata},
|
||||
};
|
||||
use scale_decode::DecodeAsType;
|
||||
|
||||
use crate::prelude::*;
|
||||
pub use scale_value::{At, Value};
|
||||
|
||||
/// A [`scale_value::Value`] type endowed with contextual information
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::metadata::{DecodeWithMetadata, Metadata};
|
||||
use core::fmt::Debug;
|
||||
use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType};
|
||||
use std::borrow::Cow;
|
||||
use crate::prelude::*;
|
||||
|
||||
use super::{Error, MetadataError};
|
||||
|
||||
|
||||
@@ -20,10 +20,12 @@ pub use dispatch_error::{
|
||||
// Re-expose the errors we use from other crates here:
|
||||
pub use crate::config::ExtrinsicParamsError;
|
||||
pub use crate::metadata::Metadata;
|
||||
use crate::prelude::*;
|
||||
pub use scale_decode::Error as DecodeError;
|
||||
pub use scale_encode::Error as EncodeError;
|
||||
pub use subxt_metadata::TryFromError as MetadataTryFromError;
|
||||
|
||||
|
||||
/// The underlying error enum, generic over the type held by the `Runtime`
|
||||
/// variant. Prefer to use the [`Error<E>`] and [`Error`] aliases over
|
||||
/// using this type directly.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use crate::backend::{Backend, BackendExt, BlockRef};
|
||||
use crate::{client::OnlineClientT, error::Error, events::Events, Config};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use std::future::Future;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use crate::{
|
||||
metadata::types::PalletMetadata,
|
||||
Config, Metadata,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use codec::{Compact, Decode};
|
||||
use derivative::Derivative;
|
||||
use scale_decode::DecodeAsType;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
//! Take a look at [the Subxt guide](book) to learn more about how to use Subxt.
|
||||
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(any(
|
||||
all(feature = "web", feature = "native"),
|
||||
@@ -56,6 +57,7 @@ pub mod runtime_api;
|
||||
pub mod storage;
|
||||
pub mod tx;
|
||||
pub mod utils;
|
||||
pub mod prelude;
|
||||
|
||||
// Internal helper macros
|
||||
#[macro_use]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use super::Metadata;
|
||||
use crate::error::Error;
|
||||
use crate::prelude::*;
|
||||
|
||||
/// This trait is implemented for all types that also implement [`scale_decode::DecodeAsType`].
|
||||
pub trait DecodeWithMetadata: Sized {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::error::MetadataError;
|
||||
|
||||
use crate::prelude::*;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// A cheaply clone-able representation of the runtime metadata received from a node.
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright 2019-2023 Parity Technologies (UK) Ltd.
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
//! Exports from `std`, `core` and `alloc` crates.
|
||||
//!
|
||||
//! Guarantees a stable interface between `std` and `no_std` modes.
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate alloc;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "std")] {
|
||||
pub use std::{
|
||||
any,
|
||||
borrow,
|
||||
boxed::{Box},
|
||||
cmp,
|
||||
collections,
|
||||
fmt,
|
||||
format,
|
||||
hash,
|
||||
marker::{PhantomData},
|
||||
mem,
|
||||
num,
|
||||
ops,
|
||||
string,
|
||||
sync,
|
||||
time,
|
||||
vec::{vec, Vec},
|
||||
rc,
|
||||
iter,
|
||||
};
|
||||
} else {
|
||||
pub use alloc::{
|
||||
borrow,
|
||||
boxed::{Box},
|
||||
collections,
|
||||
format,
|
||||
string,
|
||||
sync,
|
||||
vec::{vec, Vec},
|
||||
rc
|
||||
};
|
||||
|
||||
pub use core::{
|
||||
any,
|
||||
cmp,
|
||||
fmt,
|
||||
hash,
|
||||
marker::{PhantomData},
|
||||
mem,
|
||||
num,
|
||||
ops,
|
||||
time,
|
||||
iter,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
use super::runtime_types::RuntimeApi;
|
||||
|
||||
use crate::{backend::BlockRef, client::OnlineClientT, error::Error, Config};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use std::{future::Future, marker::PhantomData};
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use std::borrow::Cow;
|
||||
use crate::dynamic::DecodedValueThunk;
|
||||
use crate::error::MetadataError;
|
||||
use crate::{metadata::DecodeWithMetadata, Error, Metadata};
|
||||
use crate::prelude::*;
|
||||
|
||||
/// This represents a runtime API payload that can call into the runtime of node.
|
||||
///
|
||||
|
||||
@@ -9,6 +9,7 @@ use crate::{
|
||||
metadata::DecodeWithMetadata,
|
||||
Config,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use codec::Decode;
|
||||
use derivative::Derivative;
|
||||
use std::{future::Future, marker::PhantomData};
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::{
|
||||
metadata::{DecodeWithMetadata, EncodeWithMetadata, Metadata},
|
||||
utils::{Encoded, Static},
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use scale_info::TypeDef;
|
||||
use std::borrow::Cow;
|
||||
|
||||
@@ -12,6 +12,7 @@ use crate::{
|
||||
error::Error,
|
||||
Config,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use std::{future::Future, marker::PhantomData};
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::{
|
||||
metadata::{DecodeWithMetadata, Metadata},
|
||||
Config,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use codec::Decode;
|
||||
use derivative::Derivative;
|
||||
use futures::StreamExt;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
use super::StorageAddress;
|
||||
use crate::{error::Error, metadata::Metadata};
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Return the root of a given [`StorageAddress`]: hash the pallet name and entry name
|
||||
/// and append those bytes to the output.
|
||||
|
||||
@@ -9,9 +9,11 @@ use crate::{
|
||||
client::{OfflineClientT, OnlineClientT},
|
||||
config::{Config, ExtrinsicParams, ExtrinsicParamsEncoder, Hasher},
|
||||
error::{Error, MetadataError},
|
||||
prelude::*,
|
||||
tx::{Signer as SignerT, TxPayload, TxProgress},
|
||||
utils::{Encoded, PhantomDataSendSync},
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use codec::{Compact, Decode, Encode};
|
||||
use derivative::Derivative;
|
||||
use sp_core_hashing::blake2_256;
|
||||
|
||||
@@ -10,6 +10,7 @@ use crate::{
|
||||
error::{Error, MetadataError},
|
||||
metadata::Metadata,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use codec::Encode;
|
||||
use scale_encode::EncodeAsFields;
|
||||
use scale_value::{Composite, ValueDef, Variant};
|
||||
|
||||
@@ -14,6 +14,7 @@ use crate::{
|
||||
events::EventsClient,
|
||||
Config,
|
||||
};
|
||||
use crate::prelude::*;
|
||||
use derivative::Derivative;
|
||||
use futures::{Stream, StreamExt};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ mod wrapper_opaque;
|
||||
|
||||
use crate::error::RpcError;
|
||||
use crate::Error;
|
||||
use crate::prelude::*;
|
||||
use codec::{Compact, Decode, Encode};
|
||||
use derivative::Derivative;
|
||||
use url::Url;
|
||||
|
||||
@@ -153,7 +153,7 @@ impl<T> Visitor for WrapperKeepOpaqueVisitor<T> {
|
||||
impl<T> IntoVisitor for WrapperKeepOpaque<T> {
|
||||
type Visitor = WrapperKeepOpaqueVisitor<T>;
|
||||
fn into_visitor() -> Self::Visitor {
|
||||
WrapperKeepOpaqueVisitor(std::marker::PhantomData)
|
||||
WrapperKeepOpaqueVisitor(PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[package]
|
||||
name = "no-std-tests"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
version = "0.0.0"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
||||
scale-info = { workspace = true, default-features = false, features = ["bit-vec", "derive"] }
|
||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive", "bit-vec"] }
|
||||
subxt = { workspace = true, default-features = false, features = ["native"] }
|
||||
subxt-metadata = { workspace = true, default-features = false }
|
||||
|
||||
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
|
||||
libc = { version = "0.2", default-features = false }
|
||||
libc_alloc = { version = "1.0.6" }
|
||||
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
@@ -0,0 +1 @@
|
||||
nightly
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright 2019-2020
|
||||
// Parity Technologies (UK) Ltd. Technologies (UK) Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#![allow(internal_features)]
|
||||
#![feature(lang_items, start)]
|
||||
#![feature(alloc_error_handler)]
|
||||
#![no_std]
|
||||
|
||||
#[start]
|
||||
fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
||||
main();
|
||||
0
|
||||
}
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rust_eh_personality() {}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
unsafe {
|
||||
libc::abort();
|
||||
}
|
||||
}
|
||||
|
||||
use libc_alloc::LibcAlloc;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: LibcAlloc = LibcAlloc;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
use subxt::utils::H256;
|
||||
|
||||
// Note: Panics in this function will lead to `Aborted (core dumped)` and a non-zero exit status => suitable for CI tests.
|
||||
fn main() {
|
||||
let metadata_bytes: &[u8] = include_bytes!("../../../artifacts/polkadot_metadata_small.scale");
|
||||
|
||||
let genesis_hash = {
|
||||
let h = "91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3";
|
||||
let bytes = hex::decode(h).unwrap();
|
||||
H256::from_slice(&bytes)
|
||||
};
|
||||
|
||||
// // 2. A runtime version (system_version constant on a Substrate node has these):
|
||||
// let runtime_version = subxt::backend::RuntimeVersion {
|
||||
// spec_version: 9370,
|
||||
// transaction_version: 20,
|
||||
// };
|
||||
|
||||
// // 3. Metadata (I'll load it from the downloaded metadata, but you can use
|
||||
// // `subxt metadata > file.scale` to download it):
|
||||
// let metadata = {
|
||||
// let bytes: &[u8] = include_bytes!("../polkadot_metadata_small.scale");
|
||||
// Metadata::decode(&mut &*bytes).unwrap()
|
||||
// };
|
||||
|
||||
// // Create an offline client using the details obtained above:
|
||||
// let api = OfflineClient::<PolkadotConfig>::new(genesis_hash, runtime_version, metadata);
|
||||
}
|
||||
Reference in New Issue
Block a user