Skip to content

Commit

Permalink
Merge pull request #502 from interlay/nakul/fix_rm_subxt_utils
Browse files Browse the repository at this point in the history
fix: Remove the use of Custom types
  • Loading branch information
nakul1010 authored Jul 26, 2023
2 parents 3373092 + 21a8f5d commit e727ac0
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 214 deletions.
67 changes: 51 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions faucet/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct GetSignatureData {
}

async fn ensure_signature_exists(auth_url: &str, account_id: &AccountId) -> Result<(), Error> {
let account_id = runtime::sp_core::crypto::AccountId32::from(account_id.0);
let account_id = account_id.to_sp_core_account_id();
reqwest::get(Url::parse(auth_url)?.join(&account_id.to_ss58check_with_version(SS58_PREFIX.into()))?)
.await?
.json::<GetSignatureData>()
Expand Down Expand Up @@ -386,7 +386,8 @@ mod tests {
};
use kv::{Config, Store};
use runtime::{
integration::*, AccountId, BtcPublicKey, FixedPointNumber, FixedU128, OraclePallet, VaultRegistryPallet,
integration::*, utils::account_id::AccountId32, AccountId, BtcPublicKey, FixedPointNumber, FixedU128,
OraclePallet, VaultRegistryPallet,
};
use sp_keyring::AccountKeyring;

Expand Down Expand Up @@ -421,7 +422,7 @@ mod tests {
.into_iter()
.map(move |currency_id| (account_id.clone().into(), 1 << 60, 0, currency_id))
})
.collect::<Vec<(runtime::utils_accountid::AccountId32, u128, u128, CurrencyId)>>(),
.collect::<Vec<(AccountId32, u128, u128, CurrencyId)>>(),
)
.await
.expect("Should endow accounts");
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl InterBtcParachain {
signer: InterBtcSigner,
shutdown_tx: ShutdownSender,
) -> Result<Self, Error> {
let account_id = signer.account_id().clone();
let account_id = signer.account_id.clone().0;
let api = OnlineClient::from_rpc_client(Arc::new(rpc_client)).await?;

let runtime_version = api.rpc().runtime_version(None).await?;
Expand Down Expand Up @@ -125,7 +125,7 @@ impl InterBtcParachain {
api: Arc::new(api),
nonce: Arc::new(RwLock::new(0)),
signer,
account_id,
account_id: (*account_id).clone().into(),
shutdown_tx,
fee_rate_update_tx,
native_currency_id,
Expand Down
3 changes: 2 additions & 1 deletion runtime/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use super::{
VaultRegistryPallet, KBTC, KINT, KSM,
};
use crate::{
integration::*, utils_accountid::AccountId32, FeedValuesEvent, OracleKey, RuntimeCurrencyInfo, VaultId, H160, U256,
integration::*, utils::account_id::AccountId32, FeedValuesEvent, OracleKey, RuntimeCurrencyInfo, VaultId, H160,
U256,
};
use module_bitcoin::{formatter::TryFormat, types::BlockBuilder};
pub use primitives::CurrencyId::ForeignAsset;
Expand Down
14 changes: 9 additions & 5 deletions runtime/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
pub use crate::utils::{account_id as utils_accountid, multi_signature};
use crate::{metadata, utils::signer::PairSigner, Config, InterBtcRuntime, RuntimeCurrencyInfo};
use crate::{
metadata,
utils::{account_id::AccountId32, signer::PairSigner},
Config, InterBtcRuntime, RuntimeCurrencyInfo,
};
pub use currency_id::CurrencyIdExt;
pub use h256_le::RichH256Le;
pub use metadata_aliases::*;
Expand All @@ -13,8 +16,8 @@ pub use sp_core::sr25519::Pair as KeyPair;
pub use subxt;
use subxt::storage::{address::Yes, Address};

pub type AccountId = utils_accountid::AccountId32;
pub type MultiSignature = multi_signature::MultiSignature;
pub type AccountId = AccountId32;
pub type MultiSignature = sp_runtime::MultiSignature;
pub type Balance = primitives::Balance;
pub type Index = u32;
pub type BlockNumber = u32;
Expand Down Expand Up @@ -211,9 +214,10 @@ pub trait PrettyPrint {

mod account_id {
use super::*;
use sp_core::crypto::Ss58Codec;
impl PrettyPrint for AccountId {
fn pretty_print(&self) -> String {
self.to_ss58check()
self.0.to_ss58check()
}
}
}
Expand Down
Loading

0 comments on commit e727ac0

Please sign in to comment.