Skip to content

Commit 59ab65a

Browse files
authored
Merge pull request #735 from jayteemoney/fix/support-panel-form-and-albedo-wallet
fix: SupportPanel form reset + Albedo wallet network compatibility
2 parents 93866d7 + ace635e commit 59ab65a

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

frontend/src/components/support-panel.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ export function SupportPanel({
8282
const [frequency, setFrequency] = useState<"weekly" | "monthly">("monthly");
8383
const [sending, setSending] = useState(false);
8484
const [txHash, setTxHash] = useState<string | null>(null);
85+
// Values captured at submit time so the result modal can keep displaying them
86+
// after the live form fields are cleared (#708).
87+
const [submittedAmount, setSubmittedAmount] = useState("");
88+
const [submittedMessage, setSubmittedMessage] = useState("");
8589
const { showToast } = useToast();
8690

8791
const handleCopy = useCallback(async () => {
@@ -163,6 +167,13 @@ export function SupportPanel({
163167
) as Transaction | FeeBumpTransaction;
164168
const result = await horizonServer.submitTransaction(tx);
165169
setTxHash(result.hash);
170+
// Snapshot the submitted values so the result modal keeps showing them,
171+
// then clear the form fields. This prevents the user from accidentally
172+
// re-sending the same amount/message once the modal closes (#708).
173+
setSubmittedAmount(amount);
174+
setSubmittedMessage(message);
175+
setAmount("");
176+
setMessage("");
166177

167178
if (isRecurring && profileId) {
168179
await apiFetch(`${API_BASE_URL}/api/v1/recurring-support`, {
@@ -664,10 +675,10 @@ export function SupportPanel({
664675

665676
<TransactionResultModal
666677
txHash={txHash}
667-
amount={amount}
678+
amount={submittedAmount}
668679
assetCode={paymentAsset.code || "XLM"}
669680
recipientDisplayName={recipientDisplayName}
670-
note={message || null}
681+
note={submittedMessage || null}
671682
isOpen={txHash !== null}
672683
onClose={() => setTxHash(null)}
673684
/>

frontend/src/lib/wallet-adapters.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Provides a consistent interface across Freighter, Albedo, and Lobstr.
44
*/
55

6+
import { Networks } from "@stellar/stellar-sdk";
7+
68
export type WalletId = "freighter" | "albedo" | "lobstr";
79

810
export type WalletErrorCode =
@@ -113,7 +115,11 @@ const albedoAdapter: WalletAdapter = {
113115
async signTransaction(xdr, { networkPassphrase }) {
114116
const albedo = (window as any).albedo;
115117
if (!albedo) throw new WalletError("Albedo extension not found.", "NOT_FOUND");
116-
const result = await albedo.tx({ xdr, network: networkPassphrase });
118+
// Albedo's tx() expects the shorthand "public" | "testnet", not the full
119+
// network passphrase. Passing the passphrase makes every sign fail (#707).
120+
const network =
121+
networkPassphrase === Networks.PUBLIC ? "public" : "testnet";
122+
const result = await albedo.tx({ xdr, network });
117123
if (!result?.signed_envelope_xdr)
118124
throw new WalletError("Albedo did not return a signed transaction.", "SIGNING_FAILED");
119125
return result.signed_envelope_xdr;

0 commit comments

Comments
 (0)