| 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.001'; | |
| 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 | =head2 get_transaction | ||
| 37 | |||
| 38 | https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/wallet/gettransaction/ | ||
| 39 | |||
| 40 | =over 4 | ||
| 41 | |||
| 42 | =back | ||
| 43 | |||
| 44 | L<Future> | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | sub get_transaction { | ||
| 49 | 0 | ▶ | my ($self, @params) = @_; |
|
Subroutine
get_transaction: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 50 | 0 | return $self->_request('gettransaction', @params); | |
| 51 | } | ||
| 52 | |||
| 53 | 3 | ▶ | use parent qw(Net::Async::Blockchain::Client::RPC); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 54 | |||
| 55 | =head2 get_raw_transaction | ||
| 56 | |||
| 57 | https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/rawtransactions/getrawtransaction/ | ||
| 58 | |||
| 59 | =over 4 | ||
| 60 | |||
| 61 | =back | ||
| 62 | |||
| 63 | L<Future> | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | sub get_raw_transaction { | ||
| 68 | 0 | ▶ | my ($self, @params) = @_; |
|
Subroutine
get_raw_transaction: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 69 | 0 | return $self->_request('getrawtransaction', @params); | |
| 70 | } | ||
| 71 | |||
| 72 | =head2 get_block | ||
| 73 | |||
| 74 | https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/wallet/getblock/ | ||
| 75 | |||
| 76 | =over 4 | ||
| 77 | |||
| 78 | =back | ||
| 79 | |||
| 80 | L<Future> | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | sub get_block { | ||
| 85 | 0 | ▶ | my ($self, @params) = @_; |
|
Subroutine
get_block: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 86 | 0 | return $self->_request('getblock', @params); | |
| 87 | } | ||
| 88 | |||
| 89 | =head2 validate_address | ||
| 90 | |||
| 91 | https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/util/validateaddress/ | ||
| 92 | |||
| 93 | =over 4 | ||
| 94 | |||
| 95 | =back | ||
| 96 | |||
| 97 | L<Future> | ||
| 98 | |||
| 99 | =cut | ||
| 100 | |||
| 101 | sub validate_address { | ||
| 102 | 0 | ▶ | my ($self, @params) = @_; |
|
Subroutine
validate_address: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 103 | 0 | return $self->_request('validateaddress', @params); | |
| 104 | } | ||
| 105 | |||
| 106 | =head2 get_last_block | ||
| 107 | |||
| 108 | https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/blockchain/getblockcount/ | ||
| 109 | |||
| 110 | =over 4 | ||
| 111 | |||
| 112 | =back | ||
| 113 | |||
| 114 | L<Future> | ||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | sub get_last_block { | ||
| 119 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
get_last_block: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 120 | 0 | return $self->_request('getblockcount'); | |
| 121 | } | ||
| 122 | |||
| 123 | =head2 get_block_hash | ||
| 124 | |||
| 125 | https://bitcoin-rpc.github.io/en/doc/0.17.99/rpc/blockchain/getblockhash/ | ||
| 126 | |||
| 127 | =over 4 | ||
| 128 | |||
| 129 | =back | ||
| 130 | |||
| 131 | L<Future> | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub get_block_hash { | ||
| 136 | 0 | ▶ | my ($self, @params) = @_; |
|
Subroutine
get_block_hash: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 137 | 0 | return $self->_request('getblockhash', @params); | |
| 138 | } | ||
| 139 | |||
| 140 | 3 | 1; | |
| 141 | |||