|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Blocktrail\SDK\Backend; |
|
4
|
|
|
|
|
5
|
|
|
use Blocktrail\SDK\BlocktrailSDK; |
|
6
|
|
|
|
|
7
|
|
|
class BlocktrailConverter implements ConverterInterface { |
|
8
|
|
|
public function paginationParams($params) { |
|
9
|
|
|
return $params; |
|
10
|
|
|
} |
|
11
|
|
|
|
|
12
|
|
|
public function getUrlForBlock($blockHash) { |
|
13
|
|
|
return "block/{$blockHash}"; |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function getUrlForTransaction($txId) { |
|
17
|
|
|
return "transaction/{$txId}"; |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function getUrlForTransactions($txIds) { |
|
21
|
|
|
return "transactions/" . implode(",", $txIds); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function getUrlForBlockTransaction($blockHash) { |
|
25
|
|
|
return "block/{$blockHash}/transactions"; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function getUrlForAddress($address) { |
|
29
|
|
|
return "address/{$address}"; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function getUrlForAddressTransactions($address) { |
|
33
|
|
|
return "address/{$address}/transactions"; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function getUrlForAddressUnspent($address) { |
|
37
|
|
|
return "address/{$address}/unspent-outputs"; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function getUrlForAllBlocks() { |
|
41
|
|
|
return "all-blocks"; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function handleErros($data) { |
|
45
|
|
|
throw new \Exception("Not implemented"); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function convertBlock($res) { |
|
49
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
50
|
|
|
return $data; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function convertBlocks($res) { |
|
54
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
55
|
|
|
return $data; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function convertBlockTxs($res) { |
|
59
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
60
|
|
|
return $data; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function convertTx($res, $rawTx) { |
|
64
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
65
|
|
|
return $data; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function convertTxs($res) { |
|
69
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
70
|
|
|
return $data; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function convertAddressTxs($res) { |
|
74
|
|
|
|
|
75
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
76
|
|
|
return $data; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function convertAddress($res) { |
|
80
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
81
|
|
|
return $data; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function convertAddressUnspentOutputs($res, $address) { |
|
85
|
|
|
$data = BlocktrailSDK::jsonDecode($res, true); |
|
86
|
|
|
return $data; |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|