Skip to content

Latest commit

 

History

History

accounts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Accounts Module

Accounts Functions & Variables

The Accounts Module features the following functions:


accounts.access(account_id, tx, chain, standard, from) - 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 and chain 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, raw, get_widgets) - 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, existing_account) - 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. Providing a valid account object using existing_account enables new blockchains and sub-accounts to be added to existing accounts.

- back to top


accounts.poll(wait, callback, loop, loop_delay) - back to top

This function is used make regular calls to the API in order to update account information. If no wait time is provided 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. Setting loop to true ensure that the polling continues to occur after passing each loop_delay timing.

- back to top


accounts.prepare(to, account_id, amount, chain, standard, selected_fee) - back to top

This function is wrapper for accounts.access and first checks whether the to address and account_id are valid before proceeding. You may also use selected_fee for each individual transaction fee, else the default fee will be used.

- back to top


accounts.remove(collection, key, element, confirm, chain) - 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, page, chain) - 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. The chain variable can be used when wanting to update a single address from an account.

- 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, from, show_seed) - back to top

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

- back to top


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