XMR.to wrapper
Interact with XMR.to.
This is built according to the XMR.to API documentation.
With https://test.xmr.to you can pay testnet BTC with stagenet XMR (including lightning payments).
How to
- Get help
xmrto_wrapper -h
- General usage
- Create an order for an amount in
BTC:# Create an order for 0.001 BTC: xmrto_wrapper create-order --destination 3K1jSVxYqzqj7c9oLKXC7uJnwgACuTEZrY --btc-amount 0.001 # Result: {"uuid": "xmrto-p4XtrP", "state": "TO_BE_CREATED", "btc_dest_address": "3K1jSVxYqzqj7c9oLKXC7uJnwgACuTEZrY", "btc_amount": "0.001", "uses_lightning": false} # If XMR.to is fast enough with the order processing, the result can also be: {"uuid": "xmrto-LAYDkk", "state": "UNPAID", "btc_dest_address": "3K1jSVxYqzqj7c9oLKXC7uJnwgACuTEZrY", "btc_amount": "0.001", "uses_lightning": false, "receiving_subaddress": "86hZP8Qddg2KXyvjLPTRs9a7C5zwAgC21RcwGtEjD3RPCzfbu4aKBeYgqFgpcsNNCcP5iGuswbMKRFXLHiSu45sWMuRYrxc", "incoming_amount_total": "0.1373", "remaining_amount_incoming": "0.1373", "incoming_price_btc": "0.00728332", "btc_amount_partial": "0", "seconds_till_timeout": 2697, "created_at": "2020-05-01T18:47:57Z"}--btcis the equivalent of--btc-amountand can be used interchangeably.- It's possible to give the amount in
XMR, where--xmris the equivalent of--xmr-amount(They can be used interchangeably).# Create an order for 1 XMR: xmrto_wrapper create-order --destination 3K1jSVxYqzqj7c9oLKXC7uJnwgACuTEZrY --xmr-amount 1 # Result: {"uuid": "xmrto-JSSqo3", "state": "TO_BE_CREATED", "btc_dest_address": "3K1jSVxYqzqj7c9oLKXC7uJnwgACuTEZrY", "btc_amount": "0.00722172", "uses_lightning": false} - Use
--followto keep tracking the order. - Prior to
v0.1there used to be a separate sub command:--create-and-track-order.--followprovides the same behaviour.
- Track an existing order:
xmrto_wrapper track-order --secret-key xmrto-ebmA9q--secretand--keyare the equivalents of--secret-keyand can be used interchangeably.- Use
--followto keep tracking the order.
- Confirm an underpaid order (for an underpaid order):
xmrto_wrapper confirm-partial-payment --secret-key xmrto-ebmA9q--secretand--keyare the equivalents of--secret-keyand can be used interchangeably.- Use
--followto keep tracking the order.
- Get the recent price for an amount in
BTC:xmrto_wrapper check-price --btc-amount 0.01--btcis the equivalent of--btc-amountand can be used interchangeably.- It's possible to give the amount in
XMR, where--xmris the equivalent of--xmr-amount(They can be used interchangeably).xmrto_wrapper check-price --xmr-amount 1 - Use
--followto keep tracking the order.
- Create an order for an amount in
- The API used is
--api v3by default, so no need to actually set that parameter. - The URL used is
--url https://xmr.toby default, so no need to actually set that parameter.- There also is
--url https://test.xmr.tofor stagenet XMR. - Often
https://test.xmr.tohas some new features available for testing.
- There also is
- More info
xmrto_wrapper.py --versionxmrto_wrapper.py --logo
- The option
--debugshows debug information.
See:
xmrto_wrapper --help.xmrto_wrapper create-order --help- ...
When importing as module from xmrto_wrapper import xmrto_wrapper environment variables are considered:
| cli option | environment variable |
|---|---|
--url |
XMRTO_URL |
--api |
API_VERSION |
--destination |
DESTINATION_ADDRESS |
--btc-amount,--btc |
BTC_AMOUNT |
--xmr-amount,--xmr |
XMR_AMOUNT |
--secret-key,--secret,--key |
SECRET_KEY |
--invoice |
LN_INVOICE |
requirements.txt vs. setup.py
According to these sources:
I try to stick to:
requirements.txtlists the necessary packages to make a deployment work.setup.pydeclares the loosest possible dependency versions.
Creating requirements.txt
You won't ever need this probably - This is helpful when developing.
pip-tools is used to create requirements.txt.
- There is
requirements.inwhere dependencies are set and pinned. - To create the
requirements.txt, runupdate_requirements.shwhich basically just callspip-compile.
Note:
- There also is
build_requirements.txtwhich only containspip-tools. I found, when working with virtual environments, it is necessary to installpip-toolsinside the virtual environment as well. Otherwisepip-syncwould install outside the virtual environment.
A development environment can be created like this:
# Create a virtual environment 'venv'.
python -m venv venv
# Activate the virtual environment 'venv'.
. /venv/bin/activate
# Install 'pip-tools'.
pip install --upgrade -r build_requirements.txt
# Install dependencies.
pip-sync requirements.txt
...
python -m xmrto_wrapper.xmrto_wrapper create-order --url https://test.xmr.to --api v3 --destination="tb1qkw6npn7ann5nw9f7l94qkqhh8pdtnsuxlw3v8q" --btc 0.5 --follow
...
# Deactivate the virtual environment 'venv'.
deactivate
Use as module
module_example.py shows how to import as module.
Executable
If installed using pip, a system executable will be installed as well.
This way, you can just use the tool like every executable on your system.
xmrto_wrapper --help
If you would like to donate - Thanks:
86Avv8siJc1fG85FmNaUNK4iGMXUHLGBY2QwR3zybFMELXrNA34ioEahrupu16v6mZb2hqp2f89YH78oTvyKaha4QRVk2Rb
Metadata
Release files for xmrto-wrapper 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xmrto_wrapper-0.3.0.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xmrto_wrapper-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.9 kB
Release files / xmrto_wrapper-0.3.0.tar.gz
| Download URL | xmrto_wrapper-0.3.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf67e9f359ee7c7f5f1e976f1ae48c97000dcb2072d2005a78fc9dd3b2f32ab5
|
|
BLAKE2b-256 checksum How to use checksums |
9050c212cca946894124ee86f1dbd451bc436846382b8bdeac373611d878ce24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.8
|
Release files / xmrto_wrapper-0.3.0-py3-none-any.whl
| Download URL | xmrto_wrapper-0.3.0-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ce4d181469505148d476b6a5f8fd9aa54d3545e1fb74b691dca21eeef6edf55
|
|
BLAKE2b-256 checksum How to use checksums |
d355dd6e07f27d5dfa6dd0785940ba912c9e85cae55b87745c8ca442b9f7a940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.8
|