Skip to content

feat(paywall): offer xBull, LOBSTR, Albedo and Rabet, and make the list configurable - #81

Open
pedro-pelicioni wants to merge 3 commits into
stellar:mainfrom
Nearx-Labs:fix/74-wallet-coverage
Open

feat(paywall): offer xBull, LOBSTR, Albedo and Rabet, and make the list configurable#81
pedro-pelicioni wants to merge 3 commits into
stellar:mainfrom
Nearx-Labs:fix/74-wallet-coverage

Conversation

@pedro-pelicioni

Copy link
Copy Markdown

feat(paywall): offer xBull, LOBSTR, Albedo and Rabet, and make the list configurable

Branch: fix/74-wallet-coverage
Screenshots: harness/shots/before-wallet-modal.pngharness/shots/after-wallet-modal.png

The gap

useSWKConnection initialises Stellar Wallets Kit with four modules:

modules: [new FreighterModule(), new HanaModule(), new KleverModule(), new OneKeyModule()]

Anyone holding USDC in xBull, LOBSTR, Albedo or Rabet cannot pay, and the modal
gives no hint that their wallet was never an option. SWK ships a zero-config
module for each of them (@creit.tech/stellar-wallets-kit/modules/{xbull,lobstr,albedo,rabet}).

Opening the real modal against each version confirms the difference:

wallets offered
before Freighter, Hana, Klever, OneKey — 4
after xBull, Albedo, Freighter, LOBSTR, Rabet, Hana, Klever, OneKey — 8

The change

  • Offer all eight, Freighter first.
  • Let the host narrow and order the list: stellarWallets on PaywallConfig
    flows through to window.x402.config.wallets, the same path stellarRpcUrl
    already takes. Omitting it keeps every wallet.
  • Unknown ids are dropped with a console warning, and a list with no usable id
    falls back to all wallets, so a config typo degrades instead of leaving a
    paywall nobody can pay.

Structure

The id list and the resolution logic live in walletIds.ts with no SWK
import
. The SWK modules are browser-only — importing one under Node throws on
@stellar/freighter-api's ESM interop — so keeping them apart is what makes
the selection logic unit-testable at all. walletModules.ts maps ids to modules
through a Record<WalletId, ...>, so adding an id without wiring up its module
is a build error rather than a crash inside the modal.

Ledger, Trezor and WalletConnect are deliberately excluded: their modules need
per-integrator configuration (a transport, a project id) and cannot be enabled
by id alone.

Cost

~99 KB uncompressed for the four added wallets (3,749,116 → 3,850,869 bytes).
If that is too much for the default, the same mechanism supports shipping four
by default and letting hosts opt into the rest — say the word and I will flip it.

Tests

9 new cases covering the default list, explicit ordering, case/whitespace
tolerance, de-duplication, unknown-id warning, and the all-unknown fallback.


Part of #74.

pedro-pelicioni and others added 3 commits August 11, 2026 21:19
Kept free of any Stellar Wallets Kit import on purpose: the SWK modules
are browser-only and throw on `@stellar/freighter-api`'s ESM interop when
loaded under Node, so selection logic that imports them cannot be
unit-tested at all.

Unknown ids are dropped with a warning rather than thrown, and a list
with no usable id falls back to every wallet — a paywall offering no
wallets cannot be paid.

Ledger, Trezor and WalletConnect are left out: their modules need
per-integrator configuration and cannot be enabled by id alone.

Co-authored-by: Nearx-Labs <nearxlabs@nearx.com.br>
The kit was initialised with four modules. Anyone holding USDC in xBull,
LOBSTR, Albedo or Rabet could not pay, and the modal gave no hint their
wallet was never an option — SWK ships a zero-config module for each.

Now eight, Freighter first. Ids map to modules through a
`Record<WalletId, ...>`, so adding an id without wiring its module is a
build error rather than a crash inside the modal.

Costs about 99 KB uncompressed.

Co-authored-by: Nearx-Labs <nearxlabs@nearx.com.br>
`stellarWallets` on `PaywallConfig` reaches the browser as
`window.x402.config.wallets`, the same path `stellarRpcUrl` already
takes. Omitting it keeps every supported wallet.

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