Add functionality to create transactions

- Transactions work against the account balance
- Needs helper functions for users
- Needs more testing
This commit is contained in:
Logan Cusano
2023-02-26 03:26:24 -05:00
parent fb99d6ab01
commit 14fac69ab7
8 changed files with 194 additions and 44 deletions

View File

@@ -36,6 +36,16 @@ exports.createAccount = (_discordAccountId, callback) => {
})
}
exports.withdrawBalance = async (_withdrawAmount, _accountId, callback) => {
userStorage.updateBalance('withdraw', _withdrawAmount, _accountId, async (err, result) => {
if (err) return callback(err, undefined);
if(result) return callback(undefined, result);
return callback(undefined, undefined);
})
}
exports.verifyBalance = (_tokensToBeUsed, _accountId, callback) => {
userStorage.checkBalance(_tokensToBeUsed, _accountId, (err, results) => {
if (err) return callback(err, undefined);