feat: Add mnemonic phrase support and enhanced logging to api_trading.py#15
Open
James-4u wants to merge 4 commits intosportstensor:mainfrom
Open
feat: Add mnemonic phrase support and enhanced logging to api_trading.py#15James-4u wants to merge 4 commits intosportstensor:mainfrom
James-4u wants to merge 4 commits intosportstensor:mainfrom
Conversation
Author
|
@conidig @xzistance Could you review check my pr? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds mnemonic phrase support to
api_trading.py, allowing miners to use 12/24-word mnemonic phrases instead of requiring direct private key export. Additionally, comprehensive logging and detailed comments have been added throughout the codebase to improve debugging and maintainability.Changes
✨ New Features
Mnemonic Phrase Support
EOA_WALLET_MNEMONIC(12/24-word phrase) instead ofEOA_WALLET_PKm/44'/60'/0'/0/0) for Ethereumbip-utils(recommended) andhdwalletlibrariesEnhanced Logging
Improved Code Documentation
🔧 Technical Improvements
hdwalletlibrary API compatibility issuesbip-utilsandhdwalletwith automatic fallback📦 Dependencies
Updated
requirements.txtwith new dependencies:python-dotenv>=1.0.0- Environment variable managementpy-clob-client>=1.0.0- Polymarket CLOB API clienteth-account>=0.8.0- Ethereum account and signingmnemonic>=0.20- Mnemonic phrase validationbip-utils>=2.9.0- BIP44 derivation (recommended)hdwallet>=2.2.0- Alternative mnemonic derivationUsage
Using Mnemonic Phrase
In
api_trading.env:EOA_WALLET_ADDRESS=0x...
EOA_WALLET_MNEMONIC=word1 word2 word3 ... word12
EOA_PROXY_FUNDER=0x...
Using Private Key (existing method)
EOA_WALLET_ADDRESS=0x...
EOA_WALLET_PK=0x...
EOA_PROXY_FUNDER=0x...
Installation
pip install -r requirements.txtBenefits
Testing
bip-utilshdwalletifbip-utilsunavailableNotes
EOA_WALLET_PKandEOA_WALLET_MNEMONICare provided, the private key takes precedencebip-utilsis recommended overhdwalletfor better reliabilityContribution by Gittensor, learn more at https://gittensor.io/