/** * @param Address $address * @param BlockCypherAddressBalance $blockCypherAddressBalance * @param string $apiUrl * @param string $explorerUrl * @return $this */ public static function from(Address $address, BlockCypherAddressBalance $blockCypherAddressBalance, $apiUrl, $explorerUrl) { $addressListItemDto = new self(); $addressListItemDto->setAddress($address->getAddress()); $addressListItemDto->setTag($address->getTag()); $addressListItemDto->setCreationTime($address->getCreationTime()); $addressListItemDto->setFinalBalance($blockCypherAddressBalance->getFinalBalance()); $addressListItemDto->setNTx($blockCypherAddressBalance->getNTx()); $addressListItemDto->setApiUrl($apiUrl); $addressListItemDto->setExplorerUrl($explorerUrl); return $addressListItemDto; }
/** * @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; }