Skip to content

docs(tutorials): connect a CIP-30 wallet and send a first payment on preview - #418

Open
IanoNjuguna wants to merge 6 commits into
IntersectMBO:mainfrom
IanoNjuguna:fix/tutorial-code-samples
Open

IanoNjuguna wants to merge 6 commits into
IntersectMBO:mainfrom
IanoNjuguna:fix/tutorial-code-samples

Conversation

@IanoNjuguna

@IanoNjuguna IanoNjuguna commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

The Tutorials section has one hands-on guide: a Haskell payment detector against a local emulator. That covers the backend path. It does not cover the one a newcomer usually starts with, which is a browser wallet, a provider, and a transaction the wallet signs.

This adds Connect a Wallet and Send Your First Payment, a single page that walks the whole path on preview testnet:

  1. list the CIP-30 wallets installed in the browser
  2. connect to one, and refuse to continue if it is on mainnet
  3. read the address, UTxOs and balance
  4. build an ADA payment with MeshTxBuilder
  5. sign with the wallet and submit
  6. confirm, on chain and on an explorer

Written against the current Mesh API rather than the older Transaction class: MeshCardanoBrowserWallet from @meshsdk/wallet, MeshTxBuilder and BlockfrostProvider from @meshsdk/core. Every method named in the page is one Mesh documents today, and the page links to that documentation rather than restating it.

Fixes #265. It meets every acceptance criterion:

  • new tutorial page under website/docs/tutorials/
  • listed in Tutorials navigation and Getting Started
  • uses preview testnet, no mainnet funds required
  • clear prerequisites and copy-pasteable steps
  • npm run build succeeds

Where this could go further

The page is a single happy path, and #265 is assigned to @sadSanta-07, who is credited as a co-author on the commit. Roughly in order of value:

  1. Run it once for real. The snippets are written against Mesh's current docs, not executed; that needs a wallet extension, preview tADA and a Blockfrost key. One run would confirm every code block.
  2. Screenshots or a short recording of the wallet popup, the wrong-network state and the confirmation. The popup is where a first-timer loses confidence, and prose cannot answer "does this look right".
  3. A framework-free path. The scaffold uses the Mesh CLI, which produces Next.js; a reader on Vite or plain HTML has to translate. Ten lines of vanilla TypeScript would cover it.
  4. A native-asset payment, not just ADA. unit being policy ID plus asset name in hex needs a worked example.
  5. Showing the fee before signing. Currently a mainnet caveat rather than a taught step.
  6. One error-handling pattern for the whole flow: try/catch, disabled button while pending, user-facing message on rejection.
  7. The wallet id table for enable(): eternl, lace, nami, flint, gerowallet, typhoncip30.
  8. Collateral worked, not described: a two-line getCollateralMesh() example for a reader whose next step is a Plutus call.
  9. The explorer URL shape. The page says to paste the hash into the search box because I could not confirm the /tx/<hash> pattern; a real link would be better.
  10. Mobile. Browser wallets are extensions; the phone path is WalletConnect or CIP-45, which is its own tutorial.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • I have tested these changes locally
  • I have checked for broken links
  • Code examples have been tested

Checklist

  • My code follows the style guidelines
  • I have performed a self-review
  • I have made corresponding changes to documentation
  • My changes generate no new warnings

Verification

docusaurus build    SUCCESS with onBrokenLinks: throw

Served and inspected at 1280 and 390:

  • h1 and 11 code blocks render, the :::warning about addr_test1 vs addr1 renders as an admonition
  • the page appears in the autogenerated sidebar under Tutorials on both tutorial pages, and the breadcrumb reads Tutorials → Wallet connect and payment
  • horizontal overflow: 0 at both widths; code blocks are 342px wide at 390, so nothing scrolls sideways

External links checked with curl, not assumed:

200  docs.cardano.org/cardano-testnets/tools/faucet
200  preview.cexplorer.io
200  meshjs.dev/apis/wallets/browserwallet
200  blockfrost.io
200  cips.cardano.org/cip/CIP-30

preview.cardanoscan.io answers 403 to a scripted request, so the page links cexplorer only and mentions pasting the hash into a block explorer rather than promising a specific URL shape that I could not verify.

Notes

  • The code is not executed. It is a tutorial, and the only honest way to run it needs a browser wallet extension, test ADA and a Blockfrost key. The API surface is verified against Mesh's current docs and every failure I could not verify is described rather than asserted.
  • Step 6 says to paste the hash into the explorer's search box instead of giving a /tx/<hash> URL, because the explorer's path pattern is not documented anywhere I could confirm.
  • fix/tutorial-code-samples is the branch Update code samples so tutorials build and run #301 names for tutorial changes. It existed but carried nothing (0 commits ahead of main, 168 behind), so the branch was moved onto current main before this commit.

@IanoNjuguna IanoNjuguna added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 22, 2026
@IanoNjuguna
IanoNjuguna force-pushed the fix/tutorial-code-samples branch from 927195f to 47b82e9 Compare November 22, 2026 12:13
…preview

The Tutorials section had one hands-on guide, a Haskell payment detector
against a local emulator. There was nothing for the browser path a newcomer
actually starts with: a wallet extension, a provider, and a transaction the
wallet signs.

Adds "Connect a Wallet and Send Your First Payment", built on the current
Mesh API rather than the older Transaction class:

  MeshCardanoBrowserWallet.getInstalledWallets() / enable() / getNetworkId()
  MeshTxBuilder.txOut().changeAddress().selectUtxosFrom().complete()
  wallet.signTx(tx, false) then wallet.submitTx(tx)
  BlockfrostProvider.onTxConfirmed()

