Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api traits #363

Merged
merged 22 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde = { version = "1.0.136", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.79", default-features = false }
thiserror = { version = "1.0.30", optional = true }
tungstenite = { version = "0.18.0", optional = true, features = ["native-tls"] }
url = { verson = "2.0.0", optional = true }
url = { version = "2.0.0", optional = true }
ws = { version = "0.9.2", optional = true, features = ["ssl"] }


Expand Down
2 changes: 1 addition & 1 deletion compose-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ macro_rules! compose_extrinsic_offline {
$params: expr) => {{
use $crate::{
primitives::{ExtrinsicParams, GenericAddress, SignedPayload, UncheckedExtrinsicV4},
sp_core::crypto::Pair,
sp_core::{crypto::Pair, Public},
sp_runtime::{generic::Era, traits::IdentifyAccount, MultiSigner},
};

Expand Down
5 changes: 4 additions & 1 deletion examples/batch_payout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use sp_keyring::AccountKeyring;
#[cfg(feature = "staking-xt")]
use sp_runtime::{app_crypto::Ss58Codec, AccountId32};
#[cfg(feature = "staking-xt")]
use substrate_api_client::{rpc::JsonrpseeClient, Api, PlainTipExtrinsicParams, XtStatus};
use substrate_api_client::{
rpc::JsonrpseeClient, Api, GetGenericStorage, NodeSubscription, PlainTipExtrinsicParams,
XtStatus,
};

#[cfg(feature = "staking-xt")]
#[tokio::main]
Expand Down
3 changes: 2 additions & 1 deletion examples/benchmark_bulk_xt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
use kitchensink_runtime::{BalancesCall, Runtime, RuntimeCall};
use sp_keyring::AccountKeyring;
use substrate_api_client::{
compose_extrinsic_offline, Api, AssetTipExtrinsicParams, JsonrpseeClient, UncheckedExtrinsicV4,
compose_extrinsic_offline, Api, AssetTipExtrinsicParams, JsonrpseeClient, SubmitExtrinsic,
UncheckedExtrinsicV4,
};

#[tokio::main]
Expand Down
4 changes: 2 additions & 2 deletions examples/compose_extrinsic_offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use kitchensink_runtime::{BalancesCall, Header, Runtime, RuntimeCall};
use sp_keyring::AccountKeyring;
use sp_runtime::{generic::Era, MultiAddress};
use substrate_api_client::{
compose_extrinsic_offline, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams,
UncheckedExtrinsicV4, XtStatus,
compose_extrinsic_offline, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetHeader,
NodeSubscription, UncheckedExtrinsicV4, XtStatus,
};

#[tokio::main]
Expand Down
3 changes: 2 additions & 1 deletion examples/contract_instantiate_with_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use codec::Decode;
use kitchensink_runtime::Runtime;
use sp_keyring::AccountKeyring;
use substrate_api_client::{
rpc::JsonrpseeClient, AccountId, Api, PlainTipExtrinsicParams, StaticEvent, XtStatus,
rpc::JsonrpseeClient, AccountId, Api, NodeSubscription, PlainTipExtrinsicParams, StaticEvent,
XtStatus,
};

#[allow(unused)]
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use kitchensink_runtime::{BalancesCall, Runtime, RuntimeCall};
use sp_keyring::AccountKeyring;
use sp_runtime::{generic::Era, MultiAddress};
use substrate_api_client::{
compose_extrinsic_offline, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams,
UncheckedExtrinsicV4, XtStatus,
compose_extrinsic_offline, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetHeader,
NodeSubscription, UncheckedExtrinsicV4, XtStatus,
};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/event_callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use codec::Decode;
use kitchensink_runtime::Runtime;
use log::debug;
use sp_core::{sr25519, H256 as Hash};
use substrate_api_client::HandleSubscription;
use substrate_api_client::{HandleSubscription, NodeSubscription};

use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams};

Expand Down
3 changes: 2 additions & 1 deletion examples/event_error_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use sp_core::crypto::Pair;
use sp_keyring::AccountKeyring;
use sp_runtime::{AccountId32 as AccountId, MultiAddress};
use substrate_api_client::{
rpc::JsonrpseeClient, Api, ApiResult, AssetTipExtrinsicParams, StaticEvent, XtStatus,
rpc::JsonrpseeClient, Api, ApiResult, AssetTipExtrinsicParams, GetAccountInformation,
NodeSubscription, StaticEvent, XtStatus,
};

#[derive(Decode)]
Expand Down
2 changes: 1 addition & 1 deletion examples/generic_event_callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use sp_keyring::AccountKeyring;
use sp_runtime::{AccountId32 as AccountId, MultiAddress};
use std::thread;
use substrate_api_client::{
rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, StaticEvent, XtStatus,
rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, NodeSubscription, StaticEvent, XtStatus,
};

// Look at the how the transfer event looks like in in the metadata
Expand Down
2 changes: 1 addition & 1 deletion examples/generic_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use kitchensink_runtime::Runtime;
use sp_keyring::AccountKeyring;
use substrate_api_client::{
compose_extrinsic, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GenericAddress,
UncheckedExtrinsicV4, XtStatus,
NodeSubscription, UncheckedExtrinsicV4, XtStatus,
};

#[tokio::main]
Expand Down
4 changes: 2 additions & 2 deletions examples/get_account_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use pallet_identity::{Data, IdentityInfo, Registration};
use sp_core::{crypto::Pair, H256};
use sp_keyring::AccountKeyring;
use substrate_api_client::{
compose_extrinsic, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, UncheckedExtrinsicV4,
XtStatus,
compose_extrinsic, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetGenericStorage,
NodeSubscription, UncheckedExtrinsicV4, XtStatus,
};

type BalanceOf<T> = <<T as pallet_identity::Config>::Currency as Currency<
Expand Down
3 changes: 2 additions & 1 deletion examples/get_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
use kitchensink_runtime::Runtime;
use sp_core::sr25519;
use substrate_api_client::{
rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, HandleSubscription,
rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetBlock, GetHeader, HandleSubscription,
NodeSubscription,
};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/get_existential_deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.

use kitchensink_runtime::Runtime;
use sp_runtime::app_crypto::sp_core::sr25519;
use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams};
use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetBalance};

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/get_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use frame_system::AccountInfo as GenericAccountInfo;
use kitchensink_runtime::Runtime;
use sp_keyring::AccountKeyring;
use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams};
use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetGenericStorage};

