ChainStore
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
chain_time_offset: *[] |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
subError: * |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
subscribers: * tracks everyone who wants to receive updates when the cache changes |
|
public |
timeout: * |
|
public |
|
|
public |
workers: * |
Method Summary
Public Methods | ||
public |
addProposalData(approvals: *, objectId: *): * |
|
public |
Clears all cached state. |
|
public |
clearObjectCache(id: *) Clear an object from the cache to force it to be fetched again. |
|
public |
fetchAllWorkers(): * |
|
public |
fetchCommitteeMemberByAccount(account_id: *): * |
|
public |
fetchFullAccount(an: *): * Fetches an account and all of its associated data in a single query |
|
public |
fetchObject(id: *, force: boolean, autosubscribe: boolean, no_full_account: boolean): * If there is not already a pending request to fetch this object, a new request will be made. |
|
public |
fetchRecentHistory(account: *): * There are two ways to extend the account history, add new more recent history, and extend historic hstory. |
|
public |
fetchWitnessByAccount(account_id: *): * |
|
public |
getAccount(name_or_id: *, autosubscribe: boolean): * |
|
public |
getAccountBalance(account: *, asset_type: *): number |
|
public |
getAccountMemberStatus(account: *): string |
|
public |
getAccountName(id: *): * |
|
public |
getAccountRefsOfAccount(the: *): * |
|
public |
getAccountRefsOfKey(the: *): * |
|
public |
getAsset(id_or_symbol: *): * |
|
public |
getBalanceObjects(address: *): * |
|
public |
getCommitteeMemberById(account_id: *): * This method will attempt to lookup committee member by account_id. |
|
public |
|
|
public |
getHeadBlockDate(): * |
|
public |
There are three states an object id could be in: |
|
public |
getObjectByVoteID(vote_id: *): * |
|
public |
getObjectsByVoteIds(vote_ids: *): * |
|
public |
getWitnessById(account_id: *): * This method will attempt to lookup witness by account_id. |
|
public |
|
|
public |
|
|
public |
onUpdate(updated_objects: *) |
|
public |
resetCache(subscribe_to_new: *): * |
|
public |
setDispatchFrequency(freq: *) |
|
public |
subscribe(callback: *): * Add a callback that will be called anytime any object in the cache is updated |
|
public |
unSubFrom(type: *, id: *) |
|
public |
unsubscribe(callback: *): * Remove a callback that was previously added via subscribe |
Private Methods | ||
private |
_isSubbedTo(type: *, id: *): * |
|
private |
_subTo(type: *, id: *) |
|
private |
_updateObject(object: *, notify_subscribers: boolean, emit: boolean): * Updates the object in place by only merging the set properties of object. |
Public Constructors
public constructor() source
Public Members
public account_history_requests: * source
public account_ids_by_account: * source
public account_ids_by_key: * source
public accounts_by_name: * source
public assets_by_symbol: * source
public balance_objects_by_address: * source
public chain_time_offset: *[] source
public committee_by_account_id: * source
public fetching_get_full_accounts: * source
public get_account_refs_of_accounts_calls: * source
public get_account_refs_of_keys_calls: * source
public get_full_accounts_subscriptions: * source
public head_block_time_string: * source
public objects_by_id: * source
public objects_by_vote_id: * source
public subError: * source
public subbed_accounts: * source
public subbed_committee: * source
public subbed_witnesses: * source
public timeout: * source
public witness_by_account_id: * source
public workers: * source
Public Methods
public addProposalData(approvals: *, objectId: *): * source
Params:
Name | Type | Attribute | Description |
approvals | * | ||
objectId | * |
Return:
* |
public clearCache() source
Clears all cached state. This should be called any time the network connection is reset.
public clearObjectCache(id: *) source
Clear an object from the cache to force it to be fetched again. This may be useful if a query failed the first time and the wallet has reason to believe it may succeede the second time.
Params:
Name | Type | Attribute | Description |
id | * |
public fetchCommitteeMemberByAccount(account_id: *): * source
Params:
Name | Type | Attribute | Description |
account_id | * |
Return:
* | a promise with the witness object |
public fetchFullAccount(an: *): * source
Fetches an account and all of its associated data in a single query
Params:
Name | Type | Attribute | Description |
an | * | account name or account id |
Return:
* | null if the object has been queried and was not found |
public fetchObject(id: *, force: boolean, autosubscribe: boolean, no_full_account: boolean): * source
If there is not already a pending request to fetch this object, a new request will be made.
Return:
* | the object if it does exist and is in our cache |
public fetchRecentHistory(account: *): * source
There are two ways to extend the account history, add new more recent history, and extend historic hstory. This method will fetch the most recent account history and prepend it to the list of historic operations.
Params:
Name | Type | Attribute | Description |
account | * | immutable account object |
Return:
* | a promise with the account history |
public fetchWitnessByAccount(account_id: *): * source
Params:
Name | Type | Attribute | Description |
account_id | * |
Return:
* | a promise with the witness object |
public getAccount(name_or_id: *, autosubscribe: boolean): * source
Params:
Name | Type | Attribute | Description |
name_or_id | * | ||
autosubscribe | boolean |
|
Return:
* | the account object if it does exist |
public getAccountBalance(account: *, asset_type: *): number source
Params:
Name | Type | Attribute | Description |
account | * | ||
asset_type | * |
public getAccountMemberStatus(account: *): string source
Params:
Name | Type | Attribute | Description |
account | * |
public getAccountName(id: *): * source
Params:
Name | Type | Attribute | Description |
id | * |
Return:
* | the account name |
public getAccountRefsOfAccount(the: *): * source
Params:
Name | Type | Attribute | Description |
the | * | account id to find accounts that reference it |
Return:
* | undefined if the result is unknown If this method returns undefined, then it will send a request to the server for the current set of accounts after which the server will notify us of any accounts that reference these keys |
public getAccountRefsOfKey(the: *): * source
Params:
Name | Type | Attribute | Description |
the | * | public key to find accounts that reference it |
Return:
* | undefined if the result is unknown If this method returns undefined, then it will send a request to the server for the current set of accounts after which the server will notify us of any accounts that reference these keys |
public getAsset(id_or_symbol: *): * source
Params:
Name | Type | Attribute | Description |
id_or_symbol | * |
Return:
* | object if the id_or_symbol exists |
public getBalanceObjects(address: *): * source
Params:
Name | Type | Attribute | Description |
address | * |
Return:
* | a empty Set if no items are found If this method returns undefined, then it will send a request to the server for the current state after which it will be subscribed to changes to this set. |
public getCommitteeMemberById(account_id: *): * source
This method will attempt to lookup committee member by account_id. If committee member doesn't exist it will return null, if committee member is found it will return committee member object, if it's not fetched yet it will return undefined.
Params:
Name | Type | Attribute | Description |
account_id | * | account id |
Return:
* |
public getObject(id: *, force: boolean, autosubscribe: boolean, no_full_account: boolean): * source
There are three states an object id could be in:
- undefined - returned if a query is pending
- defined - return an object
- null - query return null
Return:
* |
public getObjectByVoteID(vote_id: *): * source
Params:
Name | Type | Attribute | Description |
vote_id | * |
Return:
* |
public getObjectsByVoteIds(vote_ids: *): * source
Params:
Name | Type | Attribute | Description |
vote_ids | * |
Return:
* |
public getWitnessById(account_id: *): * source
This method will attempt to lookup witness by account_id. If witness doesn't exist it will return null, if witness is found it will return witness object, if it's not fetched yet it will return undefined.
Params:
Name | Type | Attribute | Description |
account_id | * | account id |
Return:
* |
public init(subscribe_to_new: boolean): * source
Params:
Name | Type | Attribute | Description |
subscribe_to_new | boolean |
|
Return:
* |
public notifySubscribers() source
public onUpdate(updated_objects: *) source
Params:
Name | Type | Attribute | Description |
updated_objects | * |
public resetCache(subscribe_to_new: *): * source
Params:
Name | Type | Attribute | Description |
subscribe_to_new | * |
Return:
* |
public setDispatchFrequency(freq: *) source
Params:
Name | Type | Attribute | Description |
freq | * |
public subscribe(callback: *): * source
Add a callback that will be called anytime any object in the cache is updated
Params:
Name | Type | Attribute | Description |
callback | * |
Return:
* |
public unSubFrom(type: *, id: *) source
Params:
Name | Type | Attribute | Description |
type | * | ||
id | * |
public unsubscribe(callback: *): * source
Remove a callback that was previously added via subscribe
Params:
Name | Type | Attribute | Description |
callback | * |
Return:
* |
Private Methods
private _isSubbedTo(type: *, id: *): * source
Params:
Name | Type | Attribute | Description |
type | * | ||
id | * |
Return:
* |
private _subTo(type: *, id: *) source
Params:
Name | Type | Attribute | Description |
type | * | ||
id | * |
private _updateObject(object: *, notify_subscribers: boolean, emit: boolean): * source
Updates the object in place by only merging the set properties of object.
This method will create an immutable object with the given ID if it does not already exist.
This is a "private" method called when data is received from the server and should not be used by others.
Return:
* | an Immutable constructed from object and deep merged with the current state |