Everything runs on preview testnet, addresses start addr_test1, and the
faucet, Blockfrost and explorer links are the current ones. The failures a
first-timer hits get their own troubleshooting entries: wallet list empty
until reload, wrong network, Blockfrost 403 from a mainnet key, funds not
yet arrived, stale UTxOs after a submit, collateral (and why a plain
payment does not need it), and a rejected signature.

Also lists it under Tutorials in getting-started.md, next to the existing
guide, with a trailing-slash route.

Verified on a local build: the page renders with 11 code blocks and the
warning admonition, the autogenerated sidebar carries it under Tutorials,
the breadcrumb resolves, and there is no horizontal overflow at 1280 or 390.

Fixes IntersectMBO#265

Co-authored-by: Sahil Singh <180702365+sadSanta-07@users.noreply.github.com>
The page carried a frontmatter title, sidebar label and position, where the
other tutorial in this folder has none and opens on a prose H1. It now reads
as the same set as local-cardano-payment-detector.md: an H1 that names the
build, two paragraphs of why, then named steps.

Each heading that held several code blocks is split into its own subsection
(The Building Blocks, What Is Installed, Asking for Permission, Guarding the
Network, and so on), and every block is followed by the sentence that says
what it does. Where the old page explained a thing before showing it (the
short string amounts, the change address, what complete() reaches the network
for), the explanation now sits under the block that demonstrates it.

Two content moves: the provider key section moves from after the full
component up into setup, where a reader needs it, and the full component gains
try/catch and a pending flag so it does the error handling the prose asks for.
A Summary closes the page, matching the sibling.

No API changed. MeshCardanoBrowserWallet, MeshTxBuilder and BlockfrostProvider
method names were checked against @meshsdk/wallet@2.0.0-beta.11 and
@meshsdk/core@1.9.1 type definitions, and every external link returns 200.
The page tells a reader to use MeshCardanoBrowserWallet, getUtxosMesh and
MeshTxBuilder({ fetcher }), all of which postdate what a coding assistant
learned. Mesh ships an MCP server for that gap, so the page now carries it as
an optional step between setup and the first wallet call, where a reader needs
it rather than at the end.

The configuration is the one Mesh publishes, read off the Cursor install
deeplink on meshjs.dev/ai/mcp: npx -y meshjs-mcp with API_KEY and MODEL, and
the note that VS Code spells the container `servers` where Claude Code and
Cursor use `mcpServers`.

The warning is deliberate, because the step does not work end to end today:
meshjs-mcp@1.1.1 handshakes and lists askDocs, askDocs posts to
mimir-api.meshjs.dev which has no DNS record, and meshjs.dev/api/mcp/ask
answers 404. A reader who runs it gets "Couldn't match documentation" on every
call, so the section says so and gives them meshjs.dev/llms-full.txt and the
.md twin of any page instead.
Most people reading this will be driving a coding agent, and the page led
with the wallet walkthrough while keeping the MCP setup as an optional aside
two thirds of the way into setup. That order is backwards: an agent that has
not read Mesh's docs writes BrowserWallet and the Transaction class, and then
every snippet on the page is wrong in the same quiet way.

Step 1 is now handing the agent the documentation (the MCP config, the VS Code
`servers` difference, and the llms-full.txt fallback for when the hosted
service answers nothing), followed by the question to ask it whose answer
changed between versions. The build then runs as seven numbered steps, each
closing with the prompt to give the agent and the specific shape to reject.

The intro now carries the four facts an agent gets wrong, so a reader can
audit the output before the first wallet call.

Checked against the packages rather than the prose: @meshsdk/wallet@2.0.0-beta.11
exports MeshCardanoBrowserWallet and CardanoBrowserWallet and has no
BrowserWallet (that name survives in the 1.9.1 wallet that @meshsdk/core
re-exports), the Transaction class still ships in @meshsdk/transaction, and
Mesh's current docs build transactions with MeshTxBuilder. So the page says
"previous class" and "no longer taught" rather than calling either one gone.
Step 1 opened with the MCP config and treated the llms-full.txt download as
something to fall back to when the MCP failed. That is the wrong order twice
over: the file works today and the MCP does not, and a downloaded copy is what
an agent can actually grep and cite without a key or a network call.

So Step 1 is now the file: fetch meshjs.dev/llms-full.txt into docs/, keep it
out of git with .gitignore, and give the agent one sentence to obey, the same
sentence in AGENTS.md or CLAUDE.md so it survives a new session. The markdown
twin hint stays for the follow-up question. The MCP server moves to its own
subsection at the end of the step, complete with the verified note that its
hosted service answers nothing today, so the config is there for when it is
back rather than being the thing a reader tries first.
The hosted service behind it does not resolve, so the section documented a
setup a reader cannot use, and the warning explaining that took more room than
the instructions it warned about. Step 1 keeps the method that works today: the
llms-full.txt download, the sentence for the agent, and the markdown twin for
anything the file does not settle.

Also finishes the language: the intro promised "Mesh's live documentation"
when what the reader gets is a local snapshot.
@sadSanta-07

Copy link
Copy Markdown
Contributor

Hey @IanoNjuguna, huge thanks for putting this together and adding me as co-author! Really appreciate you keeping my earlier claim in mind, guide looks super clean and well-structured.

This branch has not been deployed

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

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add hands-on tutorial: CIP-30 wallet connect and first preview transaction (Mesh)

2 participants