mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 01:21:01 +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:
+6
-6
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "subxt-signer"
|
||||
name = "pezkuwi-subxt-signer"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -44,14 +44,14 @@ polkadot-js-compat = ["std", "subxt", "sr25519", "base64", "scrypt", "crypto_sec
|
||||
|
||||
# Make the keypair algorithms here compatible with Subxt's Signer trait,
|
||||
# so that they can be used to sign transactions for compatible chains.
|
||||
subxt = ["dep:subxt-core"]
|
||||
subxt = ["dep:pezkuwi-subxt-core"]
|
||||
|
||||
# The getrandom package is used via schnorrkel. We need to enable the JS
|
||||
# feature on it if compiling for the web.
|
||||
web = ["getrandom/js"]
|
||||
|
||||
[dependencies]
|
||||
subxt-core = { workspace = true, optional = true, default-features = false }
|
||||
pezkuwi-subxt-core = { workspace = true, optional = true, default-features = false }
|
||||
secrecy = { workspace = true }
|
||||
regex = { workspace = true, features = ["unicode"] }
|
||||
hex = { workspace = true }
|
||||
@@ -59,7 +59,7 @@ cfg-if = { workspace = true }
|
||||
codec = { package = "parity-scale-codec", workspace = true, features = [
|
||||
"derive",
|
||||
] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
pezsp-crypto-hashing = { workspace = true }
|
||||
pbkdf2 = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
hmac = { workspace = true }
|
||||
@@ -87,8 +87,8 @@ getrandom = { workspace = true, optional = true }
|
||||
[dev-dependencies]
|
||||
proptest = { workspace = true }
|
||||
hex-literal = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-keyring = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-keyring = { workspace = true }
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["getrandom"]
|
||||
|
||||
@@ -40,7 +40,7 @@ impl DeriveJunction {
|
||||
let mut cc: [u8; JUNCTION_ID_LEN] = Default::default();
|
||||
index.using_encoded(|data| {
|
||||
if data.len() > JUNCTION_ID_LEN {
|
||||
cc.copy_from_slice(&sp_crypto_hashing::blake2_256(data));
|
||||
cc.copy_from_slice(&pezsp_crypto_hashing::blake2_256(data));
|
||||
} else {
|
||||
cc[0..data.len()].copy_from_slice(data);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ use thiserror::Error as DeriveError;
|
||||
/// Parse [`DEV_PHRASE`] secret URI with junction:
|
||||
///
|
||||
/// ```
|
||||
/// # use subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||
/// # use pezkuwi_subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||
/// # use std::str::FromStr;
|
||||
/// let suri = SecretUri::from_str("//Alice").expect("Parse SURI");
|
||||
///
|
||||
@@ -60,7 +60,7 @@ use thiserror::Error as DeriveError;
|
||||
/// Parse [`DEV_PHRASE`] secret URI with junction and password:
|
||||
///
|
||||
/// ```
|
||||
/// # use subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||
/// # use pezkuwi_subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||
/// # use std::str::FromStr;
|
||||
/// let suri = SecretUri::from_str("//Alice///SECRET_PASSWORD").expect("Parse SURI");
|
||||
///
|
||||
@@ -72,7 +72,7 @@ use thiserror::Error as DeriveError;
|
||||
/// Parse [`DEV_PHRASE`] secret URI with hex phrase and junction:
|
||||
///
|
||||
/// ```
|
||||
/// # use subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||
/// # use pezkuwi_subxt_signer::{SecretUri, DeriveJunction, DEV_PHRASE, ExposeSecret};
|
||||
/// # use std::str::FromStr;
|
||||
/// let suri = SecretUri::from_str("0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a//Alice").expect("Parse SURI");
|
||||
///
|
||||
|
||||
+11
-11
@@ -49,7 +49,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ SecretUri, ecdsa::Keypair };
|
||||
/// use pezkuwi_subxt_signer::{ SecretUri, ecdsa::Keypair };
|
||||
/// use std::str::FromStr;
|
||||
///
|
||||
/// let uri = SecretUri::from_str("//Alice").unwrap();
|
||||
@@ -85,7 +85,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair };
|
||||
///
|
||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||
@@ -123,7 +123,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair, DeriveJunction };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, ecdsa::Keypair, DeriveJunction };
|
||||
///
|
||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||
@@ -145,7 +145,7 @@ impl Keypair {
|
||||
DeriveJunction::Soft(_) => return Err(Error::SoftJunction),
|
||||
DeriveJunction::Hard(junction_bytes) => {
|
||||
acc = ("Secp256k1HDKD", acc, junction_bytes)
|
||||
.using_encoded(sp_crypto_hashing::blake2_256)
|
||||
.using_encoded(pezsp_crypto_hashing::blake2_256)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ impl Keypair {
|
||||
|
||||
/// Sign some message. These bytes can be used directly in a Substrate `MultiSignature::Ecdsa(..)`.
|
||||
pub fn sign(&self, message: &[u8]) -> Signature {
|
||||
self.sign_prehashed(&sp_crypto_hashing::blake2_256(message))
|
||||
self.sign_prehashed(&pezsp_crypto_hashing::blake2_256(message))
|
||||
}
|
||||
|
||||
/// Signs a pre-hashed message.
|
||||
@@ -179,7 +179,7 @@ impl Keypair {
|
||||
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, ecdsa };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, ecdsa };
|
||||
///
|
||||
/// let keypair = ecdsa::dev::alice();
|
||||
/// let message = b"Hello!";
|
||||
@@ -189,7 +189,7 @@ impl Keypair {
|
||||
/// assert!(ecdsa::verify(&signature, message, &public_key));
|
||||
/// ```
|
||||
pub fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, pubkey: &PublicKey) -> bool {
|
||||
let message_hash = sp_crypto_hashing::blake2_256(message.as_ref());
|
||||
let message_hash = pezsp_crypto_hashing::blake2_256(message.as_ref());
|
||||
let wrapped = Message::from_digest_slice(&message_hash).expect("Message is 32 bytes; qed");
|
||||
|
||||
internal::verify(&sig.0, &wrapped, pubkey)
|
||||
@@ -298,9 +298,9 @@ pub mod dev {
|
||||
mod subxt_compat {
|
||||
use super::*;
|
||||
|
||||
use subxt_core::config::Config;
|
||||
use subxt_core::tx::signer::Signer as SignerT;
|
||||
use subxt_core::utils::{AccountId32, MultiAddress, MultiSignature};
|
||||
use pezkuwi_subxt_core::config::Config;
|
||||
use pezkuwi_subxt_core::tx::signer::Signer as SignerT;
|
||||
use pezkuwi_subxt_core::utils::{AccountId32, MultiAddress, MultiSignature};
|
||||
|
||||
impl From<Signature> for MultiSignature {
|
||||
fn from(value: Signature) -> Self {
|
||||
@@ -325,7 +325,7 @@ mod subxt_compat {
|
||||
/// We often want this type, and using this method avoids any
|
||||
/// ambiguous type resolution issues.
|
||||
pub fn to_account_id(self) -> AccountId32 {
|
||||
AccountId32(sp_crypto_hashing::blake2_256(&self.0))
|
||||
AccountId32(pezsp_crypto_hashing::blake2_256(&self.0))
|
||||
}
|
||||
/// A shortcut to obtain a [`MultiAddress`] from a [`PublicKey`].
|
||||
/// We often want this type, and using this method avoids any
|
||||
|
||||
+9
-9
@@ -47,7 +47,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, eth::{ Keypair, DerivationPath } };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, eth::{ Keypair, DerivationPath } };
|
||||
///
|
||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||
@@ -176,7 +176,7 @@ impl AsRef<[u8; 65]> for Signature {
|
||||
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, eth };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, eth };
|
||||
///
|
||||
/// let keypair = eth::dev::alith();
|
||||
/// let message = b"Hello!";
|
||||
@@ -309,10 +309,10 @@ pub mod dev {
|
||||
#[cfg(feature = "subxt")]
|
||||
mod subxt_compat {
|
||||
use super::*;
|
||||
use subxt_core::config::Config;
|
||||
use subxt_core::tx::signer::Signer as SignerT;
|
||||
use subxt_core::utils::AccountId20;
|
||||
use subxt_core::utils::MultiAddress;
|
||||
use pezkuwi_subxt_core::config::Config;
|
||||
use pezkuwi_subxt_core::tx::signer::Signer as SignerT;
|
||||
use pezkuwi_subxt_core::utils::AccountId20;
|
||||
use pezkuwi_subxt_core::utils::MultiAddress;
|
||||
|
||||
impl<T: Config> SignerT<T> for Keypair
|
||||
where
|
||||
@@ -365,9 +365,9 @@ mod test {
|
||||
use bip39::Mnemonic;
|
||||
use proptest::prelude::*;
|
||||
use secp256k1::Secp256k1;
|
||||
use subxt_core::utils::AccountId20;
|
||||
use pezkuwi_subxt_core::utils::AccountId20;
|
||||
|
||||
use subxt_core::{config::*, tx::signer::Signer as SignerT};
|
||||
use pezkuwi_subxt_core::{config::*, tx::signer::Signer as SignerT};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -434,7 +434,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_subxt_signer_implementation_matches(keypair in keypair(), msg in ".*") {
|
||||
fn check_pezkuwi_subxt_signer_implementation_matches(keypair in keypair(), msg in ".*") {
|
||||
let msg_as_bytes = msg.as_bytes();
|
||||
|
||||
assert_eq!(SubxtSigner::account_id(&keypair), keypair.public_key().to_account_id());
|
||||
|
||||
@@ -10,7 +10,7 @@ use crypto_secretbox::{
|
||||
aead::{Aead, KeyInit},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use subxt_core::utils::AccountId32;
|
||||
use pezkuwi_subxt_core::utils::AccountId32;
|
||||
|
||||
use thiserror::Error as DeriveError;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ SecretUri, sr25519::Keypair };
|
||||
/// use pezkuwi_subxt_signer::{ SecretUri, sr25519::Keypair };
|
||||
/// use std::str::FromStr;
|
||||
///
|
||||
/// let uri = SecretUri::from_str("//Alice").unwrap();
|
||||
@@ -95,7 +95,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, sr25519::Keypair };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, sr25519::Keypair };
|
||||
///
|
||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||
@@ -145,7 +145,7 @@ impl Keypair {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, sr25519::Keypair, DeriveJunction };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, sr25519::Keypair, DeriveJunction };
|
||||
///
|
||||
/// let phrase = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
|
||||
/// let mnemonic = Mnemonic::parse(phrase).unwrap();
|
||||
@@ -187,7 +187,7 @@ impl Keypair {
|
||||
/// Verify that some signature for a message was created by the owner of the [`PublicKey`].
|
||||
///
|
||||
/// ```rust,standalone_crate
|
||||
/// use subxt_signer::{ bip39::Mnemonic, sr25519 };
|
||||
/// use pezkuwi_subxt_signer::{ bip39::Mnemonic, sr25519 };
|
||||
///
|
||||
/// let keypair = sr25519::dev::alice();
|
||||
/// let message = b"Hello!";
|
||||
@@ -291,7 +291,7 @@ pub mod dev {
|
||||
mod subxt_compat {
|
||||
use super::*;
|
||||
|
||||
use subxt_core::{
|
||||
use pezkuwi_subxt_core::{
|
||||
Config,
|
||||
tx::signer::Signer as SignerT,
|
||||
utils::{AccountId32, MultiAddress, MultiSignature},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![no_std]
|
||||
|
||||
use subxt_signer::{ecdsa, eth, sr25519};
|
||||
use pezkuwi_subxt_signer::{ecdsa, eth, sr25519};
|
||||
|
||||
// Run the tests by calling:
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![cfg(target_arch = "wasm32")]
|
||||
|
||||
use subxt_signer::{ecdsa, eth, sr25519};
|
||||
use pezkuwi_subxt_signer::{ecdsa, eth, sr25519};
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
||||
|
||||
Reference in New Issue
Block a user