Exemplo n.º 1
0
 /**
  * Push the raw transaction to the network.
  *
  * @param string $hexRawTx
  * @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 push($hexRawTx, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($hexRawTx, 'hexRawTx');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array();
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $txHex = new TXHex();
     $txHex->setTx($hexRawTx);
     $payLoad = $txHex->toJSON();
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/txs/push?" . http_build_query($params), "POST", $payLoad, null, $apiContext, $restCall);
     $ret = new TX();
     $ret->fromJson($json);
     return $ret;
 }