Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fruity-onions-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@relayprotocol/relay-kit-ui': patch
---

Add data tracking for gas subsidization
1 change: 1 addition & 0 deletions packages/ui/src/components/widgets/SwapWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,7 @@ const SwapWidget: FC<SwapWidgetProps> = ({
} else {
const swapEventData = getSwapEventData(
quote?.details,
quote?.fees,
quote?.steps
? (quote?.steps as Execute['steps'])
: null,
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/components/widgets/SwapWidgetRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
const swapEventData = {
...getSwapEventData(
quote?.details,
quote?.fees,
currentSteps ?? null,
linkedWallet?.connector,
quoteParameters
Expand Down Expand Up @@ -964,6 +965,7 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
try {
const swapEventData = getSwapEventData(
quote?.details,
quote?.fees,
quote?.steps ? (quote?.steps as Execute['steps']) : null,
linkedWallet?.connector,
quoteParameters
Expand Down Expand Up @@ -1014,6 +1016,7 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
const { step, stepItem } = getCurrentStep(currentSteps)
const swapEventData = getSwapEventData(
quote?.details,
quote?.fees,
currentSteps,
linkedWallet?.connector,
quoteParameters
Expand Down
9 changes: 8 additions & 1 deletion packages/ui/src/utils/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export const getCurrentStep = (steps?: Execute['steps'] | null) => {

export const getSwapEventData = (
details: Execute['details'],
fees: Execute['fees'],
steps: Execute['steps'] | null,
connector?: string,
quoteParameters?: Parameters<typeof useQuote>['2']
Expand Down Expand Up @@ -298,9 +299,11 @@ export const getSwapEventData = (
quote_id: steps ? extractQuoteId(steps) : undefined,
amount_in: details?.currencyIn?.amount,
currency_in: details?.currencyIn?.currency?.symbol,
currency_in_address: details?.currencyIn?.currency?.address,
chain_id_in: details?.currencyIn?.currency?.chainId,
amount_out: details?.currencyOut?.amount,
currency_out: details?.currencyOut?.currency?.symbol,
currency_out_address: details?.currencyOut?.currency?.address,
chain_id_out: details?.currencyOut?.currency?.chainId,
currency_in_usd: details?.currencyIn?.amountUsd,
currency_out_usd: details?.currencyOut?.amountUsd,
Expand Down Expand Up @@ -333,7 +336,11 @@ export const getSwapEventData = (
})
return checkStatuses
})
.flat()
.flat(),
subsidized:
fees?.subsidized !== undefined && fees.subsidized.amount !== '0'
? true
: false
}
}

Expand Down