Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
id: this.asset.inTransfer.dappId,
},
]);
const dappTransaction =
transactions && transactions.length > 0
? transactions.find(
tx =>
tx.type === TRANSACTION_DAPP_TYPE &&
tx.id === this.asset.inTransfer.dappId
)
: undefined;
if (dappTransaction) {
await store.account.cache([
{ address: cryptography.getAddressFromPublicKey(dappTransaction.senderPublicKey) },
]);
}
}
this.asset.amount,
this.fee
);
if (balanceError) {
errors.push(balanceError);
}
const updatedBalance = new BigNum(sender.balance).sub(this.asset.amount);
const updatedSender = { ...sender, balance: updatedBalance.toString() };
store.account.set(updatedSender.address, updatedSender);
const dappTransaction = store.transaction.get(this.asset.inTransfer.dappId);
const recipient = store.account.get(cryptography.getAddressFromPublicKey(dappTransaction.senderPublicKey));
const updatedRecipientBalance = new BigNum(recipient.balance).add(
this.asset.amount
);
const updatedRecipient = {
...recipient,
balance: updatedRecipientBalance.toString(),
};
store.account.set(updatedRecipient.address, updatedRecipient);
return errors;
}
protected undoAsset(store: transactions.StateStore): ReadonlyArray {
const errors: transactions.TransactionError[] = [];
const sender = store.account.get(this.senderId);
const updatedBalance = new BigNum(sender.balance).add(this.asset.amount);
const updatedSender = { ...sender, balance: updatedBalance.toString() };
store.account.set(updatedSender.address, updatedSender);
const dappTransaction = store.transaction.get(this.asset.inTransfer.dappId);
const recipient = store.account.get(cryptography.getAddressFromPublicKey(dappTransaction.senderPublicKey));
const updatedRecipientBalance = new BigNum(recipient.balance).sub(
this.asset.amount
);
if (updatedRecipientBalance.lt(0)) {
errors.push(
new TransactionError(
`Account does not have enough LSK: ${
recipient.address
}, balance: ${convertBeddowsToLSK(recipient.balance)}.`,
this.id
)
);
}
const updatedRecipient = {