Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove the use of Custom types #502

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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