Accounts Module

Accounts Functions & Variables

The Accounts Module features the following functions:


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.

- back to top


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.

- back to top


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.

- back to top


accounts.get(id) - back to top

This function will return an account object based upon the provided id.

If the account id is not provided it will instead return an array containing all of the account objects.

- back to top


accounts.new(blockchain, name, password, keys, callback) - back to top

This function will take the required blockchain, name, password and keys and create a new account, then perform the callback function upon completion.

- back to top


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.

- back to top


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.

- back to top


accounts.remove(collection, key, element, confirm) - back to top

This function will use the collection and key to locate an item stored locally.

If the confirm is set to true, it will first ask for confirmation before then deleting the item.

If an element is provided, it will also remove this from the DOM.

- back to top


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 US$.

- back to top


accounts.tx(txid, account_id) - back to top

This function will return a transaction object based upon the txid.

It will by default search all available accounts, but if an account_id is provided, it will only check the corresponding account.

- back to top


accounts.txs(account_id) - back to top

This function will return an array of transaction objects based upon the provided account_id.

- back to top


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.

- back to top


accounts.updates(index, callback, old_txs, old_tx_count) - back to top

This function cycles through all accounts and applies accounts.update as required.

- back to top


accounts.verify(account, fields, callback, password) - back to top

This function is used to verify the results provided after submitting the form generated via accounts.access.

- back to top


  1. Related Articles
  2. Back to Modules
  3. Accounts
  4. API
  5. Buttons
  6. Contacts
  7. Blockchains
  8. Data
  9. Filters
  10. Forms
  11. Security
  12. Styles
  13. Templates
  14. Table of Contents