Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ADN-495-set-dependenc…
Browse files Browse the repository at this point in the history
…y-sandboxing
  • Loading branch information
jinoosss committed Apr 9, 2024
2 parents 79b4666 + 5808190 commit e7573be
Show file tree
Hide file tree
Showing 130 changed files with 2,651 additions and 748 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adena-wallet",
"version": "1.9.2",
"version": "1.10.0",
"description": "Adena Wallet",
"license": "Adena License",
"private": true,
Expand Down
148 changes: 143 additions & 5 deletions packages/adena-extension/index.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,152 @@
@import url('https://cdn.jsdelivr.net/npm/[email protected]/reset.css');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
/* Reset CSS
http://meyerweb.com/eric/tools/css/reset/
v5.0.1 | 20191019
License: none (public domain)
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
menu,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
main,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section {
display: block;
}
/* HTML5 hidden-attribute fix for newer browsers */
*[hidden] {
display: none;
}
body {
line-height: 1;
}
menu,
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Reset CSS END */

* {
box-sizing: border-box;
}

html,
body {
width: 360px;
height: 540px;
width: 100%;
height: 100%;
min-width: 360px;
min-height: 540px;
padding: 0;
margin: 0;
font-family: 'Poppins', sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion packages/adena-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adena-extension",
"version": "1.9.2",
"version": "1.10.0",
"private": true,
"description": "Adena is a friendly browser extension wallet for the Gnoland blockchain.",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/adena-extension/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Adena",
"description": "Adena is a friendly browser extension wallet for the Gnoland blockchain.",
"manifest_version": 3,
"version": "1.9.2",
"version": "1.10.0",
"action": {
"default_icon": {
"16": "icons/icon16.png",
Expand Down Expand Up @@ -31,6 +31,6 @@
}
],
"content_security_policy": {
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; default-src 'self'; img-src 'self' https: data:; font-src data: https://fonts.gstatic.com; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdn.jsdelivr.net; connect-src 'self' data: *; frame-src *;"
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; img-src 'self' https: data:; font-src data:; style-src 'self' 'unsafe-inline'; connect-src 'self' data: https: http://127.0.0.1:*; frame-src https:;"
}
}
9 changes: 2 additions & 7 deletions packages/adena-extension/public/popup.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Adena</title>
<meta charset="utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
<link href="/resources/fonts/poppins.css" rel="stylesheet" type="text/css" />
<style>
html,
body {
Expand Down
9 changes: 2 additions & 7 deletions packages/adena-extension/public/web.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Adena</title>
<meta charset="utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
<link href="/resources/fonts/poppins.css" rel="stylesheet" type="text/css" />
<link href="/resources/fonts/inter.css" rel="stylesheet" type="text/css" />
</head>

Expand Down
8 changes: 6 additions & 2 deletions packages/adena-extension/src/App/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ import useLink from '@hooks/use-link';
const RunApp = (): ReactElement => {
useApp();
useInitWallet();
const { existWallet, isLoadingExistWallet } = useWallet();
const { existWallet, isLoadingExistWallet, isLoadingLockedWallet } = useWallet();
const { openRegister } = useLink();

if (isLoadingExistWallet === false && existWallet === false) {
openRegister();
window.close();
}

return existWallet ? <PopupRouter /> : <></>;
if (isLoadingLockedWallet || !existWallet) {
return <></>;
}

return <PopupRouter />;
};

const App = (): ReactElement => {
Expand Down
11 changes: 1 addition & 10 deletions packages/adena-extension/src/App/use-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useRecoilState } from 'recoil';
import { useCurrentAccount } from '@hooks/use-current-account';
import { useNetwork } from '@hooks/use-network';
import { useTokenMetainfo } from '@hooks/use-token-metainfo';
import { useTokenBalance } from '@hooks/use-token-balance';
import { useWalletContext } from '@hooks/use-context';
import { useAccountName } from '@hooks/use-account-name';
import useScrollHistory from '@hooks/use-scroll-history';
Expand All @@ -19,8 +18,7 @@ const useApp = (): void => {
const { initAccountNames } = useAccountName();
const { currentAccount } = useCurrentAccount();
const { currentNetwork } = useNetwork();
const { tokenMetainfos, initTokenMetainfos } = useTokenMetainfo();
const { updateTokenBalanceInfos } = useTokenBalance();
const { initTokenMetainfos } = useTokenMetainfo();
const { pathname, key } = useLocation();
const [failedNetwork, setFailedNetwork] = useRecoilState(CommonState.failedNetwork);
const { scrollMove } = useScrollHistory();
Expand All @@ -39,13 +37,6 @@ const useApp = (): void => {
}
}, [currentAccount, currentNetwork]);

