Ejemplo n.º 1
0
 /**
  * Constructor passing addresses array. Default constructor can not be overridden
  *
  * @param string[] $addresses
  * @return AddressList
  */
 public static function fromAddressesArray($addresses)
 {
     ArgumentArrayValidator::validate($addresses, 'addresses');
     $addressList = new self();
     $addressList->setAddresses($addresses);
     return $addressList;
 }
Ejemplo n.º 2
0
 /**
  * Sign array of hex data deterministically using deterministic k.
  *
  * @param string[] $hexDataToSign
  * @param PrivateKeyInterface|string $privateKey
  * @return string[]
  */
 public static function signMultiple($hexDataToSign, $privateKey)
 {
     ArgumentArrayValidator::validate($hexDataToSign, 'hexDataToSign');
     $signatures = array();
     foreach ($hexDataToSign as $tosign) {
         $signatures[] = self::sign($tosign, $privateKey);
     }
     return $signatures;
 }
Ejemplo n.º 3
0
 /**
  * @param string[] $hexPrivateKeys
  * @param string
  * @param bool $compressed True if the public key should be using compressed format
  * @return PrivateKeyList
  * @throws \BlockCypher\Exception\BlockCypherInvalidPrivateKeyException
  */
 public static function fromHexPrivateKeyArray($hexPrivateKeys, $coinSymbol, $compressed = true)
 {
     ArgumentArrayValidator::validate($hexPrivateKeys, 'hexPrivateKeys');
     CoinSymbolValidator::validate($coinSymbol, 'coinSymbol');
     $privateKeyList = new self($coinSymbol);
     foreach ($hexPrivateKeys as $hexPrivateKey) {
         $privateKey = PrivateKeyManipulator::importPrivateKeyFromHex($hexPrivateKey, $compressed);
         // Add private key indexed by public key
         $privateKeyList->addPrivateKey($privateKey);
     }
     return $privateKeyList;
 }
Ejemplo n.º 4
0
 /**
  * Obtain multiple Wallet resources for the given wallet names list.
  *
  * @param string[] $walletNames
  * @param array $params Parameters. Options: txstart, 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 Wallet[]
  */
 public function getMultiple($walletNames, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($walletNames, 'walletNames');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array();
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $walletList = implode(";", $walletNames);
     $payLoad = "";
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/wallets/{$walletList}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return Wallet::getList($json);
 }
Ejemplo n.º 5
0
 /**
  * Obtain multiple TransactionConfidences resources for the given identifiers.
  *
  * @deprecated since version 1.2.1 Use TXClient.
  * @param string[] $array
  * @param array $params Parameters
  * @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 TXConfidence[]
  */
 public static function getMultiple($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array();
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $payLoad = "";
     $txhashList = implode(";", $array);
     $chainUrlPrefix = self::getChainUrlPrefix($apiContext);
     $json = self::executeCall("{$chainUrlPrefix}/txs/{$txhashList}/confidence" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall);
     return TXConfidence::getList($json);
 }
Ejemplo n.º 6
0
 /**
  * Obtain multiple Block resources for the given identifiers (hash or height).
  *
  * @param string[] $array
  * @param array $params Parameters. Options: txstart, 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 Block[]
  */
 public function getMultiple($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array('txstart' => 1, 'limit' => 1);
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $blockList = implode(";", $array);
     $payLoad = "";
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/blocks/{$blockList}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return Block::getList($json);
 }
Ejemplo n.º 7
0
 /**
  * Obtain multiple WebHooks resources for the given identifiers.
  *
  * @deprecated since version 1.2. Use WebHookClient.
  * @param string[] $array
  * @param array $params Parameters
  * @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 WebHook[]
  */
 public static function getMultiple($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array('token' => 1);
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $webHookList = implode(";", $array);
     $payLoad = "";
     $chainUrlPrefix = self::getChainUrlPrefix($apiContext);
     $json = self::executeCall("{$chainUrlPrefix}/hooks/{$webHookList}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return WebHook::getList($json);
 }
Ejemplo n.º 8
0
 /**
  * Obtain multiple FullAddress 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 FullAddress[]
  */
 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}/full?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall);
     return FullAddress::getList($json);
 }
Ejemplo n.º 9
0
 /**
  * Obtain multiple AddressBalances resources for the given identifiers.
  *
  * @param string[] $array
  * @param array $params Parameters
  * @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 AddressBalance[]
  */
 public function getMultipleBalances($array, $params = array(), $apiContext = null, $restCall = null)
 {
     ArgumentArrayValidator::validate($array, 'array');
     ArgumentGetParamsValidator::validate($params, 'params');
     $allowedParams = array('omitWalletAddresses' => 1);
     $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams);
     $payLoad = "";
     $addressList = implode(";", $array);
     $chainUrlPrefix = $this->getChainUrlPrefix($apiContext);
     $json = $this->executeCall("{$chainUrlPrefix}/addrs/{$addressList}/balance" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall);
     return AddressBalance::getList($json);
 }
 /**
  *
  * @dataProvider invalidProvider
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidDataValidate($input)
 {
     $this->assertTrue(ArgumentArrayValidator::validate($input, "Name"));
 }