From faa03609f979b203dc3a2d2be9c4e4b6908fa475 Mon Sep 17 00:00:00 2001 From: WRadoslaw Date: Mon, 11 Dec 2023 10:45:42 +0100 Subject: [PATCH] Post merge fixes --- .../_crt/BuyMarketTokenModal/BuyMarketTokenModal.tsx | 8 +++++++- .../_crt/ClaimShareModal/ClaimShareModal.tsx | 7 +++++++ .../_crt/CloseMarketModal/CloseMarketModal.tsx | 3 ++- .../CloseRevenueShareButton.tsx | 11 ++++++++++- .../CreateTokenDrawer/steps/TokenSummaryStep.tsx | 3 ++- .../_crt/MarketDrawer/steps/SaleSummaryStep.tsx | 6 ++++++ .../_crt/RevenueShareWidget/RevenueShareWidget.tsx | 2 +- .../StartRevenueShareModal.tsx | 8 +++++++- packages/atlas/src/hooks/useUnlockTokenStake.ts | 12 ++++++++++++ 9 files changed, 54 insertions(+), 6 deletions(-) diff --git a/packages/atlas/src/components/_crt/BuyMarketTokenModal/BuyMarketTokenModal.tsx b/packages/atlas/src/components/_crt/BuyMarketTokenModal/BuyMarketTokenModal.tsx index 421d7dcedd..2f67ae9f2f 100644 --- a/packages/atlas/src/components/_crt/BuyMarketTokenModal/BuyMarketTokenModal.tsx +++ b/packages/atlas/src/components/_crt/BuyMarketTokenModal/BuyMarketTokenModal.tsx @@ -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, @@ -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', diff --git a/packages/atlas/src/components/_crt/ClaimShareModal/ClaimShareModal.tsx b/packages/atlas/src/components/_crt/ClaimShareModal/ClaimShareModal.tsx index 84ccfce2af..f32cb7aa6f 100644 --- a/packages/atlas/src/components/_crt/ClaimShareModal/ClaimShareModal.tsx +++ b/packages/atlas/src/components/_crt/ClaimShareModal/ClaimShareModal.tsx @@ -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', diff --git a/packages/atlas/src/components/_crt/CloseMarketModal/CloseMarketModal.tsx b/packages/atlas/src/components/_crt/CloseMarketModal/CloseMarketModal.tsx index 068713a16d..fb224f1b7d 100644 --- a/packages/atlas/src/components/_crt/CloseMarketModal/CloseMarketModal.tsx +++ b/packages/atlas/src/components/_crt/CloseMarketModal/CloseMarketModal.tsx @@ -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({ @@ -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', diff --git a/packages/atlas/src/components/_crt/CloseRevenueShareButton/CloseRevenueShareButton.tsx b/packages/atlas/src/components/_crt/CloseRevenueShareButton/CloseRevenueShareButton.tsx index 89f7fec305..c348f9132b 100644 --- a/packages/atlas/src/components/_crt/CloseRevenueShareButton/CloseRevenueShareButton.tsx +++ b/packages/atlas/src/components/_crt/CloseRevenueShareButton/CloseRevenueShareButton.tsx @@ -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({ @@ -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', diff --git a/packages/atlas/src/components/_crt/CreateTokenDrawer/steps/TokenSummaryStep.tsx b/packages/atlas/src/components/_crt/CreateTokenDrawer/steps/TokenSummaryStep.tsx index 23dba304c0..d1fe4b4da1 100644 --- a/packages/atlas/src/components/_crt/CreateTokenDrawer/steps/TokenSummaryStep.tsx +++ b/packages/atlas/src/components/_crt/CreateTokenDrawer/steps/TokenSummaryStep.tsx @@ -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({ @@ -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', diff --git a/packages/atlas/src/components/_crt/MarketDrawer/steps/SaleSummaryStep.tsx b/packages/atlas/src/components/_crt/MarketDrawer/steps/SaleSummaryStep.tsx index 5b75eec195..037e29bf68 100644 --- a/packages/atlas/src/components/_crt/MarketDrawer/steps/SaleSummaryStep.tsx +++ b/packages/atlas/src/components/_crt/MarketDrawer/steps/SaleSummaryStep.tsx @@ -57,6 +57,12 @@ export const SaleSummaryStep: FC = ({ onSuccess() }, onError: () => { + SentryLogger.error('Failed to start CRT market', 'MarketDrawer', { + joystream, + memberId, + channelId, + tokenPrice, + }) displaySnackbar({ title: 'Something went wrong', }) diff --git a/packages/atlas/src/components/_crt/RevenueShareWidget/RevenueShareWidget.tsx b/packages/atlas/src/components/_crt/RevenueShareWidget/RevenueShareWidget.tsx index e59efbd50a..0e8c353de9 100644 --- a/packages/atlas/src/components/_crt/RevenueShareWidget/RevenueShareWidget.tsx +++ b/packages/atlas/src/components/_crt/RevenueShareWidget/RevenueShareWidget.tsx @@ -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) diff --git a/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx b/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx index d58122c64d..f291c158ed 100644 --- a/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx +++ b/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx @@ -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, @@ -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() }, }) diff --git a/packages/atlas/src/hooks/useUnlockTokenStake.ts b/packages/atlas/src/hooks/useUnlockTokenStake.ts index a48d9cae26..ec057a9393 100644 --- a/packages/atlas/src/hooks/useUnlockTokenStake.ts +++ b/packages/atlas/src/hooks/useUnlockTokenStake.ts @@ -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() @@ -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]