Skip to content

feat: migrate send-funds tutorial to new evo-sdk#65

Merged
thephez merged 1 commit intomainfrom
feat/send-funds
Mar 19, 2026
Merged

feat: migrate send-funds tutorial to new evo-sdk#65
thephez merged 1 commit intomainfrom
feat/send-funds

Conversation

@thephez
Copy link
Collaborator

@thephez thephez commented Mar 19, 2026

Summary

  • Rewrite send-funds.jssend-funds.mjs using the new @dashevo/evo-sdk platform address transfer API (sdk.addresses.transfer())
  • Replace old CommonJS wallet-account pattern with ESM imports and AddressKeyManager signer
  • Add RECIPIENT_PLATFORM_ADDRESS env var to .env.example
  • Add send-funds test case to read-write test suite

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a send-funds tutorial script that enables users to transfer funds with a configurable recipient address via environment variables and displays transaction details upon successful completion.
  • Chores

    • Added the RECIPIENT_PLATFORM_ADDRESS environment variable configuration for the send-funds tutorial.
  • Tests

    • Added test coverage for the send-funds tutorial validating transaction broadcasting success and error handling.

Replace old CommonJS wallet-account pattern with ESM
sdk.addresses.transfer() using platform addresses (bech32m).
Add RECIPIENT_PLATFORM_ADDRESS to .env.example and test case.

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

coderabbitai bot commented Mar 19, 2026

📝 Walkthrough

Walkthrough

The pull request replaces an older JavaScript send-funds script with a modern module-based version, adds configuration support for specifying transaction recipients via an environment variable, and introduces test coverage for the updated implementation.

Changes

Cohort / File(s) Summary
Configuration
.env.example
Added RECIPIENT_PLATFORM_ADDRESS environment variable for specifying send-funds tutorial recipient address (bech32m format).
Tutorial Script
send-funds.js, send-funds.mjs
Removed legacy CommonJS script; added new ES module script that initializes Dash client, derives signer, prepares transfer with configurable recipient or fallback address, executes transfer, and logs transaction confirmation with address balances and nonces.
Test Coverage
test/read-write.test.mjs
Added Phase 0 test case validating send-funds script execution with 120-second timeout, asserting "Transaction broadcast!" success pattern and error handling.

Poem

🐰 The funds now flow through modules bright,
Where old code yields to new design right,
With env vars guiding each transaction's way,
And tests ensuring success each day! ✨

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: migrating the send-funds tutorial from the old CommonJS pattern to the new evo-sdk with ESM and updated API usage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/send-funds
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.env.example:
- Around line 14-15: The RECIPIENT_PLATFORM_ADDRESS dotenv entry uses quoted
empty string which triggers dotenv-linter QuoteCharacter; edit the
RECIPIENT_PLATFORM_ADDRESS line (the variable name RECIPIENT_PLATFORM_ADDRESS)
to use an unquoted empty assignment (remove the single quotes) so it reads as an
empty value without quotes.

In `@send-funds.mjs`:
- Around line 4-6: Guard against addressKeyManager being undefined and ensure
failures exit with non-zero code: move the signer initialization
(addressKeyManager.getSigner()) into the try block after calling
setupDashClient(), check that addressKeyManager is not null/undefined before
calling getSigner (e.g., if (!addressKeyManager) { processLogger.error(...);
process.exit(1); }), and on any caught errors in the setup/send flow call
process.exit(1) instead of exiting with code 0; update all related blocks that
reference addressKeyManager, signer, or setupDashClient() to follow this
pattern.
- Around line 7-10: The code hardcodes a testnet recipient and assumes testnet
formatting; change recipient resolution and output formatting to respect
process.env.NETWORK: instead of defaulting to a testnet literal in the recipient
constant, derive the default or validate the provided RECIPIENT_PLATFORM_ADDRESS
against process.env.NETWORK (e.g., throw or normalize if prefix/network
mismatches), and update any address formatting/serialization logic that
currently assumes testnet to use the NETWORK value (process.env.NETWORK) so
addresses are formatted for mainnet when NETWORK='mainnet' (referencing the
recipient constant and the address formatting/serialization code where output is
produced).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38769d08-039d-4555-8874-4df36971de1a

📥 Commits

Reviewing files that changed from the base of the PR and between b1b32dc and 6303644.

📒 Files selected for processing (4)
  • .env.example
  • send-funds.js
  • send-funds.mjs
  • test/read-write.test.mjs
💤 Files with no reviewable changes (1)
  • send-funds.js

@thephez thephez merged commit 037c02a into main Mar 19, 2026
3 checks passed
@thephez thephez deleted the feat/send-funds branch March 19, 2026 20:38
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