Wallet API

The wallet API is defined in keys.js ,which contain the AccountList class.


Using 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

constructor (divName,listName,opts)


Account manipulation

setAccounts(accounts,accountName)


updateAccounts()


find_account(accnt_name)


getSelectedAddrs()


scan_addr(address)


import_keys(label)


maketx(amount, fee, dstAddr)

Reacting to webpage events

accountselected(accnt_name)


addr_selected(addr)

Fetch transaction data for selected addresses

fetch_recvs()


fetch_spents()


fetch_unspents()


fetch_staking_unspents()

Updating HTML layouts

update_addrs()


update_addrs_select(select_name)


update_txs()


update_recvs()


update_spent()


update_unspent()


Wallet event source

seteventsrc = function (in_url = '/newspent_event', handler_sent, handler_recv)