The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Finance::Dogechain::Address - class representing addresses in the Dogechain API

SYNOPSIS

    use Finance::Dogechain::Address;

    my $address = Finance::Dogechain::Address->new(
        address => 'DDMczmdPkpHMCaAJGEno11hMRc46A2uKsj',
    );

    my $balance  = $address->balance;
    my $received = $address->received;
    my $sent     = $address->sent;
    my $unspent  = $address->unspent;

DESCRIPTION

Finance::Dogechain::Address represents addresses in the Dogechain API. It inherits methods from Finance::Dogechain::Base and provides several of its own.

METHODS

new( ua => ..., base_url => ..., address => '...' )

Creates a new instance of this object. You must provide a address parameter, which is either a valid address in the Dogecoin public ledger.

Other default constructor values are:

  • ua, a user agent. Defaults to an instance of Mojo::UserAgent.

  • base_url, the base URL path of the dogechain.info API (or an equivalent).

These attributes are available by instance methods address(), ua(), and base_url().

balance()

Returns a floating point value representing the current balance (number of Dogecoins) that this address contains.

Returns an undefined value (undef in scalar context or an empty list in list context) if the HTTP call did not succeed.

Returns 0 if the HTTP call did succeed but the API returned an unsuccessful payload.

received()

Returns a floating point value representing the total number of Dogecoins that this address has received.

Returns an undefined value (undef in scalar context or an empty list in list context) if the HTTP call did not succeed.

Returns 0 if the HTTP call did succeed but the API returned an unsuccessful payload.

sent()

Returns a floating point value representing the total number of Dogecoins that this address has sent.

Returns an undefined value (undef in scalar context or an empty list in list context) if the HTTP call did not succeed.

Returns 0 if the HTTP call did succeed but the API returned an unsuccessful payload.

unspent()

Returns an array reference of values from transaction outputs that this address has not yet spent.

Returns an undefined value (undef in scalar context or an empty list in list context) if the HTTP call did not succeed.

Returns 0 if the HTTP call did succeed but the API returned an unsuccessful payload.

TO_JSON()

Returns a string representation of this object (its class and address) so that you can serialize this object with JSON.

COPYRIGHT & LICENSE

Copyright 2021 chromatic, some rights reserved.

This program is free software. You can redistribute it and/or modify it under the same terms as Perl 5.32.