Blockchain/Client/RPC/ETH.pm

filter: Statementstmt 57.1% 16 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.4% 5 / 11 Podpod 100% 7 / 7 totaltotal 60.8% 28 / 46 CC 1 SCAR 4.4
CC
1
Cov
57%
call
2.0
get_transaction_receipt
2.0
get_block_by_hash
2.0
CRAP 1.5
« Blockchain/Client/RPC/BTC.pm ↑ Summary Blockchain/Client/RPC/Omni.pm »
1 package Net::Async::Blockchain::Client::RPC::ETH;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.001';
7  
8 =head1 NAME
9  
10 Net::Async::Blockchain::Client::RPC::ETH - Async ETH 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::ETH->new(endpoint => 'http://127.0.0.1:8545', timeout => 100)
18 );
19  
20 my $response = $http_client->accounts()->get;
21  
22 =head1 DESCRIPTION
23  
24 ETH RPC calls
25  
26 =over 4
27  
28 =back
29  
30 =cut
31  
32 2 ▶no indirect;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 2 ▶use parent qw(Net::Async::Blockchain::Client::RPC);
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 =head2 call
37  
38 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call
39  
40 =over 4
41  
42 =back
43  
44 L<Future>
45  
46 =cut
47  
48 sub call {
49 0 ▶ my ($self, @params) = @_;
Subroutine call: not called CC=1 SCAR=6.9
Pod documented
50 0 return $self->_request('eth_call', @params);
51 }
52  
53 =head2 get_transaction_receipt
54  
55 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt
56  
57 =over 4
58  
59 =back
60  
61 L<Future>
62  
63 =cut
64  
65 sub get_transaction_receipt {
66 0 ▶ my ($self, @params) = @_;
Subroutine get_transaction_receipt: not called CC=1 SCAR=6.9
Pod documented
67 0 return $self->_request('eth_getTransactionReceipt', @params);
68 }
69  
70 =head2 accounts
71  
72 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts
73  
74 =over 4
75  
76 =back
77  
78 L<Future>
79  
80 =cut
81  
82 sub accounts {
83 13 ▶ my ($self) = @_;
Subroutine accounts: called CC=1 SCAR=0.0
Pod documented
84 13 return $self->_request('eth_accounts');
85 }
86  
87 =head2 get_block_by_hash
88  
89 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash
90  
91 =over 4
92  
93 =back
94  
95 L<Future>
96  
97 =cut
98  
99 sub get_block_by_hash {
100 0 ▶ my ($self, @params) = @_;
Subroutine get_block_by_hash: not called CC=1 SCAR=6.9
Pod documented
101 0 return $self->_request('eth_getBlockByHash', @params);
102 }
103  
104 =head2 get_block_by_number
105  
106 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber
107  
108 =over 4
109  
110 =back
111  
112 L<Future>
113  
114 =cut
115  
116 sub get_block_by_number {
117 0 ▶ my ($self, @params) = @_;
Subroutine get_block_by_number: not called CC=1 SCAR=6.9
Pod documented
118 0 return $self->_request('eth_getBlockByNumber', @params);
119 }
120  
121 =head2 get_last_block
122  
123 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber
124  
125 =over 4
126  
127 =back
128  
129 L<Future>
130  
131 =cut
132  
133 sub get_last_block {
134 0 ▶ my ($self) = @_;
Subroutine get_last_block: not called CC=1 SCAR=6.9
Pod documented
135 0 return $self->_request('eth_blockNumber');
136 }
137  
138 =head2 get_balance
139  
140 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance
141  
142 =over 4
143  
144 =back
145  
146 L<Future>
147  
148 =cut
149  
150 sub get_balance {
151 0 ▶ my ($self, $address) = @_;
Subroutine get_balance: not called CC=1 SCAR=6.9
Pod documented
152 0 return $self->_request('eth_getBalance', $address, 'latest');
153 }
154  
155 2 1;
156  
« Blockchain/Client/RPC/BTC.pm ↑ Summary Blockchain/Client/RPC/Omni.pm »