Skip to content

Commit

Permalink
Merge pull request #22 from eric-volz/test
Browse files Browse the repository at this point in the history
merge test into main
  • Loading branch information
eric-volz authored May 21, 2022
2 parents 59fa5cf + 65d9f0d commit f04ad43
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 2 deletions.
60 changes: 60 additions & 0 deletions README_for_pypi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[![Downloads](https://static.pepy.tech/personalized-badge/defichain?period=total&units=international_system&left_color=blue&right_color=green&left_text=Downloads)](https://pepy.tech/project/defichain)

# [DefichainPython](https://github.com/eric-volz/DefichainPython)

## This library is not finished yet and therefore should not be used in production!
## Changes can still occur at any time and may break your code!

## Welcome to Defichain's Python Library
___
Welcome to the Python Library for the Defichain!

In this library all RPC commands of a [Defichain Node](https://defichain.com/downloads) are available and can be
called in a few lines of code!

If you just want to query data from the blockchain you can also use the Ocean API: you don't need a Defichain Node for
this, just an internet connection!

But first we need to install it:

### Installation
```bash
pip install defichain
```

### Example Code for RPC
```python
from defichain import Node

node = Node("user", "password", "127.0.0.1", 8554)

node.blockchain.getblockcount() # returns block height of the latest block

node.poolpair.compositeswap("fromAddress", "BTC", 0.01, "toAddress", "DFI") # swaps 0.01 BTC to DFI
```

### Example Code for Ocean API
```python
from defichain import Ocean

ocean = Ocean() # creates the connection to Ocean

ocean.blocks.list() # returns the latest 30 blocks

ocean.poolpairs.get(4) # returns data from ETH-DFI Pool
```

## Next Steps
- Finish the RPC Code
- Write unit tests for RPC and Ocean commands
- Document all functions and publish it on [ReadTheDocs](https://readthedocs.org/)

## Community
This [project](https://github.com/DeFiCh/dfips/issues/133) is funded by the Defichain Community:
Thank you for your trust! If you have suggestions for improvement
or other ideas open an [issue](https://github.com/eric-volz/DefichainPython/issues),
write me on [Twitter](https://twitter.com/Intr0c) or via email ([email protected])!

## License & Disclaimer
By using (this repo), you (the user) agree to be bound by the
[terms of this license](https://github.com/eric-volz/defichainLibrary/blob/main/LICENSE) (MIT License).
Binary file removed dist/defichain-0.0.7-py3-none-any.whl
Binary file not shown.
Binary file removed dist/defichain-0.0.7.tar.gz
Binary file not shown.
Binary file added dist/defichain-0.0.8-py3-none-any.whl
Binary file not shown.
Binary file added dist/defichain-0.0.8.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from setuptools import setup
from os import path

VERSION = '0.0.7'
VERSION = '0.0.8'
DESCRIPTION = 'Defichain Python Library'

this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
with open(path.join(this_directory, 'README_for_pypi.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()

# Setting up
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file added tests/node/__init__.py
Empty file.
Empty file added tests/ocean/__init__.py
Empty file.

0 comments on commit f04ad43

Please sign in to comment.