WARNING DO NOT RUN MIGRATIONS UNTIL THE SEED SCRIPT IS RUN TO PRESERVE TRANSACTION HASHES
What's included in this pr + description
Adding moralis webhook support, so gnosis payments are automatically responded to. There are two different flavors of actions we are listening to now -- a successful payment, or a rejection. This PR includes an API endpoint to listen to the webhook, and UI changes responded to such actions, including the ability to re-queue rejected payments.
Motivation & Context
Our old code for handling gnosis transactions was janky and running in the client. This runs as an API endpoint to immediately respond to changes, and also offers improved UI to show rejections and allow re-queuing.
Steps to test
This one can be a bit tricky to test locally, because of the webhooks. I would recommend downloading ngrok so you can funnel online requests to something running locally. https://ngrok.com/
Once you have ngrok running, you'll need to add the url it spits out to the .env file under NEXT_PUBLIC_MORALIS_WEBHOOK_URL
You will also need the NEXT_PUBLIC_MORALIS_API_KEY which I can share.
If we are testing on staging, this should not be an issue, since the env variables are set up automatically.
Test steps
create a new proposal with payment to a gnosis safe
approve it, queue the tx
reject the first transaction on gnosis
see that the UI says it was rejected
click "re-queue"
see a new transaction on gnosis
approve the transaction on gnosis
check the UI, it should show the approved tx
Cases to test
gnosis singer, approve on first try ✅
gnosis signer, reject first tx, requeue, approve ✅
wallet signer, pay on first try (no such thing as rejecting here, but we want to make sure history is working) ✅
wallet signer, attach tx ✅
gnosis signer, attach tx ✅
gnosis signer, reject first tx, attach tx for second tx ❌ (overriding the failed transaction)
After execution, the data is stale. The webhook response should ideally revalidate the data so it is immediately fresh on the UI. Not sure if it's possible though for backend APIs to call client side invalidation
Updated useGnosisSignature and useGnosisSignatureToConfirmTransaction hooks to call this new hook instead of using gnosis-safe-contracts library directly
Removed unused imports from RoleSignature component (activeUserMeetsCriteria, ProposalRoleApprovalStatus)
Created webhook endpoint for parsing tx events coming in from moralis streams api
WARNING DO NOT RUN MIGRATIONS UNTIL THE SEED SCRIPT IS RUN TO PRESERVE TRANSACTION HASHES
What's included in this pr + description
Adding moralis webhook support, so gnosis payments are automatically responded to. There are two different flavors of actions we are listening to now -- a successful payment, or a rejection. This PR includes an API endpoint to listen to the webhook, and UI changes responded to such actions, including the ability to re-queue rejected payments.
Motivation & Context
Our old code for handling gnosis transactions was janky and running in the client. This runs as an API endpoint to immediately respond to changes, and also offers improved UI to show rejections and allow re-queuing.
Steps to test
This one can be a bit tricky to test locally, because of the webhooks. I would recommend downloading ngrok so you can funnel online requests to something running locally. https://ngrok.com/
Once you have ngrok running, you'll need to add the url it spits out to the .env file under
NEXT_PUBLIC_MORALIS_WEBHOOK_URL
You will also need the
NEXT_PUBLIC_MORALIS_API_KEY
which I can share.If we are testing on staging, this should not be an issue, since the env variables are set up automatically.
Test steps
Cases to test
Screenshots and/or loom video
Outstanding issues
After execution, the data is stale. The webhook response should ideally revalidate the data so it is immediately fresh on the UI. Not sure if it's possible though for backend APIs to call client side invalidation
Relevant docs
Conner as a resource for Gnosis/solidity lol