Skip to content

Commit

Permalink
Merge branch 'master' into clear-stale-pending-tx
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Jun 20, 2023
2 parents bb341fd + fe2f9fa commit b5d0f88
Show file tree
Hide file tree
Showing 49 changed files with 1,488 additions and 952 deletions.
69 changes: 69 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Bug Report
description: File a bug report
title: "[bug]: "
labels: ["bug", "triage"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: dropdown
id: devices
attributes:
label: What devices are you seeing the problem on?
multiple: true
options:
- Desktop
- Tablet
- Mobile
- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Brave
- type: input
id: browser-version
attributes:
label: Browser Version
description: What is your browser version?
placeholder: Version 114.0.5735.90 (Official Build) (arm64)
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OffchainLabs/arbitrum-token-bridge/blob/82e4cfc0f569467f20ad0ba7a82c366e99140cd3/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Arbitrum Bridge UI Support
url: https://support.arbitrum.io/hc/en-us/requests/new
about: Please ask your specific questions here.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Feature Request
description: File a feature request
title: "[feat]: "
labels: ["new feature", "triage"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request form!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. [email protected]
validations:
required: false
- type: textarea
id: details
attributes:
label: Describe the feature or enhancement
description: Please include how the feature should behave in all possible scenarios.
placeholder: Tell us what you want!
validations:
required: true
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OffchainLabs/arbitrum-token-bridge/blob/82e4cfc0f569467f20ad0ba7a82c366e99140cd3/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
17 changes: 11 additions & 6 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ jobs:
files=`git diff --name-only HEAD^ HEAD`
echo "$files"
for file in $files; do
if [[ $file != packages/* ]] && [[ $file != yarn.lock ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
else
echo "run_tests=true" >> $GITHUB_OUTPUT
break
fi
if [[ $file != packages/* ]] && ! [[ $file =~ .*\.(lock|yml)$ ]]; then
# if not in packages/ and does not end with .lock or .yml
echo "run_tests=false" >> $GITHUB_OUTPUT
elif [[ $file == .github/ISSUE_TEMPLATE/* ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
elif [[ $file =~ .*\.(md|svg|png|webp|gif|txt)$ ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
else
echo "run_tests=true" >> $GITHUB_OUTPUT
break
fi
done
shell: bash

Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"axios": "^1.3.4",
"boring-avatars": "^1.7.0",
"cheerio": "^1.0.0-rc.12",
"dayjs": "^1.10.6",
"dayjs": "^1.11.8",
"ethers": "^5.6.0",
"fetch-retry": "^5.0.3",
"framer-motion": "^10.12.10",
Expand Down
41 changes: 23 additions & 18 deletions packages/arb-token-bridge-ui/src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { TOS_LOCALSTORAGE_KEY } from '../../constants'
import { AppConnectionFallbackContainer } from './AppConnectionFallbackContainer'
import FixingSpaceship from '@/images/arbinaut-fixing-spaceship.webp'
import { appInfo, chains, wagmiClient } from '../../util/wagmi/setup'
import { useAccountIsBlocked } from '../../hooks/useAccountIsBlocked'

declare global {
interface Window {
Expand Down Expand Up @@ -134,8 +135,9 @@ const AppContent = (): JSX.Element => {

const Injector = ({ children }: { children: React.ReactNode }): JSX.Element => {
const actions = useActions()
const { address, isConnected } = useAccount()
const { chain } = useNetwork()
const { address, isConnected } = useAccount()
const { isBlocked } = useAccountIsBlocked()

const networksAndSigners = useNetworksAndSigners()

Expand Down Expand Up @@ -170,11 +172,13 @@ const Injector = ({ children }: { children: React.ReactNode }): JSX.Element => {
// Any time one of those changes
setTokenBridgeParams(null)
actions.app.setConnectionState(ConnectionState.LOADING)

if (!isConnected || !chain) {
return
}

const { l1, l2, isConnectedToArbitrum } = networksAndSigners
const { l1, l2 } = networksAndSigners
const isConnectedToArbitrum = isNetwork(chain.id).isArbitrum

const l1NetworkChainId = l1.network.id
const l2NetworkChainId = l2.network.id
Expand Down Expand Up @@ -208,6 +212,20 @@ const Injector = ({ children }: { children: React.ReactNode }): JSX.Element => {
})
}, [])

if (address && isBlocked) {
return (
<BlockedDialog
address={address}
isOpen={true}
// ignoring until we use the package
// https://github.com/OffchainLabs/config-monorepo/pull/11
//
// eslint-disable-next-line
onClose={() => {}}
/>
)
}

return (
<>
{tokenBridgeParams && (
Expand All @@ -232,6 +250,8 @@ function NetworkReady({ children }: { children: React.ReactNode }) {
}

function ConnectionFallback(props: FallbackProps): JSX.Element {
const { chain } = useNetwork()

switch (props.status) {
case UseNetworksAndSignersStatus.LOADING:
return (
Expand Down Expand Up @@ -263,23 +283,8 @@ function ConnectionFallback(props: FallbackProps): JSX.Element {
</>
)

case UseNetworksAndSignersStatus.BLOCKED:
return (
<AppConnectionFallbackContainer>
<BlockedDialog
address={props.address}
isOpen={true}
// ignoring until we use the package
// https://github.com/OffchainLabs/config-monorepo/pull/11
//
// eslint-disable-next-line
onClose={() => {}}
/>
</AppConnectionFallbackContainer>
)

case UseNetworksAndSignersStatus.NOT_SUPPORTED:
const supportedNetworks = getSupportedNetworks(props.chainId)
const supportedNetworks = getSupportedNetworks(chain?.id)

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { InformationCircleIcon } from '@heroicons/react/24/outline'
import { isDepositReadyToRedeem, isPending } from '../../../state/app/utils'
import { TransactionDateTime } from './TransactionsTable'
import { formatAmount } from '../../../util/NumberUtils'
import { useIsConnectedToArbitrum } from '../../../hooks/useIsConnectedToArbitrum'
import { sanitizeTokenSymbol } from '../../../util/TokenUtils'

function DepositRowStatus({ tx }: { tx: MergedTransaction }) {
switch (tx.depositStatus) {
Expand Down Expand Up @@ -166,8 +168,17 @@ export function TransactionsTableDepositRow({
tx: MergedTransaction
className?: string
}) {
const { isConnectedToArbitrum } = useNetworksAndSigners()
const { l1 } = useNetworksAndSigners()
const { redeem, isRedeeming } = useRedeemRetryable()
const isConnectedToArbitrum = useIsConnectedToArbitrum()

const isRedeemButtonDisabled = useMemo(
() =>
typeof isConnectedToArbitrum !== 'undefined'
? !isConnectedToArbitrum
: true,
[isConnectedToArbitrum]
)

const isError = useMemo(() => {
if (
Expand All @@ -179,7 +190,7 @@ export function TransactionsTableDepositRow({

if (tx.depositStatus === DepositStatus.CREATION_FAILED) {
// In case of a retryable ticket creation failure, mark only the token deposits as errors
return tx.asset !== 'eth'
return tx.asset.toLowerCase() !== 'eth'
}

return false
Expand All @@ -202,6 +213,15 @@ export function TransactionsTableDepositRow({
return ''
}, [tx, isError, showRedeemRetryableButton, showRetryableExpiredText])

const tokenSymbol = useMemo(
() =>
sanitizeTokenSymbol(tx.asset, {
erc20L1Address: tx.tokenAddress,
chain: l1.network
}),
[l1.network, tx.asset, tx.tokenAddress]
)

return (
<tr
className={`text-sm text-dark ${
Expand All @@ -218,7 +238,9 @@ export function TransactionsTableDepositRow({
</td>

<td className="w-1/5 whitespace-nowrap px-3 py-3">
{formatAmount(Number(tx.value), { symbol: tx.asset.toUpperCase() })}
{formatAmount(Number(tx.value), {
symbol: tokenSymbol
})}
</td>

<td className="w-1/5 px-3 py-3">
Expand All @@ -228,7 +250,7 @@ export function TransactionsTableDepositRow({
<td className="relative w-1/5 py-3 pl-3 pr-6 text-right">
{showRedeemRetryableButton && (
<Tooltip
show={!isConnectedToArbitrum}
show={isRedeemButtonDisabled}
wrapperClassName=""
content={
<span>
Expand All @@ -241,7 +263,7 @@ export function TransactionsTableDepositRow({
<Button
variant="primary"
loading={isRedeeming}
disabled={!isConnectedToArbitrum}
disabled={isRedeemButtonDisabled}
onClick={() => redeem(tx)}
>
Retry
Expand Down
Loading

0 comments on commit b5d0f88

Please sign in to comment.