mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-22 16:08:00 +00:00
Read constants from metadata at runtime (#494)
* Read constants from metadata at runtime * Update polkadot codegen * Update polkadot.rs * Update polkadot.rs
This commit is contained in:
@@ -203,6 +203,7 @@ impl RuntimeGenerator {
|
||||
let constants_mod = if !pallet.constants.is_empty() {
|
||||
constants::generate_constants(
|
||||
&type_gen,
|
||||
pallet,
|
||||
&pallet.constants,
|
||||
types_mod_ident,
|
||||
)
|
||||
@@ -300,8 +301,8 @@ impl RuntimeGenerator {
|
||||
T: ::subxt::Config,
|
||||
X: ::subxt::extrinsic::ExtrinsicParams<T>,
|
||||
{
|
||||
pub fn constants(&'a self) -> ConstantsApi {
|
||||
ConstantsApi
|
||||
pub fn constants(&'a self) -> ConstantsApi<'a, T> {
|
||||
ConstantsApi { client: &self.client }
|
||||
}
|
||||
|
||||
pub fn storage(&'a self) -> StorageApi<'a, T> {
|
||||
@@ -335,12 +336,14 @@ impl RuntimeGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ConstantsApi;
|
||||
pub struct ConstantsApi<'a, T: ::subxt::Config> {
|
||||
client: &'a ::subxt::Client<T>,
|
||||
}
|
||||
|
||||
impl ConstantsApi {
|
||||
impl<'a, T: ::subxt::Config> ConstantsApi<'a, T> {
|
||||
#(
|
||||
pub fn #pallets_with_constants(&self) -> #pallets_with_constants::constants::ConstantsApi {
|
||||
#pallets_with_constants::constants::ConstantsApi
|
||||
pub fn #pallets_with_constants(&self) -> #pallets_with_constants::constants::ConstantsApi<'a, T> {
|
||||
#pallets_with_constants::constants::ConstantsApi::new(self.client)
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user