-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from eric-volz/test
merge test into main
- Loading branch information
Showing
9 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Empty file.
Empty file.