Finance::Dogecoin::API - use the dogeapi.com API from Perl
use Finance::Dogecoin::API; # may throw errors eval { my $dc = Finance::Dogecoin::API->new( api_key => $SECRET_KEY ); my $block = $dc->get_current_block; my $price = $dc->get_current_price; my $balance = $dc->get_balance; my $result = $dc->withdraw( payment_address => $ADDY, amount => $AMOUNT ); }; # tip the author $dc->withdraw( payment_address => 'DPxuFc7dhNrTvNMCE53ENGF5g7LSGrzyYs', amount => 5, );
Finance::Dogecoin::API provides an OO interface to the Dogecoin API provided by http://dogeapi.com/. You need to sign up for an API key to use most of the methods in this class; do so at the site. When creating the object, you must provide the api_key as a constructor argument.
Finance::Dogecoin::API
api_key
This module provides several methods. See the documentation at https://www.dogeapi.com/api_documentation for current details. These methods may all throw an exception if a network error or protocol error occurs, so be ready to catch them:
Returns the current price of Dogecoins in US dollars. This is a floating point number.
Returns the current block of Doge mining.
Returns the current difficulty of Doge mining.
Returns the balance of your entire account across all wallets. This is a floating point number.
Returns an array reference of all payment addresses associated with your account. This array may be empty.
Withdraws $amount from your account and sends it to <$address>. The API and the Doge network each charge a modest transaction fee. The transaction will fail unless your account meets these criteria. In particular, you must transfer at least 5 Doge at a time.
$amount
If you do not provide both the payment_address and amount parameters, this method will throw an exception.
payment_address
amount
Creates and returns a new payment address for your account. You may provide an optional address_label parameter. The API will use this alphanumeric value as the label if possible.
address_label
Returns the current amount of Dogecoins recieved at the given address or label. This method will throw an exception if you do not provide either the payment_address or address_label parameters. This method will return the number 0 if you provide an invalid address or label.
0
Returns the payment address for the given address label. This method will throw an exception if you do not provide the address_label parameter. This method will return the string No matching addresses if there are no matching addresses.
No matching addresses
The Dogecoin API is under development, so these methods might change and new methods might appear.
Copyright 2014 chromatic, some rights reserved.
This program is free software. You can redistribute it and/or modify it under the same terms as Perl 5.18.
To install Finance::Dogecoin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::Dogecoin
CPAN shell
perl -MCPAN -e shell install Finance::Dogecoin
For more information on module installation, please visit the detailed CPAN module installation guide.