From c680ab2805ac72399b38e1ed88fbe3d56a1f1544 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Fri, 19 Jan 2024 17:57:32 +0000 Subject: [PATCH 1/7] Display individual fedimint balances --- src/routes/settings/ManageFederations.tsx | 68 +++++++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/src/routes/settings/ManageFederations.tsx b/src/routes/settings/ManageFederations.tsx index ed932324..ead77b4c 100644 --- a/src/routes/settings/ManageFederations.tsx +++ b/src/routes/settings/ManageFederations.tsx @@ -6,9 +6,19 @@ import { SubmitHandler } from "@modular-forms/solid"; import { useSearchParams } from "@solidjs/router"; -import { createSignal, For, onMount, Show } from "solid-js"; +import { + createResource, + createSignal, + For, + Match, + onMount, + Show, + Suspense, + Switch +} from "solid-js"; import { + AmountSats, BackLink, Button, ConfirmDialog, @@ -130,7 +140,10 @@ function AddFederationForm() { ); } -function FederationListItem(props: { fed: MutinyFederationIdentity }) { +function FederationListItem(props: { + fed: MutinyFederationIdentity; + balance?: bigint; +}) { const i18n = useI18n(); const [state, actions] = useMegaStore(); @@ -165,6 +178,16 @@ function FederationListItem(props: { fed: MutinyFederationIdentity }) {

{props.fed.welcome_message}

+ + + + + { + try { + const balances = + await state.mutiny_wallet?.get_federation_balances(); + return balances?.balances || []; + } catch (e) { + console.error(e); + return []; + } + }); + return ( @@ -220,9 +254,33 @@ export function ManageFederations() { - - {(fed) => } - + + + + + {(fed) => ( + + b.identity_federation_id === + fed.federation_id + )?.balance + } + /> + )} + + + + + {(fed) => ( + + )} + + + + From 8ff11a2380cfd8038384bd4e5028f336ce408aec Mon Sep 17 00:00:00 2001 From: benalleng Date: Sat, 30 Sep 2023 21:55:53 -0400 Subject: [PATCH 2/7] feat: Add payjoin sends --- src/i18n/en/translations.ts | 2 ++ src/logic/waila.ts | 4 ++++ src/routes/Send.tsx | 21 ++++++++++++++++++++- src/state/megaStore.tsx | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index e42fa0b5..120f9e8f 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -138,6 +138,8 @@ export default { error_keysend: "Keysend failed", error_LNURL: "LNURL Pay failed", error_expired: "Invoice is expired", + payjoin_send: + "This is a payjoin! The Mutiny will continue until privacy improves", payment_pending: "Payment pending", payment_pending_description: "It's taking a while, but it's possible this payment may still go through. Please check 'Activity' for the current status.", diff --git a/src/logic/waila.ts b/src/logic/waila.ts index 20b1a407..d2a29b72 100644 --- a/src/logic/waila.ts +++ b/src/logic/waila.ts @@ -6,7 +6,9 @@ import { Result } from "~/utils"; await initWaila(); export type ParsedParams = { + original: string; address?: string; + payjoin_enabled?: boolean; invoice?: string; amount_sats?: bigint; network?: string; @@ -53,7 +55,9 @@ export function toParsedParams( return { ok: true, value: { + original: str, address: params.address, + payjoin_enabled: params.payjoin_supported, invoice: params.invoice, amount_sats: params.amount_sats, network, diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 76ed6117..cedac967 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -261,7 +261,9 @@ export function Send() { const [nodePubkey, setNodePubkey] = createSignal(); const [lnurlp, setLnurlp] = createSignal(); const [lnAddress, setLnAddress] = createSignal(); + const [originalScan, setOriginalScan] = createSignal(); const [address, setAddress] = createSignal(); + const [payjoinEnabled, setPayjoinEnabled] = createSignal(); const [description, setDescription] = createSignal(); const [contactId, setContactId] = createSignal(); const [isHodlInvoice, setIsHodlInvoice] = createSignal(false); @@ -414,9 +416,11 @@ export function Send() { function handleDestination(source: ParsedParams | undefined) { if (!source) return; setParsingDestination(true); - + setOriginalScan(source.original); try { if (source.address) setAddress(source.address); + if (source.payjoin_enabled) + setPayjoinEnabled(source.payjoin_enabled); if (source.memo) setDescription(source.memo); if (source.contact_id) setContactId(source.contact_id); @@ -594,6 +598,16 @@ export function Send() { tags ); + sentDetails.amount = amountSats(); + sentDetails.destination = address(); + sentDetails.txid = txid; + sentDetails.fee_estimate = feeEstimate() ?? 0; + } else if (payjoinEnabled()) { + const txid = await state.mutiny_wallet?.send_payjoin( + originalScan()!, + amountSats(), + tags + ); sentDetails.amount = amountSats(); sentDetails.destination = address(); sentDetails.txid = txid; @@ -789,6 +803,11 @@ export function Send() { setChosenMethod={setSourceFromMethod} /> + + +

{i18n.t("send.payjoin_send")}

+
+
{ } else { if ( result.value?.address || + result.value?.payjoin_enabled || result.value?.invoice || result.value?.node_pubkey || (result.value?.lnurl && !result.value.is_lnurl_auth) From 0324b49599431147a4e2293cf223f12b6ebfdf4c Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 25 Jan 2024 13:11:14 +0000 Subject: [PATCH 3/7] fix on-chain amount not showing --- src/routes/Send.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index cedac967..fca0422f 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -435,6 +435,7 @@ export function Send() { processLnurl(source as ParsedParams & { lnurl: string }); } else { setAmountSats(source.amount_sats || 0n); + if (source.amount_sats) setIsAmtEditable(false); setSource("onchain"); } // Return the source just to trigger `decodedDestination` as not undefined From 0ace3a3c28180b0ce1c620d24ba4ebeefbd4ad85 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Thu, 25 Jan 2024 07:15:40 -0600 Subject: [PATCH 4/7] New relay url --- e2e/routes.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/routes.spec.ts b/e2e/routes.spec.ts index 1523fedf..97234753 100644 --- a/e2e/routes.spec.ts +++ b/e2e/routes.spec.ts @@ -166,7 +166,7 @@ test("visit each route", async ({ page }) => { // Now we have to check routes that aren't linked to directly for whatever reason await page.goto( - "http://localhost:3420/gift?amount=50000&nwc_uri=nostr%2Bwalletconnect%3A%2F%2Ff6d55dff6da0f23e0d609121905aaa8da5d2bad7759459402e2bee1162912556%3Frelay%3Dwss%253A%252F%252Fnostr.mutinywallet.com%252F%26secret%3D8a2d579a182e9091d36d5668eb1c3b301d98bc792d94e866526123df79568355" + "http://localhost:3420/gift?amount=50000&nwc_uri=nostr%2Bwalletconnect%3A%2F%2Ff6d55dff6da0f23e0d609121905aaa8da5d2bad7759459402e2bee1162912556%3Frelay%3Dwss%253A%252F%252Frelay.mutinywallet.com%252F%26secret%3D8a2d579a182e9091d36d5668eb1c3b301d98bc792d94e866526123df79568355" ); await expect(page.locator("h2").nth(1)).toHaveText( "You've been gifted some sats!" From 1824cb2688e63e0e373428527d2b4a7c92c8486e Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Thu, 25 Jan 2024 09:01:48 -0600 Subject: [PATCH 5/7] Bump to v0.5.6 --- android/app/build.gradle | 4 ++-- ios/App/App.xcodeproj/project.pbxproj | 4 ++-- package.json | 4 ++-- pnpm-lock.yaml | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4fcdfa28..421b1ad1 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 46 - versionName "0.5.5" + versionCode 47 + versionName "0.5.6" 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 5b7ad2e1..8e0c53c6 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.5.5; + MARKETING_VERSION = 1.5.6; 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.5.5; + MARKETING_VERSION = 1.5.6; PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/package.json b/package.json index ebbda979..e1a8e4d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mutiny-wallet", - "version": "0.5.5", + "version": "0.5.6", "license": "MIT", "packageManager": "pnpm@8.6.6", "scripts": { @@ -55,7 +55,7 @@ "@kobalte/core": "^0.9.8", "@kobalte/tailwindcss": "^0.5.0", "@modular-forms/solid": "^0.18.1", - "@mutinywallet/mutiny-wasm": "0.5.5", + "@mutinywallet/mutiny-wasm": "0.5.6", "@mutinywallet/waila-wasm": "^0.2.6", "@solid-primitives/upload": "^0.0.111", "@solidjs/meta": "^0.29.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff757297..d79fa583 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.5.5 - version: 0.5.5 + specifier: 0.5.6 + version: 0.5.6 '@mutinywallet/waila-wasm': specifier: ^0.2.6 version: 0.2.6 @@ -2570,8 +2570,8 @@ packages: solid-js: 1.8.5 dev: false - /@mutinywallet/mutiny-wasm@0.5.5: - resolution: {integrity: sha512-+8+Qq5GQL612WKpX39ruUXqQJAgNGV+TwqSzz0w0/T6pxP09Fj8wt27Q2O7FpAdbqoxGHfbgNULsIDYRYPtkMA==} + /@mutinywallet/mutiny-wasm@0.5.6: + resolution: {integrity: sha512-/AW+knNFZ+hLdZjA+4QwM3rUdGpkyaEz7driQa8R9oMMMcXVMOzM+mOPhd2gXg9nmAGzP/E8l1fZrk20HfuMPA==} dev: false /@mutinywallet/waila-wasm@0.2.6: From 5dde1fff486f13b68ae05ad425721c60194b126c Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Thu, 25 Jan 2024 09:13:08 -0600 Subject: [PATCH 6/7] Changes for v0.5.6 --- src/components/SyncContactsForm.tsx | 5 +---- src/logic/mutinyWalletSetup.ts | 18 ++++++++++++++++-- src/routes/settings/SyncNostrContacts.tsx | 12 ++---------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/components/SyncContactsForm.tsx b/src/components/SyncContactsForm.tsx index 2dc13f9b..dfa506d4 100644 --- a/src/components/SyncContactsForm.tsx +++ b/src/components/SyncContactsForm.tsx @@ -12,8 +12,6 @@ type NostrContactsForm = { npub: string; }; -const PRIMAL_API = import.meta.env.VITE_PRIMAL; - export function SyncContactsForm() { const i18n = useI18n(); const [state, actions] = useMegaStore(); @@ -30,8 +28,7 @@ export function SyncContactsForm() { ) => { try { const npub = f.npub.trim(); - if (!PRIMAL_API) throw new Error("PRIMAL_API not set"); - await state.mutiny_wallet?.sync_nostr_contacts(PRIMAL_API, npub); + await state.mutiny_wallet?.sync_nostr_contacts(npub); actions.saveNpub(npub); } catch (e) { console.error(e); diff --git a/src/logic/mutinyWalletSetup.ts b/src/logic/mutinyWalletSetup.ts index 7ba1ba8c..4b0f9ed9 100644 --- a/src/logic/mutinyWalletSetup.ts +++ b/src/logic/mutinyWalletSetup.ts @@ -17,6 +17,7 @@ export type MutinyWalletSettingStrings = { storage?: string; scorer?: string; selfhosted?: string; + primal_api?: string; }; const SETTINGS_KEYS = [ @@ -79,6 +80,11 @@ const SETTINGS_KEYS = [ name: "selfhosted", storageKey: "USER_SETTINGS_selfhosted", default: import.meta.env.VITE_SELFHOSTED + }, + { + name: "primal_api", + storageKey: "USER_SETTINGS_primal_api", + default: import.meta.env.VITE_PRIMAL } ]; @@ -246,7 +252,8 @@ export async function setupMutinyWallet( auth, subscriptions, storage, - scorer + scorer, + primal_api } = settings; console.log("Initializing Mutiny Manager"); @@ -261,6 +268,7 @@ export async function setupMutinyWallet( console.log("Using subscriptions address", subscriptions); console.log("Using storage address", storage); console.log("Using scorer address", scorer); + console.log("Using primal api", primal_api); console.log(safeMode ? "Safe mode enabled" : "Safe mode disabled"); console.log(shouldZapHodl ? "Hodl zaps enabled" : "Hodl zaps disabled"); @@ -290,7 +298,13 @@ export async function setupMutinyWallet( // Safe mode safeMode || undefined, // Skip hodl invoices? (defaults to true, so if shouldZapHodl is true that's when we pass false) - shouldZapHodl ? false : undefined + shouldZapHodl ? false : undefined, + // Nsec override + undefined, + // Nip7 + undefined, + // primal URL + primal_api || "https://primal-cache.mutinywallet.com/api" ); sessionStorage.setItem("MUTINY_WALLET_INITIALIZED", Date.now().toString()); diff --git a/src/routes/settings/SyncNostrContacts.tsx b/src/routes/settings/SyncNostrContacts.tsx index c5847f02..fb938d62 100644 --- a/src/routes/settings/SyncNostrContacts.tsx +++ b/src/routes/settings/SyncNostrContacts.tsx @@ -24,8 +24,6 @@ type NostrContactsForm = { npub: string; }; -const PRIMAL_API = import.meta.env.VITE_PRIMAL; - function SyncContactsForm() { const i18n = useI18n(); const [state, actions] = useMegaStore(); @@ -42,8 +40,7 @@ function SyncContactsForm() { ) => { try { const npub = f.npub.trim(); - if (!PRIMAL_API) throw new Error("PRIMAL_API not set"); - await state.mutiny_wallet?.sync_nostr_contacts(PRIMAL_API, npub); + await state.mutiny_wallet?.sync_nostr_contacts(npub); actions.saveNpub(npub); } catch (e) { console.error(e); @@ -105,12 +102,7 @@ export function SyncNostrContacts() { setError(undefined); setLoading(true); try { - if (!PRIMAL_API) throw new Error("PRIMAL_API not set"); - await state.mutiny_wallet?.sync_nostr_contacts( - PRIMAL_API, - // We can only see the resync button if there's an npub set - state.npub! - ); + await state.mutiny_wallet?.sync_nostr_contacts(state.npub!); } catch (e) { console.error(e); } From 4d3ecdcc875ab922cb68b983619fcfbea63529f8 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Thu, 25 Jan 2024 15:42:27 -0600 Subject: [PATCH 7/7] Bump to v0.5.7 --- android/app/build.gradle | 4 ++-- ios/App/App.xcodeproj/project.pbxproj | 4 ++-- package.json | 4 ++-- pnpm-lock.yaml | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 421b1ad1..1f55a5a1 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 47 - versionName "0.5.6" + versionCode 48 + versionName "0.5.7" 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 8e0c53c6..77a7daf1 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.5.6; + MARKETING_VERSION = 1.5.7; 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.5.6; + MARKETING_VERSION = 1.5.7; PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/package.json b/package.json index e1a8e4d1..8a708c44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mutiny-wallet", - "version": "0.5.6", + "version": "0.5.7", "license": "MIT", "packageManager": "pnpm@8.6.6", "scripts": { @@ -55,7 +55,7 @@ "@kobalte/core": "^0.9.8", "@kobalte/tailwindcss": "^0.5.0", "@modular-forms/solid": "^0.18.1", - "@mutinywallet/mutiny-wasm": "0.5.6", + "@mutinywallet/mutiny-wasm": "0.5.7", "@mutinywallet/waila-wasm": "^0.2.6", "@solid-primitives/upload": "^0.0.111", "@solidjs/meta": "^0.29.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d79fa583..56ad47bc 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.5.6 - version: 0.5.6 + specifier: 0.5.7 + version: 0.5.7 '@mutinywallet/waila-wasm': specifier: ^0.2.6 version: 0.2.6 @@ -2570,8 +2570,8 @@ packages: solid-js: 1.8.5 dev: false - /@mutinywallet/mutiny-wasm@0.5.6: - resolution: {integrity: sha512-/AW+knNFZ+hLdZjA+4QwM3rUdGpkyaEz7driQa8R9oMMMcXVMOzM+mOPhd2gXg9nmAGzP/E8l1fZrk20HfuMPA==} + /@mutinywallet/mutiny-wasm@0.5.7: + resolution: {integrity: sha512-swz7lFC86b8zWAc5gDz4I4O+66va2aOS9sHOkKhG0SEMp2vVti11Y4lpN0aJVuCy8Wx4FNZZLSxro00pYyf8kQ==} dev: false /@mutinywallet/waila-wasm@0.2.6: