Update return type. #75
This commit is contained in:
parent
59d32cc7f2
commit
f9fcf2c045
|
@ -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)))
|
||||||
|
|
Loading…
Reference in New Issue