/**
  * @param Wallet $wallet
  * @param BigMoney|null $balance
  * @param $apiUrl
  * @return WalletListItemDto
  */
 public static function from(Wallet $wallet, BigMoney $balance, $apiUrl)
 {
     $walletListItemDto = new self();
     $walletListItemDto->setId($wallet->getId()->getValue());
     $walletListItemDto->setCoinSymbol($wallet->getCoinSymbol());
     $walletListItemDto->setCreationTime($wallet->getCreationTime());
     $walletListItemDto->setName($wallet->getName());
     if ($balance !== null) {
         $walletListItemDto->setBalance((double) (string) $balance->getAmount());
     } else {
         $walletListItemDto->setBalance(-1);
     }
     $walletListItemDto->setApiUrl($apiUrl);
     return $walletListItemDto;
 }
Esempio n. 2
0
 /**
  * @param Wallet $wallet
  * @param BlockCypherAddress $blockCypherAddress
  * @return WalletDto
  */
 public static function from(Wallet $wallet, BlockCypherAddress $blockCypherAddress)
 {
     $walletDto = new WalletDto();
     // From Wallet
     $walletDto->setUserId($wallet->getUserId()->getValue());
     $walletDto->setName($wallet->getName());
     // From BlockCypherAddress
     $walletDto->setId($blockCypherAddress->getWallet()->getName());
     $walletDto->setTotalSent($blockCypherAddress->getTotalSent());
     $walletDto->setTotalReceived($blockCypherAddress->getTotalReceived());
     $walletDto->setUnconfirmedBalance($blockCypherAddress->getUnconfirmedBalance());
     $walletDto->setBalance($blockCypherAddress->getBalance());
     $walletDto->setFinalBalance($blockCypherAddress->getFinalBalance());
     $walletDto->setNTx($blockCypherAddress->getNTx());
     $walletDto->setUnconfirmedNTx($blockCypherAddress->getUnconfirmedNTx());
     $walletDto->setFinalNTx($blockCypherAddress->getFinalNTx());
     return $walletDto;
 }