Add functionality to create transactions
- Transactions work against the account balance - Needs helper functions for users - Needs more testing
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user