Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

System asset support #107

Merged
merged 3 commits into from
Dec 8, 2017
Merged

System asset support #107

merged 3 commits into from
Dec 8, 2017

Conversation

rockacola
Copy link
Collaborator

@rockacola rockacola commented Dec 5, 2017

Description

Adding and exposing asset related endpoints in storage class. They are:

  • 'store.getAssetList' - list all available assets found in address collection in storage.
  • 'store.getAsset' - get document of the specific asset from address collection in storage.
  • 'store.getAssetState' - get the 'state' object of the specific asset.
  • 'store.getAssetBalance' - get total balance of the specific asset within the specific wallet address.
  • 'store.getAssetTransactions' - list transactions relates to the specific asset within the specific wallet address.

There are several major changes:

  • address collection now has a state property in its schema. Backward compatibility is ensured, you may perform sync over your existing local database without corruption concern.
  • Sync process now has a separate clock that triggers every 60 seconds to verify assets for missing state information.
  • several method returns in /storage/mongodb.js has been modified to "not to throw error upon empty result".

How Has This Been Tested?

Smoke tested via various of usages.

An example usage can be found to test run usages: /examples/nodejs/node/asset.js.

Proper integration tests to be added in 0.7.0 follow by unit tests in the future.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -86,7 +86,7 @@ class mesh {
* @returns {Promise.<Object>}
*/
getBlock (index, sort = 'latency') {
return this.nodeWithBlock(index, sort).rpc.getBlock(index)
return (this.nodeWithBlock(index, sort) || this.nodes[0]).rpc.getBlock(index)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if node[0] is dead?

@lllwvlvwlll lllwvlvwlll merged commit fe0dc84 into CityOfZion:develop Dec 8, 2017
@lllwvlvwlll lllwvlvwlll added this to Done in 0.6.0: Mnemonic via automation Dec 8, 2017
@lllwvlvwlll lllwvlvwlll removed this from Done in 0.6.0: Mnemonic Dec 8, 2017
@rockacola rockacola deleted the feature/asset-support branch December 10, 2017 23:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants