Project is in active development and has been moved to the EthereumJS VM monorepo.
This release introduces a major API upgrade from callbacks to Promises.
Example using async/await syntax:
import { BaseTrie as Trie } from 'merkle-patricia-tree'
const trie = new Trie()
async function test() {
await trie.put(Buffer.from('test'), Buffer.from('one'))
const value = await trie.get(Buffer.from('test'))
console.log(value.toString()) // 'one'
}
test()
See the docs for the latest Promise-based method signatures.
To clarify the method's purpose Trie.prove
has been renamed to Trie.createProof
. Trie.prove
has been deprecated but will remain as an alias for Trie.createProof
until removed.
getRaw
, putRaw
and delRaw
were deprecated in v3.0.0
and have been removed from this release. Instead, please use trie.db.get
, trie.db.put
, and trie.db.del
. If using a SecureTrie
or CheckpointTrie
, use trie._mainDB
to override the checkpointing mechanism and interact directly with the db.
SecureTrie.copy
now includes checkpoint metadata by default. To maintain original behavior of not copying checkpoint state, pass false
to param includeCheckpoints
.
Nibbles
type for number[]
(#115)_formatNode
(#109)failingRefactorTests
to secure.spec.ts
(#110)This release comes along with some major version bump of the underlying level
database storage backend. If you have the library deeper integrated in one of
your projects make sure that the new DB version plays well with the rest of the
code.
The release also introduces modern ES6
JavaScript for the library (thanks @alextsg)
switching to ES6
classes and clean inheritance on all the modules.
Trie.prove()
and verification Trie.verifyProof()
(see ./proof.js)