Skip to content

Commit 5d84838

Browse files
committed
fix url object conversion
1 parent ad3effd commit 5d84838

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
@@ -238,7 +238,7 @@ const AccountConnect = (props: AccountConnectProps) => {
238238

239239
try {
240240
hasPermittedChains = Engine.context.PermissionController.hasCaveat(
241-
new URL(urlWithProtocol).hostname,
241+
getUrlObj(urlWithProtocol).hostname,
242242
PermissionKeys.permittedChains,
243243
CaveatTypes.restrictNetworkSwitching,
244244
);
@@ -248,15 +248,15 @@ const AccountConnect = (props: AccountConnectProps) => {
248248

249249
if (hasPermittedChains) {
250250
Engine.context.PermissionController.updateCaveat(
251-
new URL(urlWithProtocol).hostname,
251+
getUrlObj(urlWithProtocol).hostname,
252252
PermissionKeys.permittedChains,
253253
CaveatTypes.restrictNetworkSwitching,
254254
chainsToPermit,
255255
);
256256
} else {
257257
Engine.context.PermissionController.grantPermissionsIncremental({
258258
subject: {
259-
origin: new URL(urlWithProtocol).hostname,
259+
origin: getUrlObj(urlWithProtocol).hostname,
260260
},
261261
approvedPermissions: {
262262
[PermissionKeys.permittedChains]: {
@@ -320,7 +320,7 @@ const AccountConnect = (props: AccountConnectProps) => {
320320

321321
const secureIcon = useMemo(
322322
() =>
323-
(getUrlObj(new URL(urlWithProtocol).hostname)).protocol === 'https:'
323+
getUrlObj(urlWithProtocol).protocol === 'https:'
324324
? IconName.Lock
325325
: IconName.LockSlash,
326326
[urlWithProtocol],
@@ -420,7 +420,7 @@ const AccountConnect = (props: AccountConnectProps) => {
420420
const triggerDappViewedEvent = useCallback(
421421
(numberOfConnectedAccounts: number) =>
422422
// Track dapp viewed event
423-
trackDappViewedEvent({ hostname: new URL(urlWithProtocol).hostname, numberOfConnectedAccounts }),
423+
trackDappViewedEvent({ hostname: getUrlObj(urlWithProtocol).hostname, numberOfConnectedAccounts }),
424424
[urlWithProtocol],
425425
);
426426

@@ -735,7 +735,7 @@ const AccountConnect = (props: AccountConnectProps) => {
735735
setScreen(AccountConnectScreens.SingleConnect);
736736
}}
737737
connection={sdkConnection}
738-
hostname={new URL(urlWithProtocol).hostname}
738+
hostname={getUrlObj(urlWithProtocol).hostname}
739739
onPrimaryActionButtonPress={() => {
740740
setConfirmedAddresses(selectedAddresses);
741741
setScreen(AccountConnectScreens.SingleConnect);
@@ -763,7 +763,7 @@ const AccountConnect = (props: AccountConnectProps) => {
763763
isLoading={isLoading}
764764
onUserAction={setUserIntent}
765765
urlWithProtocol={urlWithProtocol}
766-
hostname={new URL(urlWithProtocol).hostname}
766+
hostname={getUrlObj(urlWithProtocol).hostname}
767767
onBack={() => setScreen(AccountConnectScreens.SingleConnect)}
768768
onNetworksSelected={handleNetworksSelected}
769769
initialChainId={chainId}

0 commit comments

Comments
 (0)