public static AccountInfo adaptAccountInfo ( final RippleAccountBalances account , final String username ) { // Adapt account balances to XChange balances final Map < String , List < Balance > > balances = new HashMap <> ( ) ; for ( final RippleBalance balance : account . getBalances ( ) ) { final String walletId ; if ( balance . getCurrency ( ) . equals ( "XRP" ) ) { walletId = null ; } else { walletId = balance . getCounterparty ( ) ; } if ( ! balances . containsKey ( walletId ) ) { balances . put ( walletId , new LinkedList < Balance > ( ) ) ; } balances . get ( walletId ) . add ( new Balance ( Currency . getInstance ( balance . getCurrency ( ) ) , balance . getValue ( ) ) ) ; } final List < Wallet > accountInfo = new ArrayList <> ( balances . size ( ) ) ; for ( final Map . Entry < String , List < Balance > > wallet : balances . entrySet ( ) ) { accountInfo . add ( new Wallet ( wallet . getKey ( ) , wallet . getValue ( ) ) ) ; } return new AccountInfo ( username , BigDecimal . ZERO , accountInfo ) ; }
Adapts a Ripple Account to an XChange Wallet object .