/** * @param string[] $addressList * @param $coinSymbol * @param $token * @return AddressBalance[] */ public function getMultipleAddressBalance($addressList, $coinSymbol, $token) { $apiContext = $this->apiContextFactory->getApiContext($coinSymbol, $token); $addressClient = new AddressClient($apiContext); $addressBalances = $addressClient->getMultipleBalances($addressList); return $addressBalances; }
/** * @param string $token * @return bool */ public function authenticate($token) { $apiContext = $this->apiContextFactory->getApiContext(self::AUTH_WALLET_COIN_SYMBOL, $token); $walletClient = new WalletClient($apiContext); try { // Create BlockCypher wallet $bcWallet = new BlockCypherWallet(); $bcWallet->setToken($token); $bcWallet->setName(self::AUTH_WALLET_NAME); $bcWallet = $walletClient->create($bcWallet); if ($bcWallet && $bcWallet->getName() == self::AUTH_WALLET_NAME) { return true; } else { return false; } } catch (BlockCypherConnectionException $e) { if ($e->getCode() == self::ERROR_WALLET_ALREADY_EXISTS) { return true; } else { return false; } } catch (\Exception $e) { return false; } }
/** * @param $hashOrHeight * @param $coinSymbol * @param $token * @return Block */ public function getBlock($hashOrHeight, $coinSymbol, $token) { $apiContext = $this->apiContextFactory->getApiContext($coinSymbol, $token); $blockClient = new BlockClient($apiContext); $block = $blockClient->get($hashOrHeight); return $block; }
/** * @param TXSkeleton $txSkeleton * @param $coinSymbol * @param $token * @return TXSkeleton */ public function send(TXSkeleton $txSkeleton, $coinSymbol, $token) { $apiContext = $this->apiContextFactory->getApiContext($coinSymbol, $token); $txClient = new TXClient($apiContext); $txSkeleton = $txClient->send($txSkeleton); return $txSkeleton; }
/** * @param $walletName * @param $coinSymbol * @param $token * @return \string[] */ public function getWalletAddresses($walletName, $coinSymbol, $token) { $apiContext = $this->apiContextFactory->getApiContext($coinSymbol, $token); $walletClient = new WalletClient($apiContext); $addressList = $walletClient->getWalletAddresses($walletName); $addresses = $addressList->getAddresses(); return $addresses; }