diff --git a/src/app/components/Enable/AlbyEnable.tsx b/src/app/components/Enable/AlbyEnable.tsx new file mode 100644 index 0000000000..f0d77ad086 --- /dev/null +++ b/src/app/components/Enable/AlbyEnable.tsx @@ -0,0 +1,99 @@ +import { CheckIcon } from "@bitcoin-design/bitcoin-icons-react/filled"; +import ConfirmOrCancel from "@components/ConfirmOrCancel"; +import Container from "@components/Container"; +import PublisherCard from "@components/PublisherCard"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import ScreenHeader from "~/app/components/ScreenHeader"; +import toast from "~/app/components/Toast"; +import { USER_REJECTED_ERROR } from "~/common/constants"; +import msg from "~/common/lib/msg"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; +function AlbyEnableComponent(props: Props) { + const [loading, setLoading] = useState(false); + const { t } = useTranslation("translation", { + keyPrefix: "alby_enable", + }); + const { t: tCommon } = useTranslation("common"); + + const enable = () => { + try { + setLoading(true); + msg.reply({ + enabled: true, + remember: true, + }); + } catch (e) { + console.error(e); + if (e instanceof Error) toast.error(`${tCommon("error")}: ${e.message}`); + } finally { + setLoading(false); + } + }; + + function reject(event: React.MouseEvent) { + event.preventDefault(); + msg.error(USER_REJECTED_ERROR); + } + + async function block(event: React.MouseEvent) { + event.preventDefault(); + await msg.request("addBlocklist", { + domain: props.origin.domain, + host: props.origin.host, + }); + alert(tCommon("enable.block_added", { host: props.origin.host })); + msg.error(USER_REJECTED_ERROR); + } + + return ( +
+ + +
+ + +
+

{tCommon("enable.allow")}

+ +
+ +

{tCommon("enable.request1")}

+
+
+ +

{t("request2")}

+
+
+
+ +
+
+ ); +} + +export default AlbyEnableComponent; diff --git a/src/app/components/Enable/LiquidEnable.tsx b/src/app/components/Enable/LiquidEnable.tsx new file mode 100644 index 0000000000..3b34f56655 --- /dev/null +++ b/src/app/components/Enable/LiquidEnable.tsx @@ -0,0 +1,99 @@ +import { CheckIcon } from "@bitcoin-design/bitcoin-icons-react/filled"; +import ConfirmOrCancel from "@components/ConfirmOrCancel"; +import Container from "@components/Container"; +import PublisherCard from "@components/PublisherCard"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import ScreenHeader from "~/app/components/ScreenHeader"; +import toast from "~/app/components/Toast"; +import { USER_REJECTED_ERROR } from "~/common/constants"; +import msg from "~/common/lib/msg"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; +function LiquidEnableComponent(props: Props) { + const [loading, setLoading] = useState(false); + const { t } = useTranslation("translation", { + keyPrefix: "liquid_enable", + }); + const { t: tCommon } = useTranslation("common"); + + const enable = () => { + try { + setLoading(true); + msg.reply({ + enabled: true, + remember: true, + }); + } catch (e) { + console.error(e); + if (e instanceof Error) toast.error(`${tCommon("error")}: ${e.message}`); + } finally { + setLoading(false); + } + }; + + function reject(event: React.MouseEvent) { + event.preventDefault(); + msg.error(USER_REJECTED_ERROR); + } + + async function block(event: React.MouseEvent) { + event.preventDefault(); + await msg.request("addBlocklist", { + domain: props.origin.domain, + host: props.origin.host, + }); + alert(tCommon("enable.block_added", { host: props.origin.host })); + msg.error(USER_REJECTED_ERROR); + } + + return ( +
+ + +
+ + +
+

{tCommon("enable.allow")}

+ +
+ +

{tCommon("enable.request1")}

+
+
+ +

{t("request2")}

+
+
+
+ +
+
+ ); +} + +export default LiquidEnableComponent; diff --git a/src/app/screens/Enable/index.tsx b/src/app/components/Enable/NostrEnable.tsx similarity index 73% rename from src/app/screens/Enable/index.tsx rename to src/app/components/Enable/NostrEnable.tsx index 07a76a6876..8b7d0d0245 100644 --- a/src/app/screens/Enable/index.tsx +++ b/src/app/components/Enable/NostrEnable.tsx @@ -2,7 +2,7 @@ import { CheckIcon } from "@bitcoin-design/bitcoin-icons-react/filled"; import ConfirmOrCancel from "@components/ConfirmOrCancel"; import Container from "@components/Container"; import PublisherCard from "@components/PublisherCard"; -import { useCallback, useEffect, useRef, useState } from "react"; +import { useState } from "react"; import { useTranslation } from "react-i18next"; import ScreenHeader from "~/app/components/ScreenHeader"; import toast from "~/app/components/Toast"; @@ -13,16 +13,14 @@ import type { OriginData } from "~/types"; type Props = { origin: OriginData; }; - -function Enable(props: Props) { - const hasFetchedData = useRef(false); +function NostrEnableComponent(props: Props) { const [loading, setLoading] = useState(false); const { t } = useTranslation("translation", { - keyPrefix: "enable", + keyPrefix: "nostr_enable", }); const { t: tCommon } = useTranslation("common"); - const enable = useCallback(() => { + const enable = () => { try { setLoading(true); msg.reply({ @@ -35,7 +33,7 @@ function Enable(props: Props) { } finally { setLoading(false); } - }, [tCommon]); + }; function reject(event: React.MouseEvent) { event.preventDefault(); @@ -48,32 +46,10 @@ function Enable(props: Props) { domain: props.origin.domain, host: props.origin.host, }); - alert(t("block_added", { host: props.origin.host })); + alert(tCommon("enable.block_added", { host: props.origin.host })); msg.error(USER_REJECTED_ERROR); } - useEffect(() => { - async function getAllowance() { - try { - const allowance = await msg.request("getAllowance", { - domain: props.origin.domain, - host: props.origin.host, - }); - if (allowance && allowance.enabled) { - enable(); - } - } catch (e) { - if (e instanceof Error) console.error(e.message); - } - } - - // Run once. - if (!hasFetchedData.current) { - getAllowance(); - hasFetchedData.current = true; - } - }, [enable, props.origin.domain, props.origin.host]); - return (
@@ -87,7 +63,7 @@ function Enable(props: Props) { />
-

{t("allow")}

+

{tCommon("enable.allow")}

@@ -112,7 +88,7 @@ function Enable(props: Props) { href="#" onClick={block} > - {t("block_and_ignore", { host: props.origin.host })} + {tCommon("enable.block_and_ignore", { host: props.origin.host })}
@@ -120,4 +96,4 @@ function Enable(props: Props) { ); } -export default Enable; +export default NostrEnableComponent; diff --git a/src/app/components/Enable/WebbtcEnable.tsx b/src/app/components/Enable/WebbtcEnable.tsx new file mode 100644 index 0000000000..61c8179b8d --- /dev/null +++ b/src/app/components/Enable/WebbtcEnable.tsx @@ -0,0 +1,99 @@ +import { CheckIcon } from "@bitcoin-design/bitcoin-icons-react/filled"; +import ConfirmOrCancel from "@components/ConfirmOrCancel"; +import Container from "@components/Container"; +import PublisherCard from "@components/PublisherCard"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import ScreenHeader from "~/app/components/ScreenHeader"; +import toast from "~/app/components/Toast"; +import { USER_REJECTED_ERROR } from "~/common/constants"; +import msg from "~/common/lib/msg"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; +function WebbtcEnableComponent(props: Props) { + const [loading, setLoading] = useState(false); + const { t } = useTranslation("translation", { + keyPrefix: "webbtc_enable", + }); + const { t: tCommon } = useTranslation("common"); + + const enable = () => { + try { + setLoading(true); + msg.reply({ + enabled: true, + remember: true, + }); + } catch (e) { + console.error(e); + if (e instanceof Error) toast.error(`${tCommon("error")}: ${e.message}`); + } finally { + setLoading(false); + } + }; + + function reject(event: React.MouseEvent) { + event.preventDefault(); + msg.error(USER_REJECTED_ERROR); + } + + async function block(event: React.MouseEvent) { + event.preventDefault(); + await msg.request("addBlocklist", { + domain: props.origin.domain, + host: props.origin.host, + }); + alert(tCommon("enable.block_added", { host: props.origin.host })); + msg.error(USER_REJECTED_ERROR); + } + + return ( +
+ + +
+ + +
+

{tCommon("enable.allow")}

+ +
+ +

{tCommon("enable.request1")}

+
+
+ +

{t("request2")}

+
+
+
+ +
+
+ ); +} + +export default WebbtcEnableComponent; diff --git a/src/app/components/Enable/WeblnEnable.tsx b/src/app/components/Enable/WeblnEnable.tsx new file mode 100644 index 0000000000..d857ebaaa4 --- /dev/null +++ b/src/app/components/Enable/WeblnEnable.tsx @@ -0,0 +1,99 @@ +import { CheckIcon } from "@bitcoin-design/bitcoin-icons-react/filled"; +import ConfirmOrCancel from "@components/ConfirmOrCancel"; +import Container from "@components/Container"; +import PublisherCard from "@components/PublisherCard"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; +import ScreenHeader from "~/app/components/ScreenHeader"; +import toast from "~/app/components/Toast"; +import { USER_REJECTED_ERROR } from "~/common/constants"; +import msg from "~/common/lib/msg"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; +function WeblnEnableComponent(props: Props) { + const [loading, setLoading] = useState(false); + const { t } = useTranslation("translation", { + keyPrefix: "webln_enable", + }); + const { t: tCommon } = useTranslation("common"); + + const enable = () => { + try { + setLoading(true); + msg.reply({ + enabled: true, + remember: true, + }); + } catch (e) { + console.error(e); + if (e instanceof Error) toast.error(`${tCommon("error")}: ${e.message}`); + } finally { + setLoading(false); + } + }; + + function reject(event: React.MouseEvent) { + event.preventDefault(); + msg.error(USER_REJECTED_ERROR); + } + + async function block(event: React.MouseEvent) { + event.preventDefault(); + await msg.request("addBlocklist", { + domain: props.origin.domain, + host: props.origin.host, + }); + alert(tCommon("enable.block_added", { host: props.origin.host })); + msg.error(USER_REJECTED_ERROR); + } + + return ( +
+ + +
+ + +
+

{tCommon("enable.allow")}

+ +
+ +

{tCommon("enable.request1")}

+
+
+ +

{t("request2")}

+
+
+
+ +
+
+ ); +} + +export default WeblnEnableComponent; diff --git a/src/app/screens/Onboard/Prompt/index.tsx b/src/app/components/onboard/index.tsx similarity index 100% rename from src/app/screens/Onboard/Prompt/index.tsx rename to src/app/components/onboard/index.tsx diff --git a/src/app/router/Prompt/Prompt.tsx b/src/app/router/Prompt/Prompt.tsx index 21412caa68..36ffae360c 100644 --- a/src/app/router/Prompt/Prompt.tsx +++ b/src/app/router/Prompt/Prompt.tsx @@ -4,7 +4,6 @@ import ConfirmKeysend from "@screens/ConfirmKeysend"; import ConfirmPayment from "@screens/ConfirmPayment"; import ConfirmRequestPermission from "@screens/ConfirmRequestPermission"; import ConfirmSignMessage from "@screens/ConfirmSignMessage"; -import Enable from "@screens/Enable"; import LNURLAuth from "@screens/LNURLAuth"; import LNURLChannel from "@screens/LNURLChannel"; import LNURLPay from "@screens/LNURLPay"; @@ -23,7 +22,11 @@ import Toaster from "~/app/components/Toast/Toaster"; import Providers from "~/app/context/Providers"; import RequireAuth from "~/app/router/RequireAuth"; import BitcoinConfirmGetAddress from "~/app/screens/Bitcoin/ConfirmGetAddress"; -import Onboard from "~/app/screens/Onboard/Prompt"; +import AlbyEnable from "~/app/screens/Enable/AlbyEnable"; +import LiquidEnable from "~/app/screens/Enable/LiquidEnable"; +import NostrEnable from "~/app/screens/Enable/NostrEnable"; +import WebbtcEnable from "~/app/screens/Enable/WebbtcEnable"; +import WeblnEnable from "~/app/screens/Enable/WeblnEnable"; import type { NavigationState, OriginData } from "~/types"; // Parse out the parameters from the querystring. @@ -74,23 +77,33 @@ function Prompt() { /> } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp + element={ + + } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp /> } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp + element={ + + } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp /> } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp + element={ + + } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp /> } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp + element={ + + } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp /> } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp + element={ + + } // prompt will always have an `origin` set, just the type is optional to support usage via PopUp /> } /> } /> } /> - } /> - } /> - } /> - } /> } @@ -161,7 +170,6 @@ const Layout = () => {
-
diff --git a/src/app/router/connectorRoutes.tsx b/src/app/router/connectorRoutes.tsx index 25ddfe84b5..09149b1b82 100644 --- a/src/app/router/connectorRoutes.tsx +++ b/src/app/router/connectorRoutes.tsx @@ -20,8 +20,8 @@ import btcpay from "/static/assets/icons/btcpay.svg"; import citadel from "/static/assets/icons/citadel.png"; import core_ln from "/static/assets/icons/core_ln.svg"; import eclair from "/static/assets/icons/eclair.jpg"; -import galoyBitcoinBeach from "/static/assets/icons/galoy_bitcoin_beach.png"; import galoyBitcoinJungle from "/static/assets/icons/galoy_bitcoin_jungle.png"; +import galoyBlink from "/static/assets/icons/galoy_blink.png"; import kolliderLogo from "/static/assets/icons/kollider.png"; import lightning_node from "/static/assets/icons/lightning_node.png"; import lightning_terminal from "/static/assets/icons/lightning_terminal.png"; @@ -63,7 +63,7 @@ interface ConnectorRoute extends Route { } const galoyPaths: { [key: string]: keyof typeof galoyUrls } = { - bitcoinBeach: "galoy-bitcoin-beach", + blink: "galoy-blink", bitcoinJungle: "galoy-bitcoin-jungle", }; @@ -163,11 +163,11 @@ const connectorMap: { [key: string]: ConnectorRoute } = { logo: kolliderLogo, children: kolliderConnectorRoutes, }, - [galoyPaths.bitcoinBeach]: { - path: galoyPaths.bitcoinBeach, - element: , - title: i18n.t("translation:choose_connector.bitcoin_beach.title"), - logo: galoyBitcoinBeach, + [galoyPaths.blink]: { + path: galoyPaths.blink, + element: , + title: i18n.t("translation:choose_connector.blink.title"), + logo: galoyBlink, }, [galoyPaths.bitcoinJungle]: { path: galoyPaths.bitcoinJungle, @@ -262,7 +262,7 @@ function getConnectorRoutes(): ConnectorRoute[] { connectorMap["lnd-hub-bluewallet"], connectorMap["eclair"], connectorMap["btcpay"], - connectorMap[galoyPaths.bitcoinBeach], + connectorMap[galoyPaths.blink], connectorMap[galoyPaths.bitcoinJungle], getDistribution("citadel"), getDistribution("umbrel"), diff --git a/src/app/screens/Enable/AlbyEnable.tsx b/src/app/screens/Enable/AlbyEnable.tsx new file mode 100644 index 0000000000..18238c7a8b --- /dev/null +++ b/src/app/screens/Enable/AlbyEnable.tsx @@ -0,0 +1,10 @@ +import AlbyEnableComponent from "~/app/components/Enable/AlbyEnable"; +import { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; + +export default function AlbyEnable(props: Props) { + return ; +} diff --git a/src/app/screens/Enable/LiquidEnable.tsx b/src/app/screens/Enable/LiquidEnable.tsx new file mode 100644 index 0000000000..f7712f67be --- /dev/null +++ b/src/app/screens/Enable/LiquidEnable.tsx @@ -0,0 +1,43 @@ +import { useEffect, useState } from "react"; +import LiquidEnableComponent from "~/app/components/Enable/LiquidEnable"; +import Onboard from "~/app/components/onboard"; +import { useAccount } from "~/app/context/AccountContext"; +import api from "~/common/lib/api"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; + +export default function LiquidEnable(props: Props) { + const { account } = useAccount(); + const [hasMnemonic, setHasMnemonic] = useState(false); + + useEffect(() => { + async function fetchAccountInfo() { + try { + const fetchedAccount = await api.getAccount(); + + if (fetchedAccount.hasMnemonic) { + setHasMnemonic(true); + } else { + setHasMnemonic(false); + } + } catch (e) { + console.error(e); + } + } + + fetchAccountInfo(); + }, [props.origin, account]); + + return ( + <> + {hasMnemonic ? ( + + ) : ( + + )} + + ); +} diff --git a/src/app/screens/Enable/NostrEnable.tsx b/src/app/screens/Enable/NostrEnable.tsx new file mode 100644 index 0000000000..3e720a239b --- /dev/null +++ b/src/app/screens/Enable/NostrEnable.tsx @@ -0,0 +1,43 @@ +import { useEffect, useState } from "react"; +import NostrEnableComponent from "~/app/components/Enable/NostrEnable"; +import Onboard from "~/app/components/onboard"; +import { useAccount } from "~/app/context/AccountContext"; +import api from "~/common/lib/api"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; + +export default function NostrEnable(props: Props) { + const { account } = useAccount(); + const [hasNostrKeys, setHasNostrKeys] = useState(false); + + useEffect(() => { + async function fetchAccountInfo() { + try { + const fetchedAccount = await api.getAccount(); + + if (fetchedAccount.nostrEnabled) { + setHasNostrKeys(true); + } else { + setHasNostrKeys(false); + } + } catch (e) { + console.error(e); + } + } + + fetchAccountInfo(); + }, [props.origin, account]); + + return ( + <> + {hasNostrKeys ? ( + + ) : ( + + )} + + ); +} diff --git a/src/app/screens/Enable/WebbtcEnable.tsx b/src/app/screens/Enable/WebbtcEnable.tsx new file mode 100644 index 0000000000..99fc52d15e --- /dev/null +++ b/src/app/screens/Enable/WebbtcEnable.tsx @@ -0,0 +1,43 @@ +import { useEffect, useState } from "react"; +import LiquidEnableComponent from "~/app/components/Enable/LiquidEnable"; +import Onboard from "~/app/components/onboard"; +import { useAccount } from "~/app/context/AccountContext"; +import api from "~/common/lib/api"; +import type { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; + +export default function WebbtcEnable(props: Props) { + const { account } = useAccount(); + const [hasMnemonic, setHasMnemonic] = useState(false); + + useEffect(() => { + async function fetchAccountInfo() { + try { + const fetchedAccount = await api.getAccount(); + + if (fetchedAccount.hasMnemonic) { + setHasMnemonic(true); + } else { + setHasMnemonic(false); + } + } catch (e) { + console.error(e); + } + } + + fetchAccountInfo(); + }, [props.origin, account]); + + return ( + <> + {hasMnemonic ? ( + + ) : ( + + )} + + ); +} diff --git a/src/app/screens/Enable/WeblnEnable.tsx b/src/app/screens/Enable/WeblnEnable.tsx new file mode 100644 index 0000000000..827dd18865 --- /dev/null +++ b/src/app/screens/Enable/WeblnEnable.tsx @@ -0,0 +1,10 @@ +import WeblnEnableComponent from "~/app/components/Enable/WeblnEnable"; +import { OriginData } from "~/types"; + +type Props = { + origin: OriginData; +}; + +export default function WeblnEnable(props: Props) { + return ; +} diff --git a/src/app/screens/connectors/ConnectGaloy/index.tsx b/src/app/screens/connectors/ConnectGaloy/index.tsx index 2846baad8c..93c3be66d7 100644 --- a/src/app/screens/connectors/ConnectGaloy/index.tsx +++ b/src/app/screens/connectors/ConnectGaloy/index.tsx @@ -9,18 +9,16 @@ import { useNavigate } from "react-router-dom"; import toast from "~/app/components/Toast"; import msg from "~/common/lib/msg"; -import galoyBitcoinBeach from "/static/assets/icons/galoy_bitcoin_beach.png"; import galoyBitcoinJungle from "/static/assets/icons/galoy_bitcoin_jungle.png"; +import galoyBlink from "/static/assets/icons/galoy_blink.png"; export const galoyUrls = { - "galoy-bitcoin-beach": { - i18nPrefix: "bitcoin_beach", - label: "Bitcoin Beach Wallet", - website: "https://galoy.io/bitcoin-beach-wallet/", - logo: galoyBitcoinBeach, - url: - process.env.BITCOIN_BEACH_GALOY_URL || - "https://api.mainnet.galoy.io/graphql", + "galoy-blink": { + i18nPrefix: "blink", + label: "Blink Wallet", + website: "https://www.blink.sv/", + logo: galoyBlink, + url: process.env.BLINK_GALOY_URL || "https://api.mainnet.galoy.io/graphql", }, "galoy-bitcoin-jungle": { i18nPrefix: "bitcoin_jungle", diff --git a/src/extension/background-script/actions/allowances/enable.ts b/src/extension/background-script/actions/alby/enable.ts similarity index 100% rename from src/extension/background-script/actions/allowances/enable.ts rename to src/extension/background-script/actions/alby/enable.ts diff --git a/src/extension/background-script/actions/alby/index.ts b/src/extension/background-script/actions/alby/index.ts new file mode 100644 index 0000000000..e9478e1569 --- /dev/null +++ b/src/extension/background-script/actions/alby/index.ts @@ -0,0 +1,2 @@ +import enable from "./enable"; +export { enable }; diff --git a/src/extension/background-script/actions/allowances/__tests__/enable.test.ts b/src/extension/background-script/actions/allowances/__tests__/enable.test.ts index d84e67197d..e8b957b5d2 100644 --- a/src/extension/background-script/actions/allowances/__tests__/enable.test.ts +++ b/src/extension/background-script/actions/allowances/__tests__/enable.test.ts @@ -4,7 +4,7 @@ import state from "~/extension/background-script/state"; import { allowanceFixture } from "~/fixtures/allowances"; import type { DbAllowance, MessageAllowanceEnable, Sender } from "~/types"; -import enableAllowance from "../enable"; +import enableAllowance from "../../webln/enable"; jest.mock("~/extension/background-script/state"); diff --git a/src/extension/background-script/actions/allowances/index.ts b/src/extension/background-script/actions/allowances/index.ts index 072d493211..bc39862c9d 100644 --- a/src/extension/background-script/actions/allowances/index.ts +++ b/src/extension/background-script/actions/allowances/index.ts @@ -1,9 +1,8 @@ import add from "./add"; import deleteAllowance from "./delete"; -import enable from "./enable"; import get from "./get"; import getById from "./getById"; import list from "./list"; import updateAllowance from "./update"; -export { add, deleteAllowance, enable, get, getById, list, updateAllowance }; +export { add, deleteAllowance, get, getById, list, updateAllowance }; diff --git a/src/extension/background-script/actions/liquid/enable.ts b/src/extension/background-script/actions/liquid/enable.ts new file mode 100644 index 0000000000..b560416bbf --- /dev/null +++ b/src/extension/background-script/actions/liquid/enable.ts @@ -0,0 +1,78 @@ +import utils from "~/common/lib/utils"; +import { getHostFromSender } from "~/common/utils/helpers"; +import db from "~/extension/background-script/db"; +import type { MessageAllowanceEnable, Sender } from "~/types"; + +import state from "../../state"; +import { ExtensionIcon, setIcon } from "../setup/setIcon"; + +const enable = async (message: MessageAllowanceEnable, sender: Sender) => { + const host = getHostFromSender(sender); + if (!host) return; + + const isUnlocked = await state.getState().isUnlocked(); + const account = await state.getState().getAccount(); + const allowance = await db.allowances + .where("host") + .equalsIgnoreCase(host) + .first(); + + if (isUnlocked && allowance && allowance.enabled && account?.mnemonic) { + return { + data: { enabled: true }, + }; + } else { + try { + const response = await utils.openPrompt<{ + enabled: boolean; + remember: boolean; + }>(message); + + if (response.data.enabled && sender.tab) { + await setIcon(ExtensionIcon.Active, sender.tab.id as number); // highlight the icon when enabled + } + + // if the response should be saved/remembered we update the allowance for the domain + // as this returns a promise we must wait until it resolves + if (response.data.enabled && response.data.remember) { + if (allowance) { + if (!allowance.id) { + return { data: { error: "id is missing" } }; + } + await db.allowances.update(allowance.id, { + enabled: true, + name: message.origin.name, + imageURL: message.origin.icon, + }); + } else { + await db.allowances.add({ + host: host, + name: message.origin.name, + imageURL: message.origin.icon, + enabled: true, + lastPaymentAt: 0, + totalBudget: 0, + remainingBudget: 0, + createdAt: Date.now().toString(), + lnurlAuth: false, + tag: "", + }); + } + await db.saveToStorage(); + } + return { + data: { + enabled: response.data.enabled, + remember: response.data.remember, + }, + }; + } catch (e) { + console.error(e); + if (e instanceof Error) { + return { error: e.message }; + } + } + } +}; + +export default enable; diff --git a/src/extension/background-script/actions/liquid/index.ts b/src/extension/background-script/actions/liquid/index.ts index 27255b8e1d..e1e48d8bd0 100644 --- a/src/extension/background-script/actions/liquid/index.ts +++ b/src/extension/background-script/actions/liquid/index.ts @@ -1,3 +1,4 @@ +import enable from "./enable"; import fetchAssetRegistry from "./fetchAssetRegistry"; import getAddressOrPrompt from "./getAddressOrPrompt"; import getPsetPreview from "./getPsetPreview"; @@ -5,6 +6,7 @@ import signPset from "./signPset"; import signPsetWithPrompt from "./signPsetWithPrompt"; export { + enable, fetchAssetRegistry, getAddressOrPrompt, getPsetPreview, diff --git a/src/extension/background-script/actions/nostr/enable.ts b/src/extension/background-script/actions/nostr/enable.ts new file mode 100644 index 0000000000..d8c9fa8d98 --- /dev/null +++ b/src/extension/background-script/actions/nostr/enable.ts @@ -0,0 +1,84 @@ +import utils from "~/common/lib/utils"; +import { getHostFromSender } from "~/common/utils/helpers"; +import db from "~/extension/background-script/db"; +import type { MessageAllowanceEnable, Sender } from "~/types"; + +import state from "../../state"; +import { ExtensionIcon, setIcon } from "../setup/setIcon"; + +const enable = async (message: MessageAllowanceEnable, sender: Sender) => { + const host = getHostFromSender(sender); + if (!host) return; + + const isUnlocked = await state.getState().isUnlocked(); + const account = await state.getState().getAccount(); + const allowance = await db.allowances + + .where("host") + .equalsIgnoreCase(host) + .first(); + + if ( + isUnlocked && + allowance && + allowance.enabled && + account?.nostrPrivateKey + ) { + return { + data: { enabled: true }, + }; + } else { + try { + const response = await utils.openPrompt<{ + enabled: boolean; + remember: boolean; + }>(message); + + if (response.data.enabled && sender.tab) { + await setIcon(ExtensionIcon.Active, sender.tab.id as number); // highlight the icon when enabled + } + + // if the response should be saved/remembered we update the allowance for the domain + // as this returns a promise we must wait until it resolves + if (response.data.enabled && response.data.remember) { + if (allowance) { + if (!allowance.id) { + return { data: { error: "id is missing" } }; + } + await db.allowances.update(allowance.id, { + enabled: true, + name: message.origin.name, + imageURL: message.origin.icon, + }); + } else { + await db.allowances.add({ + host: host, + name: message.origin.name, + imageURL: message.origin.icon, + enabled: true, + lastPaymentAt: 0, + totalBudget: 0, + remainingBudget: 0, + createdAt: Date.now().toString(), + lnurlAuth: false, + tag: "", + }); + } + await db.saveToStorage(); + } + return { + data: { + enabled: response.data.enabled, + remember: response.data.remember, + }, + }; + } catch (e) { + console.error(e); + if (e instanceof Error) { + return { error: e.message }; + } + } + } +}; + +export default enable; diff --git a/src/extension/background-script/actions/nostr/index.ts b/src/extension/background-script/actions/nostr/index.ts index cf1e1d38f5..54ae6b8c47 100644 --- a/src/extension/background-script/actions/nostr/index.ts +++ b/src/extension/background-script/actions/nostr/index.ts @@ -1,6 +1,7 @@ import getPublicKey from "~/extension/background-script/actions/nostr/getPublicKey"; import decryptOrPrompt from "./decryptOrPrompt"; +import enable from "./enable"; import encryptOrPrompt from "./encryptOrPrompt"; import generatePrivateKey from "./generatePrivateKey"; import getPrivateKey from "./getPrivateKey"; @@ -13,6 +14,7 @@ import signSchnorrOrPrompt from "./signSchnorrOrPrompt"; export { decryptOrPrompt, + enable, encryptOrPrompt, generatePrivateKey, getPrivateKey, diff --git a/src/extension/background-script/actions/webbtc/enable.ts b/src/extension/background-script/actions/webbtc/enable.ts new file mode 100644 index 0000000000..b560416bbf --- /dev/null +++ b/src/extension/background-script/actions/webbtc/enable.ts @@ -0,0 +1,78 @@ +import utils from "~/common/lib/utils"; +import { getHostFromSender } from "~/common/utils/helpers"; +import db from "~/extension/background-script/db"; +import type { MessageAllowanceEnable, Sender } from "~/types"; + +import state from "../../state"; +import { ExtensionIcon, setIcon } from "../setup/setIcon"; + +const enable = async (message: MessageAllowanceEnable, sender: Sender) => { + const host = getHostFromSender(sender); + if (!host) return; + + const isUnlocked = await state.getState().isUnlocked(); + const account = await state.getState().getAccount(); + const allowance = await db.allowances + .where("host") + .equalsIgnoreCase(host) + .first(); + + if (isUnlocked && allowance && allowance.enabled && account?.mnemonic) { + return { + data: { enabled: true }, + }; + } else { + try { + const response = await utils.openPrompt<{ + enabled: boolean; + remember: boolean; + }>(message); + + if (response.data.enabled && sender.tab) { + await setIcon(ExtensionIcon.Active, sender.tab.id as number); // highlight the icon when enabled + } + + // if the response should be saved/remembered we update the allowance for the domain + // as this returns a promise we must wait until it resolves + if (response.data.enabled && response.data.remember) { + if (allowance) { + if (!allowance.id) { + return { data: { error: "id is missing" } }; + } + await db.allowances.update(allowance.id, { + enabled: true, + name: message.origin.name, + imageURL: message.origin.icon, + }); + } else { + await db.allowances.add({ + host: host, + name: message.origin.name, + imageURL: message.origin.icon, + enabled: true, + lastPaymentAt: 0, + totalBudget: 0, + remainingBudget: 0, + createdAt: Date.now().toString(), + lnurlAuth: false, + tag: "", + }); + } + await db.saveToStorage(); + } + return { + data: { + enabled: response.data.enabled, + remember: response.data.remember, + }, + }; + } catch (e) { + console.error(e); + if (e instanceof Error) { + return { error: e.message }; + } + } + } +}; + +export default enable; diff --git a/src/extension/background-script/actions/webbtc/index.ts b/src/extension/background-script/actions/webbtc/index.ts index ece0f0d4f7..18779f9280 100644 --- a/src/extension/background-script/actions/webbtc/index.ts +++ b/src/extension/background-script/actions/webbtc/index.ts @@ -1,5 +1,6 @@ +import enable from "./enable"; import getAddress from "./getAddress"; import getAddressOrPrompt from "./getAddressOrPrompt"; import getInfo from "./getInfo"; -export { getAddress, getAddressOrPrompt, getInfo }; +export { enable, getAddress, getAddressOrPrompt, getInfo }; diff --git a/src/extension/background-script/actions/webln/enable.ts b/src/extension/background-script/actions/webln/enable.ts new file mode 100644 index 0000000000..ceb6665d07 --- /dev/null +++ b/src/extension/background-script/actions/webln/enable.ts @@ -0,0 +1,77 @@ +import utils from "~/common/lib/utils"; +import { getHostFromSender } from "~/common/utils/helpers"; +import db from "~/extension/background-script/db"; +import type { MessageAllowanceEnable, Sender } from "~/types"; + +import state from "../../state"; +import { ExtensionIcon, setIcon } from "../setup/setIcon"; + +const enable = async (message: MessageAllowanceEnable, sender: Sender) => { + const host = getHostFromSender(sender); + if (!host) return; + + const isUnlocked = await state.getState().isUnlocked(); + const allowance = await db.allowances + .where("host") + .equalsIgnoreCase(host) + .first(); + + if (isUnlocked && allowance && allowance.enabled) { + return { + data: { enabled: true }, + }; + } else { + try { + const response = await utils.openPrompt<{ + enabled: boolean; + remember: boolean; + }>(message); + + if (response.data.enabled && sender.tab) { + await setIcon(ExtensionIcon.Active, sender.tab.id as number); // highlight the icon when enabled + } + + // if the response should be saved/remembered we update the allowance for the domain + // as this returns a promise we must wait until it resolves + if (response.data.enabled && response.data.remember) { + if (allowance) { + if (!allowance.id) { + return { data: { error: "id is missing" } }; + } + await db.allowances.update(allowance.id, { + enabled: true, + name: message.origin.name, + imageURL: message.origin.icon, + }); + } else { + await db.allowances.add({ + host: host, + name: message.origin.name, + imageURL: message.origin.icon, + enabled: true, + lastPaymentAt: 0, + totalBudget: 0, + remainingBudget: 0, + createdAt: Date.now().toString(), + lnurlAuth: false, + tag: "", + }); + } + await db.saveToStorage(); + } + return { + data: { + enabled: response.data.enabled, + remember: response.data.remember, + }, + }; + } catch (e) { + console.error(e); + if (e instanceof Error) { + return { error: e.message }; + } + } + } +}; + +export default enable; diff --git a/src/extension/background-script/actions/webln/index.ts b/src/extension/background-script/actions/webln/index.ts index 16cb886fbd..faa8513fec 100644 --- a/src/extension/background-script/actions/webln/index.ts +++ b/src/extension/background-script/actions/webln/index.ts @@ -1,3 +1,4 @@ +import enable from "./enable"; import getBalanceOrPrompt from "./getBalanceOrPrompt"; import keysendOrPrompt from "./keysendOrPrompt"; import lnurl from "./lnurl"; @@ -6,10 +7,11 @@ import { sendPaymentOrPrompt } from "./sendPaymentOrPrompt"; import signMessageOrPrompt from "./signMessageOrPrompt"; export { - sendPaymentOrPrompt, + enable, + getBalanceOrPrompt, keysendOrPrompt, - signMessageOrPrompt, - makeInvoiceOrPrompt, lnurl, - getBalanceOrPrompt, + makeInvoiceOrPrompt, + sendPaymentOrPrompt, + signMessageOrPrompt, }; diff --git a/src/extension/background-script/router.ts b/src/extension/background-script/router.ts index 0c1ef3dbcf..1cd1b50b4e 100644 --- a/src/extension/background-script/router.ts +++ b/src/extension/background-script/router.ts @@ -1,4 +1,5 @@ import * as accounts from "./actions/accounts"; +import * as alby from "./actions/alby"; import * as allowances from "./actions/allowances"; import * as blocklist from "./actions/blocklist"; import * as cache from "./actions/cache"; @@ -84,18 +85,17 @@ const routes = { // Public calls that are accessible from the inpage script (through the content script) public: { webbtc: { - onboard: onboard.prompt, - enable: allowances.enable, + enable: webbtc.enable, getInfo: webbtc.getInfo, getAddressOrPrompt: webbtc.getAddressOrPrompt, }, alby: { - enable: allowances.enable, + enable: alby.enable, addAccount: accounts.promptAdd, }, webln: { onboard: onboard.prompt, - enable: allowances.enable, + enable: webln.enable, getInfo: ln.getInfo, sendPaymentOrPrompt: webln.sendPaymentOrPrompt, keysendOrPrompt: webln.keysendOrPrompt, @@ -106,14 +106,12 @@ const routes = { request: ln.request, }, liquid: { - onboard: onboard.prompt, - enable: allowances.enable, + enable: liquid.enable, getAddressOrPrompt: liquid.getAddressOrPrompt, signPsetWithPrompt: liquid.signPsetWithPrompt, }, nostr: { - onboard: onboard.prompt, - enable: allowances.enable, + enable: nostr.enable, getPublicKeyOrPrompt: nostr.getPublicKeyOrPrompt, signEventOrPrompt: nostr.signEventOrPrompt, signSchnorrOrPrompt: nostr.signSchnorrOrPrompt, diff --git a/src/extension/content-script/liquid.js b/src/extension/content-script/liquid.js index 65d22d4f24..0d1f5e147a 100644 --- a/src/extension/content-script/liquid.js +++ b/src/extension/content-script/liquid.js @@ -1,6 +1,5 @@ import browser from "webextension-polyfill"; -import api from "~/common/lib/api"; import getOriginData from "./originData"; import shouldInject from "./shouldInject"; @@ -16,7 +15,6 @@ const disabledCalls = ["liquid/enable"]; let isEnabled = false; // store if liquid is enabled for this content page let isRejected = false; // store if the liquid enable call failed. if so we do not prompt again -let account; const SCOPE = "liquid"; @@ -68,14 +66,6 @@ async function init() { origin: getOriginData(), }; - // Overrides the enable action so the user can go through onboarding to setup their keys - if (!account || !account.hasMnemonic) { - account = await api.getAccount(); - if (!account.hasMnemonic) { - messageWithOrigin.action = ev.data.action = `public/liquid/onboard`; - } - } - const replyFunction = (response) => { if (ev.data.action === `${SCOPE}/enable`) { isEnabled = response.data?.enabled; diff --git a/src/extension/content-script/nostr.js b/src/extension/content-script/nostr.js index 76fc586729..92ff55266c 100644 --- a/src/extension/content-script/nostr.js +++ b/src/extension/content-script/nostr.js @@ -1,6 +1,5 @@ import browser from "webextension-polyfill"; -import api from "~/common/lib/api"; import getOriginData from "./originData"; import shouldInject from "./shouldInject"; @@ -23,7 +22,6 @@ const disabledCalls = ["nostr/enable"]; let isEnabled = false; // store if nostr is enabled for this content page let isRejected = false; // store if the nostr enable call failed. if so we do not prompt again -let account; async function init() { const inject = await shouldInject(); @@ -84,14 +82,7 @@ async function init() { origin: getOriginData(), }; - // Overrides the enable action so the user can go through onboarding to setup their keys - if (!account || !account.nostrEnabled) { - account = await api.getAccount(); - if (!account.nostrEnabled) { - messageWithOrigin.action = ev.data.action = `public/nostr/onboard`; - } - } - + // we don't handle onboard in content script. hence we will be resolving original call nostr/enable with an error hence we need reload the next time we execute the call const replyFunction = (response) => { if (ev.data.action === "nostr/enable") { isEnabled = response.data?.enabled; diff --git a/src/extension/content-script/webbtc.js b/src/extension/content-script/webbtc.js index 2470b6d4cd..db2ff09d87 100644 --- a/src/extension/content-script/webbtc.js +++ b/src/extension/content-script/webbtc.js @@ -1,6 +1,5 @@ import browser from "webextension-polyfill"; -import api from "~/common/lib/api"; import getOriginData from "./originData"; import shouldInject from "./shouldInject"; // WebBTC calls that can be executed from the WebBTC Provider. @@ -15,7 +14,7 @@ const disabledCalls = ["webbtc/enable"]; let isEnabled = false; // store if webbtc is enabled for this content page let isRejected = false; // store if the webbtc enable call failed. if so we do not prompt again -let account; + const SCOPE = "webbtc"; async function init() { @@ -66,14 +65,6 @@ async function init() { origin: getOriginData(), }; - // Overrides the enable action so the user can go through onboarding to setup their keys - if (!account || !account.hasMnemonic) { - account = await api.getAccount(); - if (!account.hasMnemonic) { - messageWithOrigin.action = ev.data.action = `public/webbtc/onboard`; - } - } - const replyFunction = (response) => { if (ev.data.action === `${SCOPE}/enable`) { isEnabled = response.data?.enabled; diff --git a/src/extension/content-script/webln.js b/src/extension/content-script/webln.js index fa5822ff03..21b51e9f99 100644 --- a/src/extension/content-script/webln.js +++ b/src/extension/content-script/webln.js @@ -1,6 +1,5 @@ import browser from "webextension-polyfill"; -import api from "~/common/lib/api"; import extractLightningData from "./batteries"; import getOriginData from "./originData"; import shouldInject from "./shouldInject"; @@ -26,7 +25,6 @@ const disabledCalls = ["webln/enable"]; let isEnabled = false; // store if webln is enabled for this content page let isRejected = false; // store if the webln enable call failed. if so we do not prompt again -let account; async function init() { const inject = await shouldInject(); @@ -91,16 +89,6 @@ async function init() { origin: getOriginData(), }; - // Overrides the enable action so the user can go through onboarding to setup their keys - - // Overrides the enable action so the user can go through onboarding to setup their keys - if (!account || !account.hasMnemonic) { - account = await api.getAccount(); - if (!account.hasMnemonic) { - messageWithOrigin.action = ev.data.action = `public/webln/onboard`; - } - } - const replyFunction = (response) => { // if it is the enable call we store if webln is enabled for this content script if (ev.data.action === "webln/enable") { diff --git a/src/i18n/locales/cs/translation.json b/src/i18n/locales/cs/translation.json index 7cb6d91985..c04c797a46 100644 --- a/src/i18n/locales/cs/translation.json +++ b/src/i18n/locales/cs/translation.json @@ -167,10 +167,10 @@ "placeholder": "onion-adresa-vaseho-uzlu:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink", "page": { - "title": "Připojení k <0>Bitcoin Beach Wallet" + "title": "Připojení k <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/da/translation.json b/src/i18n/locales/da/translation.json index d575782581..2e99842934 100644 --- a/src/i18n/locales/da/translation.json +++ b/src/i18n/locales/da/translation.json @@ -208,10 +208,10 @@ "placeholder": "din-nodes-onion-adresse:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "Opret forbindelse til <0>Bitcoin Beach Wallet" + "title": "Opret forbindelse til <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json index 7a0c3ad47c..a61a9741b2 100644 --- a/src/i18n/locales/de/translation.json +++ b/src/i18n/locales/de/translation.json @@ -173,10 +173,10 @@ }, "title": "Start9" }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "Verbinden mit <0>Bitcoin Beach Wallet" + "title": "Verbinden mit <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 4c2960a1dd..b3286d7d8e 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -218,10 +218,10 @@ "placeholder": "your-node-onion-address:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "Connect to <0>Bitcoin Beach Wallet" + "title": "Connect to <0>Blink Wallet" } }, "bitcoin_jungle": { @@ -528,13 +528,27 @@ "add_account": "Add account" } }, - "enable": { - "title": "Connect", - "allow": "Allow this website to:", - "request1": "Request approval for transactions", - "request2": "Request invoices and lightning information", - "block_and_ignore": "Block and ignore {{host}}", - "block_added": "Added {{host}} to the blocklist, please reload the website." + "webln_enable": { + "title": "Connect to WebLN", + + "request2": "Request invoices and lightning information" + }, + "alby_enable": { + "title": "Connect to Alby", + "request2": "Request invoices and alby information" + }, + "nostr_enable": { + "title": "Connect to Nostr", + "request1": "Request to read your Nostr public key", + "request2": "Sign events using your Nostr private key" + }, + "liquid_enable": { + "title": "Connect to Liquid", + "request2": "Request invoices and liquid information" + }, + "webbtc_enable": { + "title": "Connect to WebBTC", + "request2": "Request invoices and liquid information" }, "unlock": { "unlock_to_continue": "Unlock to continue", @@ -1038,6 +1052,12 @@ "between": "between {{min}} and {{max}}", "lessThanOrEqual": "≤ {{max}}", "greaterOrEqual": "≥ {{min}}" + }, + "enable": { + "allow": "Allow this website to:", + "block_added": "Added {{host}} to the blocklist, please reload the website.", + "request1": "Request approval for transactions", + "block_and_ignore": "Block and ignore {{host}}" } }, "components": { diff --git a/src/i18n/locales/eo/translation.json b/src/i18n/locales/eo/translation.json index a7f602f2ee..eb3667c7e8 100644 --- a/src/i18n/locales/eo/translation.json +++ b/src/i18n/locales/eo/translation.json @@ -166,7 +166,7 @@ "placeholder": "" } }, - "bitcoin_beach": { + "blink": { "title": "", "page": { "title": "" diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json index c0a694e288..094446f51f 100644 --- a/src/i18n/locales/es/translation.json +++ b/src/i18n/locales/es/translation.json @@ -145,10 +145,10 @@ "placeholder": "tu-nodo-direccion onion:puerto" } }, - "bitcoin_beach": { - "title": "Billetera de Bitcoin Beach", + "blink": { + "title": "Billetera de Blink", "page": { - "title": "Conecta a <0>La cartera Bitcoin Beach" + "title": "Conecta a <0>La cartera Blink" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/fa/translation.json b/src/i18n/locales/fa/translation.json index 0f4ff4937b..681564dff9 100644 --- a/src/i18n/locales/fa/translation.json +++ b/src/i18n/locales/fa/translation.json @@ -218,10 +218,10 @@ "placeholder": "your-node-onion-address:port" } }, - "bitcoin_beach": { - "title": "کیف پول Bitcoin Beach", + "blink": { + "title": "کیف پول Blink", "page": { - "title": "اتصال به <0>Bitcoin Beach Wallet" + "title": "اتصال به <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/fi/translation.json b/src/i18n/locales/fi/translation.json index 9e493581bd..82e4b08ec0 100644 --- a/src/i18n/locales/fi/translation.json +++ b/src/i18n/locales/fi/translation.json @@ -166,10 +166,10 @@ "placeholder": "solmusi-sipuli-osoite:portti" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach -lompakko", + "blink": { + "title": "Bitcoin Blink -lompakko", "page": { - "title": "Yhdistä <0>Bitcoin Beach -lompakkoon" + "title": "Yhdistä <0>Blink -lompakkoon" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/fr/translation.json b/src/i18n/locales/fr/translation.json index cf47ec4e71..5e9bc45f6c 100644 --- a/src/i18n/locales/fr/translation.json +++ b/src/i18n/locales/fr/translation.json @@ -208,10 +208,10 @@ "placeholder": "adresse-de-votre-node-onion:port" } }, - "bitcoin_beach": { + "blink": { "title": "Portefeuille de plage Bitcoin", "page": { - "title": "Connectez-vous à <0>Bitcoin Beach Wallet" + "title": "Connectez-vous à <0>Bitcoin Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/hi/translation.json b/src/i18n/locales/hi/translation.json index 34254c0d8b..cff0d2f372 100644 --- a/src/i18n/locales/hi/translation.json +++ b/src/i18n/locales/hi/translation.json @@ -215,10 +215,10 @@ "placeholder": "your-node-onion-address:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "<0>Bitcoin Beach Wallet" + "title": "<0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/id/translation.json b/src/i18n/locales/id/translation.json index 0c222bd82e..353c48fa09 100644 --- a/src/i18n/locales/id/translation.json +++ b/src/i18n/locales/id/translation.json @@ -214,10 +214,10 @@ "placeholder": "your-node-onion-address:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "Sambungkan dengan <0>Bitcoin Beach Wallet" + "title": "Sambungkan dengan <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/it/translation.json b/src/i18n/locales/it/translation.json index bb1d989026..bafdadfbfd 100644 --- a/src/i18n/locales/it/translation.json +++ b/src/i18n/locales/it/translation.json @@ -167,10 +167,10 @@ "placeholder": "indirizzo-onion-del-tuo-nodo:porta" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "Connetti il tuo <0>Bitcoin Beach Wallet" + "title": "Connetti il tuo <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/ja/translation.json b/src/i18n/locales/ja/translation.json index d7a3670ede..a11797494e 100644 --- a/src/i18n/locales/ja/translation.json +++ b/src/i18n/locales/ja/translation.json @@ -215,11 +215,11 @@ }, "title": "RaspiBlitz" }, - "bitcoin_beach": { + "blink": { "page": { - "title": "<0>Bitcoin Beach Walletに接続" + "title": "<0>Blink Walletに接続" }, - "title": "Bitcoin Beach Wallet" + "title": "Blink Wallet" }, "title": "ライトニング・ウォレットを接続", "description": "外部のライトニング・ウォレットまたはノードに接続", diff --git a/src/i18n/locales/mr/translation.json b/src/i18n/locales/mr/translation.json index 8f366258d7..f84cb6b428 100644 --- a/src/i18n/locales/mr/translation.json +++ b/src/i18n/locales/mr/translation.json @@ -208,10 +208,10 @@ "placeholder": "your-node-onion-address:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "<0>Bitcoin Beach Wallet ला कनेक्ट करा" + "title": "<0>Blink Wallet ला कनेक्ट करा" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/nl/translation.json b/src/i18n/locales/nl/translation.json index 8a5f5ef463..aee9bda3c2 100644 --- a/src/i18n/locales/nl/translation.json +++ b/src/i18n/locales/nl/translation.json @@ -167,7 +167,7 @@ "placeholder": "" } }, - "bitcoin_beach": { + "blink": { "title": "", "page": { "title": "" diff --git a/src/i18n/locales/pl/translation.json b/src/i18n/locales/pl/translation.json index c589b0d0e6..2cf14c6c9a 100644 --- a/src/i18n/locales/pl/translation.json +++ b/src/i18n/locales/pl/translation.json @@ -214,10 +214,10 @@ "placeholder": "adres-onion-twojego-wezla:port" } }, - "bitcoin_beach": { - "title": "Portfel Bitcoin Beach", + "blink": { + "title": "Portfel Blink", "page": { - "title": "Podłącz do <0>Bitcoin Beach Wallet" + "title": "Podłącz do <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/pt_BR/translation.json b/src/i18n/locales/pt_BR/translation.json index 0efa6c0649..4d523b3acb 100644 --- a/src/i18n/locales/pt_BR/translation.json +++ b/src/i18n/locales/pt_BR/translation.json @@ -145,10 +145,10 @@ "placeholder": "seu-endereço-servidor-onion:porta" } }, - "bitcoin_beach": { - "title": "Carteira Bitcoin Beach", + "blink": { + "title": "Carteira Blink", "page": { - "title": "Conecte-se na <0>Carteira Bitcoin Beach" + "title": "Conecte-se na <0>Carteira Blink" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/ro/translation.json b/src/i18n/locales/ro/translation.json index efe97e7946..b0d8badd58 100644 --- a/src/i18n/locales/ro/translation.json +++ b/src/i18n/locales/ro/translation.json @@ -208,10 +208,10 @@ "placeholder": "adresa-onion-a-nodului-tau:portul" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "Conectare la <0>Bitcoin Beach Wallet" + "title": "Conectare la <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/ru/translation.json b/src/i18n/locales/ru/translation.json index 516c435f8e..7e3daf4b37 100644 --- a/src/i18n/locales/ru/translation.json +++ b/src/i18n/locales/ru/translation.json @@ -208,7 +208,7 @@ "placeholder": "" } }, - "bitcoin_beach": { + "blink": { "title": "", "page": { "title": "" diff --git a/src/i18n/locales/sv/translation.json b/src/i18n/locales/sv/translation.json index a651520f05..27a25c217d 100644 --- a/src/i18n/locales/sv/translation.json +++ b/src/i18n/locales/sv/translation.json @@ -173,10 +173,10 @@ "placeholder": "din-onion-nod-adress:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach plånbok", + "blink": { + "title": "Blink plånbok", "page": { - "title": "Anslut <0>Bitcoin Beach Wallet" + "title": "Anslut <0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/src/i18n/locales/tl/translation.json b/src/i18n/locales/tl/translation.json index 3c22e3aa8f..ed04e4904f 100644 --- a/src/i18n/locales/tl/translation.json +++ b/src/i18n/locales/tl/translation.json @@ -166,7 +166,7 @@ "placeholder": "" } }, - "bitcoin_beach": { + "blink": { "title": "", "page": { "title": "" diff --git a/src/i18n/locales/uk/translation.json b/src/i18n/locales/uk/translation.json index fdb210bfb1..5d5a6d562c 100644 --- a/src/i18n/locales/uk/translation.json +++ b/src/i18n/locales/uk/translation.json @@ -208,7 +208,7 @@ "placeholder": "" } }, - "bitcoin_beach": { + "blink": { "title": "", "page": { "title": "" diff --git a/src/i18n/locales/zh_Hans/translation.json b/src/i18n/locales/zh_Hans/translation.json index 9b9fc48282..1af8edf39d 100644 --- a/src/i18n/locales/zh_Hans/translation.json +++ b/src/i18n/locales/zh_Hans/translation.json @@ -122,11 +122,11 @@ "placeholder": "config=http://your-btc-pay.org/lnd-config/212121/lnd.config" } }, - "bitcoin_beach": { + "blink": { "page": { - "title": "连接<0>比特币海滩钱包" + "title": "连接<0>眨眼钱包" }, - "title": "比特币海滩钱包" + "title": "眨眼钱包" }, "commando": { "config": { diff --git a/src/i18n/locales/zh_Hant/translation.json b/src/i18n/locales/zh_Hant/translation.json index fbcdc2c44a..62b21a65ce 100644 --- a/src/i18n/locales/zh_Hant/translation.json +++ b/src/i18n/locales/zh_Hant/translation.json @@ -215,10 +215,10 @@ "placeholder": "your-node-onion-address:port" } }, - "bitcoin_beach": { - "title": "Bitcoin Beach Wallet", + "blink": { + "title": "Blink Wallet", "page": { - "title": "連接<0>Bitcoin Beach Wallet" + "title": "連接<0>Blink Wallet" } }, "bitcoin_jungle": { diff --git a/static/assets/icons/galoy_bitcoin_beach.png b/static/assets/icons/galoy_bitcoin_beach.png deleted file mode 100644 index 409c2f1429..0000000000 Binary files a/static/assets/icons/galoy_bitcoin_beach.png and /dev/null differ diff --git a/static/assets/icons/galoy_blink.png b/static/assets/icons/galoy_blink.png new file mode 100644 index 0000000000..855bf3acc1 Binary files /dev/null and b/static/assets/icons/galoy_blink.png differ diff --git a/webpack.config.js b/webpack.config.js index b7e4ad3f21..f1e002c544 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -113,8 +113,8 @@ if (!process.env.ALBY_OAUTH_AUTHORIZE_URL) { } // default value is set in the code where it is used -if (!process.env.BITCOIN_BEACH_GALOY_URL) { - process.env.BITCOIN_BEACH_GALOY_URL = ""; // env variables are passed as string. empty strings are still falsy +if (!process.env.BLINK_GALOY_URL) { + process.env.BLINK_GALOY_URL = ""; // env variables are passed as string. empty strings are still falsy } // default value is set in the code where it is used @@ -238,7 +238,7 @@ var options = { // new webpack.SourceMapDevToolPlugin({ filename: false }), // environmental variables new webpack.EnvironmentPlugin([ - "BITCOIN_BEACH_GALOY_URL", + "BLINK_GALOY_URL", "BITCOIN_JUNGLE_GALOY_URL", "NODE_ENV", "TARGET_BROWSER",