-
Notifications
You must be signed in to change notification settings - Fork 1
Create BRC100 & JSON-RPC Django Example, and some fixes for examples to be passed #12
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
Conversation
|
unintended close |
|
unintended close, reopen |
|
reopen! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds comprehensive Python example code ported from the Go wallet toolbox, providing interactive demonstrations of wallet functionality. The PR includes fixes to ensure examples can be executed successfully.
Key Changes
- Created internal helper modules (
setup.py,show.py,services_helpers.py) for shared configuration, console output formatting, and service interactions - Added 11 wallet example scripts demonstrating features like balance checking, transaction creation, encryption/decryption, and advanced patterns like NoSend/SendWith
- Provided comprehensive documentation in README.md with step-by-step execution instructions
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 23 comments.
Show a summary per file
| File | Description |
|---|---|
examples/from_go/internal/setup.py |
Configuration loading, wallet initialization, and environment setup utilities |
examples/from_go/internal/show.py |
Console output formatting utilities with ANSI color support |
examples/from_go/internal/services_helpers.py |
Helper functions for interacting with wallet services and building BEEF structures |
examples/from_go/internal/__init__.py |
Package initialization for internal helpers |
examples/from_go/wallet_examples/show_address_for_tx_from_faucet/show_address_for_tx_from_faucet.py |
Generates and displays a BRC-29 testnet address for receiving faucet funds |
examples/from_go/wallet_examples/internalize_tx_from_faucet/internalize_tx_from_faucet.py |
Demonstrates how to internalize a faucet transaction into the wallet database |
examples/from_go/wallet_examples/internalize_wallet_payment/internalize_wallet_payment.py |
Shows how to internalize wallet payments with BRC-29 derivation |
examples/from_go/wallet_examples/get_balance/get_balance.py |
Simple example for retrieving wallet balance |
examples/from_go/wallet_examples/encrypt/encrypt.py |
Demonstrates message encryption using wallet keys |
examples/from_go/wallet_examples/decrypt/decrypt.py |
Demonstrates message decryption using wallet keys |
examples/from_go/wallet_examples/create_data_tx/create_data_tx.py |
Creates and broadcasts a transaction with OP_RETURN data output |
examples/from_go/wallet_examples/create_p2pkh_tx/create_p2pkh_tx.py |
Creates and broadcasts a standard P2PKH payment transaction |
examples/from_go/wallet_examples/list_actions/list_actions.py |
Lists wallet action history with pagination support |
examples/from_go/wallet_examples/list_failed_actions/list_failed_actions.py |
Lists failed wallet actions for debugging purposes |
examples/from_go/wallet_examples/list_outputs/list_outputs.py |
Lists wallet UTXOs with filtering and pagination |
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py |
Advanced example showing batch transaction construction and broadcasting |
examples/from_go/wallet_examples/no_send_send_with/token/token.py |
Token data structure for PushDrop example |
examples/from_go/wallet_examples/no_send_send_with/token/mint.py |
Token minting implementation using P2PKH for demonstration |
examples/from_go/wallet_examples/no_send_send_with/token/redeem.py |
Token redemption implementation for PushDrop example |
examples/from_go/requirements.txt |
Python dependencies for running the examples |
examples/from_go/README.md |
Comprehensive documentation with setup and execution instructions |
examples/from_go/.gitignore |
Git ignore rules for generated config files |
examples/from_go/__init__.py |
Package initialization for Go-port examples |
examples/__init__.py |
Root examples package initialization |
Comments suppressed due to low confidence (9)
examples/from_go/wallet_examples/internalize_wallet_payment/internalize_wallet_payment.py:44
- Variable derivation_prefix is not used.
derivation_prefix = base64.b64decode(PREFIX).decode("utf-8") # Go decodes to bytes, Python string in JSON often expects str or bytes
examples/from_go/wallet_examples/create_p2pkh_tx/create_p2pkh_tx.py:12
- Import of 'PublicKey' is not used.
from bsv.keys import PublicKey
examples/from_go/wallet_examples/create_p2pkh_tx/create_p2pkh_tx.py:13
- Import of 'Script' is not used.
from bsv.script import Script
examples/from_go/wallet_examples/internalize_wallet_payment/internalize_wallet_payment.py:12
- Import of 'PublicKey' is not used.
from bsv.keys import PublicKey
examples/from_go/wallet_examples/no_send_send_with/token/mint.py:7
- Import of 'json' is not used.
import json
examples/from_go/internal/show.py:6
- Import of 'sys' is not used.
import sys
examples/from_go/internal/setup.py:10
- Import of 'Optional' is not used.
from typing import Callable, Optional, Tuple
examples/from_go/wallet_examples/no_send_send_with/token/token.py:8
- Import of 'Optional' is not used.
from typing import List, Optional
examples/from_go/wallet_examples/internalize_wallet_payment/internalize_wallet_payment.py:53
- Unnecessary 'pass' statement.
pass
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
examples/from_go/wallet_examples/internalize_wallet_payment/internalize_wallet_payment.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/token/mint.py
Outdated
Show resolved
Hide resolved
...s/from_go/wallet_examples/show_address_for_tx_from_faucet/show_address_for_tx_from_faucet.py
Show resolved
Hide resolved
...s/from_go/wallet_examples/show_address_for_tx_from_faucet/show_address_for_tx_from_faucet.py
Show resolved
Hide resolved
…tracks, Monitor not implemented?
…ough an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ough an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 15 comments.
Comments suppressed due to low confidence (1)
src/bsv_wallet_toolbox/wallet.py:619
- Syntax Error (in Python 3).
<<<<<<< HEAD
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/no_send_send_with.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/token/mint.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/no_send_send_with/token/token.py
Outdated
Show resolved
Hide resolved
examples/from_go/wallet_examples/internalize_wallet_payment/internalize_wallet_payment.py
Outdated
Show resolved
Hide resolved
|
I fixed 1 failing test. |
Removed unused imports Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
F1r3Hydr4nt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed, leaving warnings in place
I wrote 2 examples
brc100_wallet_demoanddjango_server.brc100_wallet_demoprovides interactive and comprehensive CUI demo application.It provides access to all of 28 BRC100 method's with intaractive command line.
It can reproduce most of Go's example (with manual input) and do more.
django_servveris JSON-RPC complient server implementation.Currently it lacks integration with py-middleware so it should be implemented soon.
It will be next task.