Example #1
0
 /**
  * @return TX[]
  */
 public function testGetMultiple()
 {
     $request = $this->operation['response']['body'];
     $transactionArray = TX::getList($request);
     $transactionList = array();
     /** @var TX $transaction */
     foreach ($transactionArray as $transaction) {
         $transactionList[] = $transaction->getHash();
     }
     $result = TX::getMultiple($transactionList, array(), $this->apiContext, $this->mockBlockCypherRestCall);
     $this->assertNotNull($result);
     $this->assertContainsOnlyInstancesOf('\\BlockCypher\\Api\\TX', $result);
     $this->assertEquals(count($result), count($transactionList));
     foreach ($result as $tx) {
         $this->assertContains($tx->getHash(), $transactionList);
     }
     return $result;
 }
Example #2
0
 /**
  * The Unconfirmed Transactions Endpoint returns an array of the latest transactions relayed by nodes
  * in a blockchain that haven’t been included in any blocks.
  *
  * @param array $params Parameters. Options: instart, outstart and limit
  * @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 TX[]
  */
 public function getUnconfirmed($params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array();
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $payLoad = "";
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/txs?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return TX::getList($json);
 }