kaspagang / k-wallet

Discord wallet bot (node based)
4 stars 3 forks source link

Receipient should be able to approve/accept an incoming transaction #5

Open HLXEasy opened 7 months ago

HLXEasy commented 7 months ago

Is your feature request related to a problem? Please describe. To prevent any loss in case a receipient is not aware of his wallet right on Discord, it would be cool to have something like "accept incoming transaction" functionality.

Describe the solution you'd like If one is tipped or something is transferred in general, there should be another option to activate "accept transaction". If this option is activated, the receipient gets notified about an incoming transaction and he must accept it. After this reaction, the transfer will be executed.

Additionally there should be a timeout like one hour/day/week/..., maybe with a default value but also configurable.

tmrlvi commented 5 months ago

The accept transaction mechanism already exists implicitly - if your DM are openned, you receive a DM if there are custodial funds for you. When you unlock a wallet for the first time, you receive all custodial funds that were sent to you. However, there is no timeout, which could lead to losing funds.

To support timeout, we need to change the structure saved in the custodial DB. Instead of saving the total owned, we should save both the from address, timestamp and timeout. In order the support it, we need to complete the following tasks:

tmrlvi commented 5 months ago

However, the more I think about it, the solution should be on the wallet level, using P2SH which allows either the custodial wallet to spend, or the sender to spend after timeout has passed. This is more intricate solution, but will be better down the line:

This way, users will have stronger control over the wallet, and can see how much funds they still have held in custody

tmrlvi commented 5 months ago

The second option requires #9