@@ -238,7 +238,7 @@ const AccountConnect = (props: AccountConnectProps) => {
238
238
239
239
try {
240
240
hasPermittedChains = Engine . context . PermissionController . hasCaveat (
241
- new URL ( urlWithProtocol ) . hostname ,
241
+ getUrlObj ( urlWithProtocol ) . hostname ,
242
242
PermissionKeys . permittedChains ,
243
243
CaveatTypes . restrictNetworkSwitching ,
244
244
) ;
@@ -248,15 +248,15 @@ const AccountConnect = (props: AccountConnectProps) => {
248
248
249
249
if ( hasPermittedChains ) {
250
250
Engine . context . PermissionController . updateCaveat (
251
- new URL ( urlWithProtocol ) . hostname ,
251
+ getUrlObj ( urlWithProtocol ) . hostname ,
252
252
PermissionKeys . permittedChains ,
253
253
CaveatTypes . restrictNetworkSwitching ,
254
254
chainsToPermit ,
255
255
) ;
256
256
} else {
257
257
Engine . context . PermissionController . grantPermissionsIncremental ( {
258
258
subject : {
259
- origin : new URL ( urlWithProtocol ) . hostname ,
259
+ origin : getUrlObj ( urlWithProtocol ) . hostname ,
260
260
} ,
261
261
approvedPermissions : {
262
262
[ PermissionKeys . permittedChains ] : {
@@ -320,7 +320,7 @@ const AccountConnect = (props: AccountConnectProps) => {
320
320
321
321
const secureIcon = useMemo (
322
322
( ) =>
323
- ( getUrlObj ( new URL ( urlWithProtocol ) . hostname ) ) . protocol === 'https:'
323
+ getUrlObj ( urlWithProtocol ) . protocol === 'https:'
324
324
? IconName . Lock
325
325
: IconName . LockSlash ,
326
326
[ urlWithProtocol ] ,
@@ -420,7 +420,7 @@ const AccountConnect = (props: AccountConnectProps) => {
420
420
const triggerDappViewedEvent = useCallback (
421
421
( numberOfConnectedAccounts : number ) =>
422
422
// Track dapp viewed event
423
- trackDappViewedEvent ( { hostname : new URL ( urlWithProtocol ) . hostname , numberOfConnectedAccounts } ) ,
423
+ trackDappViewedEvent ( { hostname : getUrlObj ( urlWithProtocol ) . hostname , numberOfConnectedAccounts } ) ,
424
424
[ urlWithProtocol ] ,
425
425
) ;
426
426
@@ -735,7 +735,7 @@ const AccountConnect = (props: AccountConnectProps) => {
735
735
setScreen ( AccountConnectScreens . SingleConnect ) ;
736
736
} }
737
737
connection = { sdkConnection }
738
- hostname = { new URL ( urlWithProtocol ) . hostname }
738
+ hostname = { getUrlObj ( urlWithProtocol ) . hostname }
739
739
onPrimaryActionButtonPress = { ( ) => {
740
740
setConfirmedAddresses ( selectedAddresses ) ;
741
741
setScreen ( AccountConnectScreens . SingleConnect ) ;
@@ -763,7 +763,7 @@ const AccountConnect = (props: AccountConnectProps) => {
763
763
isLoading = { isLoading }
764
764
onUserAction = { setUserIntent }
765
765
urlWithProtocol = { urlWithProtocol }
766
- hostname = { new URL ( urlWithProtocol ) . hostname }
766
+ hostname = { getUrlObj ( urlWithProtocol ) . hostname }
767
767
onBack = { ( ) => setScreen ( AccountConnectScreens . SingleConnect ) }
768
768
onNetworksSelected = { handleNetworksSelected }
769
769
initialChainId = { chainId }
0 commit comments