Repository: scs/substrate-api-client (language: rust)

Issue:
make stable build work for std
There is an upstream issue for the polkadot-sdk which makes us build our node in stable:
https://github.com/paritytech/polkadot-sdk/pull/3296

api client currently uses a nightly feature which is only necessary for no_std builds. I suggest to enable this feature only for no_std builds

PR will come shortly

CC #581 


Discussion / hints:

Fix patch:
diff --git a/node-api/src/lib.rs b/node-api/src/lib.rs
index 558af9559..7d9f16e63 100644
--- a/node-api/src/lib.rs
+++ b/node-api/src/lib.rs
@@ -14,7 +14,7 @@
 //! Contains stuff to instantiate communication with a substrate node.
 
 #![cfg_attr(not(feature = "std"), no_std)]
-#![feature(error_in_core)]
+#![cfg_attr(not(feature = "std"), feature(error_in_core))]
 
 extern crate alloc;
 
diff --git a/src/api/error.rs b/src/api/error.rs
index 80944c764..e398d40cf 100644
--- a/src/api/error.rs
+++ b/src/api/error.rs
@@ -23,6 +23,11 @@ use ac_node_api::{
 use alloc::{boxed::Box, vec::Vec};
 use codec::{Decode, Encode};
 
+#[cfg(not(feature = "std"))]
+use core::error::Error as ErrorT;
+#[cfg(feature = "std")]
+use std::error::Error as ErrorT;
+
 pub type Result<T> = core::result::Result<T, Error>;
 
 #[derive(Debug, derive_more::From)]
@@ -56,7 +61,7 @@ pub enum Error {
 	/// Could not find the expected block.
 	BlockNotFound,
 	/// Any custom Error.
-	Other(Box<dyn core::error::Error + Send + Sync + 'static>),
+	Other(Box<dyn ErrorT + Send + Sync + 'static>),
 }
 
 /// Encountered unexpected tx status during watch process or the extrinsic failed.
diff --git a/src/lib.rs b/src/lib.rs
index 20980f11e..dcd705d06 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,7 @@
 
 */
 #![cfg_attr(not(feature = "std"), no_std)]
-#![feature(error_in_core)]
+#![cfg_attr(not(feature = "std"), feature(error_in_core))]
 
 extern crate alloc;
 
diff --git a/src/rpc/error.rs b/src/rpc/error.rs
index e11e6e585..14245e5e8 100644
--- a/src/rpc/error.rs
+++ b/src/rpc/error.rs
@@ -16,6 +16,10 @@
 */
 
 use alloc::{boxed::Box, string::String};
+#[cfg(not(feature = "std"))]
+use core::error::Error as ErrorT;
+#[cfg(feature = "std")]
+use std::error::Error as ErrorT;
 
 pub type Result<T> = core::result::Result<T, Error>;
 
@@ -29,7 +33,7 @@ pub enum Error {
 	Io(String),
 	MaxConnectionAttemptsExceeded,
 	ConnectionClosed,
-	Client(Box<dyn core::error::Error + Send + Sync + 'static>),
+	Client(Box<dyn ErrorT + Send + Sync + 'static>),
 }
 
 impl From<serde_json::error::Error> for Error {


Test patch: