diff --git a/packages/web/components/swap-tool/alt.tsx b/packages/web/components/swap-tool/alt.tsx index 1688b1dcfb..f3107e3e45 100644 --- a/packages/web/components/swap-tool/alt.tsx +++ b/packages/web/components/swap-tool/alt.tsx @@ -229,6 +229,7 @@ export const AltSwapTool: FunctionComponent = observer( feeValueUsd: Number(swapState.totalFee?.toString() ?? "0"), page, quoteTimeMilliseconds: swapState.quote?.timeMs, + swapSource: "swap" as "swap" | "market", }; logEvent([EventName.Swap.swapStarted, baseEvent]); setIsSendingTx(true); diff --git a/packages/web/config/analytics-events.ts b/packages/web/config/analytics-events.ts index a8256c5ec7..ba6b1f92a1 100644 --- a/packages/web/config/analytics-events.ts +++ b/packages/web/config/analytics-events.ts @@ -72,6 +72,7 @@ export type EventProperties = { isRecommendedVariant: boolean; walletName: string; transferDirection: "deposit" | "withdraw"; + swapSource: "market" | "swap"; coinDenom: string; appName: string; isFeatured: boolean; diff --git a/packages/web/hooks/limit-orders/use-place-limit.ts b/packages/web/hooks/limit-orders/use-place-limit.ts index 88f5b2b877..8d58e58991 100644 --- a/packages/web/hooks/limit-orders/use-place-limit.ts +++ b/packages/web/hooks/limit-orders/use-place-limit.ts @@ -225,21 +225,26 @@ export const usePlaceLimit = ({ return; } - // The requested price must account for the ratio between the quote and base asset as the base asset may not be a stablecoin. - // To account for this we divide by the quote asset price. - const tickId = priceToTick( - priceState.price.quo(quoteAssetPrice.toDec()).mul(normalizationFactor) - ); - const msg = { - place_limit: { - tick_id: parseInt(tickId.toString()), - order_direction: orderDirection, - quantity, - claim_bounty: CLAIM_BOUNTY, - }, - }; + try { + // The requested price must account for the ratio between the quote and base asset as the base asset may not be a stablecoin. + // To account for this we divide by the quote asset price. + const tickId = priceToTick( + priceState.price.quo(quoteAssetPrice.toDec()).mul(normalizationFactor) + ); + const msg = { + place_limit: { + tick_id: parseInt(tickId.toString()), + order_direction: orderDirection, + quantity, + claim_bounty: CLAIM_BOUNTY, + }, + }; - return msg; + return msg; + } catch (error) { + console.error("Error attempting to place limit order", error); + return; + } }, [ orderDirection, priceState.price, @@ -295,6 +300,7 @@ export const usePlaceLimit = ({ feeValueUsd: Number(marketState.totalFee?.toString() ?? "0"), page, quoteTimeMilliseconds: marketState.quote?.timeMs, + swapSource: "market" as "swap" | "market", }; try { logEvent([EventName.Swap.swapStarted, baseEvent]);