Wallet deposit notification in plugins

I am developing a plugin and I need to know when one of my users receive a crypto deposit to his wallet.

I am going to use this feature for payments and it would be extremely important to know exactly when a deposit is made with the information about the deposit like amount, confirmation status etc.

You can use the following code to listen to deposit and withdrawals in the exchange real-time and use it in your plugin:

toolsLib.database.subscriber.subscribe('channel:events');

toolsLib.database.subscriber.on('message', async (channel, message) => {
	if (channel === 'channel:events') {
		const { type, data } = JSON.parse(message);
	}

	if (type === 'deposit') {
		// you have a deposit and you can parse the deposit data
	} else if (type === 'withdrawal') {
		// you have a withdrawal and you can parse the withdrawal data
	}
})
1 Like

This feature is really nice. Is there a way to use this outside of the plugin using some APIs?