useEffect(() => {
if (tokenMetainfos.length === 0) {
return;
}
updateTokenBalanceInfos(tokenMetainfos);
}, [tokenMetainfos]);

useEffect(() => {
initAccountNames(wallet?.accounts ?? []);
}, [wallet?.accounts]);
Expand Down
12 changes: 12 additions & 0 deletions packages/adena-extension/src/assets/web/box-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/adena-extension/src/assets/web/convenience-rate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/adena-extension/src/assets/web/security-rate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 20 additions & 17 deletions packages/adena-extension/src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,39 @@ function existsWallet(): Promise<boolean> {
.catch(() => false);
}

function setupPopup(existWallet: boolean): boolean {
const popupUri = existWallet ? 'popup.html' : '';
chrome.action.setPopup({ popup: popupUri });
return true;
}

chrome.runtime.onInstalled.addListener((details) => {
if (details.reason === 'install') {
chrome.tabs.create({
url: chrome.runtime.getURL('/register.html'),
});
} else if (details.reason === 'update') {
existsWallet().then(() => {
chrome.action.setPopup({ popup: '/popup.html' });
existsWallet().then((existWallet) => {
setupPopup(existWallet);
});
}
});

chrome.action.onClicked.addListener((tab) => {
existsWallet()
.then(async (exist) => {
if (!exist) {
await chrome.action.setPopup({ tabId: tab.id, popup: '/popup.html' });
chrome.tabs.create({
url: chrome.runtime.getURL('/register.html'),
});
} else {
await chrome.action.setPopup({ tabId: tab.id, popup: '' });
}
})
.catch(async () => {
await chrome.action.setPopup({ tabId: tab.id, popup: '' });
chrome.tabs.onCreated.addListener(() => {
existsWallet().then((existWallet) => {
setupPopup(existWallet);
});
});

chrome.action.onClicked.addListener(async () => {
existsWallet().then((existWallet) => {
setupPopup(existWallet);
if (!existWallet) {
chrome.tabs.create({
url: chrome.runtime.getURL('/register.html'),
});
});
}
});
});

chrome.runtime.onMessage.addListener(MessageHandler.createHandler);
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export const ADENA_HELP_PAGE = 'https://docs.adena.app/resources/faq' as const;
export const ADENA_DOCS_PAGE = 'https://docs.adena.app' as const;
export const ADENA_SETUP_AIRGAP_HELP_PAGE = 'https://docs.adena.app/user-guide/sign-in/set-up-air-gap-account' as const;
export const HARDWARE_WALLET_LEARN_PAGE = 'https://docs.adena.app/user-guide/sign-in/connect-hardware-wallet' as const;
export const GNO_CLI_HELP_PAGE = 'https://docs.gno.land/getting-started/working-with-key-pairs' as const;
export const GNO_CLI_HELP_PAGE = 'https://docs.gno.land/getting-started/local-setup/working-with-key-pairs' as const;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const WALLET_EXPORT_TYPE_STORAGE_KEY = 'WALLET_EXPORT_TYPE' as const;
export const WALLET_EXPORT_ACCOUNT_ID = 'WALLET_EXPORT_ACCOUNT_ID' as const;
export const QUESTIONNAIRE_EXPIRATION_MIN = 30 * 24 * 60;
export const POPUP_SESSION_DATA_KEY = 'POPUP_SESSION_DATA' as const;
10 changes: 10 additions & 0 deletions packages/adena-extension/src/common/constants/ui.constant.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Web Constants
export const WEB_CONTENT_WIDTH = 552 as const;
export const WEB_TOP_SPACING = 272 as const;
export const WEB_TOP_SPACING_RESPONSIVE = 150 as const;

// Responsive Sizes
export const RESPONSIVE_EXTENSION_WIDTH = 650 as const;

// Popup Constants
export const POPUP_WIDTH = 380 as const;
export const POPUP_HEIGHT = 590 as const;

export const WINDOW_EXPAND_SIZE = 650 as const;
Loading

0 comments on commit e7573be

Please sign in to comment.