Last active
November 2, 2020 15:33
-
-
Save KasraAb/428bcb4427786d29bfaacf64ee3721cb to your computer and use it in GitHub Desktop.
NashTransfer
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
//update recipient's account | |
const new_recipient_nash = (!recipient.asset.nash)? this.asset.amount | |
: new BigNum(recipient.asset.nash).add(this.asset.amount).toString(); | |
const updated_recipient = { ...recipient, asset: { ...recipient.asset, nash: new_recipient_nash} }; | |
store.account.set(updated_recipient.address, updated_recipient); | |
//update sender's account | |
const new_sender_nash = new BigNum(sender.asset.nash).sub(this.asset.amount).toString(); | |
const updated_sender = { ...sender, asset: { ...sender.asset, nash: new_sender_nash} }; | |
store.account.set(updated_sender.address, updated_sender); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment