Changes for v0.5.6

This commit is contained in:
Tony Giorgio
2024-01-25 09:13:08 -06:00
committed by Tony Giorgio
parent 1824cb2688
commit 5dde1fff48
3 changed files with 19 additions and 16 deletions

View File

@@ -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);

View File

@@ -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());

View File

@@ -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);
}