Skip to content

Commit

Permalink
Merge pull request #2740 from synapsecns/master
Browse files Browse the repository at this point in the history
FE Release 06-18-2024
  • Loading branch information
aureliusbtc authored Jun 18, 2024
2 parents a289482 + 1710a84 commit e278abc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
11 changes: 11 additions & 0 deletions packages/synapse-interface/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.26.2](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-06-18)


### Bug Fixes

* **synapse-interface:** disable input pending wallet ([#2738](https://github.com/synapsecns/sanguine/issues/2738)) ([667a90e](https://github.com/synapsecns/sanguine/commit/667a90e76c0f958c37b6b760af4228657df0332d))





## [0.26.1](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-06-18)

**Note:** Version bump only for package @synapsecns/synapse-interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ export const InputContainer = () => {
const dispatch = useAppDispatch()
const { chain, isConnected } = useAccount()
const { balances } = usePortfolioState()
const { fromChainId, toChainId, fromToken, toToken, fromValue } =
useBridgeState()
const {
fromChainId,
toChainId,
fromToken,
toToken,
fromValue,
isWalletPending,
} = useBridgeState()
const [showValue, setShowValue] = useState('')
const [hasMounted, setHasMounted] = useState(false)

Expand Down Expand Up @@ -152,6 +158,7 @@ export const InputContainer = () => {
inputRef={inputRef}
showValue={showValue}
handleFromValueChange={handleFromValueChange}
disabled={isWalletPending}
/>
<AvailableBalance
balance={formattedBalance}
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-interface/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synapsecns/synapse-interface",
"version": "0.26.1",
"version": "0.26.2",
"private": true,
"engines": {
"node": ">=18.18.0"
Expand Down
12 changes: 7 additions & 5 deletions packages/synapse-interface/pages/state-managed-bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ import {
setFromToken,
setToChainId,
setToToken,
} from '@/slices/bridge/reducer'
import {
updateFromValue,
setBridgeQuote,
setIsLoading,
setIsWalletPending,
setDestinationAddress,
} from '@/slices/bridge/reducer'
import {
Expand Down Expand Up @@ -94,12 +93,12 @@ const StateManagedBridge = () => {
debouncedFromValue,
destinationAddress,
isLoading: isQuoteLoading,
isWalletPending,
}: BridgeState = useBridgeState()
const { showSettingsSlideOver, showDestinationAddress } = useSelector(
(state: RootState) => state.bridgeDisplay
)

const [isWalletPending, setIsWalletPending] = useState<boolean>(false)
const [isApproved, setIsApproved] = useState<boolean>(false)

const dispatch = useAppDispatch()
Expand Down Expand Up @@ -327,6 +326,7 @@ const StateManagedBridge = () => {

const approveTxn = async () => {
try {
dispatch(setIsWalletPending(true))
const tx = approveToken(
bridgeQuote?.routerAddress,
fromChainId,
Expand All @@ -338,6 +338,8 @@ const StateManagedBridge = () => {
getAndSetBridgeQuote()
} catch (error) {
return txErrorHandler(error)
} finally {
dispatch(setIsWalletPending(false))
}
}

Expand Down Expand Up @@ -377,7 +379,7 @@ const StateManagedBridge = () => {
})
)
try {
setIsWalletPending(true)
dispatch(setIsWalletPending(true))
const wallet = await getWalletClient(wagmiConfig, {
chainId: fromChainId,
})
Expand Down Expand Up @@ -524,7 +526,7 @@ const StateManagedBridge = () => {

return txErrorHandler(error)
} finally {
setIsWalletPending(false)
dispatch(setIsWalletPending(false))
}
}

Expand Down
6 changes: 6 additions & 0 deletions packages/synapse-interface/slices/bridge/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface BridgeState {
toTokensBridgeQuotes: BridgeQuoteResponse[]
toTokensBridgeQuotesStatus: FetchState
isLoading: boolean
isWalletPending: boolean
deadlineMinutes: number | null
destinationAddress: Address | null
}
Expand Down Expand Up @@ -71,6 +72,7 @@ export const initialState: BridgeState = {
toTokensBridgeQuotes: [],
toTokensBridgeQuotesStatus: FetchState.IDLE,
isLoading: false,
isWalletPending: false,
deadlineMinutes: null,
destinationAddress: null,
}
Expand All @@ -82,6 +84,9 @@ export const bridgeSlice = createSlice({
setIsLoading: (state, action: PayloadAction<boolean>) => {
state.isLoading = action.payload
},
setIsWalletPending: (state, action: PayloadAction<boolean>) => {
state.isWalletPending = action.payload
},
setFromChainId: (state, action: PayloadAction<number>) => {
const incomingFromChainId = action.payload

Expand Down Expand Up @@ -509,6 +514,7 @@ export const {
setDeadlineMinutes,
setDestinationAddress,
setIsLoading,
setIsWalletPending,
resetBridgeInputs,
clearDestinationAddress,
resetFetchedBridgeQuotes,
Expand Down

0 comments on commit e278abc

Please sign in to comment.