Configurable Config and Extra types (#373)

* WIP config

* WIP separate default config

* Separate trait impls on client

* WIP introduce new ApiConfig (to be renamed) trait

* Update generated polkadot codegen

* Allow configuring Config and Extra types independently

* Add extra default configuration

* Revert ir parsing of config attr

* Add default-features = false to substrate deps

* Revert "Add default-features = false to substrate deps"

This reverts commit 099d20cd4cbf8000ff938d1dc090ecbc28a5e788.
This commit is contained in:
Andrew Jones
2022-01-06 09:39:38 +00:00
committed by GitHub
parent 30665bf1c2
commit ca5345c47e
22 changed files with 11057 additions and 5027 deletions
+10 -12
View File
@@ -19,8 +19,8 @@ use crate::{
balances,
runtime_types,
system,
DefaultConfig,
},
pair_signer,
test_context,
};
use codec::Decode;
@@ -30,20 +30,18 @@ use sp_core::{
};
use sp_keyring::AccountKeyring;
use subxt::{
extrinsic::{
PairSigner,
Signer,
},
DefaultConfig,
Error,
EventSubscription,
PalletError,
RuntimeError,
Signer,
};
#[async_std::test]
async fn tx_basic_transfer() -> Result<(), subxt::Error> {
let alice = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Alice.pair());
let bob = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Bob.pair());
let alice = pair_signer(AccountKeyring::Alice.pair());
let bob = pair_signer(AccountKeyring::Bob.pair());
let bob_address = bob.account_id().clone().into();
let cxt = test_context().await;
let api = &cxt.api;
@@ -114,7 +112,7 @@ async fn storage_total_issuance() {
#[async_std::test]
async fn storage_balance_lock() -> Result<(), subxt::Error> {
let bob = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Bob.pair());
let bob = pair_signer(AccountKeyring::Bob.pair());
let charlie = AccountKeyring::Charlie.to_account_id();
let cxt = test_context().await;
@@ -155,9 +153,9 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> {
#[async_std::test]
async fn transfer_error() {
env_logger::try_init().ok();
let alice = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Alice.pair());
let alice = pair_signer(AccountKeyring::Alice.pair());
let alice_addr = alice.account_id().clone().into();
let hans = PairSigner::<DefaultConfig, _>::new(Pair::generate().0);
let hans = pair_signer(Pair::generate().0);
let hans_address = hans.account_id().clone().into();
let cxt = test_context().await;
@@ -198,7 +196,7 @@ async fn transfer_error() {
#[async_std::test]
async fn transfer_subscription() {
env_logger::try_init().ok();
let alice = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Alice.pair());
let alice = pair_signer(AccountKeyring::Alice.pair());
let bob = AccountKeyring::Bob.to_account_id();
let bob_addr = bob.clone().into();
let cxt = test_context().await;
@@ -230,7 +228,7 @@ async fn transfer_subscription() {
#[async_std::test]
async fn transfer_implicit_subscription() {
env_logger::try_init().ok();
let alice = PairSigner::<DefaultConfig, _>::new(AccountKeyring::Alice.pair());
let alice = pair_signer(AccountKeyring::Alice.pair());
let bob = AccountKeyring::Bob.to_account_id();
let bob_addr = bob.clone().into();
let cxt = test_context().await;