From ebf0bb3d1e7b76f8d44d58be66562075e40743d1 Mon Sep 17 00:00:00 2001 From: Fionna <13184582+fionnachan@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:40:58 +0000 Subject: [PATCH 1/2] feat: allow scw to change destination chain --- .../src/components/TransferPanel/AdvancedSettings.tsx | 8 ++++++-- .../src/components/common/NetworkSelectionContainer.tsx | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx index f5051aa244..06e88e7740 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx @@ -83,7 +83,11 @@ export const AdvancedSettings = () => { isDepositMode } = useNetworksRelationship(networks) const { address } = useAccount() - const { isEOA, isSmartContractWallet } = useAccountType() + const { + isEOA, + isSmartContractWallet, + isLoading: isLoadingAccountType + } = useAccountType() const [inputLocked, setInputLocked] = useState(true) const [warning, setWarning] = useState(null) @@ -165,7 +169,7 @@ export const AdvancedSettings = () => { }) }, [debouncedDestinationAddress, setQueryParams]) - if (!isEOA && !isSmartContractWallet) { + if (!isEOA && !isSmartContractWallet && !isLoadingAccountType) { return null } diff --git a/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx b/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx index dc328d6034..8f277a7961 100644 --- a/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx +++ b/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx @@ -122,7 +122,10 @@ export function NetworkButton({ const hasOneOrLessChain = chains.length <= 1 - const disabled = hasOneOrLessChain || isSmartContractWallet || isLoading + const disabled = + hasOneOrLessChain || + (isSmartContractWallet && type === 'source') || + isLoading const buttonStyle = { backgroundColor: getBridgeUiConfigForChain(selectedChainId).color From e0fff84e12e5f79fa86259e9832f43483649f92d Mon Sep 17 00:00:00 2001 From: Fionna <13184582+fionnachan@users.noreply.github.com> Date: Fri, 27 Dec 2024 16:07:32 +0000 Subject: [PATCH 2/2] update --- .../src/components/TransferPanel/AdvancedSettings.tsx | 3 ++- .../src/components/common/NetworkSelectionContainer.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx b/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx index 06e88e7740..c142af036b 100644 --- a/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx +++ b/packages/arb-token-bridge-ui/src/components/TransferPanel/AdvancedSettings.tsx @@ -117,6 +117,7 @@ export const AdvancedSettings = () => { ) }, [ initialDestinationAddressFromQueryParams, + isLoadingAccountType, isEOA, setAdvancedSettingsCollapsed ]) @@ -169,7 +170,7 @@ export const AdvancedSettings = () => { }) }, [debouncedDestinationAddress, setQueryParams]) - if (!isEOA && !isSmartContractWallet && !isLoadingAccountType) { + if (!isEOA && !isSmartContractWallet) { return null } diff --git a/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx b/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx index 8f277a7961..fdc884eeaf 100644 --- a/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx +++ b/packages/arb-token-bridge-ui/src/components/common/NetworkSelectionContainer.tsx @@ -407,6 +407,7 @@ export const NetworkSelectionContainer = ( const [oneNovaTransferDialogProps, openOneNovaTransferDialog] = useDialog() const [, setQueryParams] = useArbQueryParams() const { setAdvancedSettingsCollapsed } = useAdvancedSettingsStore() + const { isSmartContractWallet } = useAccountType() const isSource = props.type === 'source' @@ -444,7 +445,10 @@ export const NetworkSelectionContainer = ( actions.app.setSelectedToken(null) setQueryParams({ destinationAddress: undefined }) - setAdvancedSettingsCollapsed(true) + + if (!isSmartContractWallet) { + setAdvancedSettingsCollapsed(true) + } }, [ isSource, @@ -453,7 +457,8 @@ export const NetworkSelectionContainer = ( actions.app, setQueryParams, setAdvancedSettingsCollapsed, - openOneNovaTransferDialog + openOneNovaTransferDialog, + isSmartContractWallet ] )