Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Updated API docs (Geth compatibility PR #47) #48

Merged
merged 1 commit into from
May 17, 2018
Merged

Conversation

holgerd77
Copy link
Member

Updated README API documentation according to #47 (Geth compatibility), added example code snippet.

@holgerd77
Copy link
Member Author

@vpulim Ok, have updated the docs caring all the stuff together manually (phew, the other way would have been definitely more fun 🐌 😄 Can you have a look?

@holgerd77
Copy link
Member Author

@coveralls
Copy link

coveralls commented May 16, 2018

Coverage Status

Coverage remained the same at 96.93% when pulling cafa973 on update-docs into 78e23e8 on master.

README.md Outdated
const utils = require('ethereumjs-util')

var gethDbPath = './chaindata' // Add your own path here
var db = levelup(gethDbPath, { db: leveldown })
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nitpick: these should be const declarations. (my fault)

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

```javascript
const levelup = require('levelup')
const leveldown = require('leveldown')
const Blockchain = require('./index.js')
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be require('ethereumjs-blockchain')?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, it's a depending on what installation context one is executing the example. This is for executing e.g. out of a cloned repo context. I think people will get what to insert here, other ethereumjs library examples are also written from this perspective, so I'll leave it.

README.md Outdated
- `totallDifficulty` - The totall difficulty which is the some of a the difficulty of all the prevous blocks
[DEPRECATION NOTE]
The old separated DB constructor parameters `opts.blockDB` and `opts.detailsDB` from before the Geth DB-compatible ``v3.0.0`` release are deprecated and continued usage is discouraged. When provided `opts.blockDB` will be used
as `opts.db` and `opts.detailsDB` is ignored. On storage level DB formats are not compatible and it is not
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a typo: "On storage level DB formats..."?

Copy link
Member Author

Choose a reason for hiding this comment

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

Made this a bit clearer.

README.md Outdated

#### `blockchain.getHead(name, callback)`
Returns that head block.
- `name` - name of the state root head
Copy link
Contributor

@vpulim vpulim May 16, 2018

Choose a reason for hiding this comment

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

name is optional (defaults to 'vm')

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@vpulim
Copy link
Contributor

vpulim commented May 16, 2018

Awesome! Thanks for doing this. Overall, it looks great. I'm a little OCD so I left some comments on some minor typos/nitpicks above :)

README.md Outdated
- [`blockchain.getBlockHashes(parentHash, count, cb)`](#blockchaingetblockhashesparenthash-count-cb)
- [`blockchain.getBlockChain(startingHashes, count, cb)`](#blockchaingetblockhashesparenthash-count-cb)
- [`blockchain.selectNeededHashes(hashes, cb)`](#blockchainselectneededhasheshashes-cb)
- [`blockchain.getBlocks(blockId, maxBlocks, skip, reverse, [cb])`](#blockchaingetblocksblockid-maxblocks-skip-reverse-cb)
Copy link
Contributor

Choose a reason for hiding this comment

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

[cb] should be [callback] for consistent naming

Copy link
Member Author

Choose a reason for hiding this comment

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

Did this the other way around and now use cb everywhere since this is also the naming in all the function declarations.

README.md Outdated
- [`blockchain.getBlocks(blockId, maxBlocks, skip, reverse, [cb])`](#blockchaingetblocksblockid-maxblocks-skip-reverse-cb)
- [`blockchain.selectNeededHashes(hashes, [callback])`](#blockchainselectneededhasheshashes-callback)
- [`blockchain.delBlock(blockHash, [callback])`](#blockchaindelblockblockhash-callback)
- [`blockchain.iterator(name, onBlock, [cb])`](#blockchainiteratorname-onblock-cb)
Copy link
Contributor

@vpulim vpulim May 16, 2018

Choose a reason for hiding this comment

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

same here ([cb] => [callback])

Copy link
Member Author

Choose a reason for hiding this comment

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

Same.

@holgerd77 holgerd77 merged commit 16cddd1 into master May 17, 2018
@holgerd77 holgerd77 deleted the update-docs branch May 17, 2018 10:26
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.

3 participants