Skip to content

Commit

Permalink
fix: Revert constants, add fallback for pending tx notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Aug 29, 2023
1 parent 88c6a13 commit 57104ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import chains from './chains'
export const IS_PRODUCTION = !!process.env.NEXT_PUBLIC_IS_PRODUCTION
export const IS_DEV = process.env.NODE_ENV === 'development'

export const GATEWAY_URL_PRODUCTION = process.env.NEXT_PUBLIC_GATEWAY_URL_PRODUCTION || 'http://localhost:3030'
export const GATEWAY_URL_STAGING = process.env.NEXT_PUBLIC_GATEWAY_URL_STAGING || 'http://localhost:3030'
export const GATEWAY_URL_PRODUCTION =
process.env.NEXT_PUBLIC_GATEWAY_URL_PRODUCTION || 'https://safe-client.safe.global'
export const GATEWAY_URL_STAGING = process.env.NEXT_PUBLIC_GATEWAY_URL_STAGING || 'https://safe-client.staging.5afe.dev'

// Magic numbers
export const POLLING_INTERVAL = 15_000
Expand Down
9 changes: 7 additions & 2 deletions src/store/txHistorySlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { listenerMiddlewareInstance } from '@/store'
import type { TransactionListPage } from '@safe-global/safe-gateway-typescript-sdk'
import { isTransactionListItem } from '@/utils/transaction-guards'
import { isMultisigExecutionInfo, isTransactionListItem } from '@/utils/transaction-guards'
import { txDispatch, TxEvent } from '@/services/tx/txEvents'
import { selectPendingTxs } from './pendingTxsSlice'
import { makeLoadableSlice } from './common'
Expand Down Expand Up @@ -28,10 +28,15 @@ export const txHistoryListener = (listenerMiddleware: typeof listenerMiddlewareI
const txId = result.transaction.id

if (pendingTxs[txId]) {
const HUMAN_DESCRIPTION_FALLBACK =
'Transaction' +
(isMultisigExecutionInfo(result.transaction.executionInfo) && `#${result.transaction.executionInfo.nonce}`)
const humanDescription = result.transaction.txInfo?.humanDescription || HUMAN_DESCRIPTION_FALLBACK

txDispatch(TxEvent.SUCCESS, {
txId,
groupKey: pendingTxs[txId].groupKey,
humanDescription: result.transaction.txInfo?.humanDescription,
humanDescription,
})
}
}
Expand Down

0 comments on commit 57104ff

Please sign in to comment.