.008;
use strict;
use warnings;
use Moo;
use JSON::RPC::Legacy::Client;
our $VERSION = '0.12';
has jsonrpc => (is => "lazy", default => sub { "JSON::RPC::Legacy::Client"->new });
has user =>
en
if ($self->wallet) {
$url .= "/wallet/" . $self->wallet;
}
my $client = $self->jsonrpc;
# Set timeout because bitcoin is slow
$client->ua->timeout($self->timeout);
# Set
e =~ s/\s+//g;
$_[0] = $cookie;
}
1;
=pod
=head1 NAME
Bitcoin::RPC::Client - Bitcoin Core JSON RPC Client
=head1 SYNOPSIS
use Bitcoin::RPC::Client;
# Create Bitcoin::RPC::Client objec
trigger => 1;
sub _trigger_path {
my ($self) = @_;
$self->jwt(Mojo::JWT::Google->new(from_json => $self->path));
}
has jwt => is => 'rw';
has tokens => is => 'ro',
default => sub { {
accounts, please see
L<WebService::GoogleAPI::AuthStorage::GapiJSON>.
This backend is only for explicitly passing a service account JSON file. It will
not attempt to find one by itself, or to do the
ce::GoogleAPI::Client::AuthStorage::GapiJSON;
our $VERSION = '0.27'; # VERSION
# ABSTRACT: Auth Storage Backend based on gapi.json
use Moo;
use Config::JSON;
use Carp;
with 'WebService::GoogleAP
has 'path' => (is => 'rw', default => './gapi.json'); # default is gapi.json
has 'tokensfile' => (is => 'rw'); # Config::JSON object pointer
# NOTE- this type of class ha
okensfile(Config::JSON->new($self->path));
my $missing = grep !$_, map $self->get_from_storage($_), qw/client_id client_secret/;
croak <<NOCLIENT if $missing;
Malformed gapi.json detected. We need
date ;
use strict ;
use warnings ;
use feature 'say' ;
use HTTP::Request::Common ;
use JSON qw[ encode_json ] ;
use LWP::UserAgent ;
use URI::QueryParam ;
use URI ;
my ($GOOGLE_DRIVE_UPLOAD_API ,
くことは出来るだろうか?
'Content-Type' => 'application/json;charset=UTF-8',
'Content' => encode_json( {} ) #name=>'temp.txt', mimeType=>'text/plain', parents => ['10_33char
;
use MooX qw/late/;
use HTML::Parser 3.00 ();
use List::MoreUtils qw(any);
use JSON::MaybeXS qw(decode_json);
use Path::Tiny 0.144 qw/ path /;
use Digest ();
has '_inside' =>
ef, $ddata ) = @_;
$cache_fh->parent()->mkdir();
$cache_fh->spew_raw(
JSON::MaybeXS->new( canonical => 1 )->encode(
{
$app_key => {
}
my $main_json = decode_json( scalar( $cache_fh->slurp_raw() ) );
my $timestamp_cache = $main_json->{$app_key}->{$data_key};
my $digest_cache =
( $main_json->{$app_key}->{$
r\n Foo::Bar=arg1,arg2\n\nSee also: `perl::modname`.\nA two-element array from (coercible from JSON string) is also allowed:\n\n [\"Foo::Bar\", \\\@args]\n\n",examples=>[{valid=>0,value=>""},{va
"]]},{summary=>"Too many elements",valid=>0,value=>["Foo",["arg1","arg2"],{}]}],of=>[["array_from_json",{description=>"\nThese are valid values for this schema:\n\n [\"Foo\"]
x->res->json('/access_token');
unless ($new_token) {
croak "Failed to refresh access token: ", join ' - ', map $tx->res->json("/$_"), qw/error error_description/
if $tx->res->json;
#
$tx->res->json('/access_token');
unless ($new_token) {
croak "Failed to get access token: ", join ' - ', map $tx->res->json("/$_"), qw/error error_description/
if $tx->res->json;
# i
e backends.
This dist comes with two consumers, L<WebService::GoogleAPI::Client::AuthStorage::GapiJSON>
and L<WebService::GoogleAPI::Client::AuthStorage::ServiceAccount>. See those for more info
on ho
ct::Helper::ImportHelper - ImportHelper
=cut
use JSON::MaybeXS;
=head2 to_hex
Auxiliar to get bytecode and the ABI from the compiled truffle json.
Parameters:
file path
Return:
{abi, byt
t = path($file)->slurp_utf8;
my $decoded_json = decode_json($document);
return {
abi => encode_json($decoded_json->{abi}),
bytecode => $decoded_json->{bytecode}};
}
1;
aggregation};
# stringify to unbless from PDL, then numify for type-aware JSON
$value = $value ? (0+sprintf("%6.2f", $value)) : undef;
o::Tango::Database;
use Arango::Tango::Collection;
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use MIME::Base64 3.11 'encode_base64url';
use URI::Encode qw(uri_encode);
BEGIN {
Arango::Tang
;
$self->{headers} = {
Authorization => $self->_auth,
Accept => 'application/json',
};
$self->{http} = HTTP::Tiny->new(default_headers => $self->{headers});
return $s
=head1 CAVEATS
=head2 Options Validation
Most optional options are validated and fitted using
C<JSON::Scheme::Fit>. This means that the module will try to remove
invalid options and adapt values fro
ebsockets_observable';
use BoardStreams::Client::Util 'unique_id';
use BoardStreams::Util 'decode_json', 'eqq';
use RxPerl::Mojo ':all';
use Mojo::UserAgent;
no autovivification;
has url => sub { d
= @$data_ws;
$ws or die 'Attempted to send data while not connected';
$ws->send({ json => $data });
});
# read incoming messages
$self->{incoming_o} = rx_subject->new;
al and $i == ($ongoing_messages->{$identifier}{i} // -1)) {
my $data = decode_json $ongoing_messages->{$identifier}{bytes};
delete $ongoing_messages->{$identifi
} =~ s{/+/$}{/};
}
my $root = ($conf->{prefix} || '/');
my $path = $conf->{path} || 'jsonrpc';
my $r = $app->routes;
if ($conf->{controller}){
$r->any($root.$path)->to(
us';
use MyJsonRpcController;
sub startup {
my $self = shift;
$self->plugin('qooxdoo',{
prefix => '/',
path => 'jsonrpc',
controller => 'my_json_rpc_conroll
er'
});
}
=head1 DESCRIPTION
To deal with incoming JSON-RPC requests, write a controller using L<Mojolicious::Plugin::Qooxdoo::JsonRpcController>
as a parent, instead of the normal L<Mojolicio
package BoardStreams::Error::JSONRPC;
use Moo;
extends 'BoardStreams::Error';
use BoardStreams::Util 'make_one_line';
use Data::Dump 'dump';
use Carp 'croak';
use experimental 'signatures';
use o
;
return make_one_line $text;
};
our $VERSION = "v0.0.36";
has '+code' => (
default => 'jsonrpc_error',
);
has code_num => (
is => 'ro',
isa => sub ($code) {
croa
a string" unless !length(ref $message) and defined $message;
},
required => 1
);
sub TO_JSON ($self) {
return {
code => int $self->code_num,
message => $self->message,
til qw/
trim :bool unique_id hashify next_tick_p sleep_p
encode_json decode_json
/;
use BoardStreams::Exceptions qw/ jsonrpc_error /;
use BoardStreams::REs;
use BoardStreams::DBMigrations;
us
) if @new_dead_worker_ids_for_stream;
$tx->commit;
}
});
# send JSON, but only if transaction is not destroyed
async sub _send_p ($c, $data) {
my sub get_
return min($tx->max_websocket_size, $MAX_WEBSOCKET_SIZE);
}
my $message = encode_json $data;
my $whole_length = length $message;
if ($whole_length <= get_max_size) {
package Mojolicious::Plugin::Qooxdoo::JsonRpcController;
use strict;
use warnings;
use Mojo::JSON qw(encode_json decode_json);
use Mojo::Base 'Mojolicious::Controller';
use Mojo::Promise;
use Storab
# Data comes as JSON object, so fetch a reference to it
my $type = $self->req->headers->content_type//'*missing header*';
if ($type !~ m{^application/json\b}i) {
application/json)");
$self->render(text => "invalid payload format announcement", status=>500);
return;
}
$data = eval { decode_json($self->req-
Support for interacting with Ethereum contracts using the geth RPC interface
=cut
use Moo;
use JSON::MaybeXS;
use Math::BigInt;
use Scalar::Util qw(looks_like_number);
use List::Util qw(first
BUILD {
my ($self) = @_;
my @decoded_json = @{decode_json($self->contract_abi // "[]")};
for my $json_input (@decoded_json) {
if ($json_input->{type} =~ /^function|event|construct
or$/) {
push(@{$self->contract_decoded->{$json_input->{name} // $json_input->{type}}}, $json_input->{inputs});
}
}
unless ($self->contract_decoded->{constructor}) {
h the static items before the dynamic items in the encoded
data
=over 4
=item C<input_list> the json input from the abi data
=back
return the integer offset
=head2 get_hex_param
Convert paramete
ed)
=item event_params_size => numeric (required)
=back
Returns a json encoded object: https://github.com/ethereum/wiki/wiki/JSON-RPC#returns-42
=head2 invoke_deploy
Prepare a deploy transaction.
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use Clone 'clone';
use MIME::Base64 3.11 'encode_base64url';
use URI::Encode qw(uri_encode);
use JSON::Schema::Fit 0.07;
use Sub::Install qw(insta
type => 'object', additionalProperties => 0, properties => $properties };
my $prepared_data = JSON::Schema::Fit->new(replace_invalid_values => 1)->get_adjusted($params, $schema);
return $prepa
arameters = join("&", map {
my $val = $url_opts->{$_};
if (ref($val) eq "JSON::PP::Boolean") {
$val = $val ? "yes" : "no"
}
"$_=$val" }
eger gasPrice )
Return:
New contract instance
=head1 NAME
Ethereum::RPC::Client - Ethereum JSON-RPC Client
=head1 SYNOPSIS
use Ethereum::RPC::Client;
# Create Ethereum::RPC::Client obj
ps://github.com/ethereum/wiki/wiki/JSON-RPC
=head1 DESCRIPTION
This module implements in PERL the JSON-RPC of Ethereum L<https://github.com/ethereum/wiki/wiki/JSON-RPC>
=head1 SEE ALSO
L<Bitcoin::
package Ethereum::RPC::Client;
use strict;
use warnings;
use Moo;
use JSON::MaybeXS;
use Mojo::UserAgent;
use Ethereum::RPC::Contract;
our $VERSION = '0.05';
has host => (
is => 'ro',
,
jsonrpc => '2.0',
params => (ref $_[0] ? $_[0] : [@_]),
};
my $res = $self->http_client->post($url => json => $obj)->result;
# https://eth.wiki/json-rpc/json-rpc-error
, error message: %s (%s)\n", $res->json->{error}->{code}, $res->json->{error}->{message}, $method)
if ($res->json->{error}->{message});
return $res->json->{result};
}
=head2 contract
Cre