Skip to content

Commit da780f3

Browse files
committed
fix url object conversion
1 parent 1e9cd83 commit da780f3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/components/Views/AccountConnect/AccountConnect.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ const AccountConnect = (props: AccountConnectProps) => {
232232

233233
try {
234234
hasPermittedChains = Engine.context.PermissionController.hasCaveat(
235-
new URL(urlWithProtocol).hostname,
235+
getUrlObj(urlWithProtocol).hostname,
236236
PermissionKeys.permittedChains,
237237
CaveatTypes.restrictNetworkSwitching,
238238
);
@@ -242,15 +242,15 @@ const AccountConnect = (props: AccountConnectProps) => {
242242

243243
if (hasPermittedChains) {
244244
Engine.context.PermissionController.updateCaveat(
245-
new URL(urlWithProtocol).hostname,
245+
getUrlObj(urlWithProtocol).hostname,
246246
PermissionKeys.permittedChains,
247247
CaveatTypes.restrictNetworkSwitching,
248248
chainsToPermit,
249249
);
250250
} else {
251251
Engine.context.PermissionController.grantPermissionsIncremental({
252252
subject: {
253-
origin: new URL(urlWithProtocol).hostname,
253+
origin: getUrlObj(urlWithProtocol).hostname,
254254
},
255255
approvedPermissions: {
256256
[PermissionKeys.permittedChains]: {
@@ -314,7 +314,7 @@ const AccountConnect = (props: AccountConnectProps) => {
314314

315315
const secureIcon = useMemo(
316316
() =>
317-
(getUrlObj(new URL(urlWithProtocol).hostname)).protocol === 'https:'
317+
getUrlObj(urlWithProtocol).protocol === 'https:'
318318
? IconName.Lock
319319
: IconName.LockSlash,
320320
[urlWithProtocol],
@@ -414,7 +414,7 @@ const AccountConnect = (props: AccountConnectProps) => {
414414
const triggerDappViewedEvent = useCallback(
415415
(numberOfConnectedAccounts: number) =>
416416
// Track dapp viewed event
417-
trackDappViewedEvent({ hostname: new URL(urlWithProtocol).hostname, numberOfConnectedAccounts }),
417+
trackDappViewedEvent({ hostname: getUrlObj(urlWithProtocol).hostname, numberOfConnectedAccounts }),
418418
[urlWithProtocol],
419419
);
420420

@@ -723,7 +723,7 @@ const AccountConnect = (props: AccountConnectProps) => {
723723
setScreen(AccountConnectScreens.SingleConnect);
724724
}}
725725
connection={sdkConnection}
726-
hostname={new URL(urlWithProtocol).hostname}
726+
hostname={getUrlObj(urlWithProtocol).hostname}
727727
onPrimaryActionButtonPress={() => {
728728
setConfirmedAddresses(selectedAddresses);
729729
setScreen(AccountConnectScreens.SingleConnect);
@@ -751,7 +751,7 @@ const AccountConnect = (props: AccountConnectProps) => {
751751
isLoading={isLoading}
752752
onUserAction={setUserIntent}
753753
urlWithProtocol={urlWithProtocol}
754-
hostname={new URL(urlWithProtocol).hostname}
754+
hostname={getUrlObj(urlWithProtocol).hostname}
755755
onBack={() => setScreen(AccountConnectScreens.SingleConnect)}
756756
onNetworksSelected={handleNetworksSelected}
757757
initialChainId={chainId}

0 commit comments

Comments
 (0)