Skip to content

Commit

Permalink
chore(token-import): Adding analytics for the send flow (valora-inc#4901
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dievazqu authored and shottah committed May 15, 2024
1 parent 32803cc commit cba90ff
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ interface SendEventsProperties {
networkId: NetworkId | null
tokenId: string
commentLength: number
isTokenManuallyImported: boolean
}

[SendEvents.send_secure_start]: {
Expand Down Expand Up @@ -598,6 +599,7 @@ interface SendEventsProperties {
tokenAddress: string | undefined
tokenId: string
networkId: string
isTokenManuallyImported: boolean
}
[SendEvents.send_tx_error]: {
error: string
Expand Down
1 change: 1 addition & 0 deletions src/send/SendConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ function SendConfirmation(props: Props) {
networkId: tokenInfo?.networkId ?? null,
tokenId,
commentLength: comment.length,
isTokenManuallyImported: !!tokenInfo?.isManuallyImported,
})

dispatch(
Expand Down
1 change: 1 addition & 0 deletions src/send/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ describe(sendPaymentSaga, () => {
tokenAddress: '0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1'.toLowerCase(),
tokenId: mockCusdTokenId,
networkId: 'celo-alfajores',
isTokenManuallyImported: false,
})
})

Expand Down
1 change: 1 addition & 0 deletions src/send/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function* sendPayment(
tokenAddress: tokenInfo.address ?? undefined,
tokenId: tokenInfo.tokenId,
networkId: tokenInfo.networkId,
isTokenManuallyImported: !!tokenInfo?.isManuallyImported,
})
} catch (err) {
const error = ensureError(err)
Expand Down
9 changes: 9 additions & 0 deletions src/tokens/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ describe(fetchImportedTokenBalances, () => {
name: 'TestToken',
symbol: 'TT',
isManuallyImported: true,
priceUsd: null,
lastKnownPriceUsd: null,
},
[mockPoofTokenId]: {
address: mockPoofAddress,
Expand All @@ -374,6 +376,8 @@ describe(fetchImportedTokenBalances, () => {
name: 'PoofToken',
symbol: 'Poof',
isManuallyImported: true,
priceUsd: null,
lastKnownPriceUsd: null,
},
[mockUSDCTokenId]: {
address: mockUSDCAddress,
Expand All @@ -385,6 +389,8 @@ describe(fetchImportedTokenBalances, () => {
name: 'USD Coin',
symbol: 'USDC',
isManuallyImported: true,
priceUsd: null,
lastKnownPriceUsd: null,
},
}

Expand Down Expand Up @@ -416,14 +422,17 @@ describe(fetchImportedTokenBalances, () => {
[mockTestTokenTokenId]: {
...mockImportedTokens[mockTestTokenTokenId],
balance: new BigNumber(0.000000001).toFixed(),
priceUsd: undefined,
},
[mockPoofTokenId]: {
...mockImportedTokens[mockPoofTokenId],
balance: new BigNumber(0.0005).toFixed(),
priceUsd: undefined,
},
[mockUSDCTokenId]: {
...mockImportedTokens[mockUSDCTokenId],
balance: new BigNumber(10).toFixed(),
priceUsd: undefined,
},
})
})
Expand Down

0 comments on commit cba90ff

Please sign in to comment.