Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions apps/web-wallet/app/features/receive/spark-receive-quote-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
SparkReceiveQuoteRepository,
SparkReceiveQuoteService,
getInitializedCashuWallet,
getLightningQuote,
sparkDebugLog,
} from '@agicash/wallet-sdk/temporary';
import { MintOperationError, NetworkError } from '@cashu/cashu-ts';
Expand All @@ -27,6 +26,7 @@ import {
useQueryClient,
} from '@tanstack/react-query';
import { useEffect, useMemo } from 'react';
import { sdk } from '~/features/shared/sdk.client';
import { useOnMeltQuoteStateChange } from '~/lib/cashu/melt-quote-subscription';
import { useLatest } from '~/lib/use-latest';
import {
Expand Down Expand Up @@ -108,12 +108,11 @@ export function useTrackSparkReceiveQuote({
const enabled = !!quoteId;
const onPaidRef = useLatest(onPaid);
const onExpiredRef = useLatest(onExpired);
const sparkReceiveQuoteRepository = useSparkReceiveQuoteRepository();

const { data } = useQuery({
queryKey: [SparkReceiveQuoteCache.Key, quoteId],
// biome-ignore lint/style/noNonNullAssertion: quoteId is guaranteed by enabled
queryFn: () => sparkReceiveQuoteRepository.get(quoteId!),
queryFn: () => sdk.receive.spark.getQuote(quoteId!),
staleTime: Number.POSITIVE_INFINITY,
refetchOnWindowFocus: 'always',
refetchOnReconnect: 'always',
Expand Down Expand Up @@ -303,8 +302,6 @@ type CreateProps = {
* The quote is stored in the database and will be tracked by the background task processor.
*/
export function useCreateSparkReceiveQuote() {
const userId = useUser((user) => user.id);
const sparkReceiveQuoteService = useSparkReceiveQuoteService();
const sparkReceiveQuoteCache = useSparkReceiveQuoteCache();

return useMutation({
Expand All @@ -318,17 +315,14 @@ export function useCreateSparkReceiveQuote() {
purpose,
transferId,
}: CreateProps) => {
const lightningQuote = await getLightningQuote({
wallet: account.wallet,
const lightningQuote = await sdk.receive.spark.getLightningQuote({
account,
amount,
description,
});

return sparkReceiveQuoteService.createReceiveQuote({
userId,
return sdk.receive.spark.createQuote({
account,
lightningQuote,
receiveType: 'LIGHTNING',
purpose,
transferId,
});
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ is **step 2 (cycle-break) before step 3 (move)**.
`toAccount`) stays in one shared place so the halves cannot drift.
- Live money-path verification is mandatory here.
19. **Cleanup** — delete `@agicash/wallet-sdk/temporary`; route remaining consumers through the contract. Boundary now build-enforced.
- **Swap the web hosts' direct `ensureBreezWasm` calls to `sdk.init()`**
(decided in the #1179 review discussion): `entry.client.tsx`'s module-scope
warm-up and `_protected.tsx`'s await before the temporary spark-mnemonic
prefetch both import it from `/temporary`, so this step cannot compile
without the swap; land it with (or before) the slice that removes that
prefetch. The entry-file swap starts session restore at module scope —
re-verify the OAuth deep-link boot order when it lands.

## Verification

Expand Down
Loading
Loading