Update return type. #75

This commit is contained in:
Miguel Mota 2023-03-30 10:03:46 -07:00
parent 59d32cc7f2
commit f9fcf2c045
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9
1 changed files with 3 additions and 3 deletions

View File

@ -401,20 +401,20 @@ export class MerkleTree extends Base {
*const layers = tree.getLayers() *const layers = tree.getLayers()
*``` *```
*/ */
getLayers ():Buffer[] { getLayers ():Buffer[][] {
return this.layers return this.layers
} }
/** /**
* getHexLayers * getHexLayers
* @desc Returns multi-dimensional array of all layers of Merkle Tree, including leaves and root as hex strings. * @desc Returns multi-dimensional array of all layers of Merkle Tree, including leaves and root as hex strings.
* @return {String[]} * @return {String[][]}
* @example * @example
*```js *```js
*const layers = tree.getHexLayers() *const layers = tree.getHexLayers()
*``` *```
*/ */
getHexLayers ():string[] { getHexLayers ():string[][] {
return this.layers.reduce((acc: string[][], item: Buffer[]) => { return this.layers.reduce((acc: string[][], item: Buffer[]) => {
if (Array.isArray(item)) { if (Array.isArray(item)) {
acc.push(item.map(layer => this.bufferToHex(layer))) acc.push(item.map(layer => this.bufferToHex(layer)))