diff --git a/android/app/build.gradle b/android/app/build.gradle index 8ce842d3..02578d85 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.mutinywallet.mutinywallet" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 35 - versionName "0.4.34" + versionCode 36 + versionName "0.4.35" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index cf7d3f76..c4e478fa 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -360,7 +360,7 @@ INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.4.34; + MARKETING_VERSION = 1.4.35; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -387,7 +387,7 @@ INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.4.34; + MARKETING_VERSION = 1.4.35; PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/package.json b/package.json index 1b3a791c..fa7959e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mutiny-wallet", - "version": "0.4.34", + "version": "0.4.35", "license": "MIT", "packageManager": "pnpm@8.6.6", "scripts": { @@ -57,7 +57,7 @@ "@kobalte/core": "^0.9.8", "@kobalte/tailwindcss": "^0.5.0", "@modular-forms/solid": "^0.18.1", - "@mutinywallet/mutiny-wasm": "0.4.34", + "@mutinywallet/mutiny-wasm": "0.4.35", "@mutinywallet/waila-wasm": "^0.2.4", "@solid-primitives/upload": "^0.0.111", "@solid-primitives/websocket": "^1.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c68ad9af..673e014f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,8 +54,8 @@ importers: specifier: ^0.18.1 version: 0.18.1(solid-js@1.8.5) '@mutinywallet/mutiny-wasm': - specifier: 0.4.34 - version: 0.4.34 + specifier: 0.4.35 + version: 0.4.35 '@mutinywallet/waila-wasm': specifier: ^0.2.4 version: 0.2.4 @@ -2573,8 +2573,8 @@ packages: solid-js: 1.8.5 dev: false - /@mutinywallet/mutiny-wasm@0.4.34: - resolution: {integrity: sha512-pM3kRz2acXM4E+xGGjIz1rubyj/9Sg+8XfZL5GD4wLZop+mF/YRFY8r1XkJuknNBZ6kTrlD4zbjxNsnVOCLFpA==} + /@mutinywallet/mutiny-wasm@0.4.35: + resolution: {integrity: sha512-DvI5i6rsn3uqrauh2LtrEj2igFyuPtOLw/eGJn+cZxtSrOmaiacQQgjO1mtjst1SM0xRhgnMceyGM7wCVbKoBQ==} dev: false /@mutinywallet/waila-wasm@0.2.4: diff --git a/src/components/KitchenSink.tsx b/src/components/KitchenSink.tsx index a81935f9..639770ee 100644 --- a/src/components/KitchenSink.tsx +++ b/src/components/KitchenSink.tsx @@ -21,6 +21,7 @@ import { Restart, ResyncOnchain, showToast, + ToggleHodl, VStack } from "~/components"; import { useI18n } from "~/i18n/context"; @@ -465,6 +466,8 @@ export function KitchenSink() {

+ +

diff --git a/src/components/ToggleHodl.tsx b/src/components/ToggleHodl.tsx new file mode 100644 index 00000000..271144f4 --- /dev/null +++ b/src/components/ToggleHodl.tsx @@ -0,0 +1,42 @@ +import { Button, InnerCard, NiceP, VStack } from "~/components"; +import { useI18n } from "~/i18n/context"; +import { useMegaStore } from "~/state/megaStore"; + +export function ToggleHodl() { + const i18n = useI18n(); + const [state, actions] = useMegaStore(); + + async function toggle() { + try { + await actions.toggleHodl(); + window.location.href = "/"; + } catch (e) { + console.error(e); + } + } + + return ( + + + + {i18n.t("settings.admin.kitchen_sink.zaps_to_hodl_desc")} + + + + + + ); +} diff --git a/src/components/index.ts b/src/components/index.ts index 53cfc36f..aac89aa3 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -44,3 +44,4 @@ export * from "./NostrActivity"; export * from "./SyncContactsForm"; export * from "./GiftLink"; export * from "./MutinyPlusCta"; +export * from "./ToggleHodl"; diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index 437e9030..0211bc2a 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -271,7 +271,12 @@ export default { amount: "Amount", open_channel: "Open Channel", nodes: "Nodes", - no_nodes: "No nodes" + no_nodes: "No nodes", + enable_zaps_to_hodl: "Enable zaps to hodl invoices?", + zaps_to_hodl_desc: + "Zaps to hodl invoices can result in channel force closes, which results in high on-chain fees. Use at your own risk!", + zaps_to_hodl_enable: "Enable hodl zaps", + zaps_to_hodl_disable: "Disable hodl zaps" } }, backup: { diff --git a/src/logic/mutinyWalletSetup.ts b/src/logic/mutinyWalletSetup.ts index 9e7d0106..75a0d563 100644 --- a/src/logic/mutinyWalletSetup.ts +++ b/src/logic/mutinyWalletSetup.ts @@ -202,7 +202,8 @@ export async function initializeWasm() { export async function setupMutinyWallet( settings: MutinyWalletSettingStrings, password?: string, - safeMode?: boolean + safeMode?: boolean, + shouldZapHodl?: boolean ): Promise { console.log("Starting setup..."); @@ -245,6 +246,7 @@ export async function setupMutinyWallet( console.log("Using storage address", storage); console.log("Using scorer address", scorer); console.log(safeMode ? "Safe mode enabled" : "Safe mode disabled"); + console.log(shouldZapHodl ? "Hodl zaps enabled" : "Hodl zaps disabled"); const mutinyWallet = await new MutinyWallet( // Password @@ -265,7 +267,9 @@ export async function setupMutinyWallet( // Do not skip device lock undefined, // Safe mode - safeMode || undefined + safeMode || undefined, + // Skip hodl invoices? (defaults to true, so if shouldZapHodl is true that's when we pass false) + shouldZapHodl ? false : undefined ); sessionStorage.setItem("MUTINY_WALLET_INITIALIZED", Date.now().toString()); diff --git a/src/state/megaStore.tsx b/src/state/megaStore.tsx index 5e13c94d..8c277793 100644 --- a/src/state/megaStore.tsx +++ b/src/state/megaStore.tsx @@ -66,6 +66,7 @@ export type MegaStore = [ npub?: string; preferredInvoiceType: "unified" | "lightning" | "onchain"; betaWarned: boolean; + should_zap_hodl: boolean; }, { setup(password?: string): Promise; @@ -87,6 +88,7 @@ export type MegaStore = [ onSuccess: (value: ParsedParams) => void ): void; setBetaWarned(): void; + toggleHodl(): void; } ]; @@ -121,7 +123,8 @@ export const Provider: ParentComponent = (props) => { safe_mode: searchParams.safe_mode === "true", npub: localStorage.getItem("npub") || undefined, preferredInvoiceType: "unified" as "unified" | "lightning" | "onchain", - betaWarned: localStorage.getItem("betaWarned") === "true" + betaWarned: localStorage.getItem("betaWarned") === "true", + should_zap_hodl: localStorage.getItem("should_zap_hodl") === "true" }); const actions = { @@ -177,7 +180,8 @@ export const Provider: ParentComponent = (props) => { const mutinyWallet = await setupMutinyWallet( settings, password, - state.safe_mode + state.safe_mode, + state.should_zap_hodl ); // Give other components access to settings via the store @@ -381,6 +385,11 @@ export const Provider: ParentComponent = (props) => { setBetaWarned() { localStorage.setItem("betaWarned", "true"); setState({ betaWarned: true }); + }, + toggleHodl() { + const should_zap_hodl = !state.should_zap_hodl; + localStorage.setItem("should_zap_hodl", should_zap_hodl.toString()); + setState({ should_zap_hodl }); } };