Skip to content

feat(ui): add copy as stellar CLI command to TxDrawer (closes #12) - #21

Open
NePreby wants to merge 5 commits into
Flow-Pulse:mainfrom
NePreby:feat/tx-drawer-copy-stellar-cli-command
Open

NePreby wants to merge 5 commits into
Flow-Pulse:mainfrom
NePreby:feat/tx-drawer-copy-stellar-cli-command

Conversation

@NePreby

@NePreby NePreby commented Nov 6, 2026

Copy link
Copy Markdown

Summary

Closes #12.

Adds a "Copy CLI command" action to TxDrawer that generates the equivalent stellar contract invoke --id … -- <method> --arg … command for any pending invocation:

  1. CLI Generation Module (frontend/src/lib/cli.ts):
    • Implements toStellarCliCommand({ contractId, method, args, source, network }).
    • Maps methods from both StreamRouter and CascadeSplitter to their exact contract signatures (create_stream, withdraw, withdraw_all, top_up, cancel, withdrawable, get_stream, streams_by_sender, streams_by_recipient, stream_count, set_splits, get_splits, preview, distribute).
    • Automatically unmarshals ScVal representations into native types using scValToNative and formats numbers, strings, addresses, booleans, and complex structures (Vec<Split>) with safe shell quoting and JSON escaping.
  2. TxDrawer Integration (frontend/src/components/TxDrawer.tsx):
    • Renders a compact CopyButton labeled "Copy CLI command" in the Invocation section.
    • Populated dynamically with the pending transaction's contractId, method, args, and connected source address.
  3. Comprehensive Unit Test Suite (frontend/src/lib/__tests__/cli.test.ts):
    • Includes 17 dedicated unit tests verifying every contract method in StreamRouter and CascadeSplitter, along with flag formatting and shell escape logic.
    • Verified clean with npx tsc -b and npx vitest run (47/47 passing tests across 6 suites).

Payout Wallet:

  • TRX Tron (TRC20): TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'copy as stellar CLI command' to the signing drawer

1 participant