How to use the merkle-patricia-tree/baseTrie function in merkle-patricia-tree

To help you get started, we’ve selected a few merkle-patricia-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / ganache-core / src / ledgers / ethereum / components / account-manager.ts View on Github external
public async get(address: Address, blockNumber: Buffer | Tag = Tag.LATEST): Promise {
        const blockchain = this.blockchain;
        const block = await blockchain.blocks.get(blockNumber);
        const trieCopy = new Trie((blockchain as any).database.trie, block.value.header.stateRoot);
        return new Promise((resolve, reject) => {
            trieCopy.get(address.toBuffer(), (err, data)=>{
                if(err) return reject(err);
                resolve(new Account(data));
            });
        });
    }
}