Rdwv

Latest version: v1.0

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

Scan your dependencies

Page 10 of 15

1.1.0.0

Features

New event delivery method: websockets!

Websockets should be a better way of receiving updates than webhooks.

They are better because SDK doesn't need to know it's own address, and daemon doesn't need to be notified of webhook.

That way, with less complexity, any amount of listeners per wallet are possible now.

To use it, run:

python
btc.start_websocket()


It will connect to websocket with auto-reconnect feature.

You can disable it by setting `auto_reconnect` parameter to `False`.

If `force_connect` is set to `True`, first time connection errors will be ignored.
By default, if connecting to websocket failed first time (might mean invalid URL), then `ConnectionFailedError` is raised.

On successful connection to websocket, `reconnect_callback` function is called.

If called from APIManager, `currency` parameter is passed.

Breaking changes

As webhook method is not very easy to use, it is removed in favor of websockets.

So, `start_webhook`, `configure_webhook` and similar related methods are removed.

Also, daemon-side all event subscription methods are removed. Now all events are sent, and are filtered by SDK.

`start_websocket` in APIManager with no currencies set will now raise `NoCurrenciesRegisteredError`

1.0.1

Fixed issues with aiohttp warning and async functions in threads

1.0.0

All the SDK is now tested via our extensive test suite, we now gurantee to find all changes in electrum if they happen.

All the code is now following our code style.

Features

Async/sync support in one library

Before, `rdwv` and `rdwv-async` packages existed, one providing sync API, another one async API.

Now both use cases are supported in a single `rdwv` package.

You can use either:

python
btc.help()


Or

python
async def main():
await btc.help()


Better exceptions

It is now possible to catch specific exceptions in commands, not just a general one.

python
from rdwv import errors
from rdwv.errors import generate_exception, ConnectionFailedError

try:
coin.help()
except ConnectionFailedError:
print("Failed connecting to daemon")
except errors.LoadingWalletError:
print("Error loading wallet")
except RequestError as e:
print(e)


New `ConnectionFailedError` is raised when SDK failed to connect to daemon.

`UnknownError` is raised when server returned an error code not from the spec, or spec failed loading.

`RequestError` is a base error from all errors returned from server.

generate_exception function creates a new dynamic exception by passing it's name to it, used for except.

`generate_exception("test") == errors.test`

errors object is just a convenience wrapper around `generate_exception`.

All other errors are raised and created dynamically, by the spec.

You can find your version of the spec at daemon's `/spec` endpoint.

[Most recent spec url](https://github.com/rdwvcc/rdwv/blob/master/daemons/spec/btc.json)

APIManager

APIManager provides an easy-to-use interface to manage multiple wallets/currencies.

It is useful for tracking payments on many wallets at once, for example.

[APIManager documentation](https://sdk.rdwvcc.com/en/latest/apimanager.html)

New utilities

New module `rdwv.utils` was added.

It has the following functions:

- `satoshis(amount: Decimal) -> int` converts btc amount to satoshis

- `bitcoins(amount: int) -> Decimal` converts satoshis amount to btc

- `json_encode(obj: Any) -> Any` `json.dumps` supporting decimals

New list_peers method

`list_peers(gossip=False)` method will list all the lightning peers.

COINS variable

Now `COINS` variable is available, it's a dict, where keys are strings, values are coins of respective types.

It allows introspection of available coins.

python
from rdwv import COINS
COINS["BTC"] rdwv.BTC class


Coins instances now can be compared

You can now check if two coin instances are the same like so:

python
if coin1 == coin2:
print("equal")


Two coin objects are equal, if their xpubs are equal, and their `coin_name` is equal.

All methods now support passing Decimals to it

It is needed to work with latest breaking changes, see below.

0.9.1

Fixed async timeouts
Fixed timeout from 10 seconds to 5 minutes

0.9.0

To use proxy, install optional dependencies:

`pip install rdwv[proxy]` for sync version, `pip install rdwv-async[proxy]` for async version.

HTTP, SOCKS4 and SOCKS5 proxies supported.

To use, pass proxy url to coin constructor:

python
btc = BTC(proxy="socks5://localhost:9050")

0.8.5

This version removes a nasty unclosed session and connector warning, finally!

Page 10 of 15

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.