Skip to content

Commit bdda05d

Browse files
committed
fix: replace chrome.runtime with runtime from webextension-polyfill
1 parent 69d4cc6 commit bdda05d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/nami/src/api/extension/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@cardano-sdk/core';
99
import { createAvatar } from '@dicebear/avatars';
1010
import * as style from '@dicebear/avatars-bottts-sprites';
11+
import { runtime } from 'webextension-polyfill';
1112

1213
import { APIError, TxSendError } from '../../config/config';
1314

@@ -17,14 +18,14 @@ import type { Wallet } from '@lace/cardano';
1718
// This is used when dapp favicon is missing. Currently not working on chrome either
1819
// TODO: fix this if issues regarding dapp icon in whitelist is missing.
1920
export const getFavoriteIcon = (domain: string) => {
20-
return `chrome-extension://${chrome.runtime.id}/_favicon/?pageUrl=${domain}&size=32`;
21+
return `chrome-extension://${runtime.id}/_favicon/?pageUrl=${domain}&size=32`;
2122
};
2223

2324
export const createTab = async (tab: string, query = '') =>
2425
new Promise((res, rej) => {
2526
chrome.tabs.create(
2627
{
27-
url: chrome.runtime.getURL(`${tab}.html${query}`),
28+
url: runtime.getURL(`${tab}.html${query}`),
2829
active: true,
2930
},
3031
tab => {

packages/nami/src/ui/app/components/TrezorWidget.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ModalOverlay,
99
useDisclosure,
1010
} from '@chakra-ui/react';
11+
import { runtime } from 'webextension-polyfill';
1112

1213
const TrezorWidget = React.forwardRef((props, ref) => {
1314
const { isOpen, onOpen, onClose } = useDisclosure();
@@ -55,7 +56,7 @@ const TrezorWidget = React.forwardRef((props, ref) => {
5556
/>
5657
<Box rounded="3xl" overflow="hidden" background="white">
5758
<iframe
58-
src={chrome.runtime.getURL('Trezor/popup.html')}
59+
src={runtime.getURL('Trezor/popup.html')}
5960
id="trezorPopupNami"
6061
width="360px"
6162
height="560px"

packages/nami/src/ui/app/components/switchToLaceBanner.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from 'react';
33
import { Box, Image, Text, useColorModeValue } from '@chakra-ui/react';
44
import { Button as LaceButton } from '@lace/common';
55
import { motion } from 'framer-motion';
6+
import { runtime } from 'webextension-polyfill';
67

78
import LaceLogo from '../../../assets/img/lace.svg';
89
import laceGradientBackground from '../../../assets/img/laceGradientBackground.png';
@@ -15,9 +16,7 @@ import LaceSecondaryButton from './laceSecondaryButton';
1516

1617
export const getLaceVideoBackgroundSrc = () => {
1718
return (
18-
(typeof chrome !== 'undefined' &&
19-
chrome.runtime?.getURL('laceVideoBackground.mp4')) ||
20-
laceVideoBackground
19+
runtime.getURL('assets/laceVideoBackground.mp4') || laceVideoBackground
2120
);
2221
};
2322

0 commit comments

Comments
 (0)