Privex-steemengine

Latest version: v2.4.0

Safety actively analyzes 681775 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

2.3.0

Overhauled multi-network support + more flexibility with configuring beem

py
from privex.steemengine import SteemEngineToken

You may now specify RPC nodes in the constructor
Just make sure you specify the correct network too, or various methods will raise the WrongNetwork exception.
st = SteemEngineToken(nodes=["https://hived.privex.io"], network="hive")

You can also now use set_beem to replace the Beem instance with one that uses a different set of nodes
st.set_beem(["https://anyx.io", "https://hived.hive-engine.com"])

Or you can specify your own instance by setting .steem
from beem.hive import Hive
st.steem = Hive("https://hived.privex.io")

You can also change the network for an existing instance on-the-fly
The Beem instance will be automatically switched to the Steem network instance
st.network = "steem"


- Use of a Beem shared instance can now be enabled or disabled using `SteemEngineToken.use_shared_instances`

- The default nodes used for each network when creating a Beem instance are now user configurable via `SteemEngineToken.default_nodes`

- The `SteemEngineToken.steem` property now has a setter, allowing the user to override the Beem instance naturally, just by setting `.steem`

- The constructor now accepts a `nodes` argument, allowing overriding the nodes used by Beem during construction

- Added `verify_network` method, which raises `WrongNetwork` if the network of the current RPC node doesn't match the network set in the constructor or via `.network`

- Added `.set_beem` method, for easier overriding of the Beem instances

- Re-wrote `custom_beem` since `._steem` is no longer used

- Added return and parameter types to various beem-related methods

- Refactored tests into `tests/` folder for easier usage with PyTest

- Adjustments to `.travis.yml` and `pytest.ini`

- Probably some other small changes

2.0.0

- Overhauled all objects in `privex.steemengine.objects` - converted to dataclasses using `DictDataClass`, with various dynamic properties allowing querying related data via `SteemEngineToken`.

Every single object was refactored, so I'm not going to go into details on each class that was refactored.

- Added several new objects to `privex.steemengine.objects` - as dataclasses using `DictDataClass`.

- Added `SteemEngineToken.native_coin` and `SteemEngineToken.native_token`, to track the native market symbol of the network, e.g. `SWAP.HIVE` / `STEEMP`.

- Added new method `SteemEngineToken.place_order` which allows placing orders on the Steem/Hive Engine market, returning the `SEPlacedOrder` dictclass object, which allows easily referencing the Steem/Hive Engine transaction object, and the trades which fulfilled the order.

- Rebased exceptions in `privex.steemengine.exceptions` to use base class `SteemEngineException`

- Added new exceptions `NoResults` and `NoSteemEngineInstance`

- Added `r_cache` caching to various methods in `SteemEngineToken` for data which doesn't change often.

- Changed default indexes to `[]` (empty list) for query methods in SteemEngineToken, as a lot of indexes do not work on HiveEngine.

- Refactored the base functionality of `order_history` into `query_order_history` to simplify non-symbol queries in other methods

- Added new methods `SteemEngineToken.find_fulfilled_sells`, `SteemEngineToken.find_fulfilled_buys`, and `SteemEngineToken.find_fulfilled` which query using the new `sellTxId` / `buyTxId` keys

- Some improvements to the unit tests

- Various other small changes

1.1.3

- Added `order_history` and `get_orderbook` to `SteemEngineToken` for getting both historic, and currently open trades.
- Created new data objects `SETrade` and `SEOrder` to represent the data returned by get_orderbook and order_history
- `ObjBase` now aliases `__repr__()` to `__str__()` for child classes.
- Updated documentation to show the new methods and objects.

1.1.0

**Data classes / objects**

As many of us know, it gets tiring having to constantly type `x['balance']` when
something returns a dictionary, especially when there's no IDE completion for it.

To solve this problem, new classes have been written to represent SteemEngine objects, such
as balances, transactions, and tokens. This allows you to access keys simply through
`x.balance` instead.

For backwards compatibility, the `ObjBase` parent class allows instances of these data classes
to be treated like dictionaries/lists, so `x['balance']` will still work, and it will return
the same format as before, while `x.balance` for example, would return the balance as a
proper `Decimal` object.

You can also convert the classes into dicts/lists with `dict(x)` and `list(x)`, but be
aware that this uses the `raw_data` that was originally passed, so these converted objects
will not have their keys casted to the appropriate Python types, unless they were casted
before being passed into the class.

- New module `privex.steemengine.objects` for classes designed to hold data
- `ObjBase` is used as the base class for the data classes. For backwards compatibility,
it allows instances of the classes to be accessed like a dictionary/list,
offers `from_list` for easy conversions of `list<dict>` into their respective
data classes, and also implements `__iter__` so instances can be converted
using `dict(x)` and `list(x)`.
- `Token` represents the data of a SteemEngine token such as name/symbol/supply
- `SEBalance` represents a balance with account/symbol/balance
- `SETransaction` represents a history tx with txid/timestamp/quantity etc.
- `TokenMetadata` represents the `metadata` field of token data

**Upgraded SteemEngineToken to use the data classes**

The **SteemEngineToken** class has been updated to use the new data classes. Thanks to
`ObjBase`, this should hopefully not break any existing applications, but there's always a risk.

The methods that have been updated:

- `list_tokens` now returns `List[Token]` instead of `List[dict]`
- `get_token` now returns `Token` instead of `dict`
- `get_token_balances` now returns `List[SEBalance]` instead of `List[dict]`
- `list_transactions` now returns `List[SETransaction]` instead of `List[dict]`

**Documentation for the new data classes**

The documentation has been updated with details on how the data classes work.

The documentation for **SteemEngineToken** methods have *mostly* been updated to
show usage of the new data classes instead of `dict`s.

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.