Blockchain/Client/RPC/BTC.pm

filter: Statementstmt 56.6% 17 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 41.6% 5 / 12 Podpod 85.7% 6 / 7 totaltotal 57.1% 28 / 49 CC 1 SCAR 4.6
CC
1
Cov
57%
jsonrpc
2.0
get_transaction
2.0
get_raw_transaction
2.0
CRAP 1.6
« Blockchain.pm ↑ Summary Blockchain/Client/RPC/ETH.pm »
1 package Net::Async::Blockchain::Client::RPC::BTC;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 our $VERSION = '0.002';
7  
8 =head1 NAME
9  
10 Net::Async::Blockchain::Client::RPC::BTC - Async BTC RPC Client.
11  
12 =head1 SYNOPSIS
13  
14 my $loop = IO::Async::Loop->new();
15  
16 $loop->add(
17 my $http_client = Net::Async::Blockchain::Client::RPC::BTC->new(endpoint => 'http://127.0.0.1:8332', timeout => 100, rpc_user => 'test', rpc_password => 'test')
18 );
19  
20 my $response = $http_client->get_transaction('txid...')->get;
21  
22 =head1 DESCRIPTION
23  
24 BTC based RPC calls
25  
26 =over 4
27  
28 =back
29  
30 =cut
31  
32 3 ▶no indirect;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 3 ▶use parent qw(Net::Async::Blockchain::Client::RPC);
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 0 ▶sub jsonrpc { return undef }
Subroutine jsonrpc: not called CC=1 SCAR=6.9
Pod undocumented
37  
38 =head2 get_transaction
39  
40 https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/wallet/gettransaction/
41  
42 =over 4
43  
44 =back
45  
46 L<Future>
47  
48 =cut
49  
50 sub get_transaction {
51 0 ▶ my ($self, @params) = @_;
Subroutine get_transaction: not called CC=1 SCAR=6.9
Pod documented
52 0 return $self->_request('gettransaction', @params);
53 }
54  
55 3 ▶use parent qw(Net::Async::Blockchain::Client::RPC);
Subroutine BEGIN: called CC=1 SCAR=0.0
56  
57 =head2 get_raw_transaction
58  
59 https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/rawtransactions/getrawtransaction/
60  
61 =over 4
62  
63 =back
64  
65 L<Future>
66  
67 =cut
68  
69 sub get_raw_transaction {
70 0 ▶ my ($self, @params) = @_;
Subroutine get_raw_transaction: not called CC=1 SCAR=6.9
Pod documented
71 0 return $self->_request('getrawtransaction', @params);
72 }
73  
74 =head2 get_block
75  
76 https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/wallet/getblock/
77  
78 =over 4
79  
80 =back
81  
82 L<Future>
83  
84 =cut
85  
86 sub get_block {
87 0 ▶ my ($self, @params) = @_;
Subroutine get_block: not called CC=1 SCAR=6.9
Pod documented
88 0 return $self->_request('getblock', @params);
89 }
90  
91 =head2 validate_address
92  
93 https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/util/validateaddress/
94  
95 =over 4
96  
97 =back
98  
99 L<Future>
100  
101 =cut
102  
103 sub validate_address {
104 0 ▶ my ($self, @params) = @_;
Subroutine validate_address: not called CC=1 SCAR=6.9
Pod documented
105 0 return $self->_request('validateaddress', @params);
106 }
107  
108 =head2 get_last_block
109  
110 https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/blockchain/getblockcount/
111  
112 =over 4
113  
114 =back
115  
116 L<Future>
117  
118 =cut
119  
120 sub get_last_block {
121 0 ▶ my ($self) = @_;
Subroutine get_last_block: not called CC=1 SCAR=6.9
Pod documented
122 0 return $self->_request('getblockcount');
123 }
124  
125 =head2 get_block_hash
126  
127 https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/blockchain/getblockhash/
128  
129 =over 4
130  
131 =back
132  
133 L<Future>
134  
135 =cut
136  
137 sub get_block_hash {
138 0 ▶ my ($self, @params) = @_;
Subroutine get_block_hash: not called CC=1 SCAR=6.9
Pod documented
139 0 return $self->_request('getblockhash', @params);
140 }
141  
142 3 1;
143  
« Blockchain.pm ↑ Summary Blockchain/Client/RPC/ETH.pm »