Skip to content

Commit

Permalink
Changes for v0.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyRonning committed Jan 25, 2024
1 parent 1824cb2 commit 5dde1ff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
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
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
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

0 comments on commit 5dde1ff

Please sign in to comment.