/**
  * @return Address[]
  */
 public function testGetMultiple()
 {
     $request = $this->operation['response']['body'];
     $addressArray = Address::getList($request);
     $addressList = array();
     /** @var Address $address */
     foreach ($addressArray as $address) {
         $addressList[] = $address->getAddress();
     }
     $result = Address::getMultiple($addressList, array(), $this->apiContext, $this->mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertContainsOnlyInstancesOf('\\BlockCypher\\Api\\Address', $result);
     $this->assertEquals(count($result), count($addressList));
     foreach ($result as $addr) {
         $this->assertContains($addr->getAddress(), $addressList);
     }
     return $result;
 }
Exemple #2
0
 /**
  * Obtain multiple Addresses resources for the given identifiers.
  *
  * @deprecated since version 1.2. Use AddressClient.
  * @param string[] $array
  * @param array $params Parameters. Options: unspentOnly, and before
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return Address[]
  */
 public static function getMultiple($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array('unspentOnly' => 1, 'before' => 1);
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $addressList = implode(";", $array);
     $payLoad = "";
     $chainUrlPrefix = self::getChainUrlPrefix($apiContext);
     $json = self::executeCall("{$chainUrlPrefix}/addrs/{$addressList}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return Address::getList($json);
 }
 /**
  * Obtain multiple Addresses resources for the given identifiers.
  *
  * @param string[] $array
  * @param array $params Parameters. Options: unspentOnly, and before
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return Address[]
  */
 public function getMultiple($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array('unspentOnly' => 1, 'includeScript' => 1, 'includeConfidence' => 1, 'before' => 1, 'after' => 1, 'limit' => 1, 'confirmations' => 1, 'confidence' => 1, 'omitWalletAddresses' => 1);
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $addressList = implode(";", $array);
     $payLoad = "";
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/addrs/{$addressList}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return Address::getList($json);
 }