type IndexFor<T> = <T as frame_system::Config>::Index;
type AccountDataFor<T> = <T as frame_system::Config>::AccountData;
Expand Down
5 changes: 4 additions & 1 deletion examples/staking_payout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use sp_keyring::AccountKeyring;
#[cfg(feature = "staking-xt")]
use sp_runtime::{app_crypto::Ss58Codec, AccountId32};
#[cfg(feature = "staking-xt")]
use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, XtStatus};
use substrate_api_client::{
rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetGenericStorage, NodeSubscription,
XtStatus,
};

#[cfg(feature = "staking-xt")]
#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/sudo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use kitchensink_runtime::Runtime;
use sp_keyring::AccountKeyring;
use substrate_api_client::{
compose_call, compose_extrinsic, rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams,
GenericAddress, UncheckedExtrinsicV4, XtStatus,
GenericAddress, NodeSubscription, UncheckedExtrinsicV4, XtStatus,
};

#[tokio::main]
Expand Down
5 changes: 4 additions & 1 deletion examples/transfer_using_seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ use sp_core::{
sr25519,
};
use sp_runtime::MultiAddress;
use substrate_api_client::{rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, XtStatus};
use substrate_api_client::{
rpc::JsonrpseeClient, Api, AssetTipExtrinsicParams, GetAccountInformation, NodeSubscription,
XtStatus,
};

#[tokio::main]
async fn main() {
Expand Down
5 changes: 4 additions & 1 deletion examples/transfer_with_tungstenite_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ use sp_core::{
sr25519,
};
use sp_runtime::MultiAddress;
use substrate_api_client::{rpc::TungsteniteRpcClient, Api, AssetTipExtrinsicParams, XtStatus};
use substrate_api_client::{
rpc::TungsteniteRpcClient, Api, AssetTipExtrinsicParams, GetAccountInformation,
NodeSubscription, XtStatus,
};

fn main() {
env_logger::init();
Expand Down
5 changes: 4 additions & 1 deletion examples/transfer_with_ws_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ use sp_core::{
sr25519,
};
use sp_runtime::MultiAddress;
use substrate_api_client::{rpc::WsRpcClient, Api, AssetTipExtrinsicParams, XtStatus};
use substrate_api_client::{
rpc::WsRpcClient, Api, AssetTipExtrinsicParams, GetAccountInformation, NodeSubscription,
XtStatus,
};

fn main() {
env_logger::init();
Expand Down
13 changes: 4 additions & 9 deletions primitives/src/pallet_traits/frame_system_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.

*/
use codec::{Codec, EncodeLike, FullCodec, MaxEncodedLen};
use codec::{Codec, Decode, EncodeLike, FullCodec, MaxEncodedLen};
use core::fmt::Debug;
use scale_info::TypeInfo;
use sp_runtime::traits::{
Expand All @@ -37,18 +37,13 @@ pub trait FrameSystemConfig {
+ TypeInfo
+ Dispatchable<RuntimeOrigin = Self::RuntimeOrigin>
+ Debug;
type Index: Codec
+ EncodeLike
+ Clone
+ Eq
+ Debug
+ TypeInfo
+ MaybeSerializeDeserialize
type Index: MaybeSerializeDeserialize
+ Debug
+ Default
+ AtLeast32Bit
+ Copy
+ MaxEncodedLen;
+ MaxEncodedLen
+ Decode;
type BlockNumber: Codec
+ EncodeLike
+ Clone
Expand Down
Loading