Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staging' into feat/network-toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
elclandestin0 committed Dec 4, 2024
2 parents d5bdf9c + 0c24f25 commit 7a03950
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const ActionButton: React.FC<ActionButtonProps> = ({
highNetworkChainId: selectedHighNetwork.chainId,
highNetworkHash: tx?.hash,
highNetworkTimestamp: Date.now() / 1000,
challengePeriod: selectedNetworkType === 'Testnet' ? 60 * 60 : 60 * 60 * 24 * 7,
challengePeriod: selectedNetworkType === 'Testnet' ? (60 * 60) : (60 * 60) * 24 * 7,
symbol: symbol,
status: BridgeTransferStatus.WITHDRAW_UNCONFIRMED
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ const BridgeView = ({
errorMessage={inputErrorMessages.value}
setErrorMessage={(msg) => setInputErrorMessages((prev) => ({ ...prev, value: msg }))}
selectedChainId={direction === 'DEPOSIT' ? selectedLowNetwork.chainId : selectedHighNetwork.chainId}
gasFee={estimatedFee.data ?? ""}
/>
{direction === 'DEPOSIT' &&
selectedLowNetwork.chainId === L2_NETWORK.chainId &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface ValueToBridgeProps {
setErrorMessage: (arg0: string) => void
onTokenChange: (token: Token) => void
selectedChainId: number
gasFee?: string | undefined
}
const ValueToBridge: React.FC<ValueToBridgeProps> = ({
setValue,
Expand All @@ -36,7 +37,8 @@ const ValueToBridge: React.FC<ValueToBridgeProps> = ({
errorMessage,
setErrorMessage,
onTokenChange,
selectedChainId
selectedChainId,
gasFee,
}) => {
const [tokens, setTokens] = useState<Token[]>([])
const { connectedAccount, selectedBridgeToken, selectedHighNetwork, selectedLowNetwork } = useBlockchainContext()
Expand Down Expand Up @@ -72,7 +74,7 @@ const ValueToBridge: React.FC<ValueToBridgeProps> = ({
setErrorMessage('Invalid number')
return
}
if (num > Number(balance)) {
if (num + Number(gasFee) > Number(balance)) {
setErrorMessage('Insufficient funds')
return
}
Expand All @@ -85,6 +87,7 @@ const ValueToBridge: React.FC<ValueToBridgeProps> = ({
}
}, [connectedAccount])


const handleTokenChange = (token: Token) => {
onTokenChange(token)
const _tokens = getTokensForNetwork(selectedChainId, connectedAccount)
Expand All @@ -105,7 +108,11 @@ const ValueToBridge: React.FC<ValueToBridgeProps> = ({
disabled={!connectedAccount}
placeholder={'0'}
/>
<button className={styles.maxButton} onClick={() => setValue(String(balance))} disabled={!connectedAccount}>
<button
className={styles.maxButton}
onClick={() => setValue(String(Number(balance) - 0.0025))}
disabled={!connectedAccount}
>
MAX
</button>
{tokens.length > 0 && selectedBridgeToken && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ const FaucetView: React.FC<FaucetViewProps> = ({}) => {
<div className={styles.header}>
<div className={styles.title}>G7 Sepolia Faucet</div>
<div className={styles.supportingText}>
Request and get <strong> 1 {L3_NATIVE_TOKEN_SYMBOL} token </strong> to your connected wallet or an external
address on G7 Sepolia.
Request <strong> 1 {L3_NATIVE_TOKEN_SYMBOL} token </strong> to your connected wallet or an external address on G7 Sepolia.
</div>
</div>
<div className={styles.contentContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const FloatingNotification = ({ notifications }: { notifications: BridgeN
const handleExit = () => {
setShow(!show)
}

if (!notifications || notifications.length === 0) {
return <></>
}
Expand All @@ -149,7 +149,13 @@ export const FloatingNotification = ({ notifications }: { notifications: BridgeN
show && (
<div onClick={handleClick} className={styles.toastMultiple}>
{`You have ${notifications.length} new notifications. Click here to view`}
<IconCloseSmall className={styles.closeIconMultiple} />
<IconCloseSmall
onClick={(e) => {
e.stopPropagation()
handleExit()
}}
className={styles.closeIconMultiple}
/>
</div>
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type DepositDirection = 'DEPOSIT' | 'WITHDRAW'
const BridgePage = () => {
const location = useLocation()
const navigate = useNavigate()
const { connectedAccount, selectedNetworkType } = useBlockchainContext()
const { connectedAccount } = useBlockchainContext()
const [notificationsOffset] = useState(0)
const [notificationsLimit] = useState(10)
const [direction, setDirection] = useState<DepositDirection>('DEPOSIT')
Expand Down Expand Up @@ -67,18 +67,6 @@ const BridgePage = () => {
>
History
</button>
{selectedNetworkType === 'Testnet' && (
<button
className={
location.pathname === '/bridge/settings'
? styles.selectedNavigationButton
: styles.unselectedNavigationButton
}
onClick={() => navigate('/bridge/settings')}
>
Settings
</button>
)}
</div>
</div>
<div className={styles.viewContainer}>
Expand Down

0 comments on commit 7a03950

Please sign in to comment.