I am trying to develop a deposit system like solcasino, I was wondering how can i have my client listen to some event whenever any deposit is made on some specific wallet and could provide the address of the depositor and the amount of sol. Amount and depositor's address is important as I have to update database based on that wallet address. I was looking into "accountSubscribe" but I wasn't sure if it will provide wallet address. My client is in Rust, if that's important.
accountSubscribe is exactly what you want, you will:
receive notifications when the lamports or data for a given account public key changes
In your case, you'll get notifications whenever the lamports in the wallet change, and can do whatever else you need at that point.
You can find the full information at https://docs.solana.com/api/websocket#accountsubscribe
Edit: I missed the part asking about the depositor.
accountSubscribe only gives you the updated state of an account, you'll need to fetch the transaction to get more information. Once you get a notification, you can use
getSignaturesForAddress to see recent transactions.
With the signature, you can use
getTransaction and search the
postBalances to see where the lamports came from.
More information on
getSignaturesForAddress at https://docs.solana.com/api/http#getsignaturesforaddress and
getTransaction at https://docs.solana.com/api/http#gettransaction