Skip to content

Commit

Permalink
fix(apps/evm): wagmi sends
Browse files Browse the repository at this point in the history
  • Loading branch information
LufyCZ committed Mar 19, 2024
1 parent 85e38c1 commit cb25b14
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
7 changes: 5 additions & 2 deletions apps/evm/src/ui/pool/AddSectionReviewModalConcentrated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ export const AddSectionReviewModalConcentrated: FC<
if (!prepare || isSimulationError) return undefined

return async (confirm: () => void) => {
await sendTransactionAsync(prepare)
confirm()
try {
await sendTransactionAsync(prepare)

confirm()
} catch {}
}
}, [sendTransactionAsync, isSimulationError, prepare])

Expand Down
9 changes: 6 additions & 3 deletions apps/evm/src/ui/pool/AddSectionReviewModalTrident.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,14 @@ export const AddSectionReviewModalTrident: FC<
})

const send = useMemo(() => {
if (!sendTransactionAsync || !prepare || isSimulationError) return undefined
if (!prepare || isSimulationError) return undefined

return async (confirm: () => void) => {
await sendTransactionAsync(prepare)
confirm()
try {
await sendTransactionAsync(prepare)

confirm()
} catch {}
}
}, [isSimulationError, prepare, sendTransactionAsync])

Expand Down
6 changes: 4 additions & 2 deletions apps/evm/src/ui/pool/ConcentratedLiquidityCollectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ export const ConcentratedLiquidityCollectButton: FC<
})

const send = useMemo(() => {
if (!sendTransactionAsync || isSimulationError || !prepare) return
if (isSimulationError || !prepare) return

return async () => {
await sendTransactionAsync(prepare)
try {
await sendTransactionAsync(prepare)
} catch {}
}
}, [isSimulationError, prepare, sendTransactionAsync])

Expand Down
7 changes: 5 additions & 2 deletions apps/evm/src/ui/pool/ConcentratedLiquidityRemoveWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,11 @@ export const ConcentratedLiquidityRemoveWidget: FC<
if (!prepare || isSimulationError) return undefined

return async (confirm: () => void) => {
await sendTransactionAsync(prepare)
confirm()
try {
await sendTransactionAsync(prepare)

confirm()
} catch {}
}
}, [isSimulationError, prepare, sendTransactionAsync])

Expand Down
7 changes: 5 additions & 2 deletions apps/evm/src/ui/pool/CreateSectionReviewModalTrident.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,11 @@ export const CreateSectionReviewModalTrident: FC<
if (!prepare || isSimulationError) return

return async (confirm: () => void) => {
await sendTransactionAsync(prepare)
confirm()
try {
await sendTransactionAsync(prepare)

confirm()
} catch {}
}
}, [isSimulationError, prepare, sendTransactionAsync])

Expand Down
4 changes: 3 additions & 1 deletion apps/evm/src/ui/pool/RemoveSectionLegacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ export const RemoveSectionLegacy: FC<RemoveSectionLegacyProps> =

return async () => {
// TODO: Fix this
await sendTransactionAsync(prepare as any)
try {
await sendTransactionAsync(prepare as any)
} catch {}
}
}, [isSimulationError, prepare, sendTransactionAsync])

Expand Down
6 changes: 4 additions & 2 deletions apps/evm/src/ui/pool/RemoveSectionTrident.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const RemoveSectionTrident: FC<RemoveSectionTridentProps> =
return {
account: address,
to: contract.address,
chainId: _pool.chainId,
chainId: _pool.chainId as ChainId,
data: batchAction({
actions,
}),
Expand Down Expand Up @@ -312,7 +312,9 @@ export const RemoveSectionTrident: FC<RemoveSectionTridentProps> =
if (!prepare || isSimulationError) return undefined

return async () => {
await sendTransactionAsync(prepare)
try {
await sendTransactionAsync(prepare)
} catch {}
}
}, [sendTransactionAsync, isSimulationError, prepare])

Expand Down

0 comments on commit cb25b14

Please sign in to comment.