Complexity: Medium — 150 pts
Summary
StellarFlow's payment link generator lives only inside the web UI. Developers and power users who want to generate a stellarflow.vercel.app/pay?... link programmatically — for use in scripts, bots, invoices, or CI pipelines — have no way to do it without opening the browser. This issue adds a lightweight Node.js CLI script (scripts/generate-link.mjs) that accepts address, amount, asset, and memo as arguments and outputs the full payment link to stdout.
Files to Create/Modify
- Create:
scripts/generate-link.mjs — the CLI script
- Create:
scripts/README.md — usage documentation
- Create:
scripts/generate-link.test.mjs — Node assert-based tests
- Modify:
package.json — add generate-link and test:scripts npm scripts
Implementation Notes
scripts/generate-link.mjs
Use Node's built-in node:util parseArgs to read --to, --amount, --asset (default XLM), --memo, --base (default https://stellarflow.vercel.app).
Validation, in order:
--to and --amount are required → exit 1 with usage message if missing
--to must pass StellarSdk.StrKey.isValidEd25519PublicKey() → exit 1 if invalid
--amount must parse to a positive number → exit 1 if invalid
--memo, if present, must be ≤ 28 bytes via Buffer.byteLength(memo, 'utf8') → exit 1 if too long
Build the URL with URLSearchParams({ to, amount, asset }), add memo if present, and console.log the final ${base}/pay?${params} string.
package.json
"scripts": {
"generate-link": "node scripts/generate-link.mjs",
"test:scripts": "node scripts/generate-link.test.mjs"
}
scripts/README.md
Document the usage, an options table (flag, type, default, description), and example commands for XLM, USDC with memo, and pointing at a local dev server via --base.
scripts/generate-link.test.mjs
Use Node's built-in assert and execSync to test: a basic XLM link includes the right params, a USDC+memo link includes asset=USDC and the memo, and an invalid address exits with status 1.
Acceptance Criteria
Screen Recording Requirements (terminal session)
- Run
npm run generate-link -- --to GABCD... --amount 10 → valid URL printed to stdout
- Run with
--asset USDC --memo "Invoice #42" → URL includes memo and asset params
- Open the printed URL in a browser → StellarFlow Pay page loads with the correct pre-filled values
- Run with an invalid Stellar address → clear error message printed, exit code 1
- Run
npm run test:scripts → all tests pass
Complexity: Medium — 150 pts
Summary
StellarFlow's payment link generator lives only inside the web UI. Developers and power users who want to generate a
stellarflow.vercel.app/pay?...link programmatically — for use in scripts, bots, invoices, or CI pipelines — have no way to do it without opening the browser. This issue adds a lightweight Node.js CLI script (scripts/generate-link.mjs) that accepts address, amount, asset, and memo as arguments and outputs the full payment link to stdout.Files to Create/Modify
scripts/generate-link.mjs— the CLI scriptscripts/README.md— usage documentationscripts/generate-link.test.mjs— Node assert-based testspackage.json— addgenerate-linkandtest:scriptsnpm scriptsImplementation Notes
scripts/generate-link.mjsUse Node's built-in
node:util parseArgsto read--to,--amount,--asset(defaultXLM),--memo,--base(defaulthttps://stellarflow.vercel.app).Validation, in order:
--toand--amountare required → exit 1 with usage message if missing--tomust passStellarSdk.StrKey.isValidEd25519PublicKey()→ exit 1 if invalid--amountmust parse to a positive number → exit 1 if invalid--memo, if present, must be ≤ 28 bytes viaBuffer.byteLength(memo, 'utf8')→ exit 1 if too longBuild the URL with
URLSearchParams({ to, amount, asset }), addmemoif present, andconsole.logthe final${base}/pay?${params}string.package.jsonscripts/README.mdDocument the usage, an options table (flag, type, default, description), and example commands for XLM, USDC with memo, and pointing at a local dev server via
--base.scripts/generate-link.test.mjsUse Node's built-in
assertandexecSyncto test: a basic XLM link includes the right params, a USDC+memo link includesasset=USDCand the memo, and an invalid address exits with status 1.Acceptance Criteria
scripts/generate-link.mjsexists and is executable with Node.js (no build step required)--toand--amountare required; script exits with code 1 and a clear message if missingStrKey.isValidEd25519PublicKey) prints an error and exits with code 1--baseflag allows pointing at any StellarFlow deployment URLnpm run generate-linkworks as a convenience aliasscripts/README.mddocuments all flags with examplesnpm run test:scriptsruns all tests and passesScreen Recording Requirements (terminal session)
npm run generate-link -- --to GABCD... --amount 10→ valid URL printed to stdout--asset USDC --memo "Invoice #42"→ URL includes memo and asset paramsnpm run test:scripts→ all tests pass