safe-global / safe-apps-sdk

Client-side SDKs to create third-party Safe Apps
https://safe.global
MIT License
239 stars 114 forks source link

trouble with providing a nonce for a Gnosis Safe transaction #578

Open Pasha8914 opened 4 weeks ago

Pasha8914 commented 4 weeks ago

I need to send multiple transactions to Gnosis Safe, but Gnosis Safe does not automatically increment the nonce immediately after signing a transaction. Therefore, I need to provide the nonce manually, but Gnosis Safe ignores this argument.

Link to Minimal Reproducible Example

code: https://github.com/Pasha8914/wagmi-safe-bug preview: https://pasha8914.github.io/wagmi-safe-bug

Steps to Reproduce the Issue

1 - Start the demo project from this repository. 2- Open Safe Global. 3 - Navigate to the Apps section. 4 - Select My Custom Apps. 5 - Paste your local app URL. 6 - Click Send 2 txs.

OR

1 - Open Safe Global. 2 - Navigate to the Apps section. 3 - Select My Custom Apps. 4 - Paste https://pasha8914.github.io/wagmi-safe-bug 5 - Click Send 2 txs.

You will observe that the first and second transactions have the same nonce, although different nonces were provided.

https://github.com/safe-global/safe-apps-sdk/assets/43392281/c4e09678-009b-4ca5-89ec-6f23647d5baa

schmanu commented 6 days ago

There was an issue with the recommended Nonce not refreshing if a transaction never hit the queue so for instance for a 1/n Safe that directly executes the tx as in your attached recording. This change should fix this: https://github.com/safe-global/safe-wallet-web/pull/3872 It will be included in our next release which is expected to go live mid of next week.