Skip to content
This repository was archived by the owner on Sep 4, 2021. It is now read-only.

Commit 6d99864

Browse files
author
zorn
committed
broadcast request
1 parent cda72a2 commit 6d99864

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
namespace Electrum\Request\Method\Payment;
4+
5+
use Electrum\Request\AbstractMethod;
6+
use Electrum\Request\MethodInterface;
7+
use Electrum\Response\Exception\ElectrumResponseException;
8+
9+
/**
10+
* Return a payment request.
11+
* @author Pascal Krason <p.krason@padr.io>
12+
*/
13+
class Broadcast extends AbstractMethod implements MethodInterface
14+
{
15+
16+
/**
17+
* @var string
18+
*/
19+
private $method = 'broadcast';
20+
21+
/**
22+
* @var string
23+
* Serialized transaction (hexadecimal)
24+
*/
25+
private $transaction = '';
26+
27+
/**
28+
* @param array $optional
29+
*
30+
* @return PaymentRequestResponse|null
31+
* @throws \Electrum\Request\Exception\BadRequestException
32+
* @throws \Electrum\Response\Exception\ElectrumResponseException
33+
*/
34+
public function execute(array $optional = [])
35+
{
36+
$data = $this->getClient()->execute($this->method, array_merge([
37+
'tx' => $this->getTransaction()
38+
], $optional));
39+
40+
return isset($data[1]) ? $data[1] : null;
41+
}
42+
43+
/**
44+
* Get the value of Transaction
45+
*
46+
* @return string
47+
*/
48+
public function getTransaction()
49+
{
50+
return $this->transaction;
51+
}
52+
53+
/**
54+
* Set the value of Transaction
55+
*
56+
* @param string transaction
57+
*
58+
* @return self
59+
*/
60+
public function setTransaction($transaction)
61+
{
62+
$this->transaction = $transaction;
63+
64+
return $this;
65+
}
66+
67+
}

0 commit comments

Comments
 (0)