mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 13:48:00 +00:00
Rebrand subxt to pezkuwi-subxt with pezsp_runtime support
- Renamed all crate names from subxt-* to pezkuwi-subxt-* - Updated codegen to use pezsp_runtime, pezsp_core, pezframe_support instead of sp_runtime, sp_core, frame_support - Replaced all internal references from subxt_* to pezkuwi_subxt_* - Added local path dependencies to Pezkuwi SDK crates - Updated workspace configuration for edition 2024
This commit is contained in:
+5
-5
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "subxt-codegen"
|
||||
name = "pezkuwi-subxt-codegen"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -7,9 +7,9 @@ rust-version.workspace = true
|
||||
publish = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
documentation = "https://docs.rs/subxt-codegen"
|
||||
documentation = "https://docs.rs/pezkuwi-subxt-codegen"
|
||||
homepage.workspace = true
|
||||
description = "Generate an API for interacting with a substrate node from FRAME metadata"
|
||||
description = "Generate an API for interacting with a Pezkuwi/Bizinikiwi node from FRAME metadata"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
@@ -23,7 +23,7 @@ proc-macro2 = { workspace = true }
|
||||
quote = { workspace = true }
|
||||
syn = { workspace = true }
|
||||
scale-info = { workspace = true }
|
||||
subxt-metadata = { workspace = true }
|
||||
pezkuwi-subxt-metadata = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
scale-typegen = { workspace = true }
|
||||
|
||||
@@ -42,4 +42,4 @@ rustdoc-args = ["--cfg", "docsrs"]
|
||||
default-features = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
workspace = true
|
||||
|
||||
@@ -8,7 +8,7 @@ use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::{format_ident, quote};
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use scale_typegen::{TypeGenerator, typegen::ir::type_ir::CompositeIRKind};
|
||||
use subxt_metadata::PalletMetadata;
|
||||
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||
|
||||
/// Generate calls from the provided pallet's metadata. Each call returns a `StaticPayload`
|
||||
/// that can be passed to the subxt client to submit/sign/encode.
|
||||
@@ -17,7 +17,7 @@ use subxt_metadata::PalletMetadata;
|
||||
///
|
||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||
/// - `pallet` - Pallet metadata from which the calls are generated.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||
pub fn generate_calls(
|
||||
type_gen: &TypeGenerator,
|
||||
pallet: &PalletMetadata,
|
||||
@@ -123,7 +123,7 @@ pub fn generate_calls(
|
||||
use super::root_mod;
|
||||
use super::#types_mod_ident;
|
||||
|
||||
type DispatchError = #types_mod_ident::sp_runtime::DispatchError;
|
||||
type DispatchError = #types_mod_ident::pezsp_runtime::DispatchError;
|
||||
|
||||
pub mod types {
|
||||
use super::#types_mod_ident;
|
||||
|
||||
@@ -7,7 +7,7 @@ use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::{format_ident, quote};
|
||||
use scale_typegen::TypeGenerator;
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use subxt_metadata::PalletMetadata;
|
||||
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||
|
||||
use super::CodegenError;
|
||||
|
||||
@@ -32,7 +32,7 @@ use super::CodegenError;
|
||||
///
|
||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||
/// - `pallet` - Pallet metadata from which the constants are generated.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||
pub fn generate_constants(
|
||||
type_gen: &TypeGenerator,
|
||||
pallet: &PalletMetadata,
|
||||
|
||||
@@ -6,7 +6,7 @@ use heck::ToSnakeCase as _;
|
||||
use scale_typegen::TypeGenerator;
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use std::collections::HashSet;
|
||||
use subxt_metadata::{CustomValueMetadata, Metadata};
|
||||
use pezkuwi_subxt_metadata::{CustomValueMetadata, Metadata};
|
||||
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::quote;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::quote;
|
||||
use scale_typegen::TypeGenerator;
|
||||
use subxt_metadata::PalletMetadata;
|
||||
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||
|
||||
use super::CodegenError;
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
|
||||
@@ -7,7 +7,7 @@ use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::quote;
|
||||
use scale_typegen::TypeGenerator;
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use subxt_metadata::PalletMetadata;
|
||||
use pezkuwi_subxt_metadata::PalletMetadata;
|
||||
|
||||
/// Generate events from the provided pallet metadata.
|
||||
///
|
||||
@@ -28,7 +28,7 @@ use subxt_metadata::PalletMetadata;
|
||||
/// pub struct EventName {
|
||||
/// pub event_param: type,
|
||||
/// }
|
||||
/// impl ::subxt::events::StaticEvent for EventName {
|
||||
/// impl ::pezkuwi_subxt::events::StaticEvent for EventName {
|
||||
/// ...
|
||||
/// }
|
||||
/// ```
|
||||
@@ -37,7 +37,7 @@ use subxt_metadata::PalletMetadata;
|
||||
///
|
||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||
/// - `pallet` - Pallet metadata from which the events are generated.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||
pub fn generate_events(
|
||||
type_gen: &TypeGenerator,
|
||||
pallet: &PalletMetadata,
|
||||
|
||||
@@ -18,7 +18,7 @@ use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use scale_typegen::typegen::ir::type_ir::{CompositeFieldIR, CompositeIR, CompositeIRKind};
|
||||
use scale_typegen::typegen::type_params::TypeParameters;
|
||||
use scale_typegen::typegen::type_path::TypePath;
|
||||
use subxt_metadata::Metadata;
|
||||
use pezkuwi_subxt_metadata::Metadata;
|
||||
use syn::{Ident, parse_quote};
|
||||
|
||||
use crate::error::CodegenError;
|
||||
@@ -268,7 +268,7 @@ impl RuntimeGenerator {
|
||||
pub static RUNTIME_APIS: [&str; #runtime_api_names_len] = [ #(#runtime_api_names,)* ];
|
||||
|
||||
/// The error type that is returned when there is a runtime issue.
|
||||
pub type DispatchError = #types_mod_ident::sp_runtime::DispatchError;
|
||||
pub type DispatchError = #types_mod_ident::pezsp_runtime::DispatchError;
|
||||
|
||||
/// The outer event enum.
|
||||
pub type Event = #event_path;
|
||||
|
||||
@@ -10,7 +10,7 @@ use quote::{format_ident, quote};
|
||||
use scale_typegen::TypeGenerator;
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use std::collections::HashSet;
|
||||
use subxt_metadata::{PalletMetadata, ViewFunctionMetadata};
|
||||
use pezkuwi_subxt_metadata::{PalletMetadata, ViewFunctionMetadata};
|
||||
|
||||
pub fn generate_pallet_view_functions(
|
||||
type_gen: &TypeGenerator,
|
||||
|
||||
@@ -9,7 +9,7 @@ use heck::ToUpperCamelCase as _;
|
||||
|
||||
use scale_typegen::TypeGenerator;
|
||||
use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
use subxt_metadata::{Metadata, RuntimeApiMetadata};
|
||||
use pezkuwi_subxt_metadata::{Metadata, RuntimeApiMetadata};
|
||||
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::{format_ident, quote};
|
||||
@@ -239,7 +239,7 @@ mod tests {
|
||||
};
|
||||
use quote::quote;
|
||||
use scale_info::meta_type;
|
||||
use subxt_metadata::Metadata;
|
||||
use pezkuwi_subxt_metadata::Metadata;
|
||||
|
||||
fn metadata_with_runtime_apis(runtime_apis: Vec<RuntimeApiMetadata>) -> Metadata {
|
||||
let extrinsic_metadata = v15::ExtrinsicMetadata {
|
||||
|
||||
@@ -6,7 +6,7 @@ use heck::ToSnakeCase as _;
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::{format_ident, quote};
|
||||
use scale_typegen::TypeGenerator;
|
||||
use subxt_metadata::{PalletMetadata, StorageEntryMetadata};
|
||||
use pezkuwi_subxt_metadata::{PalletMetadata, StorageEntryMetadata};
|
||||
|
||||
use super::CodegenError;
|
||||
|
||||
@@ -19,7 +19,7 @@ use scale_typegen::typegen::ir::ToTokensWithSettings;
|
||||
///
|
||||
/// - `type_gen` - [`scale_typegen::TypeGenerator`] that contains settings and all types from the runtime metadata.
|
||||
/// - `pallet` - Pallet metadata from which the storage items are generated.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::subxt::ext::subxt_core` when using subxt as a dependency.
|
||||
/// - `crate_path` - The crate path under which the `subxt-core` crate is located, e.g. `::pezkuwi_subxt::ext::pezkuwi_subxt_core` when using subxt as a dependency.
|
||||
pub fn generate_storage(
|
||||
type_gen: &TypeGenerator,
|
||||
pallet: &PalletMetadata,
|
||||
@@ -173,7 +173,7 @@ fn generate_storage_entry_fns(
|
||||
mod tests {
|
||||
use frame_metadata::v15;
|
||||
use scale_info::{MetaType, meta_type};
|
||||
use subxt_metadata::Metadata;
|
||||
use pezkuwi_subxt_metadata::Metadata;
|
||||
|
||||
// TODO: Think about adding tests for storage codegen which can use this sort of function.
|
||||
#[allow(dead_code)]
|
||||
|
||||
+10
-10
@@ -28,7 +28,7 @@ use syn::parse_quote;
|
||||
|
||||
// Part of the public interface, so expose:
|
||||
pub use error::CodegenError;
|
||||
pub use subxt_metadata::Metadata;
|
||||
pub use pezkuwi_subxt_metadata::Metadata;
|
||||
pub use syn;
|
||||
|
||||
/// Generate a type safe interface to use with `subxt`.
|
||||
@@ -42,7 +42,7 @@ pub use syn;
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use codec::Decode;
|
||||
/// use subxt_codegen::{ Metadata, CodegenBuilder };
|
||||
/// use pezkuwi_subxt_codegen::{ Metadata, CodegenBuilder };
|
||||
///
|
||||
/// // Get hold of and decode some metadata:
|
||||
/// let encoded = std::fs::read("../artifacts/polkadot_metadata_full.scale").unwrap();
|
||||
@@ -71,7 +71,7 @@ pub struct CodegenBuilder {
|
||||
impl Default for CodegenBuilder {
|
||||
fn default() -> Self {
|
||||
CodegenBuilder {
|
||||
crate_path: syn::parse_quote!(::subxt::ext::subxt_core),
|
||||
crate_path: syn::parse_quote!(::pezkuwi_subxt::ext::pezkuwi_subxt_core),
|
||||
use_default_derives: true,
|
||||
use_default_substitutions: true,
|
||||
generate_docs: true,
|
||||
@@ -216,7 +216,7 @@ impl CodegenBuilder {
|
||||
self.item_mod = item_mod;
|
||||
}
|
||||
|
||||
/// Set the path to the `subxt` crate. By default, we expect it to be at `::subxt::ext::subxt_core`.
|
||||
/// Set the path to the `subxt` crate. By default, we expect it to be at `::pezkuwi_subxt::ext::pezkuwi_subxt_core`.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
@@ -232,7 +232,7 @@ impl CodegenBuilder {
|
||||
self.crate_path = crate_path;
|
||||
}
|
||||
|
||||
/// Generate an interface, assuming that the default path to the `subxt` crate is `::subxt::ext::subxt_core`.
|
||||
/// Generate an interface, assuming that the default path to the `subxt` crate is `::pezkuwi_subxt::ext::pezkuwi_subxt_core`.
|
||||
/// If the `subxt` crate is not available as a top level dependency, use `generate` and provide
|
||||
/// a valid path to the `subxt¦ crate.
|
||||
pub fn generate(self, metadata: Metadata) -> Result<TokenStream2, CodegenError> {
|
||||
@@ -300,7 +300,7 @@ impl CodegenBuilder {
|
||||
/// The default [`scale_typegen::TypeGeneratorSettings`], subxt is using for generating code.
|
||||
/// Useful for emulating subxt's code generation settings from e.g. subxt-explorer.
|
||||
pub fn default_subxt_type_gen_settings() -> TypeGeneratorSettings {
|
||||
let crate_path: syn::Path = parse_quote!(::subxt::ext::subxt_core);
|
||||
let crate_path: syn::Path = parse_quote!(::pezkuwi_subxt::ext::pezkuwi_subxt_core);
|
||||
let derives = default_derives(&crate_path);
|
||||
let substitutes = default_substitutes(&crate_path);
|
||||
subxt_type_gen_settings(derives, substitutes, &crate_path, true)
|
||||
@@ -377,7 +377,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
||||
parse_quote!(#crate_path::utils::bits::Msb0),
|
||||
),
|
||||
(
|
||||
parse_quote!(sp_core::crypto::AccountId32),
|
||||
parse_quote!(pezsp_core::crypto::AccountId32),
|
||||
parse_quote!(#crate_path::utils::AccountId32),
|
||||
),
|
||||
(
|
||||
@@ -385,7 +385,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
||||
parse_quote!(#crate_path::utils::AccountId20),
|
||||
),
|
||||
(
|
||||
parse_quote!(sp_runtime::multiaddress::MultiAddress),
|
||||
parse_quote!(pezsp_runtime::multiaddress::MultiAddress),
|
||||
parse_quote!(#crate_path::utils::MultiAddress),
|
||||
),
|
||||
(
|
||||
@@ -401,7 +401,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
||||
parse_quote!(#crate_path::utils::H512),
|
||||
),
|
||||
(
|
||||
parse_quote!(frame_support::traits::misc::WrapperKeepOpaque),
|
||||
parse_quote!(pezframe_support::traits::misc::WrapperKeepOpaque),
|
||||
parse_quote!(#crate_path::utils::WrapperKeepOpaque),
|
||||
),
|
||||
// BTreeMap and BTreeSet impose an `Ord` constraint on their key types. This
|
||||
@@ -427,7 +427,7 @@ fn default_substitutes(crate_path: &syn::Path) -> TypeSubstitutes {
|
||||
|
||||
// Note: Not sure if this is appropriate or not. The most recent polkadot.rs file does not have these.
|
||||
(
|
||||
parse_quote!(sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic),
|
||||
parse_quote!(pezsp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic),
|
||||
parse_quote!(#crate_path::utils::UncheckedExtrinsic),
|
||||
),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user