@@ -232,7 +232,7 @@ const AccountConnect = (props: AccountConnectProps) => {
232
232
233
233
try {
234
234
hasPermittedChains = Engine . context . PermissionController . hasCaveat (
235
- new URL ( urlWithProtocol ) . hostname ,
235
+ getUrlObj ( urlWithProtocol ) . hostname ,
236
236
PermissionKeys . permittedChains ,
237
237
CaveatTypes . restrictNetworkSwitching ,
238
238
) ;
@@ -242,15 +242,15 @@ const AccountConnect = (props: AccountConnectProps) => {
242
242
243
243
if ( hasPermittedChains ) {
244
244
Engine . context . PermissionController . updateCaveat (
245
- new URL ( urlWithProtocol ) . hostname ,
245
+ getUrlObj ( urlWithProtocol ) . hostname ,
246
246
PermissionKeys . permittedChains ,
247
247
CaveatTypes . restrictNetworkSwitching ,
248
248
chainsToPermit ,
249
249
) ;
250
250
} else {
251
251
Engine . context . PermissionController . grantPermissionsIncremental ( {
252
252
subject : {
253
- origin : new URL ( urlWithProtocol ) . hostname ,
253
+ origin : getUrlObj ( urlWithProtocol ) . hostname ,
254
254
} ,
255
255
approvedPermissions : {
256
256
[ PermissionKeys . permittedChains ] : {
@@ -314,7 +314,7 @@ const AccountConnect = (props: AccountConnectProps) => {
314
314
315
315
const secureIcon = useMemo (
316
316
( ) =>
317
- ( getUrlObj ( new URL ( urlWithProtocol ) . hostname ) ) . protocol === 'https:'
317
+ getUrlObj ( urlWithProtocol ) . protocol === 'https:'
318
318
? IconName . Lock
319
319
: IconName . LockSlash ,
320
320
[ urlWithProtocol ] ,
@@ -414,7 +414,7 @@ const AccountConnect = (props: AccountConnectProps) => {
414
414
const triggerDappViewedEvent = useCallback (
415
415
( numberOfConnectedAccounts : number ) =>
416
416
// Track dapp viewed event
417
- trackDappViewedEvent ( { hostname : new URL ( urlWithProtocol ) . hostname , numberOfConnectedAccounts } ) ,
417
+ trackDappViewedEvent ( { hostname : getUrlObj ( urlWithProtocol ) . hostname , numberOfConnectedAccounts } ) ,
418
418
[ urlWithProtocol ] ,
419
419
) ;
420
420
@@ -723,7 +723,7 @@ const AccountConnect = (props: AccountConnectProps) => {
723
723
setScreen ( AccountConnectScreens . SingleConnect ) ;
724
724
} }
725
725
connection = { sdkConnection }
726
- hostname = { new URL ( urlWithProtocol ) . hostname }
726
+ hostname = { getUrlObj ( urlWithProtocol ) . hostname }
727
727
onPrimaryActionButtonPress = { ( ) => {
728
728
setConfirmedAddresses ( selectedAddresses ) ;
729
729
setScreen ( AccountConnectScreens . SingleConnect ) ;
@@ -751,7 +751,7 @@ const AccountConnect = (props: AccountConnectProps) => {
751
751
isLoading = { isLoading }
752
752
onUserAction = { setUserIntent }
753
753
urlWithProtocol = { urlWithProtocol }
754
- hostname = { new URL ( urlWithProtocol ) . hostname }
754
+ hostname = { getUrlObj ( urlWithProtocol ) . hostname }
755
755
onBack = { ( ) => setScreen ( AccountConnectScreens . SingleConnect ) }
756
756
onNetworksSelected = { handleNetworksSelected }
757
757
initialChainId = { chainId }
0 commit comments