The wallet API is defined in keys.js ,which contain the AccountList class.
To use the wallet API, first need to import the keys.js file
<script type="text/javascript" src="/assets/js/keys.js"></script>
And create a new instance of the AccountList class :
<script type="text/javascript" >
MyAccount = new new AccountList(' Account list block ','Transaction list block ', Options);
</script>
Options:
{
'withSecret':true|false , Show secret key to use private key in the address list
'staking':true|false , Get staking informations
'newAccnt':true|false Show box the create new account
}
And then calling AccountList methods to fetch and update data on the webpage.
<script type= "text/javascript" src= "/assets/js/keys.js"></script > // Wallet API
<script type= "text/javascript" src= "/assets/js/ecdsa_bundle.js"></script > // ECDSA Signature API
<section><h2 class="heading-md"> Manage your wallet </h2><div id="account_list"></div></section >
<section><h2 class="heading-md"> Manage your transactions </h2><div id="my_wallet"></div></section>
<script type="text/javascript">
jQuery(document).ready(function () {
lang = 'en';
api_base_url = '';
site_base_url = '/nodix.site';
ec = new EC( 'secp256k1');
MyAccount = new AccountList( 'account_list' , 'my_wallet' , { 'withSecret' : false , 'staking' : false , 'newAccnt' : true });
});
</script>
constructor (divName,listName,opts)
setAccounts(accounts,accountName)
updateAccounts()
find_account(accnt_name)
getSelectedAddrs()
scan_addr(address)
import_keys(label)
maketx(amount, fee, dstAddr)
accountselected(accnt_name)
addr_selected(addr)
fetch_recvs()
fetch_spents()
fetch_unspents()
fetch_staking_unspents()
update_addrs()
update_addrs_select(select_name)
update_txs()
update_recvs()
update_spent()
update_unspent()
seteventsrc = function (in_url = '/newspent_event', handler_sent, handler_recv)