laravel-wallet
laravel-wallet copied to clipboard
Freezing Wallet Balance During Unconfirmed Transactions
Dear @rez1dent3, I'm interested in freezing the wallet balance during unconfirmed transactions. Could you guide me on achieving this functionality?
Hello. If you need a solution out of the box, then you can use the credits functionality for this. https://bavix.github.io/laravel-wallet/#/credit-limits
Place a lock on your wallet through the AtomicServiceInterface, create an unconfirmed transaction and reduce the credit limit (default is zero).
When you confirm or cancel a transaction, you return the credit limit back.
How can I apply credits during deposit, withdrawal, or transfer?
Demo: https://github.com/bavix/laravel-wallet/pull/940
It will work similarly with all operations. Essentially, a negative credit limit will prevent operations from working (without the force flag).
IMPORTANT! Here you monitor the update of meta and race condition yourself, and not the package, as is the case with the balance.
unconfirmed transactions.
~I realized that I didn't pay attention to the word "unconfirmed".~
~Then the answer is similar to this: https://github.com/bavix/laravel-wallet/discussions/937~
Thanks a lot
Were you able to solve your problem? Can the issue be closed?