mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 15:57:55 +00:00
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:
@@ -15,19 +15,26 @@
|
||||
// along with subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pub use crate::{
|
||||
node_runtime::{
|
||||
self,
|
||||
DefaultConfig,
|
||||
},
|
||||
node_runtime,
|
||||
TestNodeProcess,
|
||||
};
|
||||
|
||||
use sp_core::sr25519::Pair;
|
||||
use sp_keyring::AccountKeyring;
|
||||
use subxt::Client;
|
||||
use subxt::{
|
||||
extrinsic::ChargeAssetTxPayment,
|
||||
Client,
|
||||
DefaultConfig,
|
||||
DefaultExtraWithTxPayment,
|
||||
PairSigner,
|
||||
};
|
||||
|
||||
/// substrate node should be installed on the $PATH
|
||||
const SUBSTRATE_NODE_PATH: &str = "substrate";
|
||||
|
||||
pub type NodeRuntimeSignedExtra =
|
||||
DefaultExtraWithTxPayment<DefaultConfig, ChargeAssetTxPayment<DefaultConfig>>;
|
||||
|
||||
pub async fn test_node_process_with(
|
||||
key: AccountKeyring,
|
||||
) -> TestNodeProcess<DefaultConfig> {
|
||||
@@ -53,7 +60,7 @@ pub async fn test_node_process() -> TestNodeProcess<DefaultConfig> {
|
||||
|
||||
pub struct TestContext {
|
||||
pub node_proc: TestNodeProcess<DefaultConfig>,
|
||||
pub api: node_runtime::RuntimeApi<DefaultConfig>,
|
||||
pub api: node_runtime::RuntimeApi<DefaultConfig, NodeRuntimeSignedExtra>,
|
||||
}
|
||||
|
||||
impl TestContext {
|
||||
@@ -68,3 +75,9 @@ pub async fn test_context() -> TestContext {
|
||||
let api = node_proc.client().clone().to_runtime_api();
|
||||
TestContext { node_proc, api }
|
||||
}
|
||||
|
||||
pub fn pair_signer(
|
||||
pair: Pair,
|
||||
) -> PairSigner<DefaultConfig, NodeRuntimeSignedExtra, Pair> {
|
||||
PairSigner::new(pair)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user