Skip to content

fix(paywall): make the trustline banner actionable, and fix its link - #80

Open
pedro-pelicioni wants to merge 2 commits into
stellar:mainfrom
Nearx-Labs:fix/74-trustline-action
Open

fix(paywall): make the trustline banner actionable, and fix its link#80
pedro-pelicioni wants to merge 2 commits into
stellar:mainfrom
Nearx-Labs:fix/74-trustline-action

Conversation

@pedro-pelicioni

Copy link
Copy Markdown

fix(paywall): add the missing trustline from the paywall, and fix the link

Branch: fix/74-trustline-action
Screenshots: harness/shots/before-missing-trustline.pngharness/shots/after-missing-trustline.png

The problem

When the payer's account has no trustline for the payment asset, the paywall
disables Pay and shows a banner pointing at:

https://lab.stellar.org/account/fund

That is Lab's friendbot account funding page. It has nothing to do with
trustlines, and friendbot does not exist on mainnet. The banner's own text says
"add the USDC trustline" — but the link does not lead anywhere that can do it.
The payer has to work out on their own that they need a change_trust
operation, build it elsewhere, and come back.

The change

The wallet that can sign that operation is already connected to the paywall, so
offer the action directly:

  • New useAddTrustline builds a change_trust for the asset read off the SAC,
    signs it with the connected wallet through signTransaction, submits it,
    waits for confirmation, then re-reads the balance. The banner clears itself
    and Pay becomes available without leaving the page.
  • The Lab link stays as the fallback for when the asset's code/issuer could not
    be read, and now points at /transaction/build, where a change_trust
    operation can actually be assembled.

Cost

~2 KB on the bundle (3,749,116 → 3,751,075 bytes). Asset, Operation,
TransactionBuilder and rpc.Server all come from @stellar/stellar-sdk,
which the paywall already bundles for the balance read.

Failure paths

Each produces a distinct message on the existing status line: rejected
signature, network rejection (sendTransactionERROR), on-ledger failure
(getTransactionFAILED), and a 30s confirmation timeout.

Notes

Happy to split this into two PRs — the one-line link fix, and the in-paywall
trustline flow — if you would rather take them separately.


Part of #74.

pedro-pelicioni and others added 2 commits August 11, 2026 21:19
`useAddTrustline` builds a `change_trust` for the asset read off the SAC,
signs it with the wallet already connected to the paywall, submits it,
waits for confirmation and reports each failure distinctly: rejected
signature, network rejection, on-ledger failure, confirmation timeout.

`Asset`, `Operation`, `TransactionBuilder` and `rpc.Server` all come from
`@stellar/stellar-sdk`, which the paywall already bundles for the balance
read, so this costs about 2 KB.

Co-authored-by: Nearx-Labs <nearxlabs@nearx.com.br>
The banner sent people to `lab.stellar.org/account/fund` — the friendbot
account funding page, which has nothing to do with trustlines and does
not exist on mainnet. Its own text said "add the USDC trustline", but the
link led nowhere that could do it.

Offer the action in the banner instead, signed by the wallet already
connected. The banner clears itself and Pay becomes available without
leaving the page. The Lab link stays as the fallback for when the asset's
code and issuer could not be read, and now points at
`/transaction/build`, where a `change_trust` operation can be assembled.

Co-authored-by: Nearx-Labs <nearxlabs@nearx.com.br>
Copilot AI balanced review requested due to automatic review settings August 12, 2026 00:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants