コード例 #1
0
ファイル: Bitcoind.php プロジェクト: nmarley/bitcoin-php
 /**
  * @param int $minConfirms
  * @param int $maxConfirms
  * @param array $addresses
  * @param NetworkInterface $network
  * @return array
  */
 public function listunspent($minConfirms = 1, $maxConfirms = 9999999, array $addresses = [], NetworkInterface $network = null)
 {
     $amount = new Amount();
     $results = $this->client->execute('listunspent', [$minConfirms, $maxConfirms, array_map(function (AddressInterface $address) use($network) {
         return $address->getAddress($network);
     }, $addresses)]);
     return array_map(function (array $value) use($amount) {
         return new Utxo(new OutPoint(Buffer::hex($value['txid'], 32), $value['vout']), new TransactionOutput($amount->toSatoshis($value['amount']), new Script(Buffer::hex($value['scriptPubKey']))));
     }, $results);
 }
コード例 #2
0
ファイル: Uri.php プロジェクト: nmarley/bitcoin-php
 /**
  * @param Amount $amount
  * @param int $value
  * @return $this
  */
 public function setAmount(Amount $amount, $value)
 {
     $this->amount = $amount->toBtc($value);
     return $this;
 }