use JSON::RPC::Legacy::Client;
use Scalar::Util qw( blessed );
has endpoint => (is => "rw", default => sub { "http://127.0.0.1:8332/" });
has jsonrpc => (is => "lazy", default => sub { "JSON::RPC
y $self = shift;
my ($method, @params) = @_;
$self->_set_error(undef);
my $return = $self->jsonrpc->call($self->endpoint, {
method => $method,
params => \@params,
});
if (blessed
lf->_set_error(sprintf('HTTP %s', $self->jsonrpc->status_line));
return;
}
}
1;
__END__
=head1 NAME
Finance::Bitcoin::API - wrapper for the Bitcoin JSON-RPC API
=head1 SYNOPSIS
use Finance::
See also L<Coro>.
=back
=head2 JSON
=over 4
=item L<JSON::XS>
JSON::XS is pretty fast. I'm use this for the point what needs performance.
=item L<JSON::PP>
JSON::PP is written in pure perl. And
d2 JSON
=over 4
=item L<JSON|JSON>
Basic perl module to parse JSON
=item L<JSON::Any|JSON::Any>
Auto use the best available JSON module
=item L<JSON::XS|JSON::XS>
Fast C module to parse JSON
=
item L<MooseX::Types::IPv4|MooseX::Types::IPv4>
IP Address
=item L<MooseX::Types::JSON|MooseX::Types::JSON>
A JSON string
=item L<MooseX::Types::NetAddr::IP|MooseX::Types::NetAddr::IP>
Alternativ
AML::Syck>
Another fast module to parse YAML
=item L<YAML::XS|YAML::XS>
Fast C module to parse JSON
=back
=head1 INSTALLATION
See perlmodinstall for information and options on installing Perl mo
otion;
use 5.008005;
use strict;
use warnings;
use AnyEvent::Handle;
use AnyEvent::Socket ();
use JSON ();
use Protocol::WebSocket;
use Protocol::WebSocket::Frame;
use Protocol::WebSocket::Handshake::
if (my $message = $self->{frame}->next_bytes) {
my $data = JSON::decode_json($message);
if (exists $data->{id} && exists $data->{timestamp}) {
});
});
};
}
sub send {
my ($self, $data) = @_;
my $message = JSON::encode_json($data);
my $frame = Protocol::WebSocket::Frame->new($message);
$self->{handle}->pu
my $changes = CPAN::Changes->load('Changes');
my $meta = CPAN::Meta->load_file('META.json');
my $doap = RDF::DOAP::Lite->new(meta => $meta, changes => $changes);
$doap->doap_
;
}
sub addresses
{
my ($self) = @_;
my $list = $self->api->call('listreceivedbyaddress', 0, JSON::true);
return unless ref($list) eq 'ARRAY';
return
map { "Finance::Bitcoin::Address"->new
unning
Bitcoin instance.
=over 4
=item C<< new($endpoint) >>
Constructor. $endpoint may be the JSON RPC endpoint URL, or may be a
Finance::Bitcoin::API object.
=begin trustme
=item BUILDARGS
=en
tcoin instance.
=over 4
=item C<< new($endpoint, $string) >>
Constructor. $endpoint may be the JSON RPC endpoint URL, or may be a
Finance::Bitcoin::API object; $string is an address string.
=begin
use AnyEvent::Promises qw(deferred merge_promises);
use AnyEvent::HTTP;
use JSON qw(decode_json encode_json);
sub wget {
my ($uri) = @_;
my $d = deferred;
http_ge
ody, $headers ) = @_;
$headers->{Status} == 200
? $d->resolve( decode_json($body) )
: $d->reject('receiving data failed with status: '. $headers->{Status}
=> encode_json($data) => sub {
my ( $body, $headers ) = @_;
$headers->{Status} == 200 || $headers->{Status} == 204
? $d->resolve( $body? decode_json($body) )
ngs;
our $VERSION = "0.06";
use AnyEvent::APNS;
use Cache::LRU;
use Encode qw/decode_utf8/;
use JSON::XS;
use Log::Minimal;
use Plack::Request;
use Router::Boom::Method;
use Class::Accessor::Lite::
if (my $payload_json = $req->param('payload') ) {
state $json_driver = JSON::XS->new->utf8;
local $@;
$payload = eval { $json_driver->decode($payload_json) };
return
scalar( @{ $self->_queue } ),
};
my $body = encode_json($result);
return [200, [
'Content-Type' => 'application/json; charset=utf-8',
'Content-Length' => length($body),
use strict;
use warnings;
# for now, check switching to HTTP::Tiny or Hijk
use LWP::Simple;
use JSON;
use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(
start_btsync
set_config
set
cally, you need
to name it btconfig and add its path to the environment path variable.
Sync uses JSON format for the configuration file.
Here is a sample config file that you can use to enable API:
t the listened address from.
Alternatively, you can use set_listened_address.
returns the config JSON parsed to a Perl HashRef.
=over 4
=item config_file (required)
Specifies path to the config fi
::Simple::Authen
=item * IO::Capture::Stderr
=item * IO::Socket::SSL
=item * IPC::Run
=item * JSON
=item * LWP
=item * LWP::Protocol::https
=item * Module::Install
=item * Net::IP
=item * Net
($self->url => json => $self->_json_content($ex, $app, $c), $call_back );
}
sub _json_content {
my $self = shift;
my $ex = shift;
my $app = shift;
my $c = shift;
my $json = {
notifi
$VERSION,
url => 'https://github.com/jontaylor/Mojolicious-Plugin-Airbrake'
}
};
$json->{errors} = [{
type => ref $ex,
message => $ex->message,
backtrace => [],
}];
fo
line, $subroutine) = @$frame;
push @{$json->{errors}->[0]->{backtrace}}, {
file => $file, line => $line, function => $subroutine
};
}
$json->{context} = {
environment => $app->m
rency.
This module provides high and low level APIs for managing a running
bitcoin instance over JSON-RPC.
=head1 BUGS
Please report any bugs to L<http://rt.cpan.org/>.
=head1 SEE ALSO
L<Finance:
e App::DeDuppy;
# ABSTRACT: generate json files from casperjs test arguments
use strict;
use warnings;
use 5.010;
use Carp;
use Moo;
use MooX::Options;
use JSON;
option 'arglist' => (is => 'ro',
default => sub { [] });
sub truthify_maybe {
$_[0] eq 'false' ? JSON::false :
$_[0] eq 'true' ? JSON::true : $_[0];
}
sub arrayrefify_maybe {
my @values = split(/,/, $_[0]
$+{value});
$self->options->{$option} = defined $value ? arrayrefify_maybe($value) : JSON::true;
} else {
if ($self->subcommand_is_set) {
push @{$se
scroll} ||= '1m';
my $method = $params->{q} ? 'searchqs' : 'search';
my $as_json = delete $params->{as_json};
my $results = $es->$method($params);
my $self = {
_es =
max_score},
_facets => $results->{facets},
_eof => 0,
_as_json => $as_json,
};
return bless( $self, $class );
}
#===================================
sub ne
my @results = splice @{ $self->{_buffer} }, 0, $size;
return
$self->{_as_json} ? $self->{_es}->JSON->encode( \@results )
: $size == 1 ? $results[0]
:
} =~ /^(turtle|n.?triples|n.?quads|trig|n3|notation.?3|pret|pretdsl|sparql|sparql.?(update|query)|json|xml)$/i;
return $self->_syntax_highlighting_for_text_via_kate(@_);
}
sub _syntax_highlig
require Syntax::Highlight::RDF;
require Syntax::Highlight::XML;
require Syntax::Highlight::JSON2;
# Syntax::Highlight::RDF uses different CSS classes
my $css = $self->code_styles;
$sel
unless $css->{xml_tag_is_doctype};
$self->_pull_code_styles(%Syntax::Highlight::JSON2::STYLE)
unless $css->{json_boolean};
my $hlt = "Syntax::Highlight::RDF"->highlighter($opt->{language});
t ls-files
exclude_filename = README.pod ; skip this generated file
exclude_filename = META.json ; skip this generated file
[PruneCruft] ; default stuff to skip
[ManifestSkip]
as develop/requires
[MetaYAML] ; generate META.yml (v1.4)
[MetaJSON] ; generate META.json (v2)
[CPANFile] ; generate cpanfile
; build system
[ExecDir
s::PinPayment;
use strict;
use warnings;
use Net::SSL;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
our $VERSION = '0.04';
# build 4.1
sub new {
my ($class, %args) = (@_);
my $self = bless
rl);
$p->content_type('application/json');
$p->authorization_basic($api_key);
my $json_request = to_json( $self->{config}, {utf8 => 1} );
$p->content($json_request) unless $api eq 'refunds';
my $json_response;
if ($self->{response}->content) {
$json_response = from_json( $self->{response}->content, {utf8 => 1} );
$self->{json_response} = $json_response;
}
if ($json_res
t;
use warnings;
use Moo::Role;
use HTTP::Request::Common qw(GET POST PUT DELETE);
use JSON qw(from_json to_json);
use LWP::UserAgent;
use List::Util qw(any pairgrep);
use Log::Any qw($log);
use Carp
$uri, content => to_json $body);
}
sub http_put {
my ($self, $path, $body) = @_;
my $uri = $self->_request_uri($path);
return $self->_req(PUT $uri, content => to_json $body);
}
sub http
r '. $self->access_token));
$req->header(content_type => 'application/json');
$req->header(accept => 'application/json');
$self->_log_request($req);
my $res = $self->ua->request($req);
to pass test configurations as json files
use strict;
use warnings;
use Moo;
use MooX::Options;
use IPC::Run qw/run new_chunker/;
use File::Which;
use IO::All;
use JSON;
use DDP;
use Carp;
use Try::T
=> 'rw',
required => 1,
format => 's@',
doc =>
'Test option: one ore more json file(s) containing the casperjs tests to perform'
);
option 'casper_path' => (
is =>
my $content = io($file)->slurp;
try {
$ret->{$file} = decode_json($content);
}
catch {
carp "'$file' is not valid: $_";