Skip to content

Rewrite Rosetta samples as wrappers over mina-repo examples#1201

Draft
dkijania wants to merge 2 commits into
mainfrom
dkijania/rosetta-integration-guide
Draft

Rewrite Rosetta samples as wrappers over mina-repo examples#1201
dkijania wants to merge 2 commits into
mainfrom
dkijania/rosetta-integration-guide

Conversation

@dkijania
Copy link
Copy Markdown
Member

@dkijania dkijania commented May 7, 2026

Summary

Rewrites the Rosetta Code Samples pages as narrative wrappers over the runnable TypeScript examples being added to the mina repo in MinaProtocol/mina#18833. Same pattern as the docker-compose docs: docs2 owns narrative and Mina-specific knowledge, mina repo owns runnable artifacts.

Why

The current pages (landed in #1192) replaced TypeScript samples with curl + jq. That made the pages shorter but pushed integrators toward fragile shell heredocs for production code. Looking at how comparable chains handle this:

  • Coinbase blesses one JS Rosetta SDK (dfinity/rosetta-client); it was archived August 2025
  • Cardano's official examples use axios + hand-rolled wrappers + their in-tree signer
  • Stacks bundles Rosetta into their main TS API

So the TS path that integrators actually use is exactly what Cardano ships. This PR replicates that approach for Mina by linking each samples page to a runnable script in mina/src/app/rosetta/examples/ts/.

What changed

Page Before After
index.mdx curl shell variable setup Quickstart pointing at runnable examples; explains the SDK gap
scan-blocks.mdx ~50 LOC of curl + jq polling Core loop excerpt + Mina notes (reorgs, confirmations, skipped slots)
track-deposits.mdx ~60 LOC of jq filters Deposit filter excerpt + Mina notes (operation types, account creation fee, memo guidance)
send-transactions.mdx 9 manual curl steps with shell-escaped JSON Full flow using mina-signer.rosettaCombinePayload, plus cold-signing variant pointing at offline-sign.ts
requests.mdx curl-heavy reference Trimmed intro; curl snippets remain for quick exploration

static/llms-full.txt regenerated.

Dependency

Links to runnable examples won't resolve until MinaProtocol/mina#18833 merges into develop. Hence this PR is opened as draft — same workflow as #1175 → mina#18827.

Test plan

  • Local npm start and click through /node-operators/rosetta/samples/* pages
  • After mina#18833 merges, verify all GitHub permalinks resolve
  • Mark ready for review

🤖 Generated with Claude Code

The samples pages now narrate the integration patterns and Mina-specific
spec deltas, with each page linking to the corresponding TypeScript
example in src/app/rosetta/examples/ts/ in the mina repo (PR
MinaProtocol/mina#18833).

Same pattern as the docker-compose docs: docs2 owns narrative and
Mina-specific knowledge, mina repo owns runnable artifacts. Examples
stay in sync with the daemon they target via co-location and CI.

Pages updated:

- index.mdx: explains the SDK situation (no maintained TS Rosetta SDK,
  Cardano/Stacks use the same axios pattern) and points at the
  examples directory for quickstart
- scan-blocks.mdx: 10-line core loop excerpt + Mina notes (reorgs,
  confirmations, skipped slots)
- track-deposits.mdx: deposit filter excerpt + Mina notes (operation
  types, account creation fee, memo guidance)
- send-transactions.mdx: full Construction API flow with mina-signer's
  rosettaCombinePayload helper, plus cold-signing variant
- requests.mdx: trimmed intro to point at runnable scripts; curl
  snippets remain as illustrative quick-exploration tools

Regenerate llms-full.txt accordingly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs2 Error Error May 14, 2026 9:04pm

Request Review

dkijania added a commit to MinaProtocol/mina that referenced this pull request May 14, 2026
The PR's original `commons.ts` (300 lines: typed RosettaClient + Mina
operation builder) has graduated into its own published-on-npm SDK at
`o1-labs/mina-rosetta-sdk-js`. The examples now consume it as a regular
dependency.

  - `commons.ts` deleted (−300 lines).
  - `package.json`: `axios` removed (HTTP is the SDK's concern now);
    `@o1-labs/mina-rosetta-sdk@^0.0.1` added; `dotenv` + `mina-signer`
    kept.
  - Each example imports types/client/helpers from the SDK; `requireEnv`
    + `sleep` inlined per-file so each script stays self-contained for
    copy-paste reading.
  - README updated: "no Rosetta TS SDK exists" → "install the SDK
    directly", drops the layout entry for `commons.ts`.
  - `package-lock.json` removed for now — the SDK is not yet on npm, so
    `npm ci` would fail anyway. Will regenerate once the SDK publishes
    `0.0.1`. The other PR docs in MinaProtocol/docs2#1201 don't depend
    on this lockfile.

Net: −780 lines across the directory; example code-to-comment ratio
improves and "what does this example actually do" reads faster.

Blocks on: @o1-labs/mina-rosetta-sdk@0.0.1 being published to npm
(awaiting NPM_TOKEN regeneration on the shared o1-labs account).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The runnable mina-repo TS examples now depend on
@o1-labs/mina-rosetta-sdk (published to npm 2026-05-13) rather than
the inline axios+commons.ts pattern this PR originally documented.
Refresh prose accordingly:

- index.mdx setup paragraph: "axios + commons.ts" → SDK + signer
- index.mdx "Why no SDK?" callout: pivots from "Mina follows the
  hand-rolled axios pattern" to "Mina ships its own SDK; upstream
  Coinbase still has the same gap for everyone else"
- index.mdx network-identifier note: "RosettaClient in commons.ts"
  → "SDK's RosettaClient"
- send-transactions.mdx: buildTransferOperations attribution
  follows the helper into the SDK

Regenerate llms-full.txt accordingly. Pairs with
MinaProtocol/mina#18833.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant