Skip to content

Commit

Permalink
fix: uploading appData too late (#4667)
Browse files Browse the repository at this point in the history
We were trying to decode the TWAP transactions that our users were
doing. It turned out our decoding was working for some, but not for
other txs. To present a good decoding of the TWAP transaction we need
the appData as it contains information for the slippage, fee etc. It
turned out that some of the txs were not having app data. This is due
to the fact that we are trying to decode the transaction before signing,
but at this point no appData was being uploaded to the server.

Moving the uploadAppData call before the call for signing the tx solves
this problem and makes sure that appData is available even before
signing.

Co-authored-by: Leandro <[email protected]>
  • Loading branch information
2 people authored and anxolin committed Jul 5, 2024
1 parent 315fdda commit cf6f037
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export function useCreateTwapOrder() {
const fallbackSetupTxs = fallbackHandlerIsNotSet
? await extensibleFallbackSetupTxs(extensibleFallbackContext)
: []

// upload the app data here, as application might need it to decode the order info before it is being signed
uploadAppData({ chainId, orderId, appData: appDataInfo })
const createOrderTxs = createTwapOrderTxs(twapOrder, paramsStruct, twapOrderCreationContext)
const { safeTxHash } = await safeAppsSdk.txs.send({ txs: [...fallbackSetupTxs, ...createOrderTxs] })

Expand Down Expand Up @@ -128,7 +131,6 @@ export function useCreateTwapOrder() {

orderAnalytics('Posted', orderType, 'Presign')

uploadAppData({ chainId, orderId, appData: appDataInfo })
updateAdvancedOrdersState({ recipient: null, recipientAddress: null })
tradeConfirmActions.onSuccess(safeTxHash)
tradeFlowAnalytics.sign(twapFlowAnalyticsContext)
Expand Down

0 comments on commit cf6f037

Please sign in to comment.