Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod v0.5.7 #850

Merged
merged 7 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.mutinywallet.mutinywallet"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 46
versionName "0.5.5"
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.
Expand Down
2 changes: 1 addition & 1 deletion e2e/routes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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.7;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -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.7;
PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mutiny-wallet",
"version": "0.5.5",
"version": "0.5.7",
"license": "MIT",
"packageManager": "[email protected]",
"scripts": {
Expand Down Expand Up @@ -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.7",
"@mutinywallet/waila-wasm": "^0.2.6",
"@solid-primitives/upload": "^0.0.111",
"@solidjs/meta": "^0.29.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions src/components/SyncContactsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
18 changes: 16 additions & 2 deletions src/logic/mutinyWalletSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type MutinyWalletSettingStrings = {
storage?: string;
scorer?: string;
selfhosted?: string;
primal_api?: string;
};

const SETTINGS_KEYS = [
Expand Down Expand Up @@ -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
}
];

Expand Down Expand Up @@ -246,7 +252,8 @@ export async function setupMutinyWallet(
auth,
subscriptions,
storage,
scorer
scorer,
primal_api
} = settings;

console.log("Initializing Mutiny Manager");
Expand All @@ -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");

Expand Down Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions src/logic/waila.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 21 additions & 1 deletion src/routes/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ export function Send() {
const [nodePubkey, setNodePubkey] = createSignal<string>();
const [lnurlp, setLnurlp] = createSignal<string>();
const [lnAddress, setLnAddress] = createSignal<string>();
const [originalScan, setOriginalScan] = createSignal<string>();
const [address, setAddress] = createSignal<string>();
const [payjoinEnabled, setPayjoinEnabled] = createSignal<boolean>();
const [description, setDescription] = createSignal<string>();
const [contactId, setContactId] = createSignal<string>();
const [isHodlInvoice, setIsHodlInvoice] = createSignal<boolean>(false);
Expand Down Expand Up @@ -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);

Expand All @@ -431,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
Expand Down Expand Up @@ -594,6 +599,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;
Expand Down Expand Up @@ -789,6 +804,11 @@ export function Send() {
setChosenMethod={setSourceFromMethod}
/>
</Show>
<Show when={payjoinEnabled()}>
<InfoBox accent="green">
<p>{i18n.t("send.payjoin_send")}</p>
</InfoBox>
</Show>
<Show when={!isAmtEditable()}>
<AmountEditable
initialAmountSats={amountSats()}
Expand Down
68 changes: 63 additions & 5 deletions src/routes/settings/ManageFederations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -165,6 +178,16 @@ function FederationListItem(props: { fed: MutinyFederationIdentity }) {
<Show when={props.fed.welcome_message}>
<p>{props.fed.welcome_message}</p>
</Show>
<Show when={props.balance !== undefined}>
<KeyValue
key={i18n.t("activity.transaction_details.balance")}
>
<AmountSats
amountSats={props.balance}
denominationSize={"sm"}
/>
</KeyValue>
</Show>
<Show when={props.fed.federation_expiry_timestamp}>
<KeyValue
key={i18n.t("settings.manage_federations.expires")}
Expand Down Expand Up @@ -201,6 +224,17 @@ export function ManageFederations() {
const i18n = useI18n();
const [state, _actions] = useMegaStore();

const [balances] = createResource(async () => {
try {
const balances =
await state.mutiny_wallet?.get_federation_balances();
return balances?.balances || [];
} catch (e) {
console.error(e);
return [];
}
});

return (
<MutinyWalletGuard>
<SafeArea>
Expand All @@ -220,9 +254,33 @@ export function ManageFederations() {
</NiceP>
<AddFederationForm />
<VStack>
<For each={state.federations ?? []}>
{(fed) => <FederationListItem fed={fed} />}
</For>
<Suspense>
<Switch>
<Match when={balances()}>
<For each={state.federations ?? []}>
{(fed) => (
<FederationListItem
fed={fed}
balance={
balances()?.find(
(b) =>
b.identity_federation_id ===
fed.federation_id
)?.balance
}
/>
)}
</For>
</Match>
<Match when={true}>
<For each={state.federations ?? []}>
{(fed) => (
<FederationListItem fed={fed} />
)}
</For>
</Match>
</Switch>
</Suspense>
</VStack>
</DefaultMain>
<NavBar activeTab="settings" />
Expand Down
12 changes: 2 additions & 10 deletions src/routes/settings/SyncNostrContacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/state/megaStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ export const Provider: ParentComponent = (props) => {
} else {
if (
result.value?.address ||
result.value?.payjoin_enabled ||
result.value?.invoice ||
result.value?.node_pubkey ||
(result.value?.lnurl && !result.value.is_lnurl_auth)
Expand Down
Loading