Skip to content

feat(amulet-drip): batch Amulet distribution CLI with UTXO selection, tx verification, and build.sbt integration#5233

Open
anhlh2311 wants to merge 15 commits intocanton-network:mainfrom
AngelhackDev:anhle-angelhack/amulet-drip
Open

feat(amulet-drip): batch Amulet distribution CLI with UTXO selection, tx verification, and build.sbt integration#5233
anhlh2311 wants to merge 15 commits intocanton-network:mainfrom
AngelhackDev:anhle-angelhack/amulet-drip

Conversation

@anhlh2311
Copy link
Copy Markdown
Contributor

@anhlh2311 anhlh2311 commented Apr 25, 2026

Static Badge

Summary

Adds amulet-drip, a general-purpose CLI tool for batch-distributing Amulet ($CC) tokens to multiple recipients on a Canton/Splice network.

Reads a CSV of party IDs (with optional amounts), transfers Amulet from a funded internal sender party to each recipient using the Splice Token Standard v1 TransferFactory API, and writes a JSON report of the results.

Key features

  • UTXO-aware holding selection — picks the smallest holding that covers each transfer, minimizing change outputs
  • Transaction verification — uses submit-and-wait-for-transaction (not just completion) to parse created Amulet contracts and identify receiver vs change
  • Balance pre-check — queries sender's total balance before starting, warns if insufficient
  • Incremental output — writes results to file after each transfer for crash recovery
  • Rich error formatting — extracts Canton error codes and HTTP response details
  • Retry logic — configurable per-transfer retry count
  • Flexible CSV parsing — auto-detects headers, supports party,amount / party,expected_amount / party-only formats

Architecture

  • TypeScript, esbuild, pino (logging), zod (config validation), Commander.js (CLI), vitest (testing)
  • Uses generated OpenAPI clients (canton-json-api-v2-openapi for Ledger API, transfer-instruction-openapi for TransferFactory)
  • Follows party-allocator project structure and conventions
  • 26 unit tests (config, csv-parser, holdings)
  • Registered in build.sbt with npm lifecycle tasks (build, test, lint, fix)

Files

  • amulet-drip/src/ — logger, config, csv-parser, holdings, amulet-transfer, index (CLI)
  • amulet-drip/__tests__/ — config, csv-parser, holdings tests
  • amulet-drip/README.md — architecture diagrams (Mermaid), usage guide, env var reference
  • amulet-drip/TESTING.md — local dev guide with verified port reference, auth flow, troubleshooting
  • build.sbt — project definition + root aggregate registration

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a logical synchronizer upgrade test is required (from canton-3.5), comment /lsu_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release
    notes
    .
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or
    use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

…start script dependencies

Signed-off-by: Le Hoang Anh <[email protected]>
…auth flow, and troubleshooting

Signed-off-by: Le Hoang Anh <[email protected]>
Signed-off-by: Le Hoang Anh <[email protected]>
Signed-off-by: Le Hoang Anh <[email protected]>
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.

5 participants