Skip to content

Commit 2b9e563

Browse files
committed
Merge branch 'master' into feature/lnc-web
# By escapedcat (9) and others # Via GitHub (13) and René Aaron (1) * master: fix: bump version to v1.18.0 Nostr integration (#1440) fix(connectors): lnbits - avoid balance with decimal places refactor: clean up non-async usage refactor: clean up non-async usage refactor: clean up non-async usage refactor: remove redundent code New build message fix(connectors): lnbits incoming payments shows outgoing ones as well #1634 style: prettier Translated using Weblate (Portuguese (Brazil)) chore: relax node version dependency refactor(connectors): lnd incoming tx order #1625 fix(connectors): lndhub incoming tx order #1625 Update i18next-browser-languagedetector to version 6.1.8 fix: input placeholder got cut (send) #1517 Update i18next to version 21.10.0 Update all development Yarn dependencies (2022-10-15) fix(lnurlpay): disable input fields buttons #1572 fix: truncate account title # Conflicts: # src/extension/background-script/router.ts # src/extension/content-script/onend.js
2 parents d9acac1 + 5107acc commit 2b9e563

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1165
-462
lines changed

.github/workflows/artifacts-comment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
body += `\n\nWant to sponsor the next build? send some sats to ⚡️[email protected] (don't forget to provide your name)`;
6666
}
6767
68-
body += `\n\nDon't forget: **keep stacking sats!**\n`;
68+
body += `\n\nDon't forget: **keep earning sats!**\n`;
6969
7070
const {data: comments} = await github.rest.issues.listComments({repo, owner, issue_number});
7171
const existing_comment = comments.find((c) => c.user.login === 'github-actions[bot]' && c.body.match(/current build files/) );

