/** * @param Wallet $wallet * @param Address[] $addresses * @param BlockCypherAddressBalance[] $blockCypherAddressBalances * @param ApiRouter $apiRouter * @param ExplorerRouter $explorerRouter * @return AddressListItemDto */ public static function from($wallet, $addresses, $blockCypherAddressBalances, $apiRouter, $explorerRouter) { $addressListItemDtos = array(); foreach ($addresses as $address) { $addressListItemDto = AddressListItemDto::from($address, $blockCypherAddressBalances[$address->getAddress()], $apiRouter->address($address->getAddress(), $wallet->getCoinSymbol(), $wallet->getToken()), $explorerRouter->address($address->getAddress(), $wallet->getCoinSymbol())); $addressListItemDtos[] = $addressListItemDto; } return $addressListItemDtos; }
/** * @param Wallet[] $wallets * @param BigMoney[] $walletBalances * @param ApiRouter $apiRouter * @return array */ public static function from($wallets, $walletBalances, $apiRouter) { $walletListItemDtos = array(); foreach ($wallets as $wallet) { $apiUrl = $apiRouter->wallet($wallet->getId()->getValue(), $wallet->getCoinSymbol(), $wallet->getToken()); $walletListItemDto = WalletListItemDto::from($wallet, $walletBalances[$wallet->getId()->getValue()], $apiUrl); $walletListItemDtos[] = $walletListItemDto; } return $walletListItemDtos; }
/** * @param Wallet $wallet * @param Transaction[] $transactions * @param TransactionListItem[] $transactionListItems * @param ApiRouter $apiRouter * @param ExplorerRouter $explorerRouter * @return TransactionListItemDto[] */ public static function from(Wallet $wallet, $transactions, $transactionListItems, ApiRouter $apiRouter, ExplorerRouter $explorerRouter) { // DEBUG //var_dump($transactionListItems); //die(); $transactionListItemDtos = array(); foreach ($transactionListItems as $transactionListItem) { $txHash = $transactionListItem->getTxHash(); if (isset($transactions[$txHash])) { $transaction = $transactions[$txHash]; } else { $transaction = null; } $transactionListItemDto = TransactionListItemDto::from($transaction, $transactionListItem, $apiRouter->transaction($txHash, $wallet->getCoinSymbol(), $wallet->getToken()), $explorerRouter->transaction($txHash, $wallet->getCoinSymbol(), $wallet->getToken())); $transactionListItemDtos[] = $transactionListItemDto; } // DEBUG //var_dump($transactionListItemDtos); //die(); return $transactionListItemDtos; }