diff --git a/e2e/submarineSwap.spec.ts b/e2e/submarineSwap.spec.ts index 0809de10..3bf37ef6 100644 --- a/e2e/submarineSwap.spec.ts +++ b/e2e/submarineSwap.spec.ts @@ -1,5 +1,6 @@ import { expect, test } from "@playwright/test"; +import { validateResponse } from "../src/utils/validation"; import { bitcoinSendToAddress, generateBitcoinBlock, @@ -51,10 +52,12 @@ test.describe("Submarine swap", () => { await generateBitcoinBlock(); - await page.getByText("Copy preimage").click(); - const preimage = await page.evaluate(() => { - return navigator.clipboard.readText(); - }); + const validationLink = new URL( + await page.getByText("Validate payment").getAttribute("href"), + ); + + expect(validationLink.searchParams.get("invoice")).toEqual(invoice); + const preimage = validationLink.searchParams.get("preimage"); const lookupRes = await lookupInvoiceLnd(invoice); expect(lookupRes.state).toEqual("SETTLED"); diff --git a/src/config.ts b/src/config.ts index 015dad5d..08fb9274 100644 --- a/src/config.ts +++ b/src/config.ts @@ -24,6 +24,7 @@ const defaults = { telegramUrl: "https://t.me/boltzhq", email: "hi@bol.tz", dnsOverHttps: "https://1.1.1.1/dns-query", + preimageValidation: "https://validate-payment.com", }; type Asset = { diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.ts index 86a3228d..74404bed 100644 --- a/src/i18n/i18n.ts +++ b/src/i18n/i18n.ts @@ -219,7 +219,7 @@ const dict = { timeout: "Timeout", wallet_connect_failed: "Wallet connection failed: {{ error }}", ledger_open_app_prompt: "Open Ethereum or RSK app", - copy_preimage: "Copy preimage", + validate_payment: "Validate payment", no_browser_wallet: "No browser wallet detected", }, de: { @@ -452,7 +452,6 @@ const dict = { wallet_connect_failed: "Verbindung zu Wallet fehlgeschlagen: {{ error }}", ledger_open_app_prompt: "Ethereum oder RSK app öffnen", - copy_preimage: "Preimage Kopieren", no_browser_wallet: "Kein Browser Wallet gefunden", }, es: { @@ -683,7 +682,6 @@ const dict = { timeout: "timeout", wallet_connect_failed: "Fallo en la conexión del monedero: {{ error }}", ledger_open_app_prompt: "Abrir aplicación Ethereum o RSK", - copy_preimage: "Copiar preimagen", no_browser_wallet: "No se detectó monedero en el navegador", }, zh: { @@ -887,7 +885,6 @@ const dict = { timeout: "超时", wallet_connect_failed: "钱包连接失败:{{ error }}", ledger_open_app_prompt: "打开以太坊或 RSK 应用", - copy_preimage: "复制预图像", no_browser_wallet: "未检测到浏览器钱包", }, ja: { @@ -1115,7 +1112,6 @@ const dict = { timeout: "タイムアウト", wallet_connect_failed: "ウォレット接続の失敗: {{ error }}", ledger_open_app_prompt: "イーサリアムもしくはRSKのアプリを開く", - copy_preimage: "コピー前画像", no_browser_wallet: "ブラウザのウォレットが検出されない", }, }; diff --git a/src/status/TransactionClaimed.tsx b/src/status/TransactionClaimed.tsx index e5a02a1d..9d9e33b2 100644 --- a/src/status/TransactionClaimed.tsx +++ b/src/status/TransactionClaimed.tsx @@ -3,8 +3,8 @@ import { BigNumber } from "bignumber.js"; import log from "loglevel"; import { Show, createEffect, createResource, createSignal } from "solid-js"; -import CopyButton from "../components/CopyButton"; import LoadingSpinner from "../components/LoadingSpinner"; +import { config } from "../config"; import { RBTC } from "../consts/Assets"; import { SwapType } from "../consts/Enums"; import { useGlobalContext } from "../context/Global"; @@ -26,6 +26,13 @@ const Broadcasting = () => { ); }; +const paymentValidationUrl = (invoice: string, preimage: string): string => { + const url = new URL(config.preimageValidation); + url.searchParams.append("invoice", invoice); + url.searchParams.append("preimage", preimage); + return url.toString(); +}; + const TransactionClaimed = () => { const navigate = useNavigate(); @@ -94,7 +101,15 @@ const TransactionClaimed = () => { {t("new_swap")} - + + {t("validate_payment")} +