@@ -10,8 +10,8 @@ use lazy_static::lazy_static;
1010use parity_scale_codec:: { Decode , Encode } ;
1111use reqwest:: Url ;
1212use runtime:: {
13- AccountId , CollateralBalancesPallet , CurrencyId , Error as RuntimeError , InterBtcParachain , RuntimeCurrencyInfo ,
14- Ss58Codec , TryFromSymbol , VaultRegistryPallet , SS58_PREFIX ,
13+ sp_core :: crypto :: Ss58Codec , AccountId , CollateralBalancesPallet , CurrencyId , Error as RuntimeError ,
14+ InterBtcParachain , RuntimeCurrencyInfo , TryFromSymbol , VaultRegistryPallet , SS58_PREFIX ,
1515} ;
1616use serde:: { Deserialize , Deserializer , Serialize } ;
1717use std:: { net:: SocketAddr , time:: Duration } ;
@@ -225,12 +225,13 @@ struct GetSignatureData {
225225}
226226
227227async fn ensure_signature_exists ( auth_url : & str , account_id : & AccountId ) -> Result < ( ) , Error > {
228+ let account_id = runtime:: sp_core:: crypto:: AccountId32 :: from ( account_id. 0 ) ;
228229 reqwest:: get ( Url :: parse ( auth_url) ?. join ( & account_id. to_ss58check_with_version ( SS58_PREFIX . into ( ) ) ) ?)
229230 . await ?
230231 . json :: < GetSignatureData > ( )
231232 . await ?
232233 . exists
233- . then ( || ( ) )
234+ . then_some ( ( ) )
234235 . ok_or ( Error :: SignatureMissing )
235236}
236237
@@ -262,7 +263,7 @@ async fn atomic_faucet_funding(
262263 let transfers = amounts
263264 . into_iter ( )
264265 . map ( |AllowanceAmount { symbol, amount } | {
265- let currency_id = CurrencyId :: try_from_symbol ( symbol. clone ( ) ) ?;
266+ let currency_id = CurrencyId :: try_from_symbol ( symbol) ?;
266267 log:: info!(
267268 "AccountId: {}, Currency: {:?} Type: {:?}, Amount: {}" ,
268269 account_id,
@@ -418,12 +419,12 @@ mod tests {
418419 . flat_map ( |account_id| {
419420 vec ! [ DEFAULT_TESTING_CURRENCY , DEFAULT_GOVERNANCE_CURRENCY ]
420421 . into_iter ( )
421- . map ( move |currency_id| ( account_id. clone ( ) , 1 << 60 , 0 , currency_id) )
422+ . map ( move |currency_id| ( account_id. clone ( ) . into ( ) , 1 << 60 , 0 , currency_id) )
422423 } )
423- . collect ( ) ,
424+ . collect :: < Vec < ( runtime :: utils_accountid :: AccountId32 , u128 , u128 , CurrencyId ) > > ( ) ,
424425 )
425426 . await
426- . expect ( "Should endow accounts" )
427+ . expect ( "Should endow accounts" ) ;
427428 }
428429
429430 async fn set_exchange_rate ( client : SubxtClient ) {
@@ -534,7 +535,7 @@ mod tests {
534535 endow_accounts ( client. clone ( ) ) . await ;
535536
536537 // Bob's account is prefunded with lots of DOT
537- let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) ;
538+ let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) . into ( ) ;
538539 let user_allowance: Allowance = vec ! [
539540 AllowanceAmount :: new( DEFAULT_TESTING_CURRENCY . symbol( ) . unwrap( ) , 100 ) ,
540541 AllowanceAmount :: new( DEFAULT_GOVERNANCE_CURRENCY . symbol( ) . unwrap( ) , 100 ) ,
@@ -568,7 +569,7 @@ mod tests {
568569 set_exchange_rate ( client. clone ( ) ) . await ;
569570 endow_accounts ( client. clone ( ) ) . await ;
570571
571- let bob_account_id = AccountKeyring :: Bob . to_account_id ( ) ;
572+ let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) . into ( ) ;
572573 let bob_vault_id = VaultId :: new (
573574 bob_account_id. clone ( ) ,
574575 DEFAULT_TESTING_CURRENCY ,
@@ -593,13 +594,14 @@ mod tests {
593594 let alice_provider = setup_provider ( client. clone ( ) , AccountKeyring :: Alice ) . await ;
594595 let bob_provider = setup_provider ( client. clone ( ) , AccountKeyring :: Bob ) . await ;
595596 // Drain the amount Bob was prefunded by, so he is eligible to receive Faucet funding
596- let bob_prefunded_amount = get_multi_currency_balance ( & bob_account_id, & user_allowance, & bob_provider) . await ;
597+ let bob_prefunded_amount =
598+ get_multi_currency_balance ( & bob_account_id. clone ( ) . into ( ) , & user_allowance, & bob_provider) . await ;
597599 drain_multi_currency ( & bob_prefunded_amount, & bob_provider, & drain_account_id, 1 )
598600 . await
599601 . expect ( "Unable to transfer funds" ) ;
600602
601603 let req = FundAccountJsonRpcRequest {
602- account_id : bob_account_id. clone ( ) ,
604+ account_id : bob_account_id. clone ( ) . into ( ) ,
603605 currency_id : DEFAULT_TESTING_CURRENCY ,
604606 } ;
605607 fund_account (
@@ -614,11 +616,13 @@ mod tests {
614616 bob_provider. register_public_key ( dummy_public_key ( ) ) . await . unwrap ( ) ;
615617 bob_provider. register_vault ( & bob_vault_id, 3 * KSM . one ( ) ) . await . unwrap ( ) ;
616618
617- let bob_funds_before = get_multi_currency_balance ( & bob_account_id, & user_allowance, & alice_provider) . await ;
619+ let bob_funds_before =
620+ get_multi_currency_balance ( & bob_account_id. clone ( ) . into ( ) , & user_allowance, & alice_provider) . await ;
618621 fund_account ( & Arc :: from ( alice_provider. clone ( ) ) , req, store, allowance_config)
619622 . await
620623 . expect ( "Funding the account failed" ) ;
621- let bob_funds_after = get_multi_currency_balance ( & bob_account_id, & user_allowance, & alice_provider) . await ;
624+ let bob_funds_after =
625+ get_multi_currency_balance ( & bob_account_id. clone ( ) . into ( ) , & user_allowance, & alice_provider) . await ;
622626 assert_allowance_emitted ( & bob_funds_before, & bob_funds_after, & vault_allowance) ;
623627 }
624628
@@ -677,7 +681,7 @@ mod tests {
677681
678682 for currency_id in [ Token ( KINT ) , Token ( KSM ) ] {
679683 kv. clear ( ) . unwrap ( ) ;
680- let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) ;
684+ let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) . into ( ) ;
681685 let bob_vault_id = VaultId :: new ( bob_account_id. clone ( ) , currency_id, DEFAULT_WRAPPED_CURRENCY ) ;
682686 let drain_account_id: AccountId = [ 3 ; 32 ] . into ( ) ;
683687
@@ -709,7 +713,7 @@ mod tests {
709713
710714 let bob_funds_before = get_multi_currency_balance ( & bob_account_id, & user_allowance, & bob_provider) . await ;
711715 let req = FundAccountJsonRpcRequest {
712- account_id : bob_account_id. clone ( ) ,
716+ account_id : bob_account_id. clone ( ) . into ( ) ,
713717 currency_id,
714718 } ;
715719
@@ -729,7 +733,7 @@ mod tests {
729733 set_exchange_rate ( client. clone ( ) ) . await ;
730734 endow_accounts ( client. clone ( ) ) . await ;
731735
732- let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) ;
736+ let bob_account_id: AccountId = AccountKeyring :: Bob . to_account_id ( ) . into ( ) ;
733737 let bob_vault_id = VaultId :: new (
734738 bob_account_id. clone ( ) ,
735739 DEFAULT_TESTING_CURRENCY ,
0 commit comments