Skip to content

fix trustline bug#1947

Open
jeesunikim wants to merge 2 commits intomainfrom
issue-1817
Open

fix trustline bug#1947
jeesunikim wants to merge 2 commits intomainfrom
issue-1817

Conversation

@jeesunikim
Copy link
Contributor

@jeesunikim jeesunikim commented Mar 10, 2026

waiting for #1949 be merged

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Mar 10, 2026
@stellar-jenkins
Copy link

@jeesunikim jeesunikim marked this pull request as ready for review March 12, 2026 00:30
Copilot AI review requested due to automatic review settings March 12, 2026 00:30
@stellar-jenkins
Copy link

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Fund Account flow and signing logic to better reflect funded-account UI behavior and to handle extension-wallet signing outputs more safely.

Changes:

  • Hide the XLM funding option once an account is detected as already funded, and move trustline help text/link into a footer-style hint area.
  • Adjust E2E tests to account for token list re-indexing after XLM is hidden and update the “already funded” error scenario mocking.
  • In SignTransactionXdr, use the extension wallet’s returned signed XDR directly when it’s the only signer to avoid signature invalidation when wallets mutate transactions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/e2e/fundAccountPage.test.ts Updates token-button selection after XLM is hidden and tweaks accounts API mocking for the already-funded error case.
src/components/SignTransactionXdr/index.tsx Uses extension wallet signed XDR directly for extension-only signing to avoid invalid signatures from wallet-modified transactions.
src/app/(sidebar)/account/fund/page.tsx Hides XLM token for funded accounts and relocates trustline explanatory content/link below the token list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +325 to 347
// Mock accounts API call - return unfunded first so XLM button is visible,
// then funded after the fund attempt
let accountsCallCount = 0;

await page.route(
`*/**/accounts/${TEST_ACCOUNT_PUBLIC_KEY}`,
async (route) => {
await route.fulfill({
status: 200,
contentType: "application/hal+json; charset=utf-8",
body: JSON.stringify(MOCK_ACCOUNT_FUNDED_RESPONSE),
});
if (accountsCallCount === 0) {
await route.fulfill({
status: 200,
contentType: "application/hal+json; charset=utf-8",
body: JSON.stringify(MOCK_ACCOUNT_UNFUNDED_RESPONSE),
});
} else {
await route.fulfill({
status: 200,
contentType: "application/hal+json; charset=utf-8",
body: JSON.stringify(MOCK_ACCOUNT_FUNDED_RESPONSE),
});
}

accountsCallCount++;
},
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The route handler uses a shared accountsCallCount that’s incremented after awaiting route.fulfill(). If the app issues multiple /accounts/:id requests concurrently (possible since fetchAccountInfo() can be triggered by multiple effects), two handlers can observe the same count and return the same response, making this test flaky. Capture and increment the call index synchronously at the start of the handler (e.g., const callIndex = accountsCallCount++) and branch on callIndex instead.

Copilot uses AI. Check for mistakes.
<div
key={t.id}
className="Account__fundTokens__item"
data-testid="fund-account-token"
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data-testid="fund-account-token" is reused for every token row. With XLM now conditionally hidden for funded accounts, E2E selectors that rely on nth() become much more brittle (indexes change as items appear/disappear). Consider making the test id include the token id (or add a data-asset-id attribute) so tests can target USDC/EURC/XLM directly without depending on list order.

Suggested change
data-testid="fund-account-token"
data-testid={`fund-account-token-${t.id}`}
data-asset-id={t.id}

Copilot uses AI. Check for mistakes.
@jeesunikim jeesunikim requested a review from quietbits March 12, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

3 participants