diff --git a/src/features/wallet/components/create-wallet.tsx b/src/features/wallet/components/create-wallet.tsx index c1855acc1..f091926fd 100644 --- a/src/features/wallet/components/create-wallet.tsx +++ b/src/features/wallet/components/create-wallet.tsx @@ -29,7 +29,7 @@ const CreateWallet = () => { const [formActive, setFormActive] = useState(false); const [isLoading, setIsLoading] = useState(false); const [mints, setMints] = useState([]); - const { mutateAsync: createWallet } = useCreateWallet(); + const { createWallet } = useCreateWallet(); const handleSubmit = async () => { setIsLoading(true); diff --git a/src/features/wallet/hooks/useHooks.ts b/src/features/wallet/hooks/useHooks.ts index 46d9ced6b..fe7095cce 100644 --- a/src/features/wallet/hooks/useHooks.ts +++ b/src/features/wallet/hooks/useHooks.ts @@ -84,7 +84,7 @@ const useCreateWallet = () => { const queryClient = useQueryClient(); const { setWallet } = useWalletStore(); - return useMutation({ + const createWallet = useMutation({ mutationFn: async (walletInfo: IWalletInfo) => { const response = await api.put('/api/v1/ditto/cashu/wallet', walletInfo); const data = await response.json(); @@ -99,6 +99,8 @@ const useCreateWallet = () => { toast.error(error?.message || 'An error occurred while creating the wallet'); }, }); + + return { createWallet: createWallet.mutateAsync }; }; const useWallet = () => { diff --git a/src/features/zap/components/pay-request-form.tsx b/src/features/zap/components/pay-request-form.tsx index e2223747c..1baef4ff3 100644 --- a/src/features/zap/components/pay-request-form.tsx +++ b/src/features/zap/components/pay-request-form.tsx @@ -46,9 +46,11 @@ interface IPayRequestForm { } const messages = defineMessages({ + loading: { id: 'loading_indicator.label', defaultMessage: 'Loading…' }, button_rounded: { id: 'zap.button.text.rounded', defaultMessage: 'Zap {amount}K sats' }, button: { id: 'payment_method.button.text.raw', defaultMessage: 'Zap {amount} sats' }, commentPlaceholder: { id: 'payment_method.comment_input.placeholder', defaultMessage: 'Optional comment' }, + zapSats: { id: 'payment_method.button.zap_sats', defaultMessage: 'Zap sats' }, }); const PayRequestForm = ({ account, status, onClose }: IPayRequestForm) => { @@ -62,7 +64,7 @@ const PayRequestForm = ({ account, status, onClose }: IPayRequestForm) => { const { method: paymentMethod, changeMethod } = usePaymentMethod(); const isCashu = paymentMethod === 'cashu'; const hasZapSplit = zapArrays.length > 0 && !isCashu; - const { zapCashu } = useZapCashuRequest(); + const { zapCashu, isLoading } = useZapCashuRequest(); const handleSubmit = async (e?: React.FormEvent) => { e?.preventDefault(); @@ -105,6 +107,8 @@ const PayRequestForm = ({ account, status, onClose }: IPayRequestForm) => { }; const renderPaymentButtonText = () => { + if (isLoading) return intl.formatMessage(messages.loading); + if (amount >= 1000) { return intl.formatMessage(messages.button_rounded, { amount: Math.round((amount / 1000) * 10) / 10 }); } @@ -217,7 +221,7 @@ const PayRequestForm = ({ account, status, onClose }: IPayRequestForm) => { {hasZapSplit ? -