fix(paywall): make the trustline banner actionable, and fix its link - #76
Closed
pedro-pelicioni wants to merge 2 commits into
Closed
fix(paywall): make the trustline banner actionable, and fix its link#76pedro-pelicioni wants to merge 2 commits into
pedro-pelicioni wants to merge 2 commits into
Conversation
`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.
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.
Author
|
Reopened from the Nearx-Labs fork as #80 — same commits, same diff. Closing this one to keep a single thread per change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(paywall): add the missing trustline from the paywall, and fix the link
Branch:
fix/paywall-trustline-linkScreenshots:
harness/shots/before-missing-trustline.png→harness/shots/after-missing-trustline.pngThe problem
When the payer's account has no trustline for the payment asset, the paywall
disables Pay and shows a banner pointing at:
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_trustoperation, 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:
useAddTrustlinebuilds achange_trustfor 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.
be read, and now points at
/transaction/build, where achange_trustoperation can actually be assembled.
Cost
~2 KB on the bundle (3,749,116 → 3,751,075 bytes).
Asset,Operation,TransactionBuilderandrpc.Serverall 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 (
sendTransaction→ERROR), on-ledger failure(
getTransaction→FAILED), 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.