DoctorMcKay / node-steam-user

Allows interaction with the Steam network via the Steam client protocol
https://dev.doctormckay.com/forum/7-node-steam-user/
MIT License
888 stars 157 forks source link

Pending balance in the "wallet" event #464

Open aboyobam opened 11 months ago

aboyobam commented 11 months ago

Problem

There is no option to get an accounts pending balance.

Suggested solution

Emit a pending flag with the "wallet" event. Example:

user.on("wallet", (hasWallet: boolean, currency: SteamUser.ECurrencyCode, balance: number, pending: boolean) => {
    ...
});

Additionally there could be pending: number on the SteamUser.wallet like

const user = new SteamUser();
// login and stuff
user.once("wallet", () => {
   const total = user.wallet.balance + user.wallet.pending;
});

Other Ideas

Because the pending balance and normal balance never change with a single transaction, it would also be an option to add a new event for "pendingWallet" which gets emmited once the pending balance changes.