public function testBuild()
 {
     $expectedMicroTX = MicroTXTest::getObject();
     $microTX = MicroTXBuilder::newMicroTX()->fromPubkey($expectedMicroTX->getFromPubkey())->fromPrivate($expectedMicroTX->getFromPrivate())->fromWif($expectedMicroTX->getFromWif())->toAddress($expectedMicroTX->getToAddress())->withValueInSatoshis($expectedMicroTX->getValueSatoshis())->build();
     $this->assertEquals($expectedMicroTX->getFromPubkey(), $microTX->getFromPubkey());
     $this->assertEquals($expectedMicroTX->getFromPrivate(), $microTX->getFromPrivate());
     $this->assertEquals($expectedMicroTX->getFromWif(), $microTX->getFromWif());
     $this->assertEquals($expectedMicroTX->getToAddress(), $microTX->getToAddress());
     $this->assertEquals($expectedMicroTX->getValueSatoshis(), $microTX->getValueSatoshis());
 }
Beispiel #2
0
 /**
  * Send a microtransaction signing it on server side (sending the private key to the server).
  * Same functionality as fromPrivate method but using WIF format for private key.
  *
  * @param string $wif
  * @param string $toAddress
  * @param int $valueSatoshis
  * @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 MicroTX
  */
 public function sendWithWif($wif, $toAddress, $valueSatoshis, $apiContext = null, $restCall = null)
 {
     $microTX = MicroTXBuilder::newMicroTX()->fromWif($wif)->toAddress($toAddress)->withValueInSatoshis($valueSatoshis)->build();
     $microTX = $this->create($microTX, $apiContext, $restCall);
     return $microTX;
 }