-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b098689
commit 5515f62
Showing
7 changed files
with
180 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#SIGNET | ||
VITE_SENTRY_ENVIRONMENT="dev" | ||
|
||
VITE_NETWORK="signet" | ||
VITE_PROXY="wss://p.mutinywallet.com" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// Inspired by https://github.com/solidjs/solid-realworld/blob/main/src/store/index.js | ||
import { MutinyBalance, TagItem } from "@mutinywallet/mutiny-wasm"; | ||
import * as Sentry from "@sentry/browser"; | ||
import { useNavigate, useSearchParams } from "@solidjs/router"; | ||
import { SecureStoragePlugin } from "capacitor-secure-storage-plugin"; | ||
import { Remote } from "comlink"; | ||
|
@@ -41,10 +42,42 @@ type LoadStage = | |
|
||
export type WalletWorker = Remote<typeof import("../workers/walletWorker")>; | ||
|
||
const RELEASE_VERSION = import.meta.env.__RELEASE_VERSION__; | ||
const sentryenv = import.meta.env.VITE_SENTRY_ENVIRONMENT || "prod"; | ||
|
||
export const makeMegaStoreContext = () => { | ||
const [searchParams] = useSearchParams(); | ||
const navigate = useNavigate(); | ||
|
||
// initialize both inside worker and outside | ||
// TODO figure out when to set or not | ||
Sentry.init({ | ||
dsn: "https://[email protected]/2", | ||
environment: sentryenv, | ||
release: "mutiny-web@" + RELEASE_VERSION, | ||
integrations: [ | ||
Sentry.browserTracingIntegration(), | ||
Sentry.replayIntegration() | ||
], | ||
|
||
initialScope: { | ||
tags: { component: "main" } | ||
}, | ||
|
||
// Set tracesSampleRate to 1.0 to capture 100% | ||
// of transactions for performance monitoring. | ||
// We recommend adjusting this value in production | ||
tracesSampleRate: 1.0, | ||
|
||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled | ||
tracePropagationTargets: ["localhost", /^https:\/\/mutinywallet\.com/], | ||
|
||
// Capture Replay for 10% of all sessions, | ||
// plus 100% of sessions with an error | ||
replaysSessionSampleRate: 0.1, | ||
replaysOnErrorSampleRate: 1.0 | ||
}); | ||
|
||
// Not actually a shared worker, but it's the same code | ||
const sw = new ComlinkWorker<typeof import("../workers/walletWorker")>( | ||
new URL("../workers/walletWorker", import.meta.url), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import initMutinyWallet, { | |
PendingNwcInvoice, | ||
TagItem | ||
} from "@mutinywallet/mutiny-wasm"; | ||
import * as Sentry from "@sentry/browser"; | ||
|
||
import { IActivityItem } from "~/components"; | ||
import { MutinyWalletSettingStrings } from "~/logic/mutinyWalletSetup"; | ||
|
@@ -26,6 +27,9 @@ import { | |
MutinyFederationIdentity | ||
} from "~/routes/settings"; | ||
|
||
const RELEASE_VERSION = import.meta.env.__RELEASE_VERSION__; | ||
const sentryenv = import.meta.env.VITE_SENTRY_ENVIRONMENT || "prod"; | ||
|
||
// For some reason {...invoice } doesn't bring across the paid field | ||
function destructureInvoice(invoice: MutinyInvoice): MutinyInvoice { | ||
return { | ||
|
@@ -95,6 +99,51 @@ export async function setupMutinyWallet( | |
shouldZapHodl?: boolean, | ||
nsec?: string | ||
): Promise<boolean> { | ||
// initialize both inside worker and outside | ||
// TODO figure out when to set or not | ||
Sentry.init({ | ||
dsn: "https://[email protected]/2", | ||
environment: sentryenv, | ||
release: "mutiny-web@" + RELEASE_VERSION, | ||
integrations: [ | ||
Sentry.captureConsoleIntegration(), // grab all mutiny-node console lines | ||
Sentry.browserTracingIntegration(), | ||
Sentry.replayIntegration() | ||
], | ||
|
||
initialScope: { | ||
tags: { component: "worker" } | ||
}, | ||
|
||
// ignore any hex larger than 20 char | ||
ignoreErrors: [/(?:[0-9a-fA-F]{20,}\b)+/], | ||
|
||
// only do a new issue for errors w/ or w/o exceptions, and warnings | ||
beforeSend(event, hint) { | ||
const error = hint.originalException; | ||
if (error && error.message) { | ||
Check failure on line 124 in src/workers/walletWorker.ts GitHub Actions / Build APK
Check failure on line 124 in src/workers/walletWorker.ts GitHub Actions / Build iOS
|
||
return event; | ||
} else if (event.level == "warning" || event.level == "error") { | ||
return event; | ||
} else { | ||
return null; | ||
} | ||
}, | ||
|
||
// Set tracesSampleRate to 1.0 to capture 100% | ||
// of transactions for performance monitoring. | ||
// We recommend adjusting this value in production | ||
tracesSampleRate: 1.0, | ||
|
||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled | ||
tracePropagationTargets: ["localhost", /^https:\/\/mutinywallet\.com/], | ||
|
||
// Capture Replay for 10% of all sessions, | ||
// plus 100% of sessions with an error | ||
replaysSessionSampleRate: 0.1, | ||
replaysOnErrorSampleRate: 1.0 | ||
}); | ||
|
||
console.log("Starting setup..."); | ||
|
||
// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API | ||
|