diff --git a/src/components/AddressInput.tsx b/src/components/AddressInput.tsx index 9b3bdced..52ba3c7c 100644 --- a/src/components/AddressInput.tsx +++ b/src/components/AddressInput.tsx @@ -1,6 +1,5 @@ import { createEffect, on } from "solid-js"; -import { decodeAddress } from "../compat"; import { RBTC } from "../consts"; import t from "../i18n"; import { @@ -11,6 +10,7 @@ import { setAddressValid, setOnchainAddress, } from "../signals"; +import { decodeAddress } from "../utils/compat"; import { extractAddress } from "../utils/invoice"; import { setButtonLabel } from "./CreateButton"; diff --git a/src/components/AssetSelect.tsx b/src/components/AssetSelect.tsx index bfe00187..9f376319 100644 --- a/src/components/AssetSelect.tsx +++ b/src/components/AssetSelect.tsx @@ -1,6 +1,5 @@ import { pairs } from "../config"; import { LN, sideSend } from "../consts"; -import { fetchPairs } from "../helper"; import t from "../i18n"; import { assetReceive, @@ -12,6 +11,7 @@ import { setAssetSelect, setAssetSend, } from "../signals"; +import { fetchPairs } from "../utils/helper"; const assets = Object.keys(pairs).map((pair) => pair.split("/")[0]); assets.push(LN); diff --git a/src/components/CreateButton.tsx b/src/components/CreateButton.tsx index 51e25f12..70f82083 100644 --- a/src/components/CreateButton.tsx +++ b/src/components/CreateButton.tsx @@ -6,8 +6,6 @@ import { createEffect, createMemo, createSignal } from "solid-js"; import { RBTC } from "../consts"; import { useWeb3Signer } from "../context/Web3"; -import { ECPair } from "../ecpair/ecpair"; -import { feeCheck, fetcher } from "../helper"; import t from "../i18n"; import { asset, @@ -32,6 +30,8 @@ import { valid, wasmSupported, } from "../signals"; +import { ECPair } from "../utils/ecpair"; +import { feeCheck, fetcher } from "../utils/helper"; import { extractAddress, fetchLnurl } from "../utils/invoice"; import { validateResponse } from "../utils/validation"; diff --git a/src/components/DownloadRefund.tsx b/src/components/DownloadRefund.tsx index af8d1eb6..14ff0305 100644 --- a/src/components/DownloadRefund.tsx +++ b/src/components/DownloadRefund.tsx @@ -1,10 +1,10 @@ import log from "loglevel"; import QRCode from "qrcode/lib/server"; -import { isIos, isMobile } from "../helper"; import t from "../i18n"; import { swap } from "../signals"; import { download, downloadJson } from "../utils/download"; +import { isIos, isMobile } from "../utils/helper"; const createRefundData = (swap: any) => { return { diff --git a/src/components/Fees.tsx b/src/components/Fees.tsx index 7a53fc9e..5f890a1d 100644 --- a/src/components/Fees.tsx +++ b/src/components/Fees.tsx @@ -2,7 +2,6 @@ import { createEffect } from "solid-js"; import btcSvg from "../assets/btc.svg"; import satSvg from "../assets/sat.svg"; -import { fetchPairs } from "../helper"; import t from "../i18n"; import { asset, @@ -23,6 +22,7 @@ import { calculateSendAmount, } from "../utils/calculate"; import { denominations, formatAmount } from "../utils/denomination"; +import { fetchPairs } from "../utils/helper"; const Fees = () => { createEffect(() => { diff --git a/src/Footer.tsx b/src/components/Footer.tsx similarity index 88% rename from src/Footer.tsx rename to src/components/Footer.tsx index 3d5b2f58..3032300a 100644 --- a/src/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,8 +1,8 @@ -import discord from "./assets/discord.svg"; -import github from "./assets/github.svg"; -import nostr from "./assets/nostr.svg"; -import substack from "./assets/substack.svg"; -import twitter from "./assets/twitter.svg"; +import discord from "../assets/discord.svg"; +import github from "../assets/github.svg"; +import nostr from "../assets/nostr.svg"; +import substack from "../assets/substack.svg"; +import twitter from "../assets/twitter.svg"; import { blogUrl, discordUrl, @@ -10,9 +10,9 @@ import { nostrUrl, repoUrl, twitterUrl, -} from "./config"; -import t from "./i18n"; -import "./style/footer.scss"; +} from "../config"; +import t from "../i18n"; +import "../style/footer.scss"; const Footer = () => { return ( diff --git a/src/Nav.tsx b/src/components/Nav.tsx similarity index 92% rename from src/Nav.tsx rename to src/components/Nav.tsx index 400c9e4a..9d7f28a9 100644 --- a/src/Nav.tsx +++ b/src/components/Nav.tsx @@ -1,14 +1,14 @@ import { A } from "@solidjs/router"; import { For, Show, createSignal } from "solid-js"; -import { setHideHero } from "./Hero"; -import logo from "./assets/boltz.svg"; -import Warnings from "./components/Warnings"; -import { blogUrl, discordUrl, docsUrl, torUrl } from "./config"; -import t from "./i18n"; -import locales from "./i18n/i18n"; -import { setI18nConfigured } from "./signals"; -import "./style/nav.scss"; +import logo from "../assets/boltz.svg"; +import Warnings from "../components/Warnings"; +import { blogUrl, discordUrl, docsUrl, torUrl } from "../config"; +import t from "../i18n"; +import locales from "../i18n/i18n"; +import { setHideHero } from "../pages/Hero"; +import { setI18nConfigured } from "../signals"; +import "../style/nav.scss"; const Nav = ({ network }) => { let timeout: ReturnType | undefined; diff --git a/src/Notification.tsx b/src/components/Notification.tsx similarity index 93% rename from src/Notification.tsx rename to src/components/Notification.tsx index 35e999f4..fb6f41a5 100644 --- a/src/Notification.tsx +++ b/src/components/Notification.tsx @@ -5,8 +5,8 @@ import { notificationType, setNotification, setNotificationType, -} from "./signals"; -import "./style/notification.scss"; +} from "../signals"; +import "../style/notification.scss"; const Notification = () => { createEffect(() => { diff --git a/src/components/Refund.tsx b/src/components/Refund.tsx index ee2a0b89..943d93e2 100644 --- a/src/components/Refund.tsx +++ b/src/components/Refund.tsx @@ -2,8 +2,8 @@ import { Accessor, createSignal } from "solid-js"; import { RBTC } from "../consts"; import { useWeb3Signer } from "../context/Web3"; -import { refund, refundAddressChange, updateSwaps } from "../helper"; import t from "../i18n"; +import { refund, refundAddressChange, updateSwaps } from "../utils/helper"; import { decodeInvoice } from "../utils/invoice"; import { prefix0x, satoshiToWei } from "../utils/rootstock"; import ContractTransaction from "./ContractTransaction"; diff --git a/src/components/Warnings.tsx b/src/components/Warnings.tsx index 0fbbb69f..89922e1f 100644 --- a/src/components/Warnings.tsx +++ b/src/components/Warnings.tsx @@ -2,9 +2,9 @@ import { Show } from "solid-js"; import reload_svg from "../assets/reload.svg"; import { isBeta } from "../config"; -import { fetchPairs } from "../helper"; import t from "../i18n"; import { online, wasmSupported } from "../signals"; +import { fetchPairs } from "../utils/helper"; const Warnings = () => { return ( diff --git a/src/context/Web3.tsx b/src/context/Web3.tsx index add37e4c..824480b1 100644 --- a/src/context/Web3.tsx +++ b/src/context/Web3.tsx @@ -11,7 +11,7 @@ import { import { pairs } from "../config"; import { RBTC } from "../consts"; -import { getApiUrl } from "../helper"; +import { getApiUrl } from "../utils/helper"; // TODO: check network and add option to add RSK as network // TODO: handle network and account change events diff --git a/src/index.tsx b/src/index.tsx index 9d2e5055..ab5f677f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -6,24 +6,24 @@ import log from "loglevel"; import { Show, createRoot, createSignal } from "solid-js"; import { render } from "solid-js/web"; -import Create from "./Create"; -import Error from "./Error"; -import Footer from "./Footer"; -import { Hero, setHideHero } from "./Hero"; -import History from "./History"; -import Nav from "./Nav"; -import NotFound from "./NotFound"; -import Notification from "./Notification"; -import Pay from "./Pay"; -import Refund from "./Refund"; -import RefundStep from "./RefundStep"; +import Footer from "./components/Footer"; +import Nav from "./components/Nav"; +import Notification from "./components/Notification"; import { loglevel, network } from "./config"; import { Web3SignerProvider } from "./context/Web3"; -import { checkReferralId } from "./helper"; import { detectLanguage } from "./i18n/detect"; +import Create from "./pages/Create"; +import Error from "./pages/Error"; +import { Hero, setHideHero } from "./pages/Hero"; +import History from "./pages/History"; +import NotFound from "./pages/NotFound"; +import Pay from "./pages/Pay"; +import Refund from "./pages/Refund"; +import RefundStep from "./pages/RefundStep"; import { setWasmSupported, setWebln } from "./signals"; import "./style/index.scss"; import { detectEmbedded } from "./utils/embed"; +import { checkReferralId } from "./utils/helper"; import "./utils/patches"; import { swapChecker } from "./utils/swapChecker"; import { checkWasmSupported } from "./utils/wasmSupport"; diff --git a/src/Create.tsx b/src/pages/Create.tsx similarity index 92% rename from src/Create.tsx rename to src/pages/Create.tsx index 903a968c..07ea7406 100644 --- a/src/Create.tsx +++ b/src/pages/Create.tsx @@ -2,19 +2,18 @@ import { BigNumber } from "bignumber.js"; import log from "loglevel"; import { Show, createEffect, createMemo, on, onMount } from "solid-js"; -import AddressInput from "./components/AddressInput"; -import Asset from "./components/Asset"; -import AssetSelect from "./components/AssetSelect"; -import ClickableAmount from "./components/ClickableAmount"; -import ConnectMetamask from "./components/ConnectMetamask"; -import { CreateButton, setButtonLabel } from "./components/CreateButton"; -import Fees from "./components/Fees"; -import InvoiceInput from "./components/InvoiceInput"; -import QrScan from "./components/QrScan"; -import Reverse from "./components/Reverse"; -import { RBTC, sideReceive, sideSend } from "./consts"; -import { isMobile } from "./helper"; -import t from "./i18n"; +import AddressInput from "../components/AddressInput"; +import Asset from "../components/Asset"; +import AssetSelect from "../components/AssetSelect"; +import ClickableAmount from "../components/ClickableAmount"; +import ConnectMetamask from "../components/ConnectMetamask"; +import { CreateButton, setButtonLabel } from "../components/CreateButton"; +import Fees from "../components/Fees"; +import InvoiceInput from "../components/InvoiceInput"; +import QrScan from "../components/QrScan"; +import Reverse from "../components/Reverse"; +import { RBTC, sideReceive, sideSend } from "../consts"; +import t from "../i18n"; import { addressValid, amountChanged, @@ -45,15 +44,19 @@ import { setValid, wasmSupported, webln, -} from "./signals"; -import { calculateReceiveAmount, calculateSendAmount } from "./utils/calculate"; +} from "../signals"; +import { + calculateReceiveAmount, + calculateSendAmount, +} from "../utils/calculate"; import { calculateDigits, convertAmount, formatAmount, getValidationRegex, -} from "./utils/denomination"; -import { enableWebln } from "./utils/webln"; +} from "../utils/denomination"; +import { isMobile } from "../utils/helper"; +import { enableWebln } from "../utils/webln"; const Create = () => { let receiveAmountRef: HTMLInputElement, sendAmountRef: HTMLInputElement; diff --git a/src/Error.tsx b/src/pages/Error.tsx similarity index 91% rename from src/Error.tsx rename to src/pages/Error.tsx index 13c6e83d..37d72728 100644 --- a/src/Error.tsx +++ b/src/pages/Error.tsx @@ -1,4 +1,4 @@ -import t from "./i18n"; +import t from "../i18n"; const Error = () => { return ( diff --git a/src/Hero.tsx b/src/pages/Hero.tsx similarity index 95% rename from src/Hero.tsx rename to src/pages/Hero.tsx index c400863e..a4ae97ce 100644 --- a/src/Hero.tsx +++ b/src/pages/Hero.tsx @@ -2,14 +2,14 @@ import { useNavigate } from "@solidjs/router"; import log from "loglevel"; import { Show, createMemo, createSignal } from "solid-js"; -import Create from "./Create"; -import bitcoin from "./assets/bitcoin-icon.svg"; -import lightning from "./assets/lightning-icon.svg"; -import liquid from "./assets/liquid-icon.svg"; -import { ambossUrl } from "./config"; -import { fetcher } from "./helper"; -import t from "./i18n"; -import "./style/hero.scss"; +import bitcoin from "../assets/bitcoin-icon.svg"; +import lightning from "../assets/lightning-icon.svg"; +import liquid from "../assets/liquid-icon.svg"; +import { ambossUrl } from "../config"; +import t from "../i18n"; +import Create from "../pages/Create"; +import "../style/hero.scss"; +import { fetcher } from "../utils/helper"; export const [hideHero, setHideHero] = createSignal(false); diff --git a/src/History.tsx b/src/pages/History.tsx similarity index 95% rename from src/History.tsx rename to src/pages/History.tsx index bf2ac79b..ef65296b 100644 --- a/src/History.tsx +++ b/src/pages/History.tsx @@ -2,16 +2,16 @@ import { useNavigate } from "@solidjs/router"; import log from "loglevel"; import { Show } from "solid-js"; -import SwapList from "./components/SwapList"; -import { isIos } from "./helper"; -import t from "./i18n"; +import SwapList from "../components/SwapList"; +import t from "../i18n"; import { setNotification, setNotificationType, setSwaps, swaps, -} from "./signals"; -import { downloadJson } from "./utils/download"; +} from "../signals"; +import { downloadJson } from "../utils/download"; +import { isIos } from "../utils/helper"; // Throws when the file is invalid const validateBackupFile = (file: any) => { diff --git a/src/NotFound.tsx b/src/pages/NotFound.tsx similarity index 94% rename from src/NotFound.tsx rename to src/pages/NotFound.tsx index b15a4bb7..a539b93d 100644 --- a/src/NotFound.tsx +++ b/src/pages/NotFound.tsx @@ -1,6 +1,6 @@ import { useNavigate } from "@solidjs/router"; -import t from "./i18n"; +import t from "../i18n"; const NotFound = () => { const navigate = useNavigate(); diff --git a/src/Pay.tsx b/src/pages/Pay.tsx similarity index 87% rename from src/Pay.tsx rename to src/pages/Pay.tsx index 55023bb1..84d3befd 100644 --- a/src/Pay.tsx +++ b/src/pages/Pay.tsx @@ -2,11 +2,10 @@ import { useParams } from "@solidjs/router"; import log from "loglevel"; import { Show, createEffect, createSignal, onCleanup } from "solid-js"; -import BlockExplorer from "./components/BlockExplorer"; -import LoadingSpinner from "./components/LoadingSpinner"; -import { RBTC } from "./consts"; -import { fetcher } from "./helper"; -import t from "./i18n"; +import BlockExplorer from "../components/BlockExplorer"; +import LoadingSpinner from "../components/LoadingSpinner"; +import { RBTC } from "../consts"; +import t from "../i18n"; import { setFailureReason, setSwap, @@ -16,19 +15,20 @@ import { swapStatus, swapStatusTransaction, swaps, -} from "./signals"; -import InvoiceExpired from "./status/InvoiceExpired"; -import InvoiceFailedToPay from "./status/InvoiceFailedToPay"; -import InvoicePending from "./status/InvoicePending"; -import InvoiceSet from "./status/InvoiceSet"; -import SwapCreated from "./status/SwapCreated"; -import SwapExpired from "./status/SwapExpired"; -import SwapRefunded from "./status/SwapRefunded"; -import TransactionClaimed from "./status/TransactionClaimed"; -import TransactionConfirmed from "./status/TransactionConfirmed"; -import TransactionLockupFailed from "./status/TransactionLockupFailed"; -import TransactionMempool from "./status/TransactionMempool"; -import { swapStatusFailed } from "./utils/swapStatus"; +} from "../signals"; +import InvoiceExpired from "../status/InvoiceExpired"; +import InvoiceFailedToPay from "../status/InvoiceFailedToPay"; +import InvoicePending from "../status/InvoicePending"; +import InvoiceSet from "../status/InvoiceSet"; +import SwapCreated from "../status/SwapCreated"; +import SwapExpired from "../status/SwapExpired"; +import SwapRefunded from "../status/SwapRefunded"; +import TransactionClaimed from "../status/TransactionClaimed"; +import TransactionConfirmed from "../status/TransactionConfirmed"; +import TransactionLockupFailed from "../status/TransactionLockupFailed"; +import TransactionMempool from "../status/TransactionMempool"; +import { fetcher } from "../utils/helper"; +import { swapStatusFailed } from "../utils/swapStatus"; const Pay = () => { const params = useParams(); diff --git a/src/Refund.tsx b/src/pages/Refund.tsx similarity index 96% rename from src/Refund.tsx rename to src/pages/Refund.tsx index ad08c46b..4d22b1c5 100644 --- a/src/Refund.tsx +++ b/src/pages/Refund.tsx @@ -3,23 +3,23 @@ import log from "loglevel"; import QrScanner from "qr-scanner"; import { Show, createEffect, createSignal } from "solid-js"; -import BlockExplorer from "./components/BlockExplorer"; -import RefundEta from "./components/RefundEta"; -import SwapList from "./components/SwapList"; -import { fetcher, refund, refundAddressChange } from "./helper"; -import t from "./i18n"; +import BlockExplorer from "../components/BlockExplorer"; +import RefundEta from "../components/RefundEta"; +import SwapList from "../components/SwapList"; +import t from "../i18n"; import { refundTx, setTimeoutBlockheight, setTimeoutEta, setTransactionToRefund, swaps, -} from "./signals"; +} from "../signals"; +import { fetcher, refund, refundAddressChange } from "../utils/helper"; import { swapStatusFailed, swapStatusSuccess, updateSwapStatus, -} from "./utils/swapStatus"; +} from "../utils/swapStatus"; const refundJsonKeys = ["id", "asset", "privateKey", "redeemScript"]; const refundJsonKeysLiquid = refundJsonKeys.concat("blindingKey"); diff --git a/src/RefundStep.tsx b/src/pages/RefundStep.tsx similarity index 93% rename from src/RefundStep.tsx rename to src/pages/RefundStep.tsx index 13141bdc..e35f2262 100644 --- a/src/RefundStep.tsx +++ b/src/pages/RefundStep.tsx @@ -2,9 +2,9 @@ import { useNavigate, useParams } from "@solidjs/router"; import log from "loglevel"; import { For, createEffect } from "solid-js"; -import DownloadRefund from "./components/DownloadRefund"; -import t from "./i18n"; -import { setSwap, swaps } from "./signals"; +import DownloadRefund from "../components/DownloadRefund"; +import t from "../i18n"; +import { setSwap, swaps } from "../signals"; const RefundStep = () => { const params = useParams(); diff --git a/src/signals.ts b/src/signals.ts index 1424ac7c..3df0cb18 100644 --- a/src/signals.ts +++ b/src/signals.ts @@ -4,7 +4,7 @@ import { createEffect, createRoot, createSignal } from "solid-js"; import { pairs } from "./config"; import { LN, sideSend } from "./consts"; -import { isMobile } from "./helper"; +import { isMobile } from "./utils/helper"; type SwapStatusTransaction = { hex?: string; diff --git a/src/status/InvoiceSet.tsx b/src/status/InvoiceSet.tsx index a0a820cd..eed5c343 100644 --- a/src/status/InvoiceSet.tsx +++ b/src/status/InvoiceSet.tsx @@ -4,10 +4,10 @@ import ContractTransaction from "../components/ContractTransaction"; import QrCode from "../components/QrCode"; import { BTC, RBTC } from "../consts"; import { useWeb3Signer } from "../context/Web3"; -import { clipboard, cropString } from "../helper"; import t from "../i18n"; import { asset, denomination, setSwaps, swap, swaps } from "../signals"; import { denominations, formatAmount } from "../utils/denomination"; +import { clipboard, cropString } from "../utils/helper"; import { decodeInvoice } from "../utils/invoice"; import { prefix0x, satoshiToWei } from "../utils/rootstock"; diff --git a/src/status/SwapCreated.tsx b/src/status/SwapCreated.tsx index b65d5532..b8059b0c 100644 --- a/src/status/SwapCreated.tsx +++ b/src/status/SwapCreated.tsx @@ -3,10 +3,10 @@ import { Show } from "solid-js"; import QrCode from "../components/QrCode"; import { BTC } from "../consts"; -import { clipboard, cropString } from "../helper"; import t from "../i18n"; import { denomination, swap, webln } from "../signals"; import { denominations, formatAmount } from "../utils/denomination"; +import { clipboard, cropString } from "../utils/helper"; import { enableWebln } from "../utils/webln"; const SwapCreated = () => { diff --git a/src/status/SwapExpired.tsx b/src/status/SwapExpired.tsx index fa17b804..3e424ed6 100644 --- a/src/status/SwapExpired.tsx +++ b/src/status/SwapExpired.tsx @@ -2,7 +2,6 @@ import { useNavigate } from "@solidjs/router"; import log from "loglevel"; import { Show, createEffect, createSignal } from "solid-js"; -import fetcher, { refund, refundAddressChange } from "../helper"; import t from "../i18n"; import { failureReason, @@ -10,6 +9,7 @@ import { swap, transactionToRefund, } from "../signals"; +import fetcher, { refund, refundAddressChange } from "../utils/helper"; const SwapExpired = () => { const navigate = useNavigate(); diff --git a/src/compat.ts b/src/utils/compat.ts similarity index 98% rename from src/compat.ts rename to src/utils/compat.ts index f2007c8e..5c7f3df8 100644 --- a/src/compat.ts +++ b/src/utils/compat.ts @@ -31,8 +31,8 @@ import { confidential, } from "liquidjs-lib"; -import { network } from "./config"; -import { LBTC } from "./consts"; +import { network } from "../config"; +import { LBTC } from "../consts"; type LiquidTransactionOutputWithKey = LiquidTransactionOutput & { blindingPrivateKey?: Buffer; diff --git a/src/ecpair/ecpair.ts b/src/utils/ecpair.ts similarity index 100% rename from src/ecpair/ecpair.ts rename to src/utils/ecpair.ts diff --git a/src/helper.ts b/src/utils/helper.ts similarity index 97% rename from src/helper.ts rename to src/utils/helper.ts index 11431195..b2460f0e 100644 --- a/src/helper.ts +++ b/src/utils/helper.ts @@ -6,20 +6,8 @@ import { import { Buffer } from "buffer"; import log from "loglevel"; -import { - DecodedAddress, - decodeAddress, - getAddress, - getConstructClaimTransaction, - getConstructRefundTransaction, - getNetwork, - getOutputAmount, - getTransaction, - setup, -} from "./compat"; -import { pairs } from "./config"; -import { BTC, RBTC } from "./consts"; -import { ECPair } from "./ecpair/ecpair"; +import { pairs } from "../config"; +import { BTC, RBTC } from "../consts"; import { asset, ref, @@ -42,10 +30,22 @@ import { swapStatusTransaction, swaps, transactionToRefund, -} from "./signals"; -import { feeChecker } from "./utils/feeChecker"; -import { checkResponse } from "./utils/http"; -import { swapStatusPending, updateSwapStatus } from "./utils/swapStatus"; +} from "../signals"; +import { feeChecker } from "../utils/feeChecker"; +import { checkResponse } from "../utils/http"; +import { swapStatusPending, updateSwapStatus } from "../utils/swapStatus"; +import { + DecodedAddress, + decodeAddress, + getAddress, + getConstructClaimTransaction, + getConstructRefundTransaction, + getNetwork, + getOutputAmount, + getTransaction, + setup, +} from "./compat"; +import { ECPair } from "./ecpair"; export const isIos = !!navigator.userAgent.match(/iphone|ipad/gi) || false; export const isMobile = diff --git a/src/utils/invoice.ts b/src/utils/invoice.ts index 75cf8120..5ed7a688 100644 --- a/src/utils/invoice.ts +++ b/src/utils/invoice.ts @@ -3,7 +3,7 @@ import bolt11 from "bolt11"; import log from "loglevel"; import { bolt11_prefix } from "../config"; -import { errorHandler } from "../helper"; +import { errorHandler } from "./helper"; import { checkResponse } from "./http"; type LnurlResponse = { diff --git a/src/utils/swapChecker.ts b/src/utils/swapChecker.ts index c7d087a8..db87c9f0 100644 --- a/src/utils/swapChecker.ts +++ b/src/utils/swapChecker.ts @@ -1,8 +1,8 @@ import log from "loglevel"; import { createEffect, createSignal } from "solid-js"; -import { fetcher, getApiUrl, setSwapStatusAndClaim } from "../helper"; import { swap, swaps } from "../signals"; +import { fetcher, getApiUrl, setSwapStatusAndClaim } from "./helper"; import { swapStatusFinal } from "./swapStatus"; const swapCheckInterval = 3000; diff --git a/src/utils/validation.ts b/src/utils/validation.ts index ce38a64b..be3746e6 100644 --- a/src/utils/validation.ts +++ b/src/utils/validation.ts @@ -5,10 +5,10 @@ import { Buffer, Buffer as BufferBrowser } from "buffer"; import { BaseContract } from "ethers"; import log from "loglevel"; -import { decodeAddress } from "../compat"; import { RBTC } from "../consts"; -import { ECPair, ecc } from "../ecpair/ecpair"; +import { decodeAddress } from "./compat"; import { denominations, formatAmountDenomination } from "./denomination"; +import { ECPair, ecc } from "./ecpair"; import { decodeInvoice, isInvoice, isLnurl } from "./invoice"; // TODO: sanity check timeout block height? diff --git a/tests/components/Create.spec.tsx b/tests/pages/Create.spec.tsx similarity index 99% rename from tests/components/Create.spec.tsx rename to tests/pages/Create.spec.tsx index 949fffad..a7506d41 100644 --- a/tests/components/Create.spec.tsx +++ b/tests/pages/Create.spec.tsx @@ -3,10 +3,10 @@ import { fireEvent, render, screen } from "@solidjs/testing-library"; import { BigNumber } from "bignumber.js"; import { beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; -import Create from "../../src/Create"; import { sideReceive, sideSend } from "../../src/consts"; import { Web3SignerProvider } from "../../src/context/Web3"; import i18n from "../../src/i18n/i18n"; +import Create from "../../src/pages/Create"; import * as signals from "../../src/signals"; import { calculateReceiveAmount } from "../../src/utils/calculate"; import { cfg } from "../config"; diff --git a/tests/components/Error.spec.tsx b/tests/pages/Error.spec.tsx similarity index 92% rename from tests/components/Error.spec.tsx rename to tests/pages/Error.spec.tsx index a4c4a8f1..76ef0408 100644 --- a/tests/components/Error.spec.tsx +++ b/tests/pages/Error.spec.tsx @@ -1,8 +1,8 @@ import { render, screen } from "@solidjs/testing-library"; import { describe, expect, test } from "vitest"; -import Error from "../../src/Error"; import i18n from "../../src/i18n/i18n"; +import Error from "../../src/pages/Error"; describe("Error", () => { test("should render the Error page", async () => { diff --git a/tests/History.spec.ts b/tests/pages/History.spec.ts similarity index 93% rename from tests/History.spec.ts rename to tests/pages/History.spec.ts index 74d7d8d2..6e3f16ba 100644 --- a/tests/History.spec.ts +++ b/tests/pages/History.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "vitest"; -import { validateBackupFile } from "../src/History"; +import { validateBackupFile } from "../../src/pages/History"; describe("History", () => { test.each` diff --git a/tests/Nav.spec.tsx b/tests/pages/Nav.spec.tsx similarity index 95% rename from tests/Nav.spec.tsx rename to tests/pages/Nav.spec.tsx index 82776b9f..5850b356 100644 --- a/tests/Nav.spec.tsx +++ b/tests/pages/Nav.spec.tsx @@ -2,7 +2,7 @@ import { Router } from "@solidjs/router"; import { render, screen } from "@solidjs/testing-library"; import { describe, expect, test } from "vitest"; -import Nav from "../src/Nav"; +import Nav from "../../src/components/Nav"; describe("Nav", () => { test.each(["testnet", "regtest", "random"])( diff --git a/tests/utils/swapChecker.spec.ts b/tests/utils/swapChecker.spec.ts index 3bfa0a2a..e6e04ec5 100644 --- a/tests/utils/swapChecker.spec.ts +++ b/tests/utils/swapChecker.spec.ts @@ -4,8 +4,8 @@ import { AddressInfo } from "net"; import { createRoot } from "solid-js"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { setSwapStatusAndClaim } from "../../src/helper"; import { setSwap, setSwaps } from "../../src/signals"; +import { setSwapStatusAndClaim } from "../../src/utils/helper"; import { checkInterval, swapChecker } from "../../src/utils/swapChecker"; import { swapStatusFailed, diff --git a/tests/utils/validation.spec.ts b/tests/utils/validation.spec.ts index 2bcd0e6e..a397dba5 100644 --- a/tests/utils/validation.spec.ts +++ b/tests/utils/validation.spec.ts @@ -3,8 +3,8 @@ import { Contract } from "ethers"; import log from "loglevel"; import { beforeAll, describe, expect, test, vitest } from "vitest"; -import { decodeAddress } from "../../src/compat"; import { BTC, LBTC } from "../../src/consts"; +import { decodeAddress } from "../../src/utils/compat"; import { validateInvoice, validateResponse } from "../../src/utils/validation"; describe("validate responses", () => {