QuantumMechanics / NEM-sdk

NEM Developer Kit for Node.js and the browser
MIT License
137 stars 82 forks source link

NEM-NANOWALLET-527 - unable to send more than 1000 mosaics - fix for … #49

Closed cryptoBeliever closed 6 years ago

cryptoBeliever commented 6 years ago

Fix for issue: https://github.com/NemProject/NanoWallet/issues/527

In nanowallet generated main.js code I've found twice this code but there is also third one. createWithMosaics function with pretty same code but I can't locate it.

    static createWithMosaics(timeWindow, recipient, mosaics, message) {
...
                const quantity = mosaic.amount;
                const maxMosaicQuantity = 9000000000000000;
                const totalMosaicQuantity = mosaic.properties.initialSupply * Math.pow(10, mosaic.properties.divisibility);
                const supplyRelatedAdjustment = Math.floor(0.8 * Math.log(maxMosaicQuantity / totalMosaicQuantity));
                const xemFee = Math.min(25, quantity * 900000 / mosaic.properties.initialSupply);
                fee += 0.05 * Math.max(1, xemFee - supplyRelatedAdjustment) * 1000000;
...
    }

Bounty address: NDC64AJMAFIZSA2OLJZWRYGFMSN7ZHZISCNMZTM5