diff --git a/package.json b/package.json index 52fbf3fe..f0e2768c 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,8 @@ "@kobalte/core": "^0.9.8", "@kobalte/tailwindcss": "^0.5.0", "@modular-forms/solid": "^0.18.1", - "@mutinywallet/mutiny-wasm": "0.5.8", - "@mutinywallet/waila-wasm": "^0.2.6", + "@mutinywallet/mutiny-wasm": "file:../mutiny-node/mutiny-wasm/pkg", + "@mutinywallet/waila-wasm": "file:../bitcoin-waila/waila-wasm/pkg", "@solid-primitives/upload": "^0.0.111", "@solidjs/meta": "^0.29.1", "@solidjs/router": "^0.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1093e522..650c68ba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,11 +54,11 @@ importers: specifier: ^0.18.1 version: 0.18.1(solid-js@1.8.5) '@mutinywallet/mutiny-wasm': - specifier: 0.5.8 - version: 0.5.8 + specifier: file:/home/elnosh/Documents/mutiny/mutiny-node/mutiny-wasm/pkg + version: file:../mutiny-node/mutiny-wasm/pkg '@mutinywallet/waila-wasm': - specifier: ^0.2.6 - version: 0.2.6 + specifier: file:/home/elnosh/Documents/mutiny/bitcoin-waila/waila-wasm/pkg + version: file:../bitcoin-waila/waila-wasm/pkg '@solid-primitives/upload': specifier: ^0.0.111 version: 0.0.111(solid-js@1.8.5) @@ -2570,14 +2570,6 @@ packages: solid-js: 1.8.5 dev: false - /@mutinywallet/mutiny-wasm@0.5.8: - resolution: {integrity: sha512-Bwx3sMXuMiE876Kk1FI9uZoJMPkHc5RGFmUHsFeSMMGDxC2YLO5N5ilaIIig89ZbAYcBi7Y1N4Nq/2nZFcM+9A==} - dev: false - - /@mutinywallet/waila-wasm@0.2.6: - resolution: {integrity: sha512-qiyhaWX/zDKuh23VXIzeWGlmXne9IdRIx+ldGdse15JwEiC97OjATXMECX3Xo0tc3RTOo50cKyMlouKKRbLYpQ==} - dev: false - /@ndelangen/get-tarball@3.0.9: resolution: {integrity: sha512-9JKTEik4vq+yGosHYhZ1tiH/3WpUS0Nh0kej4Agndhox8pAdWhEx5knFVRcb/ya9knCRCs1rPxNrSXTDdfVqpA==} dependencies: @@ -13644,6 +13636,7 @@ packages: /workbox-google-analytics@7.0.0: resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==} + deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained dependencies: workbox-background-sync: 7.0.0 workbox-core: 7.0.0 @@ -13934,3 +13927,13 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} dev: true + + file:../bitcoin-waila/waila-wasm/pkg: + resolution: {directory: ../bitcoin-waila/waila-wasm/pkg, type: directory} + name: waila-wasm + dev: false + + file:../mutiny-node/mutiny-wasm/pkg: + resolution: {directory: ../mutiny-node/mutiny-wasm/pkg, type: directory} + name: '@mutinywallet/mutiny-wasm' + dev: false diff --git a/src/logic/waila.ts b/src/logic/waila.ts index d2a29b72..563aeb79 100644 --- a/src/logic/waila.ts +++ b/src/logic/waila.ts @@ -21,6 +21,7 @@ export type ParsedParams = { fedimint_invite?: string; is_lnurl_auth?: boolean; contact_id?: string; + cashu_token?: string; }; export function toParsedParams( @@ -67,7 +68,8 @@ export function toParsedParams( lightning_address: params.lightning_address, nostr_wallet_auth: params.nostr_wallet_auth, is_lnurl_auth: params.is_lnurl_auth, - fedimint_invite: params.fedimint_invite_code + fedimint_invite: params.fedimint_invite_code, + cashu_token: params.cashu_token } }; } diff --git a/src/router.tsx b/src/router.tsx index bb8407c6..80b39ac5 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -12,6 +12,7 @@ import { Main, NotFound, Receive, + RedeemCashu, Scanner, Search, Send, @@ -128,6 +129,7 @@ export function Router() { component={ManageFederations} /> + diff --git a/src/routes/RedeemCashu.tsx b/src/routes/RedeemCashu.tsx new file mode 100644 index 00000000..2f1cceb5 --- /dev/null +++ b/src/routes/RedeemCashu.tsx @@ -0,0 +1,66 @@ +import { useNavigate } from "@solidjs/router"; +import { createSignal } from "solid-js"; + +import { + AmountSats, + Button, + DefaultMain, + Indicator, + LargeHeader, + MutinyWalletGuard, + NavBar +} from "~/components"; +import { useI18n } from "~/i18n/context"; +import { useMegaStore } from "~/state/megaStore"; + +export type ReceiveFlavor = "unified" | "lightning" | "onchain"; +type ReceiveState = "edit" | "show" | "paid"; + +export function RedeemCashu() { + const [state, actions] = useMegaStore(); + const navigate = useNavigate(); + const i18n = useI18n(); + + const [receiveState, setReceiveState] = createSignal("edit"); + + // loading state for the continue button + const [loading, setLoading] = createSignal(false); + + async function onSubmit(e: Event) { + e.preventDefault(); + meltCashuToken(); + } + + async function meltCashuToken() { + const res = await state.mutiny_wallet?.melt_cashu_token( + String(state.scan_result?.cashu_token) + ); + } + + return ( + + + {i18n.t("receive.checking")} + ) + } + > + Redeem Cashu token + + + + + Do you wish to redeem this Cashu token for + + + + Redeem + + + {/* {i18n.t("common.redeem")} */} + + + ); +} diff --git a/src/routes/index.ts b/src/routes/index.ts index a47f92d4..a7094e48 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -9,3 +9,4 @@ export * from "./Send"; export * from "./Swap"; export * from "./SwapLightning"; export * from "./Search"; +export * from "./RedeemCashu"; diff --git a/src/state/megaStore.tsx b/src/state/megaStore.tsx index e4e8b9e7..36d2d461 100644 --- a/src/state/megaStore.tsx +++ b/src/state/megaStore.tsx @@ -408,6 +408,10 @@ export const Provider: ParentComponent = (props) => { encodeURIComponent(result.value?.nostr_wallet_auth) ); } + if (result.value?.cashu_token) { + actions.setScanResult(result.value); + navigate("/redeemcashu"); + } } }, setBetaWarned() {
+ Do you wish to redeem this Cashu token for + +