Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ksiazkowicz committed Apr 6, 2020
0 parents commit e452e51
Show file tree
Hide file tree
Showing 32 changed files with 4,475 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[run]
source = aioxrpy

[report]
exclude_lines =
pragma: no cover
if TYPE_CHECKING:

[xml]
output = coverage.xml
22 changes: 22 additions & 0 deletions .github/workflows/docscheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Build Docs"

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ammaraskar/sphinx-action@master
with:
pre-build-command: "pip install -r requirements.txt"
docs-folder: "docs/"
- uses: actions/upload-artifact@v1
with:
name: DocumentationHTML
path: docs/build/html/
46 changes: 46 additions & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python_version: [3.7]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Lint with flake8
run: |
poetry run flake8
- name: Lint with mypy
run: |
poetry run mypy aioxrpy
- name: Test with pytest
run: |
poetry run pytest --cov --cov-report xml
- name: Uploading coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./coverage.xml # optional
flags: unittests # optional
name: codecov-umbrella # optional
32 changes: 32 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry build
poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# python
__pycache__
*.pyc
*.pyd
*.so
*.o
*.def
*.egg-info
.coverage
.pytest_cache
.env
venv
build
dist
.mypy_cache

# ides
.vscode
.favorites.json
.idea
*.swp

# Mac
.DS_Store

# files
*.log
data-test
coverage.xml
5 changes: 5 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
image: latest
python:
version: 3.7
pip_install: true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Maciej Janiszewski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# aioxrpy

[![Documentation Status](https://readthedocs.org/projects/aioxrpy/badge/?version=latest)](http://aioxrpy.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/ulamlabs/aioxrpy/branch/master/graph/badge.svg)](https://codecov.io/gh/ulamlabs/aioxrpy) ![Python package](https://github.com/ulamlabs/aioxrpy/workflows/Python%20package/badge.svg) ![Upload Python Package](https://github.com/ulamlabs/aioxrpy/workflows/Upload%20Python%20Package/badge.svg)

Ripple blockchain library for Python

## Features

1. Async JSON-RPC client.
2. Signing and verifying transactions using private and public keys.
3. Two-way serializer.

## Installation

Library is available on PyPi, you can simply install it using `pip`.
```
$ pip install aioxrpy
```

## Documentation

Docs and usage examples are available [here](https://aioxrpy.readthedocs.io/en/latest).
Empty file added aioxrpy/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions aioxrpy/address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import base58


def decode_address(address):
decoded = base58.b58decode_check(address, alphabet=base58.RIPPLE_ALPHABET)
if decoded[0] == 0 and len(decoded) == 21: # is an address
return decoded[1:]
else:
raise ValueError("Not an AccountID!")


def encode_address(value):
return base58.b58encode_check(
b''.join((b'\x00', value)), alphabet=base58.RIPPLE_ALPHABET
).decode()

0 comments on commit e452e51

Please sign in to comment.