NAME
Circle::Wallet - the circle chain SDK in PERL
VERSION
Version 0.03
SYNOPSIS
use Circle::Wallet;
# first of all, you must login and then do the following operations.
# how to login please refer to Circle::User module.
# first time to use, each user has 3 wallets to create.
my $response = create_wallet();
my $address;
if ($response->{status} == 200) {
$address = $response->{data};
}
$response = balance_of_address($address);
# $response->{status} == 200, get the balance: $response->{data}
$response = assets_of_address($address);
# $response->{status} == 200, get the assets: $response->{data}
# if you created 3 wallets
$response = list_wallet();
# $response->{status} == 200, get the address list: $response->{data}
...
EXPORT
The default exported methods:
- 1. create_wallet
- 2. list_wallet
- 3. balance_of_address
- 4. balance_of_wallet
- 5. assets_of_address
- 6. assets_of_wallet
- 7. public_key_hash_from_address
- 8. send_to
- 9. pay
- 10. search_tx_by_type
- 11. search_tx_by_time
- 12. let_me_try
- 13. public_address_of_uid
- 14. public_balance_of_address
- 15. public_assets_of_address
- 16. public_search_transaction
SUBROUTINES/METHODS
create_wallet
create wallet in the cloud.
list_wallet
list the wallet address
my $response = list_wallet();
if ($response->{status} == 200) {
my $addresses = $response->{data};
// process address list here.
}
balance_of_address
get the balance of the address
my $response = balance_of_address( $address, $type ); # type: 1 ownership, 2 identity
if ($response->{status} == 200) {
my $balance = $response->{data};
// process the balance here.
}
balance_of_wallet
get the balance of the wallets
$response = balance_of_wallet();
if ($response->{status} == 200) {
my $balance_infos = $response->{data};
// process balance_infos data here.
}
assets_of_address
get the assets of the address
my $response = assets_of_address( $address, $type); # type: 1 ownership, 2 identity
if ($response->{status} == 200) {
my $asset_infos = $response->{data};
// process assets info here.
}
assets_of_wallet
get the assets of the wallet
my $response = assets_of_wallet();
if ($response->{status} == 200) {
my $assets_infos = $response->{data};
// process assets info here.
}
public_key_hash_from_address
get the public key hash from address
my $response = public_key_hash_from_address( $address );
if ($response->{status} == 200) {
my $public_key_hash = $response->{data};
// process public key hash here.
}
send_to
send assets to others
my $response = send_to({
from => '<from-address>',
address => '<to-address>',
email => 'test@gmail.com',
transContent => {
type => 1, # 1 ownership, 2 identity
uuid => '<asset uuid string>',
},
payPassword => '<pay password>'
});
if ($response->{status} == 200) {
my $success = $response->{data};
// check the sendTo api success or failure here.
}
pay
pay balance to others
my $response = pay({
from => '<from-address>',
to => '<to-address>',
value => 1000, # send 1000 li to others.
payPassword => '<pay password>'
});
if ($response->{status} == 200) {
my $success = $response->{data};
// check pay api success or failure.
}
search_tx_by_type
search transaction by type.
my $type = 0; // balance
my $page_no = 1;
my $page_size = 100;
my $response = search_tx_by_type( $type, $page_no, $page_size );
if ($response->{status} == 20) {
my $tx_info_list = $response->{data};
// process your tx info list here.
}
search_tx_by_time
search transaction by time
my $start_time = 1764233300;
my $end_time = 18343232300;
my $page_size = 100;
my $response = search_tx_by_time( $start_time, $end_time, $page_size );
if ( $response->{status} == 20 ) {
my $tx_info_list = $response->{data};
// process your tx info list here .;
}
let_me_try
let me try to mine the block, and get some assets and balances.
my $response = let_me_try();
if ($response->{status} == 200) {
my $transaction_info = $response->{data};
// process transaction info here.
}
public_address_of_uid
public api without user login, address of uid.
my $response = public_address_of_uid( $uid );
if ($response->{status} == 200) {
my $address = $response->{data};
// process address code here.
}
public_balance_of_address
public api without user login. balance_of_address
my $response = public_balance_of_address( $address );
if ($response->{status} == 200) {
my $balance = $response->{data};
// process balance code here.
}
public_assets_of_address
public api without user login, assets of address
my $response = public_assets_of_address( $address, $type ); # type: 1 ownership 2 identity
if ($response->{status} == 200) {
my $assets = $response->{data};
// process assets here.
}
public_search_transaction
public api without user login, search transaction
my $response = public_search_transaction({
address => '<address>',
inOut => 'IN', # IN/OUT
transactionContent => {
type => 1, # 0 balance, 1 ownership, 2 identity
# uid hex string or (uid hex string + '' + data hash hex)
uuid => '<uid hex string>',
}
});
if ($response->{status} == 200) {
my $trans = $response->{data};
// process trans data here.
}
AUTHOR
charles li, <lidh04 at gmail.com>
BUGS
Please report any bugs or feature requests to bug-circle-chain at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Circle-Chain. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SEE ALSO
See Circle::Common for circle common module.
See Circle::User for circle user module .
See Circle::Wallet for circle wallet module.
See Circle::Block for circle block module.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Circle::Wallet
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
This module belong to author lidh04@gmail
LICENSE AND COPYRIGHT
This software is Copyright (c) 2024 by charles li.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)