The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Async::Blockchain::ETH - Ethereum based subscription.

SYNOPSIS

    my $loop = IO::Async::Loop->new;

    $loop->add(
        my $eth_client = Net::Async::Blockchain::ETH->new(
            subscription_url => "ws://127.0.0.1:8546",
            blockchain_code  => 'Ethereum',
        )
    );

    $eth_client->subscribe("blocks")->each(sub { print shift->{hash} })->get;

DESCRIPTION

Ethereum subscription using websocket node client

subscription_id

Actual subscription ID, this ID is received every time when a subscription is created.

An hexadecimal string

websocket_client

Returns the current instance for Net::Async::Blockchain::Client::Websocket if not created create a new one.

Net::Async::Blockchain::Client::Websocket

subscribe

Connect to the websocket port and subscribe to the implemented subscription: - https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB#create-subscription

  • subscription string subscription name

Ryu::Source

INHERITED METHODS

Net::Async::Blockchain

blockchain_code, configure, subscription_msg_timeout, subscription_response, subscription_timeout, subscription_url

IO::Async::Notifier

add_child, adopt_future, adopted_futures, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent