NAME

CryptoTron::GetAccount - Perl extension for use with the blockchain of the crypto coin Tron.

SYNOPSIS

use CryptoTron::ParseAccount;

# Initialise the variable $balance.
my $balance = 0;

# Set the JSON data.
my $json_data = '{"balance": 1000000000, 
                  "frozen": [{"frozen_balance": 2000000000}],
                  "account_resource": {"frozen_balance_for_energy": {"frozen_balance": 300000000}}}';

# Get the total balance.
$balance = TotalBalance($json_data);
print $balance;

# Get the free balance.
$balance = FreeBalance($json_data);
print $balance;

# Get the frozen balance.
$balance = FrozenBalance($json_data);
print $balance;

DESCRIPTION

The module consists of methods for parsing raw JSON data. The raw JSON data can come from the module CryptoTron::GetAccount or other sources, as long it is a valid JSON object.

A distinction is made between a freely available Tron amount and a frozen Tron amount. The frozen Tron amount differs in ENERGY and BANDWIDTH. The Tron amount of interest is output with a decimal point and has a maximum of 6 digits after the decimal point.

If the raw JSON data is malformed, an exception is captured silently. The resulting amount values will be set to zero.

METHODS

Methods implemented so far:

TotalBalance()

FreeBalance()

FrozenBalance()

CreateTime()

LastWithdrawTime()

NextWithdrawTime()

SEE ALSO

CryptoTron::GetAccount

POSIX

JSON::PP

Try::Catch

AUTHOR

Dr. Peter Netz, <ztenretep@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2022 by Dr. Peter Netz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.30.0 or, at your option, any later version of Perl 5 you may have available.