web3-utils#hexToBytes TypeScript Examples
The following examples show how to use
web3-utils#hexToBytes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: merkle.ts From bal-mining-scripts with GNU General Public License v3.0 | 6 votes |
constructor(elements) {
this.elements = elements
.filter((el) => el)
.map((el) => Buffer.from(hexToBytes(el)));
// Sort elements
this.elements.sort(Buffer.compare);
// Deduplicate elements
this.elements = this.bufDedup(this.elements);
// Create layers
this.layers = this.getLayers(this.elements);
}
Example #2
Source File: merkle.ts From bal-mining-scripts with GNU General Public License v3.0 | 5 votes |
// external call - convert to buffer
getHexProof(_el) {
const el = Buffer.from(hexToBytes(_el));
const proof = this.getProof(el);
return this.bufArrToHexArr(proof);
}