Accounts Functions & Variables
The Accounts Module features the following functions:
$.fn.blockstrap.accounts.new(blockchain, name, password, keys, callback)
$.fn.blockstrap.accounts.prepare(to, account_id, amount)
$.fn.blockstrap.accounts.remove(collection, key, element, confirm)
$.fn.blockstrap.accounts.update(account, callback, force_refresh)
$.fn.blockstrap.accounts.updates(index, callback, old_txs, old_tx_count)
$.fn.blockstrap.accounts.verify(account, fields, callback, password)
accounts.access(account_id, tx) - back to top
This function is used to construct a form that can validate whether the active user has the right to access and (or) control the corresponding account. It uses the
account_id to access the stored
keys associated with that account, and then creates the necessary input fields as required. If you wish to send a payment upon completing the validation a valid
tx object is required.
accounts.address(key, account_id) - back to top
This function will return an account object based upon the
key variable matching an address from one of the locally stored accounts. If an optional
account_id is provided it will instead only select that account for ones to check, rather than checking all of the accounts.
accounts.balances() - back to top
This function checks all available accounts to find the total number of accounts for each blockchain as well as the total current balance of each account. It does this internally, without any additional API calls so is not necessarily real-time and cannot be used to update accounts.
accounts.get(id) - back to top
This function will return an account object based upon the provided
If the account
id is not provided it will instead return an array containing all of the account objects.
accounts.new(blockchain, name, password, keys, callback) - back to top
This function will take the required
keys and create a new account, then perform the
callback function upon completion.
accounts.poll(wait, callback) - back to top
This function is used make regular calls to the API in order to update account information. If no
wait time isprovided it will instead refer to the following settings
$.fn.blockstrap.settings.cache.accounts. During each interval, it will perform the
accounts.updates function. If any new transactions have occured since those stored locally, the user will be informed via a modal window regarding the new transactions, and the page content will be refreshed.
accounts.prepare(to, account_id, amount) - back to top
This function is wrapper for
accounts.access and first checks whether the
to address and
account_id are valid before proceeding.
accounts.remove(collection, key, element, confirm) - back to top
This function will use the
key to locate an item stored locally.
confirm is set to true, it will first ask for confirmation before then deleting the item.
element is provided, it will also remove this from the DOM.
accounts.total(rate, prefix) - back to top
This function is used to take the grand total from
accounts.balances and use the
rate variable to select the desired exchange rate from
$.fn.blockstrap.settings.exchange. The output returned can also be prefixed by setting
prefix to something such as
accounts.tx(txid, account_id) - back to top
This function will return a transaction object based upon the
It will by default search all available accounts, but if an
account_id is provided, it will only check the corresponding account.
accounts.txs(account_id) - back to top
This function will return an array of transaction objects based upon the provided
accounts.update(account, callback, force_refresh) - back to top
This function will make an API call to check the TX count for the provided
account object. If new transactions have occured, it will also perform another API call to collect transactions. By default, it will only update an account if the caching time (set as
$.fn.blockstrap.settings.cache.accounts) has passed. If
force_refresh is set, it will update the account regardless.
accounts.updates(index, callback, old_txs, old_tx_count) - back to top
This function cycles through all accounts and applies
accounts.update as required.
accounts.verify(account, fields, callback, password) - back to top
This function is used to verify the results provided after submitting the form generated via