Last active
April 6, 2020 17:24
-
-
Save dgarcia360/55c9a2d38133ac4142a67a9833e93603 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds mosaic information to balance mosaics | |
* @param balance array of mosaics | |
* @param network selected network | |
* @return Promise with altered balance | |
*/ | |
private _addDivisibilityToBalance(balance, network) { | |
var promises = []; | |
for (let mosaic of balance.data) { | |
//function where you call to get the mosaic Definition | |
promises.push(this.getMosaicsMetaDataPair(mosaic.mosaicId.namespaceId, mosaic.mosaicId.name, network)); | |
} | |
return Promise.all(promises).then(values => { | |
var i = 0; | |
for (let mosaic of balance.data) { | |
mosaic.definition = values[i][mosaic.mosaicId.namespaceId + ':' + mosaic.mosaicId.name].mosaicDefinition; | |
++i; | |
} | |
return balance; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment