Deferring a transaction

I’m using filterTransaction to identify transactions I wish to prevent, in my case when the user deletes certain strings. I’d like to defer these transactions, waiting for a user to confirm, and only then apply them.

What’s the recommended way to do this? Options I have considered so far:

  • Storing the transaction in plugin state from within filterTransaction, and applying it in the PluginView
  • Appending the transaction with it’s inverse, and reapplying it once the user has confirmed


I have had a lot of time playing with the APIs you’re thinking about. Without trying it myself, I am 80% confident that the first option you mentioned should work for you.

To expand on this, I’d filter out the transaction you want to be confirmed and store that transaction into a variable trNeedingConfirmation or whatever.

Then, when actually confirmed, you’d dispatch the trNeedingConfirmation onto the state, but with an added transaction meta like “confirmed transaction”, so you can be sure in the plugin, it doesn’t try to confirm it again.

1 Like

You might also need to do some form of rebasing…to make sure the confirmed transaction going through is being applied on the most current doc.

I did indeed end up with option 1. It’s working OK, but it’s a lot of code - perhaps there will be a more elegant way to do this in future

1 Like

I dealt with this by implementing a “pause” - the transaction filter stops all transactions (except my deferred ones) until my deferred transactions were complete. A bit hacky, I admit.