/** * @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); }
/** * @param Amount $amount * @param int $value * @return $this */ public function setAmount(Amount $amount, $value) { $this->amount = $amount->toBtc($value); return $this; }