onDeleted
Sets up a listener for the event when a mail is deleted by the receiver.
Usage
const receiver = '0x...';
mail.onDeleted(receiver, null, (index, deletedAt) => {
console.log(index);
console.log(deletedAt);
});
Stop watching
const stopWatching = mail.onDeleted(receiver, null, (index, deletedAt) => {
console.log(index);
console.log(deletedAt);
});
// ... Later, to stop watching for the events
stopWatching();
Returns
UnwatchFn
A function that can be invoked to stop watching for new event logs.
Parameters
receiver
- Type
Address | null
The mail receiver's address. If set to null, it listens for any receiver.
index
- Type
bigint | null
The index of the mail. If set to null, it listens for the deletion of any mail.
callback
- Type
(index: bigint, deletedAt: bigint) => void
The callback function to be executed when a mail-deleted event is detected. It receives the index of the deleted mail and its deletion timestamp as its arguments.