Skip to content

Commit

Permalink
Post merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Dec 11, 2023
1 parent 8d47ee9 commit faa0360
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const BuyMarketTokenModal = ({ tokenId, onClose, show }: BuySaleTokenModa
const onTransactionSubmit = useCallback(() => {
const slippageAmount = calculateRequiredHapi(amountRef.current ?? 0)
if (!joystream || !memberId || !amountRef.current || !slippageAmount) {
SentryLogger.error('Error while buying market token', 'BuyMarketTokenModal', {
SentryLogger.error('Failed to submit buy market token', 'BuyMarketTokenModal', {
joystream,
memberId,
amountRef,
Expand All @@ -142,6 +142,12 @@ export const BuyMarketTokenModal = ({ tokenId, onClose, show }: BuySaleTokenModa
},
onError: () => {
setActiveStep(BUY_MARKET_TOKEN_STEPS.form)
SentryLogger.error('Error while buying market token', 'BuyMarketTokenModal', {
joystream,
memberId,
amountRef,
slippageAmount,
})
displaySnackbar({
iconType: 'error',
title: 'Something went wrong',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ export const ClaimShareModal = ({ onClose, show, tokenId }: ClaimShareModalProps
client.refetchQueries({ include: 'active' })
},
onError: () => {
SentryLogger.error('Failed to claim share transaction', 'ClaimShareModal', {
joystream,
token,
memberId,
tokenBalance,
activeRevenueShare,
})
displaySnackbar({
iconType: 'error',
title: 'Something went wrong',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const CloseMarketModal = ({ onClose, show, channelId }: CloseMarketModalP

const handleCloseAmm = useCallback(async () => {
if (!joystream || !channelId || !memberId) {
SentryLogger.error('Failed to close market', 'CloseMarketModal', { joystream, channelId, memberId })
SentryLogger.error('Failed to submit close market', 'CloseMarketModal', { joystream, channelId, memberId })
return
}
handleTransaction({
Expand All @@ -55,6 +55,7 @@ export const CloseMarketModal = ({ onClose, show, channelId }: CloseMarketModalP
})
},
onError: () => {
SentryLogger.error('Failed to close market', 'CloseMarketModal', { joystream, channelId, memberId })
displaySnackbar({
iconType: 'error',
title: 'Something went wrong',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export const CloseRevenueShareButton = ({

const finalizeRevenueShare = useCallback(() => {
if (!joystream || !memberId || !channelId) {
SentryLogger.error('Failed to close revenue share', 'CloseRevenueShareButton', { joystream, memberId, channelId })
SentryLogger.error('Failed to submit close revenue share', 'CloseRevenueShareButton', {
joystream,
memberId,
channelId,
})
return
}
handleTransaction({
Expand All @@ -45,6 +49,11 @@ export const CloseRevenueShareButton = ({
})
},
onError: () => {
SentryLogger.error('Failed to close revenue share', 'CloseRevenueShareButton', {
joystream,
memberId,
channelId,
})
displaySnackbar({
iconType: 'error',
title: 'Something went wrong',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const TokenSummaryStep = ({ setPrimaryButtonProps, form, onSuccess }: Tok
])
const handleSubmitTx = async () => {
if (!joystream || !channelId || !memberId) {
SentryLogger.error('Failed to create token', 'TokenSummaryStep', { joystream, channelId, memberId })
SentryLogger.error('Failed to submit create token', 'TokenSummaryStep', { joystream, channelId, memberId })
return
}
return handleTransaction({
Expand All @@ -89,6 +89,7 @@ export const TokenSummaryStep = ({ setPrimaryButtonProps, form, onSuccess }: Tok
title: `$${form.name} minted successfully.`,
},
onError: () => {
SentryLogger.error('Failed to create token', 'TokenSummaryStep', { joystream, channelId, memberId })
displaySnackbar({
iconType: 'error',
title: 'Something went wrong',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export const SaleSummaryStep: FC<SaleSummaryProps> = ({
onSuccess()
},
onError: () => {
SentryLogger.error('Failed to start CRT market', 'MarketDrawer', {
joystream,
memberId,
channelId,
tokenPrice,
})
displaySnackbar({
title: 'Something went wrong',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const RevenueShareWidget = ({ tokenName, tokenId, revenueShare, memberId
})
const handleUnlockStake = useCallback(async () => {
if (!memberId) {
return
SentryLogger.error('Failed to submit unlock stake', 'RevenueShareWidget', { memberId })
return
}

unlockStakeTx(memberId, tokenId, tokenName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const StartRevenueShare = ({ token, onClose, show }: StartRevenueSharePro
const rawStartDate = data.startDate?.type === 'date' ? data.startDate.date : new Date()
const startBlock = convertMsTimestampToBlock(rawStartDate.getTime())
if (!joystream || !memberId || !channelId || !startBlock) {
SentryLogger.error('Failed to start revenue share', 'StartRevenueShare', {
SentryLogger.error('Failed submit to start revenue share', 'StartRevenueShare', {
joystream,
memberId,
channelId,
Expand Down Expand Up @@ -133,6 +133,12 @@ export const StartRevenueShare = ({ token, onClose, show }: StartRevenueSharePro
displaySnackbar({
title: 'Something went wrong',
})
SentryLogger.error('Failed to start revenue share', 'StartRevenueShare', {
joystream,
memberId,
channelId,
startBlock,
})
onClose()
},
})
Expand Down
12 changes: 12 additions & 0 deletions packages/atlas/src/hooks/useUnlockTokenStake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useCallback } from 'react'
import { useJoystream } from '@/providers/joystream'
import { useSnackbar } from '@/providers/snackbars'
import { useTransaction } from '@/providers/transactions/transactions.hooks'
import { SentryLogger } from '@/utils/logs'

export const useUnlockTokenStake = () => {
const { joystream, proxyCallback } = useJoystream()
Expand All @@ -23,6 +24,17 @@ export const useUnlockTokenStake = () => {
iconType: 'success',
})
},
onError: () => {
SentryLogger.error('Failed to unlock token stake', 'useUnlockTokenStake', {
joystream,
memberId,
tokenId,
})
displaySnackbar({
iconType: 'error',
title: 'Something went wrong',
})
},
})
},
[joystream, handleTransaction, proxyCallback, displaySnackbar]
Expand Down

0 comments on commit faa0360

Please sign in to comment.