package.json

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightning-browser-extension",
3-
"version": "1.17.0",
3+
"version": "1.18.0",
44
"description": "Lightning browser extension",
55
"private": true,
66
"repository": "https://github.com/bumi/lightning-browser-extension.git",
@@ -10,7 +10,7 @@
1010
},
1111
"license": "MIT",
1212
"engines": {
13-
"node": "= 14",
13+
"node": ">= 14",
1414
"yarn": ">= 1.0.0"
1515
},
1616
"scripts": {
@@ -38,6 +38,7 @@
3838
},
3939
"dependencies": {
4040
"@bitcoin-design/bitcoin-icons-react": "^0.1.9",
41+
"@noble/secp256k1": "^1.7.0",
4142
"@headlessui/react": "^1.7.3",
4243
"@lightninglabs/lnc-web": "^0.1.12-alpha",
4344
"@runcitadel/sdk": "^0.3.8",
@@ -53,8 +54,8 @@
5354
"dexie": "^3.2.2",
5455
"elliptic": "^6.5.4",
5556
"html5-qrcode": "^2.2.1",
56-
"i18next": "^21.9.2",
57-
"i18next-browser-languagedetector": "^6.1.5",
57+
"i18next": "^21.10.0",
58+
"i18next-browser-languagedetector": "^6.1.8",
5859
"lodash": "^4.17.21",
5960
"pubsub-js": "^1.9.4",
6061
"react": "^18.2.0",
@@ -100,21 +101,21 @@
100101
"@types/react-modal": "^3.13.1",
101102
"@types/uuid": "^8.3.4",
102103
"@types/webextension-polyfill": "^0.9.1",
103-
"@typescript-eslint/eslint-plugin": "^5.36.2",
104-
"@typescript-eslint/parser": "^5.36.2",
105-
"autoprefixer": "^10.4.11",
104+
"@typescript-eslint/eslint-plugin": "^5.40.0",
105+
"@typescript-eslint/parser": "^5.40.0",
106+
"autoprefixer": "^10.4.12",
106107
"buffer": "^6.0.3",
107108
"clean-webpack-plugin": "^4.0.0",
108109
"complete-randomer": "^1.9.1",
109110
"copy-webpack-plugin": "^11.0.0",
110111
"cross-env": "^7.0.3",
111112
"css-loader": "^6.7.1",
112-
"css-minimizer-webpack-plugin": "^4.1.0",
113+
"css-minimizer-webpack-plugin": "^4.2.1",
113114
"del-cli": "^5.0.0",
114-
"eslint": "^8.23.1",
115+
"eslint": "^8.25.0",
115116
"eslint-config-prettier": "^8.5.0",
116117
"eslint-plugin-import": "^2.26.0",
117-
"eslint-plugin-react": "^7.31.1",
118+
"eslint-plugin-react": "^7.31.9",
118119
"eslint-plugin-react-hooks": "^4.6.0",
119120
"fake-indexeddb": "^3.1.8",
120121
"filemanager-webpack-plugin": "^7.0.0",
@@ -125,17 +126,17 @@
125126
"jest-webextension-mock": "^3.7.22",
126127
"lint-staged": "^13.0.3",
127128
"mini-css-extract-plugin": "^2.6.1",
128-
"msw": "^0.47.3",
129+
"msw": "^0.47.4",
129130
"postcss": "^8.4.17",
130131
"postcss-cli": "^10.0.0",
131132
"postcss-loader": "^7.0.1",
132133
"pptr-testing-library": "^0.7.0",
133134
"prettier": "^2.7.1",
134135
"process": "^0.11.10",
135-
"puppeteer": "^18.0.5",
136+
"puppeteer": "^18.2.1",
136137
"resolve-url-loader": "^5.0.0",
137138
"sass": "^1.55.0",
138-
"sass-loader": "^13.0.2",
139+
"sass-loader": "^13.1.0",
139140
"stream-browserify": "^3.0.0",
140141
"swc-loader": "^0.2.3",
141142
"terser-webpack-plugin": "^5.3.6",

src/app/components/AccountMenu/index.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function AccountMenu({ showOptions = true }: Props) {
3737
const title =
3838
!!authAccount?.name &&
3939
typeof authAccount?.name === "string" &&
40-
`${authAccount?.name} - ${authAccount?.alias}`.substring(0, 21);
40+
`${authAccount?.name} - ${authAccount?.alias}`;
4141

4242
useEffect(() => {
4343
getAccounts();
@@ -72,17 +72,20 @@ function AccountMenu({ showOptions = true }: Props) {
7272
}
7373

7474
return (
75-
<div className="relative pl-2 flex bg-gray-100 rounded-md dark:bg-surface-12dp">
75+
<div className="relative pl-2 flex bg-gray-100 rounded-md dark:bg-surface-12dp max-w-full">
7676
<p className="flex items-center">
7777
<WalletIcon className="-ml-1 w-8 h-8 opacity-50 dark:text-white" />
7878
</p>
7979

8080
<div
81-
className={`flex-auto mx-2 py-1 ${
81+
className={`flex-auto mx-2 py-1 overflow-hidden ${
8282
!title && !balancesDecorated ? "w-28" : ""
8383
}`}
8484
>
85-
<p className="text-xs text-gray-700 dark:text-neutral-400">
85+
<p
86+
title={title || ""}
87+
className="text-xs text-gray-700 dark:text-neutral-400 text-ellipsis overflow-hidden whitespace-nowrap"
88+
>
8689
{title || <Skeleton />}
8790
</p>
8891

src/app/components/AllowanceMenu/index.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as SettingsContext from "~/app/context/SettingsContext";
77
import type { Props } from "./index";
88
import AllowanceMenu from "./index";
99

10-
const mockGetFiatValue = jest.fn(() => Promise.resolve("$1,22"));
10+
const mockGetFiatValue = jest.fn(() => "$1,22");
1111

1212
jest.spyOn(SettingsContext, "useSettings").mockReturnValue({
1313
settings: mockSettings,

src/app/components/AllowanceMenu/index.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@ function AllowanceMenu({ allowance, onEdit, onDelete }: Props) {
3838

3939
useEffect(() => {
4040
if (budget !== "" && showFiat) {
41-
const getFiat = async () => {
42-
const res = await getFiatValue(budget);
43-
setFiatAmount(res);
44-
};
45-
46-
getFiat();
41+
const res = getFiatValue(budget);
42+
setFiatAmount(res);
4743
}
4844
}, [budget, showFiat, getFiatValue]);
4945

src/app/components/ConfirmOrCancel/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type Props = {
99
disabled?: boolean;
1010
loading?: boolean;
1111
label?: string;
12-
onConfirm: MouseEventHandler;
12+
onConfirm?: MouseEventHandler;
1313
onCancel: MouseEventHandler;
1414
};
1515

@@ -29,8 +29,10 @@ export default function ConfirmOrCancel({
2929
onClick={onCancel}
3030
label={tCommon("actions.cancel")}
3131
halfWidth
32+
disabled={loading}
3233
/>
3334
<Button
35+
type="submit"
3436
onClick={onConfirm}
3537
label={label}
3638
primary

src/app/components/Container.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function Container({
2929

3030
return (
3131
<div
32-
className={`container mx-auto px-4 ${getMaxWidthClass(maxWidth)} ${
32+
className={`container mx-auto px-4 mb-4 ${getMaxWidthClass(maxWidth)} ${
3333
justifyBetween
3434
? "h-full flex flex-col justify-between overflow-y-auto no-scrollbar"
3535
: ""

src/app/components/SatButtons/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,39 @@ import Button from "../Button";
44

55
type Props = {
66
onClick: (amount: string) => void;
7+
disabled?: boolean;
78
};
89

9-
function SatButtons({ onClick }: Props) {
10+
function SatButtons({ onClick, disabled }: Props) {
1011
return (
1112
<div className="flex gap-2 mt-2">
1213
<Button
1314
icon={<SatoshiV2Icon className="w-4 h-4" />}
1415
label="100 ⚡"
1516
onClick={() => onClick("100")}
1617
fullWidth
18+
disabled={disabled}
1719
/>
1820
<Button
1921
icon={<SatoshiV2Icon className="w-4 h-4" />}
2022
label="1K ⚡"
2123
onClick={() => onClick("1000")}
2224
fullWidth
25+
disabled={disabled}
2326
/>
2427
<Button
2528
icon={<SatoshiV2Icon className="w-4 h-4" />}
2629
label="5K ⚡"
2730
onClick={() => onClick("5000")}
2831
fullWidth
32+
disabled={disabled}
2933
/>
3034
<Button
3135
icon={<SatoshiV2Icon className="w-4 h-4" />}
3236
label="10K ⚡"
3337
onClick={() => onClick("10000")}
3438
fullWidth
39+
disabled={disabled}
3540
/>
3641
</div>
3742
);

src/app/context/AccountContext.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export function AccountProvider({ children }: { children: React.ReactNode }) {
7474
const setAccountId = (id: string) => setAccount({ id });
7575

7676
const updateFiatValue = useCallback(
77-
async (balance: string | number) => {
78-
const fiat = await getFiatValue(balance);
77+
(balance: string | number) => {
78+
const fiat = getFiatValue(balance);
7979
setFiatBalance(fiat);
8080
},
8181
[getFiatValue]

src/app/context/SettingsContext.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface SettingsContextType {
1212
settings: SettingsStorage;
1313
updateSetting: (setting: Setting) => void;
1414
isLoading: boolean;
15-
getFiatValue: (amount: number | string) => Promise<string>;
15+
getFiatValue: (amount: number | string) => string;
1616
}
1717

1818
type Setting = Partial<SettingsStorage>;
@@ -62,8 +62,8 @@ export const SettingsProvider = ({
6262
});
6363
}, [settings.currency]);
6464

65-
const getFiatValue = async (amount: number | string) =>
66-
await getFiatValueFunc({
65+
const getFiatValue = (amount: number | string) =>
66+
getFiatValueFunc({
6767
amount,
6868
rate: currencyRate,
6969
currency: settings.currency,

src/app/router/Prompt/Prompt.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { HashRouter, Outlet, Route, Routes, Navigate } from "react-router-dom";
1313
import { ToastContainer } from "react-toastify";
1414
import Providers from "~/app/context/Providers";
1515
import RequireAuth from "~/app/router/RequireAuth";
16+
import NostrConfirmGetPublicKey from "~/app/screens/Nostr/ConfirmGetPublicKey";
1617
import type { NavigationState, OriginData } from "~/types";
1718

1819
// Parse out the parameters from the querystring.
@@ -62,9 +63,14 @@ function Prompt() {
6263
}
6364
/>
6465
<Route
65-
path="webln/enable"
66+
path="public/webln/enable"
6667
element={<Enable origin={navigationState.origin as OriginData} />} // prompt will always have an `origin` set, just the type is optional to support usage via PopUp
6768
/>
69+
<Route
70+
path="public/nostr/confirmGetPublicKey"
71+
element={<NostrConfirmGetPublicKey />}
72+
/>
73+
6874
<Route path="lnurlAuth" element={<LNURLAuth />} />
6975
<Route path="lnurlPay" element={<LNURLPay />} />
7076
<Route path="lnurlWithdraw" element={<LNURLWithdraw />} />

src/app/screens/ConfirmKeysend/index.test.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jest.spyOn(SettingsContext, "useSettings").mockReturnValue({
1313
updateSetting: jest.fn(),
1414
getFiatValue: jest
1515
.fn()
16-
.mockImplementationOnce(() => Promise.resolve("$0.00"))
17-
.mockImplementationOnce(() => Promise.resolve("$0.00"))
18-
.mockImplementationOnce(() => Promise.resolve("$0.01"))
19-
.mockImplementationOnce(() => Promise.resolve("$0.05")),
16+
.mockImplementationOnce(() => "$0.00")
17+
.mockImplementationOnce(() => "$0.00")
18+
.mockImplementationOnce(() => "$0.01")
19+
.mockImplementationOnce(() => "$0.05"),
2020
});
2121

2222
const mockOrigin: OriginData = {

src/app/screens/ConfirmKeysend/index.tsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,16 @@ function ConfirmKeysend() {
4747
const [successMessage, setSuccessMessage] = useState("");
4848

4949
useEffect(() => {
50-
(async () => {
51-
if (showFiat && amount) {
52-
const res = await getFiatValue(amount);
53-
setFiatAmount(res);
54-
}
55-
})();
50+
if (showFiat && amount) {
51+
const res = getFiatValue(amount);
52+
setFiatAmount(res);
53+
}
5654
}, [amount, showFiat, getFiatValue]);
5755

5856
useEffect(() => {
5957
if (showFiat) {
60-
(async () => {
61-
const res = await getFiatValue(budget);
62-
setFiatBudgetAmount(res);
63-
})();
58+
const res = getFiatValue(budget);
59+
setFiatBudgetAmount(res);
6460
}
6561
}, [budget, showFiat, getFiatValue]);
6662

src/app/screens/ConfirmPayment/index.test.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("ConfirmPayment", () => {
5555
settings: { ...mockSettings },
5656
isLoading: false,
5757
updateSetting: jest.fn(),
58-
getFiatValue: jest.fn(() => Promise.resolve("$0.01")),
58+
getFiatValue: jest.fn(() => "$0.01"),
5959
});
6060

6161
await act(async () => {
@@ -86,7 +86,7 @@ describe("ConfirmPayment", () => {
8686
settings: { ...mockSettings, showFiat: false },
8787
isLoading: false,
8888
updateSetting: jest.fn(),
89-
getFiatValue: jest.fn(() => Promise.resolve("$0.01")),
89+
getFiatValue: jest.fn(() => "$0.01"),
9090
});
9191

9292
const user = userEvent.setup();
@@ -121,7 +121,7 @@ describe("ConfirmPayment", () => {
121121
settings: { ...mockSettings },
122122
isLoading: false,
123123
updateSetting: jest.fn(),
124-
getFiatValue: jest.fn(() => Promise.resolve("$0.01")),
124+
getFiatValue: jest.fn(() => "$0.01"),
125125
});
126126

127127
await act(async () => {

src/app/screens/ConfirmPayment/index.tsx

+8-12
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,17 @@ function ConfirmPayment() {
4747
const [fiatBudgetAmount, setFiatBudgetAmount] = useState("");
4848

4949
useEffect(() => {
50-
(async () => {
51-
if (showFiat && invoice.satoshis) {
52-
const res = await getFiatValue(invoice.satoshis);
53-
setFiatAmount(res);
54-
}
55-
})();
50+
if (showFiat && invoice.satoshis) {
51+
const res = getFiatValue(invoice.satoshis);
52+
setFiatAmount(res);
53+
}
5654
}, [invoice.satoshis, showFiat, getFiatValue]);
5755

5856
useEffect(() => {
59-
(async () => {
60-
if (showFiat && budget) {
61-
const res = await getFiatValue(budget);
62-
setFiatBudgetAmount(res);
63-
}
64-
})();
57+
if (showFiat && budget) {
58+
const res = getFiatValue(budget);
59+
setFiatBudgetAmount(res);
60+
}
6561
}, [budget, showFiat, getFiatValue]);
6662

6763
const [rememberMe, setRememberMe] = useState(false);

src/app/screens/Enable/index.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ function Enable(props: Props) {
4949
domain: props.origin.domain,
5050
host: props.origin.host,
5151
});
52-
msg.error(
53-
`User added site to blocklist domain, host
54-
${props.origin.domain},
55-
${props.origin.host}`
56-
);
52+
msg.error(USER_REJECTED_ERROR);
5753
}
5854

5955
useEffect(() => {

0 commit comments

Comments
 (0)