Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sendBTC.ts #226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ecoin-finance
Copy link

@ecoin-finance ecoin-finance commented Feb 24, 2025

I've made to changes!

chore: changed PRIVATE_KEY to BTC_PRIVATE_KEY
chore: CLI command from "send-btc" to "btc-deposit-and-call"

After use this cli npx hardhat account --save it will create the .env on vercel, with 4 fields...
PRIVATE_KEY,EVM_PRIVATE_KEY,BTC_PRIVATE_KEY,SOLANA_PRIVATE_KEY

Since Hardhat already creates a dedicated BTC_PRIVATE_KEY variable, it makes sense to use it instead of relying on PRIVATE_KEY for Bitcoin. This change ensures that the correct private key is used when interacting with the Bitcoin network.

This is especially useful for users who have a different private key for Bitcoin, as is my case.

Summary by CodeRabbit

  • Refactor
    • Improved Bitcoin transaction configuration by requiring a dedicated private key setup with clearer error feedback.
    • Updated the task’s identifier to offer a more descriptive reference for Bitcoin deposit and execution operations.

chore: changed PRIVATE_KEY to BTC_PRIVATE_KEY and the CLI command to "btc-deposit-and-call"
@ecoin-finance ecoin-finance requested review from a team as code owners February 24, 2025 21:14
Copy link
Contributor

coderabbitai bot commented Feb 24, 2025

📝 Walkthrough

Walkthrough

This change updates the Bitcoin deposit task in sendBTC.ts by switching the environment variable used for the private key from PRIVATE_KEY to BTC_PRIVATE_KEY. The corresponding error message has been updated to reflect this change. Additionally, the task identifier has been renamed from "send-btc" to "btc-deposit-and-call". The overall control flow remains unchanged.

Changes

File Change Summary
packages/tasks/src/sendBTC.ts Updated environment variable from PRIVATE_KEY to BTC_PRIVATE_KEY (with updated error message); changed task name from "send-btc" to "btc-deposit-and-call"

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
packages/tasks/src/sendBTC.ts (1)

49-49: Consider making the transaction fee configurable.

The transaction fee is currently hardcoded to 10000 satoshis. Consider making this configurable to handle network congestion and priority requirements.

+  .addOptionalParam("fee", "Transaction fee in satoshis", "10000")

Then update the fee calculation:

-  const fee = 10000;
+  const fee = parseInt(args.fee);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21a4c82 and fd736f3.

📒 Files selected for processing (1)
  • packages/tasks/src/sendBTC.ts (2 hunks)
🔇 Additional comments (2)
packages/tasks/src/sendBTC.ts (2)

170-172:

❓ Verification inconclusive

LGTM! The task name is now more descriptive, but note this is a breaking change.

The new name "btc-deposit-and-call" better reflects that this task not only sends BTC but also interacts with contracts on ZetaChain. However, this is a breaking change that could affect existing scripts.

Let's check for any references to the old task name that might need updating:


🏁 Script executed:

#!/bin/bash
# Search for references to the old task name
rg -i "send-btc"

Length of output: 16


Heads-up: Task Name Change is Breaking – Manual Verification Recommended

LGTM! The new task name "btc-deposit-and-call" now clearly indicates that the task encompasses both BTC deposits and contract interactions on ZetaChain. Note that this renaming is a breaking change, so please ensure all integrations (scripts, documentation, etc.) referencing the old task name "send-btc" are updated accordingly.

  • Action Item: Although our automated search for "send-btc" produced no matches, please perform a manual verification to guarantee that no lingering references exist in the codebase or external documentation.

105-110:

✅ Verification successful

LGTM! The environment variable change improves clarity.

The change from PRIVATE_KEY to BTC_PRIVATE_KEY better reflects its specific purpose and aligns with the Hardhat-generated .env file structure.

Let's verify that this is the only occurrence of PRIVATE_KEY that needs to be updated for Bitcoin transactions:


🏁 Script executed:

#!/bin/bash
# Search for any remaining instances of PRIVATE_KEY that might need updating
rg -i "private_key" --type ts

Length of output: 1601


LGTM! Environment variable update in packages/tasks/src/sendBTC.ts is correct.

The change—switching from PRIVATE_KEY to BTC_PRIVATE_KEY and updating the error message—is properly implemented for Bitcoin transactions. Our repository search confirms that for BTC-related functionality, the dedicated variable is now used in sendBTC.ts and also correctly set in packages/tasks/src/account.ts and referenced in packages/tasks/src/balances.ts. (Other instances of PRIVATE_KEY found in files like sendZETA.ts and faucet.ts appear to be intended for non-BTC use.)

Please verify that these remaining PRIVATE_KEY references are intentional for their respective chains.

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