Skip to content

Commit

Permalink
Merge pull request #310 from reservoirprotocol/ted/debug-max-capacity…
Browse files Browse the repository at this point in the history
…-analytics

Add input and output amount to max capacity event
  • Loading branch information
pedromcunha authored Oct 18, 2024
2 parents 8a658e8 + ac81750 commit 3f97073
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-beers-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reservoir0x/relay-kit-ui': patch
---

Add input and output amount to max capacity event
13 changes: 8 additions & 5 deletions packages/ui/src/components/widgets/SwapWidgetRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
? address
: evmDeadAddress
: address && isSolanaAddress(address)
? address
: solDeadAddress
? address
: solDeadAddress

const isValidToAddress =
toChain?.vmType === 'evm'
Expand All @@ -326,8 +326,8 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
? recipient
: evmDeadAddress
: recipient && isSolanaAddress(recipient)
? recipient
: solDeadAddress
? recipient
: solDeadAddress

const externalLiquiditySupport = usePrice(
relayClient ? relayClient : undefined,
Expand Down Expand Up @@ -602,7 +602,10 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
!isFetchingPrice && !externalLiquiditySupport.isFetching,
(capacityExceeded) => {
if (capacityExceeded) {
onAnalyticEvent?.(EventNames.CTA_MAX_CAPACITY_PROMPTED)
onAnalyticEvent?.(EventNames.CTA_MAX_CAPACITY_PROMPTED, {
inputAmount: debouncedInputAmountValue,
outputAmount: debouncedOutputAmountValue
})
}
}
)
Expand Down

0 comments on commit 3f97073

Please sign in to comment.