mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-19 07:14:22 +01:00
export * from ~/utils
This commit is contained in:
@@ -19,7 +19,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { createDeepSignal } from "~/utils/deepSignal";
|
import { createDeepSignal } from "~/utils";
|
||||||
|
|
||||||
export const THREE_COLUMNS =
|
export const THREE_COLUMNS =
|
||||||
"grid grid-cols-[auto,1fr,auto] gap-4 py-2 px-2 border-b border-neutral-800 last:border-b-0";
|
"grid grid-cols-[auto,1fr,auto] gap-4 py-2 px-2 border-b border-neutral-800 last:border-b-0";
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import on from "~/assets/icons/upload-channel.svg";
|
|||||||
import { AmountFiat, AmountSats } from "~/components";
|
import { AmountFiat, AmountSats } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { generateGradient } from "~/utils/gradientHash";
|
import { generateGradient, timeAgo } from "~/utils";
|
||||||
import { timeAgo } from "~/utils/prettyPrintTime";
|
|
||||||
|
|
||||||
export const ActivityAmount: ParentComponent<{
|
export const ActivityAmount: ParentComponent<{
|
||||||
amount: string;
|
amount: string;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import bolt from "~/assets/icons/bolt.svg";
|
|||||||
import chain from "~/assets/icons/chain.svg";
|
import chain from "~/assets/icons/chain.svg";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { satsToUsd } from "~/utils/conversions";
|
import { satsToUsd } from "~/utils";
|
||||||
|
|
||||||
function prettyPrintAmount(n?: number | bigint): string {
|
function prettyPrintAmount(n?: number | bigint): string {
|
||||||
if (!n || n.valueOf() === 0) {
|
if (!n || n.valueOf() === 0) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { createMemo, Match, ParentComponent, Show, Switch } from "solid-js";
|
|||||||
import { AmountEditable, Card, VStack } from "~/components";
|
import { AmountEditable, Card, VStack } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { satsToUsd } from "~/utils/conversions";
|
import { satsToUsd } from "~/utils";
|
||||||
|
|
||||||
const noop = () => {
|
const noop = () => {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { useI18n } from "~/i18n/context";
|
|||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { DIALOG_CONTENT, DIALOG_POSITIONER } from "~/styles/dialogs";
|
import { DIALOG_CONTENT, DIALOG_POSITIONER } from "~/styles/dialogs";
|
||||||
import { satsToUsd, usdToSats } from "~/utils/conversions";
|
import { satsToUsd, usdToSats } from "~/utils";
|
||||||
|
|
||||||
function fiatInputSanitizer(input: string): string {
|
function fiatInputSanitizer(input: string): string {
|
||||||
// Make sure only numbers and a single decimal point are allowed
|
// Make sure only numbers and a single decimal point are allowed
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Show } from "solid-js";
|
|||||||
import { QRCodeSVG } from "solid-qr-code";
|
import { QRCodeSVG } from "solid-qr-code";
|
||||||
|
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useCopy } from "~/utils/useCopy";
|
import { useCopy } from "~/utils";
|
||||||
|
|
||||||
export function CopyableQR(props: { value: string }) {
|
export function CopyableQR(props: { value: string }) {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { A } from "solid-start";
|
|||||||
import { Button, InfoBox, SimpleDialog, TextField } from "~/components";
|
import { Button, InfoBox, SimpleDialog, TextField } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify } from "~/utils";
|
||||||
|
|
||||||
export function DecryptDialog() {
|
export function DecryptDialog() {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { createSignal } from "solid-js";
|
|||||||
import { Button, ConfirmDialog, showToast } from "~/components";
|
import { Button, ConfirmDialog, showToast } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify } from "~/utils";
|
||||||
|
|
||||||
export function DeleteEverything(props: { emergency?: boolean }) {
|
export function DeleteEverything(props: { emergency?: boolean }) {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ import {
|
|||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import mempoolTxUrl from "~/utils/mempoolTxUrl";
|
import {
|
||||||
import { prettyPrintTime } from "~/utils/prettyPrintTime";
|
mempoolTxUrl,
|
||||||
import { MutinyTagItem, tagToMutinyTag } from "~/utils/tags";
|
MutinyTagItem,
|
||||||
import { useCopy } from "~/utils/useCopy";
|
prettyPrintTime,
|
||||||
|
tagToMutinyTag,
|
||||||
|
useCopy
|
||||||
|
} from "~/utils";
|
||||||
|
|
||||||
interface ChannelClosure {
|
interface ChannelClosure {
|
||||||
channel_id: string;
|
channel_id: string;
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { downloadTextFile } from "~/utils/download";
|
import { downloadTextFile, eify } from "~/utils";
|
||||||
import eify from "~/utils/eify";
|
|
||||||
|
|
||||||
export function ImportExport(props: { emergency?: boolean }) {
|
export function ImportExport(props: { emergency?: boolean }) {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import shareBlack from "~/assets/icons/share-black.svg";
|
|||||||
import { AmountFiat, AmountSats, TruncateMiddle } from "~/components";
|
import { AmountFiat, AmountSats, TruncateMiddle } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { ReceiveFlavor } from "~/routes/Receive";
|
import { ReceiveFlavor } from "~/routes/Receive";
|
||||||
import { useCopy } from "~/utils/useCopy";
|
import { useCopy } from "~/utils";
|
||||||
|
|
||||||
function KindIndicator(props: { kind: ReceiveFlavor }) {
|
function KindIndicator(props: { kind: ReceiveFlavor }) {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ import {
|
|||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify, mempoolTxUrl } from "~/utils";
|
||||||
import mempoolTxUrl from "~/utils/mempoolTxUrl";
|
|
||||||
|
|
||||||
// TODO: hopefully I don't have to maintain this type forever but I don't know how to pass it around otherwise
|
// TODO: hopefully I don't have to maintain this type forever but I don't know how to pass it around otherwise
|
||||||
type RefetchPeersType = (
|
type RefetchPeersType = (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { MutinyWallet } from "@mutinywallet/mutiny-wasm";
|
|||||||
|
|
||||||
import { Button, InnerCard, NiceP, VStack } from "~/components";
|
import { Button, InnerCard, NiceP, VStack } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { downloadTextFile } from "~/utils/download";
|
import { downloadTextFile } from "~/utils";
|
||||||
|
|
||||||
export function Logs() {
|
export function Logs() {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import redClose from "~/assets/icons/red-close.svg";
|
|||||||
import { ActivityAmount, Card, InfoBox, VStack } from "~/components";
|
import { ActivityAmount, Card, InfoBox, VStack } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { createDeepSignal } from "~/utils/deepSignal";
|
import { createDeepSignal, eify, formatExpiration } from "~/utils";
|
||||||
import eify from "~/utils/eify";
|
|
||||||
import { formatExpiration } from "~/utils/prettyPrintTime";
|
|
||||||
|
|
||||||
type PendingItem = {
|
type PendingItem = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { createMemo, createSignal, For, Match, Switch } from "solid-js";
|
|||||||
|
|
||||||
import copyIcon from "~/assets/icons/copy.svg";
|
import copyIcon from "~/assets/icons/copy.svg";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useCopy } from "~/utils/useCopy";
|
import { useCopy } from "~/utils";
|
||||||
|
|
||||||
export function SeedWords(props: {
|
export function SeedWords(props: {
|
||||||
words: string;
|
words: string;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import shareBlack from "~/assets/icons/share-black.svg";
|
|||||||
import shareIcon from "~/assets/icons/share.svg";
|
import shareIcon from "~/assets/icons/share.svg";
|
||||||
import { Card, JsonModal, VStack } from "~/components";
|
import { Card, JsonModal, VStack } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useCopy } from "~/utils/useCopy";
|
import { useCopy } from "~/utils";
|
||||||
|
|
||||||
const STYLE =
|
const STYLE =
|
||||||
"px-4 py-2 rounded-xl border-2 border-white flex gap-2 items-center font-semibold hover:text-m-blue transition-colors";
|
"px-4 py-2 rounded-xl border-2 border-white flex gap-2 items-center font-semibold hover:text-m-blue transition-colors";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { createMemo, createSignal, For, onMount, Show } from "solid-js";
|
|||||||
|
|
||||||
import { TinyButton } from "~/components";
|
import { TinyButton } from "~/components";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { MutinyTagItem, sortByLastUsed } from "~/utils/tags";
|
import { MutinyTagItem, sortByLastUsed } from "~/utils";
|
||||||
|
|
||||||
const createLabelValue = (label: string): Partial<MutinyTagItem> => {
|
const createLabelValue = (label: string): Partial<MutinyTagItem> => {
|
||||||
return { name: label, kind: "Contact" };
|
return { name: label, kind: "Contact" };
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ import down from "~/assets/icons/down.svg";
|
|||||||
import { DecryptDialog, LoadingIndicator } from "~/components";
|
import { DecryptDialog, LoadingIndicator } from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { generateGradient } from "~/utils/gradientHash";
|
import { generateGradient, MutinyTagItem } from "~/utils";
|
||||||
import { MutinyTagItem } from "~/utils/tags";
|
|
||||||
|
|
||||||
export const SmallHeader: ParentComponent<{ class?: string }> = (props) => {
|
export const SmallHeader: ParentComponent<{ class?: string }> = (props) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import initWaila, { PaymentParams } from "@mutinywallet/waila-wasm";
|
import initWaila, { PaymentParams } from "@mutinywallet/waila-wasm";
|
||||||
|
|
||||||
import { Result } from "~/utils/typescript";
|
import { Result } from "~/utils";
|
||||||
|
|
||||||
// Make sure we've initialzied waila before we try to use it
|
// Make sure we've initialzied waila before we try to use it
|
||||||
await initWaila();
|
await initWaila();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { gradientsPerContact } from "~/utils/gradientHash";
|
import { gradientsPerContact } from "~/utils";
|
||||||
|
|
||||||
function ContactRow() {
|
function ContactRow() {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import {
|
|||||||
VStack
|
VStack
|
||||||
} from "~/components/layout";
|
} from "~/components/layout";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import eify from "~/utils/eify";
|
import { eify } from "~/utils";
|
||||||
|
|
||||||
const FEEDBACK_API = import.meta.env.VITE_FEEDBACK;
|
const FEEDBACK_API = import.meta.env.VITE_FEEDBACK;
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,12 @@ import { useI18n } from "~/i18n/context";
|
|||||||
import { matchError } from "~/logic/errorDispatch";
|
import { matchError } from "~/logic/errorDispatch";
|
||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import {
|
||||||
import mempoolTxUrl from "~/utils/mempoolTxUrl";
|
eify,
|
||||||
import { objectToSearchParams } from "~/utils/objectToSearchParams";
|
mempoolTxUrl,
|
||||||
import { MutinyTagItem } from "~/utils/tags";
|
MutinyTagItem,
|
||||||
|
objectToSearchParams
|
||||||
|
} from "~/utils";
|
||||||
|
|
||||||
type OnChainTx = {
|
type OnChainTx = {
|
||||||
transaction: {
|
transaction: {
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ import {
|
|||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import { getRedshifted, setRedshifted } from "~/utils/fakeLabels";
|
import { getRedshifted, mempoolTxUrl, setRedshifted } from "~/utils";
|
||||||
import mempoolTxUrl from "~/utils/mempoolTxUrl";
|
|
||||||
|
|
||||||
type ShiftOption = "utxo" | "lightning";
|
type ShiftOption = "utxo" | "lightning";
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ import { useI18n } from "~/i18n/context";
|
|||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { ParsedParams, toParsedParams } from "~/logic/waila";
|
import { ParsedParams, toParsedParams } from "~/logic/waila";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify, mempoolTxUrl, MutinyTagItem } from "~/utils";
|
||||||
import mempoolTxUrl from "~/utils/mempoolTxUrl";
|
|
||||||
import { MutinyTagItem } from "~/utils/tags";
|
|
||||||
|
|
||||||
import { FeedbackLink } from "./Feedback";
|
import { FeedbackLink } from "./Feedback";
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ import { useI18n } from "~/i18n/context";
|
|||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
import { MethodChooser, SendSource } from "~/routes/Send";
|
import { MethodChooser, SendSource } from "~/routes/Send";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify, mempoolTxUrl } from "~/utils";
|
||||||
import mempoolTxUrl from "~/utils/mempoolTxUrl";
|
|
||||||
|
|
||||||
const CHANNEL_FEE_ESTIMATE_ADDRESS =
|
const CHANNEL_FEE_ESTIMATE_ADDRESS =
|
||||||
"bc1qf7546vg73ddsjznzq57z3e8jdn6gtw6au576j07kt6d9j7nz8mzsyn6lgf";
|
"bc1qf7546vg73ddsjznzq57z3e8jdn6gtw6au576j07kt6d9j7nz8mzsyn6lgf";
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify } from "~/utils";
|
||||||
|
|
||||||
function Nwc() {
|
function Nwc() {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify, timeout } from "~/utils";
|
||||||
import { timeout } from "~/utils/timeout";
|
|
||||||
|
|
||||||
type EncryptPasswordForm = {
|
type EncryptPasswordForm = {
|
||||||
existingPassword: string;
|
existingPassword: string;
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify, subscriptionValid } from "~/utils";
|
||||||
import { subscriptionValid } from "~/utils/subscriptions";
|
|
||||||
|
|
||||||
function Perks(props: { alreadySubbed?: boolean }) {
|
function Perks(props: { alreadySubbed?: boolean }) {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ import {
|
|||||||
} from "~/components";
|
} from "~/components";
|
||||||
import { useI18n } from "~/i18n/context";
|
import { useI18n } from "~/i18n/context";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify, WORDS_EN } from "~/utils";
|
||||||
import { WORDS_EN } from "~/utils/words";
|
|
||||||
|
|
||||||
type SeedWordsForm = {
|
type SeedWordsForm = {
|
||||||
words: string[];
|
words: string[];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
setSettings
|
setSettings
|
||||||
} from "~/logic/mutinyWalletSetup";
|
} from "~/logic/mutinyWalletSetup";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
import eify from "~/utils/eify";
|
import { eify } from "~/utils";
|
||||||
|
|
||||||
export function SettingsStringsEditor() {
|
export function SettingsStringsEditor() {
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ import {
|
|||||||
setupMutinyWallet
|
setupMutinyWallet
|
||||||
} from "~/logic/mutinyWalletSetup";
|
} from "~/logic/mutinyWalletSetup";
|
||||||
import { ParsedParams } from "~/logic/waila";
|
import { ParsedParams } from "~/logic/waila";
|
||||||
import eify from "~/utils/eify";
|
import { eify, MutinyTagItem, subscriptionValid } from "~/utils";
|
||||||
import { subscriptionValid } from "~/utils/subscriptions";
|
|
||||||
import { MutinyTagItem } from "~/utils/tags";
|
|
||||||
|
|
||||||
const MegaStoreContext = createContext<MegaStore>();
|
const MegaStoreContext = createContext<MegaStore>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/// Sometimes we catch an error as `unknown` so this turns it into an Error.
|
/// Sometimes we catch an error as `unknown` so this turns it into an Error.
|
||||||
export default function eify(e: unknown): Error {
|
export function eify(e: unknown): Error {
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
return e;
|
return e;
|
||||||
} else if (typeof e === "string") {
|
} else if (typeof e === "string") {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default function getHostname(url: string): string {
|
export function getHostname(url: string): string {
|
||||||
// Check if the URL begins with "ws://" or "wss://"
|
// Check if the URL begins with "ws://" or "wss://"
|
||||||
if (url.startsWith("ws://")) {
|
if (url.startsWith("ws://")) {
|
||||||
// If it does, remove "ws://" from the URL
|
// If it does, remove "ws://" from the URL
|
||||||
|
|||||||
16
src/utils/index.ts
Normal file
16
src/utils/index.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export * from "./conversions";
|
||||||
|
export * from "./deepSignal";
|
||||||
|
export * from "./download";
|
||||||
|
export * from "./eify";
|
||||||
|
export * from "./fakeLabels";
|
||||||
|
export * from "./getHostname";
|
||||||
|
export * from "./gradientHash";
|
||||||
|
export * from "./mempoolTxUrl";
|
||||||
|
export * from "./objectToSearchParams";
|
||||||
|
export * from "./prettyPrintTime";
|
||||||
|
export * from "./subscriptions";
|
||||||
|
export * from "./tags";
|
||||||
|
export * from "./timeout";
|
||||||
|
export * from "./typescript";
|
||||||
|
export * from "./useCopy";
|
||||||
|
export * from "./words";
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Network } from "~/logic/mutinyWalletSetup";
|
import { Network } from "~/logic/mutinyWalletSetup";
|
||||||
|
|
||||||
export default function mempoolTxUrl(txid?: string, network?: Network) {
|
export function mempoolTxUrl(txid?: string, network?: Network) {
|
||||||
if (!txid || !network) {
|
if (!txid || !network) {
|
||||||
console.error("Problem creating the mempool url");
|
console.error("Problem creating the mempool url");
|
||||||
return "#";
|
return "#";
|
||||||
|
|||||||
Reference in New Issue
Block a user