Skip to content

Commit

Permalink
First step of replacing Bitshares by Steem
Browse files Browse the repository at this point in the history
  • Loading branch information
holgern committed Feb 14, 2018
1 parent c7f9899 commit 6393914
Show file tree
Hide file tree
Showing 62 changed files with 238 additions and 301 deletions.
1 change: 1 addition & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2015 Fabian Schuh
2018 Holger Nahrstaedt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ clean-pyc:
find . -name '*~' -exec rm -f {} +

lint:
flake8 bitsharesapi/ bitsharesbase/ bitshares/
flake8 steemapi/ steembase/ steem/

test:
python3 setup.py test
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Python Library for BitShares
# Python Library for Steem

---

## Documentation

Visit the [pybitshares website](http://docs.pybitshares.com/en/latest/) for in depth documentation on this Python library.

## Installation

### Install with pip:
```
$ sudo apt-get install libffi-dev libssl-dev python-dev python3-dev python3-pip
$ pip3 install bitshares
$ pip3 install steemi
```

### Manual installation:
```
$ git clone https://github.com/xeroc/python-bitshares/
$ cd python-bitshares
$ git clone https://github.com/holgern/pySteemi/
$ cd pySteemi
$ python3 setup.py install --user
```

Expand Down
21 changes: 0 additions & 21 deletions bitshares/__init__.py

This file was deleted.

12 changes: 0 additions & 12 deletions bitsharesbase/__init__.py

This file was deleted.

22 changes: 0 additions & 22 deletions bitsharesbase/chains.py

This file was deleted.

19 changes: 0 additions & 19 deletions bitsharesbase/objecttypes.py

This file was deleted.

60 changes: 0 additions & 60 deletions bitsharesbase/operationids.py

This file was deleted.

6 changes: 3 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
graphenelib
pycryptodome==3.4.6
scrypt==0.7.1
Events==0.2.2
pycryptodomex>=3.4.6
scrypt>=0.7.1
Events>=0.2.2
pyyaml
pytest
pytest-mock
Expand Down
28 changes: 14 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
ascii = codecs.lookup('ascii')
codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs'))

VERSION = '0.1.11'
VERSION = '0.19.0'

setup(
name='bitshares',
name='steemi',
version=VERSION,
description='Python library for bitshares',
description='Unofficial Python library for STEEM',
long_description=open('README.md').read(),
download_url='https://github.com/xeroc/python-bitshares/tarball/' + VERSION,
author='Fabian Schuh',
author_email='[email protected]',
maintainer='Fabian Schuh',
maintainer_email='[email protected]',
url='http://www.github.com/xeroc/python-bitshares',
keywords=['bitshares', 'library', 'api', 'rpc'],
download_url='https://github.com/holgern/pySteemi/tarball/' + VERSION,
author='Holger Nahrstaedt',
author_email='[email protected]',
maintainer='Holger Nahrstaedt',
maintainer_email='[email protected]',
url='http://www.github.com/holgern/pySteemi',
keywords=['steem', 'library', 'api', 'rpc'],
packages=[
"bitshares",
"bitsharesapi",
"bitsharesbase"
"steem",
"steemapi",
"steembase"
],
classifiers=[
'License :: OSI Approved :: MIT License',
Expand All @@ -45,7 +45,7 @@
"appdirs",
"Events",
"scrypt",
"pycryptodome", # for AES, installed through graphenelib already
"pycryptodomex", # for AES, installed through graphenelib already
],
setup_requires=['pytest-runner'],
tests_require=['pytest'],
Expand Down
21 changes: 21 additions & 0 deletions steem/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#from .steem import Steem

__all__ = [
#"steem",
"aes",
#"account",
#"amount",
#"asset",
#"block",
#"blockchain",
#"dex",
#"market",
#"storage",
#"price",
"utils",
#"wallet",
#"committee",
#"vesting",
#"proposal",
#"message"
]
2 changes: 1 addition & 1 deletion bitshares/account.py → steem/account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bitshares.instance import shared_bitshares_instance
from steem.instance import shared_steem_instance
from .exceptions import AccountDoesNotExistsException
from .blockchainobject import BlockchainObject

Expand Down
12 changes: 9 additions & 3 deletions bitshares/aes.py → steem/aes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from Crypto import Random
from Crypto.Cipher import AES
import hashlib
import base64

try:
from Cryptodome import Random
from Cryptodome.Cipher import AES
except ImportError:
try:
from Crypto import Random
from Crypto.Cipher import AES
except ImportError:
raise ImportError("Missing dependency: pyCryptodome")

class AESCipher(object):
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions bitshares/instance.py → steem/instance.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import bitshares as bts
import steem as stm


class SharedInstance():
instance = None


def shared_bitshares_instance():
def shared_steem_instance():
""" This method will initialize ``SharedInstance.instance`` and return it.
The purpose of this method is to have offer single default
bitshares instance that can be reused by multiple classes.
"""
if not SharedInstance.instance:
clear_cache()
SharedInstance.instance = bts.BitShares()
SharedInstance.instance = stm.Steem()
return SharedInstance.instance


def set_shared_bitshares_instance(bitshares_instance):
""" This method allows us to override default bitshares instance for all users of
def set_shared_steem_instance(steem_instance):
""" This method allows us to override default steem instance for all users of
``SharedInstance.instance``.
:param bitshares.bitshares.BitShares bitshares_instance: BitShares instance
"""
clear_cache()
SharedInstance.instance = bitshares_instance
SharedInstance.instance = steem_instance


def clear_cache():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions bitshares/bitshares.py → steem/steem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import logging

from datetime import datetime, timedelta
from bitsharesapi.bitsharesnoderpc import BitSharesNodeRPC
from bitsharesbase.account import PrivateKey, PublicKey
from bitsharesbase import transactions, operations
from steemapi.bitsharesnoderpc import SteemNodeRPC
from steembase.account import PrivateKey, PublicKey
from steembase import transactions, operations
from .asset import Asset
from .account import Account
from .amount import Amount
Expand All @@ -24,7 +24,7 @@
log = logging.getLogger(__name__)


class BitShares(object):
class Steem(object):
""" Connect to the BitShares network.
:param str node: Node to connect to *(optional)*
Expand Down Expand Up @@ -157,21 +157,21 @@ def connect(self,
rpcuser="",
rpcpassword="",
**kwargs):
""" Connect to BitShares network (internal use only)
""" Connect to Steem network (internal use only)
"""
if not node:
if "node" in config:
node = config["node"]
else:
raise ValueError("A BitShares node needs to be provided!")
raise ValueError("A Steem node needs to be provided!")

if not rpcuser and "rpcuser" in config:
rpcuser = config["rpcuser"]

if not rpcpassword and "rpcpassword" in config:
rpcpassword = config["rpcpassword"]

self.rpc = BitSharesNodeRPC(node, rpcuser, rpcpassword, **kwargs)
self.rpc = SteemNodeRPC(node, rpcuser, rpcpassword, **kwargs)

@property
def prefix(self):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bitshares/witness.py → steem/witness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bitshares.instance import shared_bitshares_instance
from steem.instance import shared_steem_instance
from .account import Account
from .exceptions import WitnessDoesNotExistsException
from .blockchainobject import BlockchainObject
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion bitsharesapi/__init__.py → steemapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__all__ = [
"bitsharesnoderpc",
"steemnoderpc",
"exceptions",
"websocket",
]
File renamed without changes.
Loading

0 comments on commit 6393914

Please sign in to comment.