diff --git a/.github/workflows/workflows.yml b/.github/workflows/workflows.yml index f888073..b7fb895 100644 --- a/.github/workflows/workflows.yml +++ b/.github/workflows/workflows.yml @@ -2,9 +2,9 @@ name: Python on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: node: @@ -14,20 +14,20 @@ jobs: python-version: [3.6, 3.7, 3.8, 3.9] runs-on: ${{ matrix.os }} steps: - - name: Fix Windows Git autocrlf - run: git config --global core.autocrlf false - if: matrix.os == 'windows-latest' - - uses: actions/checkout@v2 - - name: Use Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - pip install -r requirements.txt - - run: python3 -m flake8 --exclude="./samples/, ./dist/, ./build/, ./tests/" - - run: python3 test.py tests/ - env: - XUMM_APIKEY: aaaaaaaa-cccc-eeee-1111-333333333333 - XUMM_APISECRET: bbbbbbbb-dddd-ffff-2222-444444444444 \ No newline at end of file + - name: Fix Windows Git autocrlf + run: git config --global core.autocrlf false + if: matrix.os == 'windows-latest' + - uses: actions/checkout@v2 + - name: Use Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + pip install -e ".[develop]" + - run: python3 -m flake8 + - run: python3 test.py tests/ + env: + XUMM_APIKEY: aaaaaaaa-cccc-eeee-1111-333333333333 + XUMM_APISECRET: bbbbbbbb-dddd-ffff-2222-444444444444 diff --git a/.gitignore b/.gitignore index 1f02418..2159df5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,16 @@ venv /xumm_sdk_py.egg-info .env .pypirc -README.html \ No newline at end of file +README.html + +# virtualenv +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +.venv +pip-selfcheck.json \ No newline at end of file diff --git a/README.md b/README.md index e7beb5e..4f8f573 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,7 @@ Instead of providing a `txjson` transaction, a transaction formatted as HEX blob ```python sdk.payload.get( - payload: Union[str, CreatedPayload], - return_errors: bool = False + payload: Union[str, CreatedPayload] ): -> XummPayload ``` @@ -103,8 +102,6 @@ You can `get()` a payload by: payload = sdk.payload.get(created) ``` -If a payload can't be fetched (eg. doesn't exist), `None` will be returned, unless a second param (boolean) is provided to get the SDK to throw an Error in case a payload can't be retrieved: - ```python sdk.payload.get('aaaaaaaa-bbbb-cccc-dddd-1234567890ab', True) ``` @@ -113,8 +110,7 @@ sdk.payload.get('aaaaaaaa-bbbb-cccc-dddd-1234567890ab', True) ```python sdk.payload.create ( -payload: create_payload, -return_errors: bool = False +payload: create_payload ): -> Union[CreatedPayload, None] ``` @@ -147,8 +143,7 @@ Alternatively user routing / instruction flows can be custom built using the QR ```python sdk.payload.cancel( - payload: Union[str, XummPayload, CreatedPayload], - return_errors: bool = False + payload: Union[str, XummPayload, CreatedPayload] ): -> Union[DeletedPayload, None] ``` @@ -240,14 +235,14 @@ Your XUMM APP storage is stored at the XUMM API backend, meaning it persists unt This data is private, and accessible only with your own API credentials. This private JSON data can be used to store credentials / config / bootstrap info / ... for your headless application (eg. POS device). ```python -storage_set = await sdk.storage.set({name: 'Wietse', age: 32, male: True}) +storage_set = await sdk.storage.set({'name': 'Wietse', 'age': 32, 'male': True}) print(storage_set) # True ``` ```python storage_get = sdk.storage.get() -print(storage_get) +print(storage_get.data) # { 'name': 'Wietse', 'age': 32, 'male': True } ``` @@ -259,7 +254,7 @@ print(storage_delete) ```python storage_get_after_delete = sdk.storage.get() -print(storage_get_after_delete) +print(storage_get_after_delete.data) # None ``` @@ -346,11 +341,11 @@ Returns: [``](https://github.com/XRPL-Labs/xumm-sdk-py/blob/mai ## Development -### Run - -Build, run, show debug output & watch `dist/samples/dev.py`, compiled from `samples/dev.py` using `python3`. The `samples/dev.py` file is **not included by default**. +### Install requirments -[Here's a sample `samples/dev.py` file](https://github.com/XRPL-Labs/xumm-sdk-py/blob/main/samples/dev.py). +```bash +pip install -e ".[develop]" +``` ### Build @@ -376,4 +371,14 @@ DEBUG=xumm-sdk* python3 main.py ### Lint & test -Lint the code using `python3 -m flake8 --output-file=./logs/linter.txt --exclude="./samples/, ./build/, ./dist/, ./tests/"`, run tests (pytest) using `python3 test.py tests/` +Lint the code using: + +```bash +python3 -m flake8 +``` + +For running test: + +```bash +python3 test.py tests/ +``` diff --git a/RELEASE.md b/RELEASE.md index 7a8ff2c..9ef6de6 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -14,7 +14,7 @@ The full process for cutting a release is as follows: `bumpversion --current-version 1.0.0 minor setup.py xumm/__init__.py` 2. Change the version in the setup.py file: - `VERSION = "1.0.0"` + `VERSION = "1.0.0"` 3. Add, and commit the changes, push up the branch, and open a PR: `git add .` @@ -25,19 +25,18 @@ The full process for cutting a release is as follows: `` -4. Once the PR is merged, checkout the `main` branch: +5. Once the PR is merged, checkout the `main` branch: `git checkout main` -5. Delete `main` branch (Optional): +6. Delete `main` branch (Optional): `git branch -d 1.0.0` -5. Make a new Git tag that matches the new version (make sure it is associated with the right commit SHA): FIXUP +7. Make a new Git tag that matches the new version (make sure it is associated with the right commit SHA): FIXUP `git tag -a 1.0.0 -m "cut 1.0.0"` -7. Push up the tag from `main`: +8. Push up the tag from `main`: `git push origin 1.0.0` - ## Packaging & Releasing Update pip build (optional) @@ -50,8 +49,8 @@ Build Repo ``` dist/ - xumm-sdk-py-dangell-1.0.0-py3-none-any.whl - xumm-sdk-py-dangell-1.0.0.tar.gz + xumm-sdk-py-1.0.0-py3-none-any.whl + xumm-sdk-py-1.0.0.tar.gz ``` Install Twine @@ -70,11 +69,10 @@ Check Distribution `twine check dist/*` - Push on Staging `twine upload --skip-existing --config-file="./.pypirc" -r testpypi dist/*` Push to Production -`twine upload --config-file="./.pypirc" -r dist/*` \ No newline at end of file +`twine upload --config-file="./.pypirc" -r dist/*` diff --git a/samples/dev.py b/samples/dev.py deleted file mode 100644 index 1138950..0000000 --- a/samples/dev.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 -import asyncio - -import xumm -from xumm.resource.types import XummPostPayloadBodyJson - -import logging -logger = logging.getLogger('app') - - -async def main(): - try: - sdk = xumm.XummSdk('someAppKey', 'someAppSecret') - pong = sdk.ping() - logger.info(pong) - - curated_assets = sdk.get_curated_assets() - logger.info(curated_assets) - - kwargs = { - 'txjson': { - 'TransactionType' : 'Payment', - 'Destination' : 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY', - 'DestinationTag': 495, - 'Amount': '1337' - } - } - payment_payload: XummPostPayloadBodyJson = XummPostPayloadBodyJson(**kwargs) - payload = sdk.payload.create(payment_payload) - logger.info(payload) - - if payload: - async def callback(event): - logger.info('Subscription Event data: {}'.format(event['data'])) - if 'expired' in event['data'] or 'signed' in event['data']: - return event['data'] - - await sdk.payload.subscribe(payload, callback) - - except Exception as e: - logger.info(e) - -loop = asyncio.get_event_loop() -loop.run_until_complete(main()) \ No newline at end of file diff --git a/samples/fixtures/__init__.py b/samples/fixtures/__init__.py new file mode 100644 index 0000000..6697b2a --- /dev/null +++ b/samples/fixtures/__init__.py @@ -0,0 +1 @@ +from .sample_payload import payload as sample_payload \ No newline at end of file diff --git a/samples/fixtures/sample_payload.py b/samples/fixtures/sample_payload.py new file mode 100644 index 0000000..9369cb5 --- /dev/null +++ b/samples/fixtures/sample_payload.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# coding: utf-8 + +import binascii +from uuid import uuid4 + +payload = { + 'custom_meta': { + 'instruction': 'Hey! Please sign for:\n\nThis\nand\nthat 🍻', + 'blob': { + 'myOwnProp': 'Whereever', + 'clientCountry': 'Moon', + }, + 'identifier': str(uuid4()) + }, + 'options': { + 'submit': True, + 'multisign': False, + 'expire': 500, + 'return_url': { + 'app': 'https://example.com/callback?payload={id}&blob={txblob}', + 'web': 'https://example.com/callback?identifier={cid}&tx={txid}' + } + }, + 'txjson': { + 'TransactionType' : 'Payment', + 'Destination' : 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY', + 'DestinationTag': 495, + 'Amount': '1337', + 'LastLedgerSequence': 20, + 'Fee': '12', + 'Memos': [ + { + 'Memo': { + 'MemoData': binascii.hexlify('Sample XUMM payload'.encode('utf8')).decode('utf-8').upper(), + 'MemoFormat': binascii.hexlify('some/memo'.encode('utf8')).decode('utf-8').upper(), + } + } + ] + } +} \ No newline at end of file diff --git a/samples/main.py b/samples/main.py deleted file mode 100644 index afead45..0000000 --- a/samples/main.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -import xumm - -import logging -logger = logging.getLogger('app') - - -def main(): - - try: - sdk = xumm.XummSdk() - pong = sdk.ping() - logger.info(pong) - except Exception as e: - print(e) - - # payload = sdk.payload.create({ - # 'custom_meta': { - # 'instruction': 'Hey ❤️! Please sign for\n\nThis\nThat 🍻' - # }, - # 'user_token': 'ec079824-b804-49be-b521-a9502bc306ae', - # 'txjson': { - # 'TransactionType' : 'Payment', - # 'Destination' : 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY' - # } - # }) - # logger.info(payload) - -main() \ No newline at end of file diff --git a/samples/misc.py b/samples/misc.py new file mode 100644 index 0000000..4bab42c --- /dev/null +++ b/samples/misc.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# coding: utf-8 +import logging +import asyncio + +import xumm + +class MiscExample: + def __init__(self): + logging.debug('') + self.sdk = xumm.XummSdk('API_KEY', 'API_SECRET') + self.logger = logging.getLogger(self.__module__) + self.logger.setLevel(level=logging.DEBUG) + + async def run(self): + # send ping to the backend and print application name + ping_response = self.sdk.ping() + self.logger.info("Ping response: application name: %s" % ping_response.application.name) + + # get curated assets and print available currencies count + curated_assets_response = self.sdk.get_curated_assets() + self.logger.info("Curated_assets response: currencies count %s" % str(len(curated_assets_response.currencies))) + + + # get kyc status of a xrpl address + address = "rDWLGshgAxSX2G4TEv3gA6QhtLgiXrWQXB" + kyc_status_response = self.sdk.get_kyc_status(address) + self.logger.info("Kyc status for account %s: %s" % (address, kyc_status_response)) + + + # get transaction by hash from ledger + tx_hash = "017DED8F5E20F0335C6F56E3D5EE7EF5F7E83FB81D2904072E665EEA69402567" + get_tx_response = self.sdk.get_transaction(tx_hash) + self.logger.info("transaction balance changes: %s" % get_tx_response.balance_changes) + + +if __name__ == "__main__": + example = MiscExample() + + loop = asyncio.get_event_loop() + loop.run_until_complete(example.run()) + diff --git a/samples/payload.py b/samples/payload.py index c8a1187..f6b6169 100644 --- a/samples/payload.py +++ b/samples/payload.py @@ -1,44 +1,50 @@ #!/usr/bin/env python # coding: utf-8 +import logging +import asyncio + +import xumm + +from fixtures import sample_payload + +class PayloadExample: + def __init__(self): + logging.debug('') + self.sdk = xumm.XummSdk('API_KEY', 'API_SECRET') + self.logger = logging.getLogger(self.__module__) + self.logger.setLevel(level=logging.DEBUG) + + def subscription_callback(self, event): + self.logger.info('Subscription Event data: {}'.format(event['data'])) + if 'expired' in event['data'] or 'signed' in event['data']: + # payload is reolved reuturn the data + return event['data'] + + + async def run(self): + # create the payload by passing the details and get payload UUID + try: + create_payload_resp = self.sdk.payload.create(sample_payload) + self.logger.info("Payload created with id: %s" % create_payload_resp.uuid) + except Exception as e: + self.logger.error("Unable to create the payload: %s" % e) + return + + # start the websocket subscription on this payload and listen for changes + subscription = await self.sdk.payload.subscribe(create_payload_resp.uuid, self.subscription_callback) + # wait for the payload to resolve + resolve_data = await subscription.resolved() + # now we can cancel the subscription + self.sdk.payload.unsubscribe() + + # fetch the payload from backend + get_payload_resp = self.sdk.payload.get(create_payload_resp.uuid) + self.logger.info("Payload resolved: %s" % get_payload_resp.meta.resolved) + + +if __name__ == "__main__": + example = PayloadExample() + + loop = asyncio.get_event_loop() + loop.run_until_complete(example.run()) -import binascii - -payload = { - 'custom_meta': { - 'instruction': 'Hey! Please sign for:\n\nThis\nand\nthat 🍻', - 'blob': { - 'myOwnProp': 'Whereever', - 'clientCountry': 'Estonia', - 'clientAge': 34 - }, - 'identifier': 'MY_OWN_UNIQUE_INTERNAL_ID_123' - }, - 'options': { - 'submit': True, - 'multisign': False, - 'expire': 500, - 'return_url': { - 'app': 'https://dangell.com/xrpl?payload={}'.format(id), - 'web': 'https://dangell.com/xrpl?payload={}'.format(id) - } - }, - 'user_token': '7ccc19cf-970a-4185-8bd3-49d507bf24ae', - # 'txblob': '1200002400000003614000000002FAF0806840000000000000C8732' + - # '...' + - # '5727D0B4057696574736557696E64E1F1', - 'txjson': { - 'TransactionType' : 'Payment', - 'Destination' : 'rdAngelle2wMz3SBnAG8hkMsCgvGy9LWbZ1', - 'Amount': '1000000', - 'LastLedgerSequence': 20, - 'Fee': '1337', - 'Memos': [ - { - 'Memo': { - 'MemoData': binascii.hexlify('Sample XUMM payload'.encode('utf8')).decode('utf-8').upper(), - 'MemoFormat': binascii.hexlify('some/memo'.encode('utf8')).decode('utf-8').upper(), - } - } - ] - } -}) \ No newline at end of file diff --git a/samples/storage.py b/samples/storage.py new file mode 100644 index 0000000..804d7d8 --- /dev/null +++ b/samples/storage.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# coding: utf-8 +import logging +import asyncio + +import xumm + + +class StorageExample: + def __init__(self): + logging.debug('') + self.sdk = xumm.XummSdk('API_KEY', 'API_SECRET') + self.logger = logging.getLogger(self.__module__) + self.logger.setLevel(level=logging.DEBUG) + + async def run(self): + # storge some json value in storage + self.logger.info("Set storage value") + set_storage_result = self.sdk.storage.set({'name': 'Wietse', 'age': 32, 'male': True}) + # True + + if not set_storage_result: + self.logger.error("Unable to set to storage: %s" % e) + return + + # GET the storage content + get_storage_result = self.sdk.storage.get() + self.logger.info("Current storage value: %s" % get_storage_result.data) + # { 'name': 'Wietse', 'age': 32, 'male': True } + + + self.logger.info("Delete storage value") + delete_storage_result = self.sdk.storage.delete() + + if not delete_storage_result: + self.logger.error("Unable to delete the storage: %s" % delete_storage_result) + + get_storage_result_after_delete = self.sdk.storage.get() + self.logger.info("Current storage value after delete: %s" % get_storage_result_after_delete.data) + # None + + + +if __name__ == "__main__": + example = StorageExample() + + loop = asyncio.get_event_loop() + loop.run_until_complete(example.run()) + diff --git a/samples/ws/async_callback.py b/samples/ws/async_callback.py deleted file mode 100644 index f9588c1..0000000 --- a/samples/ws/async_callback.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -import asyncio -import xumm - -# https://gist.github.com/WietseWind/76890afd39a01e9876c8a629b3e58174 - - -async def main(): - payload_by_uuid = '289e9ae-7d5d-4d5f-b89c-18633112ce09' - - def callback_func(event): - print('Payload {} data: {}'.format(event['uuid'], event['data'])) - if 'signed' in event['data']: - """ - Handle payload resolving, eg: - 1. Fetch updated payload results, with `Sdk.payload.get()` - 2. Fetch the transaction by hash (retrieved with 1.) on the XRPL to verify the transaction - 3. Persist the results in your own app's database - 4. Inform (async) the user (notification, mail, ...) if required - """ - - print('ON SIGNED DOING...') - # Resolve & close the subscription - return True - - sdk = xumm.XummSdk() - - try: - await sdk.payload.subscribe( - payload_by_uuid, - callback_func, - ) - print('NOT WAITING...') - - # Just continue doing things here. No need to wait. - except Exception as e: - print('ERROR: {}'.format(e)) - except KeyboardInterrupt as e: - sdk.payload.unsubscribe() - -loop = asyncio.get_event_loop() -loop.run_until_complete(main()) \ No newline at end of file diff --git a/samples/ws/await_callback.py b/samples/ws/await_callback.py deleted file mode 100644 index a28884b..0000000 --- a/samples/ws/await_callback.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -import asyncio -import xumm - -# https://gist.github.com/WietseWind/76890afd39a01e9876c8a629b3e58174 - - -async def main(): - payload_by_uuid = '289e9ae-7d5d-4d5f-b89c-18633112ce09' - - def callback_func(event): - print('Payload {} data: {}'.format(event['uuid'], event['data'])) - if 'signed' in event['data']: - return event['data'] - - sdk = xumm.XummSdk() - - try: - subscription = await sdk.payload.subscribe( - payload_by_uuid, - callback_func, - ) - - await subscription.resolved() - print('Payload {} {}'.format(subscription.payload.meta.uuid, await subscription.resolved())) - except Exception as e: - print('ERROR: {}'.format(e)) - except KeyboardInterrupt as e: - sdk.payload.unsubscribe() - -loop = asyncio.get_event_loop() -loop.run_until_complete(main()) \ No newline at end of file diff --git a/samples/ws/await_event.py b/samples/ws/await_event.py deleted file mode 100644 index 733df6e..0000000 --- a/samples/ws/await_event.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -import asyncio -import xumm - -# https://gist.github.com/WietseWind/76890afd39a01e9876c8a629b3e58174 - - -async def main(): - payload_by_uuid = '289e9ae-7d5d-4d5f-b89c-18633112ce09' - - def callback_func(event): - print('Payload {} data: {}'.format(event['uuid'], event['data'])) - if 'signed' in event['data']: - return event['resolve']('is signed') - - sdk = xumm.XummSdk() - - try: - subscription = await sdk.payload.subscribe( - payload_by_uuid, - callback_func, - ) - - await subscription.resolved() - print('Payload {} {}'.format(subscription.payload.meta.uuid, await subscription.resolved())) - except Exception as e: - print('ERROR: {}'.format(e)) - except KeyboardInterrupt as e: - sdk.payload.unsubscribe() - -loop = asyncio.get_event_loop() -loop.run_until_complete(main()) \ No newline at end of file diff --git a/samples/ws/await_no_callback.py b/samples/ws/await_no_callback.py deleted file mode 100644 index 18e041b..0000000 --- a/samples/ws/await_no_callback.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -import asyncio -import xumm - -# https://gist.github.com/WietseWind/76890afd39a01e9876c8a629b3e58174 - -# THIS FAILS... -# I couldn't get the set or override (on_message) to work. I would use await_callback TBH. - -async def main(): - payload_by_uuid = '289e9ae-7d5d-4d5f-b89c-18633112ce09' - - sdk = xumm.XummSdk() - - try: - subscription = await sdk.payload.subscribe( - payload_by_uuid, - # callback_func, - ) - - def callback_func(event): - print('Payload {} data: {}'.format(event['uuid'], event['data'])) - if 'signed' in event['data']: - subscription.resolve(event['data']) - - subscription.websocket._on_message = callback_func - - await subscription.resolved() - print('Payload {} {}'.format(subscription.payload.meta.uuid, await subscription.resolved())) - except Exception as e: - print('ERROR: {}'.format(e)) - except KeyboardInterrupt as e: - sdk.payload.unsubscribe() - -loop = asyncio.get_event_loop() -loop.run_until_complete(main()) \ No newline at end of file diff --git a/test.py b/test.py index d2fb8ec..c9dbd08 100644 --- a/test.py +++ b/test.py @@ -17,13 +17,11 @@ def main(): try: os.remove(os.path.join(basedir, '.coverage')) - except OSError: pass try: shutil.rmtree(os.path.join(basedir, '.cache')) - except OSError: pass diff --git a/tests/test_app_storage.py b/tests/test_app_storage.py index 3471084..f2216bc 100644 --- a/tests/test_app_storage.py +++ b/tests/test_app_storage.py @@ -6,7 +6,6 @@ import xumm - class TestAppStorage(BaseTestConfig): @classmethod diff --git a/tests/test_common.py b/tests/test_common.py index bb8ddc5..469a7f4 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # coding: utf-8 - +import pytest from testing_config import BaseTestConfig from unittest.mock import Mock, patch from dotenv import dotenv_values @@ -65,11 +65,9 @@ def test_invalid_credentials(cls, mock_get): mock_get.return_value = Mock(status_code=403) mock_get.return_value.json.return_value = cls.json_fixtures['invalidCredentials'] - try: - sdk.ping() - cls.fail("ping() raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), 'Error code 813, see XUMM Dev Console, reference: 26279bfe-c7e1-4b12-a680-26119d8f5062') + with pytest.raises(xumm.error.APIError, match=r"Error code 813, see XUMM Dev Console, reference: 26279bfe-c7e1-4b12-a680-26119d8f5062"): + sdk.ping() + cls.fail("ping() raised Exception unexpectedly!") @patch('xumm.client.requests.get') def test_fetch_curated_assets(cls, mock_get): diff --git a/tests/test_payload_cancel.py b/tests/test_payload_cancel.py index 1b50b2f..dfbba49 100644 --- a/tests/test_payload_cancel.py +++ b/tests/test_payload_cancel.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # coding: utf-8 +import pytest + from testing_config import BaseTestConfig from tests.fixtures import xumm_api as test_fixtures from unittest.mock import Mock, patch @@ -27,17 +29,6 @@ def test_payload_cancel(cls, mock_delete): cls.assertEqual(cls.sdk.payload.cancel(payloadId).to_dict(), cls.json_fixtures['payload']['cancelled']) - @patch('xumm.client.requests.delete') - def test_payload_not_found_null(cls, mock_delete): - print('should return numm if payload not found') - payloadId = '00000000-0000-4839-af2f-f794874a80b0' - - mock_delete.return_value = Mock(status_code=404) - mock_delete.return_value.json.return_value = cls.json_fixtures['payload']['notfound'] - - response = cls.sdk.payload.cancel(payloadId) - cls.assertEqual(response, None) - @patch('xumm.client.requests.delete') def test_payload_not_found_errors(cls, mock_delete): print('should throw if payload not found with `returnErrors`') @@ -46,11 +37,9 @@ def test_payload_not_found_errors(cls, mock_delete): mock_delete.return_value = Mock(status_code=404) mock_delete.return_value.json.return_value = cls.json_fixtures['payload']['notfound'] - try: - cls.sdk.payload.cancel(payloadId, True) + with pytest.raises(xumm.error.InvalidRequestError, match=r"Error code 404, see XUMM Dev Console, reference: a61ba59a-0304-44ae-a86e-d74808bd5190"): + cls.sdk.payload.cancel(payloadId) cls.fail("payload_cancel() raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), 'Error code 404, see XUMM Dev Console, reference: a61ba59a-0304-44ae-a86e-d74808bd5190') @patch('xumm.client.requests.delete') @patch('xumm.client.requests.post') diff --git a/tests/test_payload_create.py b/tests/test_payload_create.py index 56b96e7..da4df15 100644 --- a/tests/test_payload_create.py +++ b/tests/test_payload_create.py @@ -1,13 +1,12 @@ #!/usr/bin/env python # coding: utf-8 - +import pytest from testing_config import BaseTestConfig from tests.fixtures import xumm_api as test_fixtures from unittest.mock import Mock, patch import xumm - class TestPayloadCreate(BaseTestConfig): @classmethod @@ -33,16 +32,6 @@ def test_payload_create_unwrapped(cls, mock_post): result = cls.sdk.payload.create(test_fixtures.valid_payload()['txjson']) cls.assertEqual(result.to_dict(), cls.json_fixtures['payload']['created']) - @patch('xumm.client.requests.post') - def test_payload_create_invalid_null(cls, mock_post): - print('should return null on invalid payload') - - mock_post.return_value = Mock(status_code=400) - mock_post.return_value.json.return_value = cls.json_fixtures['payload']['error'] - - response = cls.sdk.payload.create(test_fixtures.invalid_payload()) - cls.assertEqual(response, None) - @patch('xumm.client.requests.post') def test_payload_create_invalid_errors(cls, mock_post): print('should throw on invalid payload with `returnErrors`') @@ -50,8 +39,8 @@ def test_payload_create_invalid_errors(cls, mock_post): mock_post.return_value = Mock(status_code=400) mock_post.return_value.json.return_value = cls.json_fixtures['payload']['error'] - try: - cls.sdk.payload.create(test_fixtures.invalid_payload(), True) + with pytest.raises(xumm.error.InvalidRequestError, match=r"Error code 602, see XUMM Dev Console, reference: a61ba59a-0304-44ae-a86e-efefegewgew4"): + cls.sdk.payload.create(test_fixtures.invalid_payload()) cls.fail("payload_create() raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), 'Error code 602, see XUMM Dev Console, reference: a61ba59a-0304-44ae-a86e-efefegewgew4') + + diff --git a/tests/test_payload_get.py b/tests/test_payload_get.py index 9c10cbf..44f42c1 100644 --- a/tests/test_payload_get.py +++ b/tests/test_payload_get.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # coding: utf-8 - +import pytest from testing_config import BaseTestConfig from tests.fixtures import xumm_api as test_fixtures from unittest.mock import Mock, patch @@ -40,16 +40,6 @@ def test_payload_create_cancel(cls, mock_post, mock_delete): mock_delete.return_value.json.return_value = cls.json_fixtures['payload']['get'] cls.assertEqual(cls.sdk.payload.get(created_payload.uuid).to_dict(), cls.json_fixtures['payload']['get']) - @patch('xumm.client.requests.get') - def test_payload_get_invalid_null(cls, mock_get): - print('should null on getting an invalid/non existent payload') - - mock_get.return_value = Mock(status_code=400) - mock_get.return_value.json.return_value = cls.json_fixtures['payload']['notfound'] - - response = cls.sdk.payload.get('00000000-0000-4839-af2f-f794874a80b0') - cls.assertEqual(response, None) - @patch('xumm.client.requests.get') def test_payload_get_invalid_errors(cls, mock_get): print('should throw on getting an invalid/non existent payload with `returnErrors`') @@ -57,8 +47,6 @@ def test_payload_get_invalid_errors(cls, mock_get): mock_get.return_value = Mock(status_code=400) mock_get.return_value.json.return_value = cls.json_fixtures['payload']['notfound'] - try: - cls.sdk.payload.get('00000000-0000-4839-af2f-f794874a80b0', True) + with pytest.raises(xumm.error.InvalidRequestError, match=r"Error code 404, see XUMM Dev Console, reference: a61ba59a-0304-44ae-a86e-d74808bd5190"): + cls.sdk.payload.get('00000000-0000-4839-af2f-f794874a80b0') cls.fail("payload_get() raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), 'Error code 404, see XUMM Dev Console, reference: a61ba59a-0304-44ae-a86e-d74808bd5190') diff --git a/tests/test_payload_subscribe.py b/tests/test_payload_subscribe.py index 6d88010..99a9157 100644 --- a/tests/test_payload_subscribe.py +++ b/tests/test_payload_subscribe.py @@ -1,25 +1,28 @@ #!/usr/bin/env python # coding: utf-8 -from multiprocessing.sharedctypes import Value import sys import time import json +import asyncio +import websockets + +from multiprocessing.sharedctypes import Value +from threading import Thread, main_thread + from testing_config import BaseTestConfig, AsyncioTestCase from tests.fixtures import ( xumm_api as test_fixtures, ) from unittest.mock import Mock, patch -from xumm.ws_client import WSClient -import xumm -import asyncio -import websockets -from threading import Thread, main_thread +import xumm +from xumm.ws_client import WSClient from xumm.error import APIError from xumm.resource.payload import CallbackPromise + COUNT = 0 # import pytest diff --git a/tests/types/meta/test_application_details.py b/tests/types/meta/test_application_details.py index 68c3a49..8f78f20 100644 --- a/tests/types/meta/test_application_details.py +++ b/tests/types/meta/test_application_details.py @@ -1,5 +1,5 @@ -import os -import json +import pytest + from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -29,8 +29,7 @@ def test_application_details_fail(cls): "uuidv4": "2904b05f-5b37-4f3e-a624-940ad817943c" } } - try: + + with pytest.raises(ValueError, match=r"Invalid value: 1 for `uuidv4`, must be a `` found: "): ApplicationDetails(**dict) - cls.fail("ApplicationDetails: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value: 1 for `uuidv4`, must be a `` found: ") \ No newline at end of file + cls.fail("ApplicationDetails: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/meta/test_curated_asset_response.py b/tests/types/meta/test_curated_asset_response.py index 9411ae8..9026de4 100644 --- a/tests/types/meta/test_curated_asset_response.py +++ b/tests/types/meta/test_curated_asset_response.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -76,8 +75,7 @@ def test_curated_asset_response_fail(cls): } } } - try: + + with pytest.raises(ValueError, match=r"Invalid value: 1 for `name`, must be a `` found: "): CuratedAssetsResponse(**dict) - cls.fail("CuratedAssetsResponse: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value: 1 for `name`, must be a `` found: ") \ No newline at end of file + cls.fail("CuratedAssetsResponse: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/meta/test_kyc_info_response.py b/tests/types/meta/test_kyc_info_response.py index 1bede86..0bb38a1 100644 --- a/tests/types/meta/test_kyc_info_response.py +++ b/tests/types/meta/test_kyc_info_response.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -21,8 +20,7 @@ def test_kyc_info_response_fail(cls): "account": 1, # FAILS "kycApproved": True } - try: + + with pytest.raises(ValueError, match=r"Invalid value: 1 for `account`, must be a `` found: "): KycInfoResponse(**dict) - cls.fail("KycInfoResponse: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value: 1 for `account`, must be a `` found: ") \ No newline at end of file + cls.fail("KycInfoResponse: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/meta/test_kyc_status_response copy.py b/tests/types/meta/test_kyc_status_response copy.py index ac61698..5217c1c 100644 --- a/tests/types/meta/test_kyc_status_response copy.py +++ b/tests/types/meta/test_kyc_status_response copy.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -26,8 +25,7 @@ def test_kyc_status_response_fail(cls): "SUCCESSFUL": "KYC flow has been started and was SUCCESSFUL :)" } } - try: + + with pytest.raises(ValueError, match=r"Invalid value for `kyc_status` \(TEMP\), must be one of \['NONE', 'IN_PROGRESS', 'REJECTED', 'SUCCESSFUL']"): KycStatusResponse(**dict) - cls.fail("KycStatusResponse: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value for `kyc_status` (TEMP), must be one of ['NONE', 'IN_PROGRESS', 'REJECTED', 'SUCCESSFUL']") \ No newline at end of file + cls.fail("KycStatusResponse: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/meta/test_pong_response.py b/tests/types/meta/test_pong_response.py index 54044d7..2050a2e 100644 --- a/tests/types/meta/test_pong_response.py +++ b/tests/types/meta/test_pong_response.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -32,8 +31,7 @@ def test_pong_response_fail(cls): } } } - try: + + with pytest.raises(ValueError, match=r"Invalid value: true for `pong`, must be a `` found: "): PongResponse(**dict) - cls.fail("PongResponse: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value: true for `pong`, must be a `` found: ") \ No newline at end of file + cls.fail("PongResponse: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/meta/test_xrpl_transaction.py b/tests/types/meta/test_xrpl_transaction.py index ce7003d..6b60b42 100644 --- a/tests/types/meta/test_xrpl_transaction.py +++ b/tests/types/meta/test_xrpl_transaction.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -53,8 +52,7 @@ def test_xrpl_tx_response_fail(cls): "validated": True } } - try: + + with pytest.raises(ValueError, match=r"Invalid value: 1 for `txid`, must be a `` found: "): XrplTransaction(**dict) - cls.fail("XrplTransaction: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value: 1 for `txid`, must be a `` found: ") \ No newline at end of file + cls.fail("XrplTransaction: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/payload/test_on_payload_event.py b/tests/types/payload/test_on_payload_event.py index 93653e2..4830cdc 100644 --- a/tests/types/payload/test_on_payload_event.py +++ b/tests/types/payload/test_on_payload_event.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -35,8 +34,7 @@ def test_on_payload_event_fail(cls): 'payload': None, 'resolve': resolve_callback, } - try: + + with pytest.raises(TypeError, match=r'argument after \*\* must be a mapping, not NoneType'): SubscriptionCallbackParams(**dict) - cls.fail("SubscriptionCallbackParams: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "xumm.resource.types.xumm_api.XummGetPayloadResponse() argument after ** must be a mapping, not NoneType") \ No newline at end of file + cls.fail("SubscriptionCallbackParams: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/payload/test_payload_and_subscription.py b/tests/types/payload/test_payload_and_subscription.py index c89f8da..fff1043 100644 --- a/tests/types/payload/test_payload_and_subscription.py +++ b/tests/types/payload/test_payload_and_subscription.py @@ -1,6 +1,6 @@ -import os -import json import time +import pytest + from testing_config import BaseTestConfig from xumm.ws_client import WSClient @@ -57,8 +57,7 @@ def test_payload_and_subscription_fail(cls): 'resolved': resolved_callback, 'websocket': websocket_conn, } - try: + + with pytest.raises(TypeError, match=r'argument after \*\* must be a mapping, not NoneType'): PayloadAndSubscription(**dict) - cls.fail("PayloadAndSubscription: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "xumm.resource.types.xumm_api.XummPostPayloadResponse() argument after ** must be a mapping, not NoneType") \ No newline at end of file + cls.fail("PayloadAndSubscription: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/payload/test_payload_subscription.py b/tests/types/payload/test_payload_subscription.py index b6970f6..f43c9c7 100644 --- a/tests/types/payload/test_payload_subscription.py +++ b/tests/types/payload/test_payload_subscription.py @@ -1,6 +1,5 @@ -import os -import json import time +import pytest from testing_config import BaseTestConfig from xumm.ws_client import WSClient @@ -24,10 +23,6 @@ def test_payload_subscription(cls): websocket_conn = WSClient( server='ws://localhost:8765', # noqa: E501 - # on_response=on_message, - # on_error=on_error, - # on_close=on_close, - # on_open=on_open ) dict = { @@ -41,22 +36,16 @@ def test_payload_subscription(cls): def test_payload_subscription_fail(cls): print('should fail to set subscription response') - # websocket_conn = WSClient( - # server='ws://localhost:8765', # noqa: E501 - # # on_response=on_message, - # # on_error=on_error, - # # on_close=on_close, - # # on_open=on_open - # ) - dict = { 'payload': cls.json_fixtures['payload']['get'], 'resolve': resolve_callback, 'resolved': resolved_callback, 'websocket': None, # FAILS } - try: + + with pytest.raises(ValueError, match=r'Invalid value for `websocket`, must not be `None`'): PayloadSubscription(**dict) cls.fail("PayloadAndSubscription: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value for `websocket`, must not be `None`") \ No newline at end of file + + + \ No newline at end of file diff --git a/tests/types/payload/test_subscription_callback_params.py b/tests/types/payload/test_subscription_callback_params.py index 76e3de0..c9a1cf0 100644 --- a/tests/types/payload/test_subscription_callback_params.py +++ b/tests/types/payload/test_subscription_callback_params.py @@ -1,5 +1,4 @@ -import os -import json +import pytest from testing_config import BaseTestConfig from xumm.resource.types import ( @@ -33,8 +32,7 @@ def test_subscription_callback_params_fail(cls): 'payload': cls.json_fixtures['payload']['get'], 'resolve': resolve_callback, } - try: + + with pytest.raises(ValueError, match=r'Invalid value for `data`, must not be `None`'): SubscriptionCallbackParams(**dict) - cls.fail("SubscriptionCallbackParams: raised Exception unexpectedly!") - except Exception as e: - cls.assertEqual(str(e), "Invalid value for `data`, must not be `None`") \ No newline at end of file + cls.fail("SubscriptionCallbackParams: raised Exception unexpectedly!") \ No newline at end of file diff --git a/tests/types/test_misc_types.py b/tests/types/test_misc_types.py deleted file mode 100644 index e69de29..0000000 diff --git a/tox.ini b/tox.ini index add622a..04b349d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,2 @@ [flake8] -output-file = ./logs/linter.txt -exclude = .git,__pycache__,samples/source,tests,build,dist +exclude = .git,__pycache__,samples,tests,build,dist,lib,bin diff --git a/xumm/client.py b/xumm/client.py index 090d9f2..a6913a4 100644 --- a/xumm/client.py +++ b/xumm/client.py @@ -69,7 +69,7 @@ def get_headers() -> Dict[str, object]: 'X-API-Secret': api_secret, 'content-type': 'application/json', 'accept': 'application/json', - 'user-agent': "xumm-sdk/python ({}) python-requests".format(gethostname(), ) + 'user-agent': "xumm-sdk/python ({}) requests".format(gethostname(),) } @@ -204,7 +204,9 @@ def handle_error_code( # soft error elif isinstance(json['error'], dict): if 'code' not in json['error'] or 'reference' not in json['error']: - raise ValueError('Error parsing Xumm JSON response: code/reference') + raise ValueError( + 'Error parsing Xumm JSON response: code/reference' + ) err = 'Error code {}, see XUMM Dev Console, reference: {}'.format( json['error']['code'], @@ -213,7 +215,6 @@ def handle_error_code( # this should neven happen else: err = 'Unexpected error' - if status_code == 400: raise error.InvalidRequestError(err, status_code, headers) diff --git a/xumm/resource/payload.py b/xumm/resource/payload.py index 310eaa1..9724595 100644 --- a/xumm/resource/payload.py +++ b/xumm/resource/payload.py @@ -141,7 +141,6 @@ def create( XummPostPayloadBodyBlob, XummJsonTransaction ], - return_errors: bool = False ) -> XummPostPayloadResponse: """Returns the dict as a model @@ -150,8 +149,6 @@ def create( XummPostPayloadBodyJson | XummPostPayloadBodyBlob | XummJsonTransaction - :param return_errors: The return_errors of this payload_create. - :type return_errors: bool :return: The XummPostPayloadResponse of this XummPostPayloadResponse. # noqa: E501 :rtype: XummPostPayloadResponse @@ -159,13 +156,6 @@ def create( direct_tx = 'TransactionType' in payload and 'txjson' not in payload clone_payload = {'txjson': payload} if direct_tx else payload - if not return_errors: - try: - res = client.post(cls.post_url(), clone_payload) - return XummPostPayloadResponse(**res) - except: # noqa: E722 - return None - res = client.post(cls.post_url(), clone_payload) return XummPostPayloadResponse(**res) @@ -173,19 +163,12 @@ def create( def cancel( cls, id: str = None, - return_errors: bool = False ) -> XummDeletePayloadResponse: """Returns the dict as a model :return: The XummDeletePayloadResponse of this XummDeletePayloadResponse. # noqa: E501 :rtype: XummDeletePayloadResponse """ - if not return_errors: - try: - res = client.delete(cls.delete_url(id)) - return XummDeletePayloadResponse(**res) - except: # noqa: E722 - return None res = client.delete(cls.delete_url(id)) return XummDeletePayloadResponse(**res) @@ -194,20 +177,12 @@ def cancel( def get( cls, id: str = None, - return_errors: bool = False ) -> XummGetPayloadResponse: """Returns the dict as a model :return: The XummGetPayloadResponse of this XummGetPayloadResponse. # noqa: E501 :rtype: XummGetPayloadResponse """ - if not return_errors: - try: - res = client.get(cls.get_url(id)) - return XummGetPayloadResponse(**res) - except: # noqa: E722 - return None - res = client.get(cls.get_url(id)) return XummGetPayloadResponse(**res) diff --git a/xumm/resource/types/payload/payload_and_subscription.py b/xumm/resource/types/payload/payload_and_subscription.py index 13ac55f..821046a 100644 --- a/xumm/resource/types/payload/payload_and_subscription.py +++ b/xumm/resource/types/payload/payload_and_subscription.py @@ -10,10 +10,6 @@ XummPostPayloadResponse as CreatedPayload, ) -# export interface PayloadAndSubscription extends PayloadSubscription { -# created: CreatedPayload -# } - class PayloadAndSubscription(XummResource): """ diff --git a/xumm/resource/types/payload/payload_subscription.py b/xumm/resource/types/payload/payload_subscription.py index 8800adf..0f8fb82 100644 --- a/xumm/resource/types/payload/payload_subscription.py +++ b/xumm/resource/types/payload/payload_subscription.py @@ -7,13 +7,6 @@ from xumm.ws_client import WSClient from ..xumm_api import XummGetPayloadResponse as XummPayload -# export interface PayloadSubscription { -# payload: XummPayload, -# resolved: Promise | undefined -# resolve: (resolveData?: unknown) => void -# websocket: WebSocket -# } - class PayloadSubscription(XummResource): """ diff --git a/xumm/resource/types/payload/subscription_callback_params.py b/xumm/resource/types/payload/subscription_callback_params.py index 19de93c..d286907 100644 --- a/xumm/resource/types/payload/subscription_callback_params.py +++ b/xumm/resource/types/payload/subscription_callback_params.py @@ -6,13 +6,6 @@ from ..xumm_api import XummGetPayloadResponse as XummPayload -# export interface SubscriptionCallbackParams { -# uuid: string -# data: AnyJson -# resolve: (resolveData?: unknown) => void, -# payload: XummPayload -# } - class SubscriptionCallbackParams(XummResource): """ diff --git a/xumm/resource/types/xumm_api/__init__.py b/xumm/resource/types/xumm_api/__init__.py index d9b9c87..841c86a 100644 --- a/xumm/resource/types/xumm_api/__init__.py +++ b/xumm/resource/types/xumm_api/__init__.py @@ -1,11 +1,6 @@ #!/usr/bin/env python # coding: utf-8 -# Type definitions for non-npm package xumm-sdk 0.1 -# Project: https://xumm.app -# Definitions by: Wietse Wind -# Definitions: https://github.com/XRPL-Labs/XUMM-SDK - from xumm.resource import XummResource from typing import Union, Dict @@ -45,18 +40,12 @@ 'SetFee' ] -# export type XummTransactionType = typeof XummTxTypes[number] -# export type XrplTransactionType = typeof XrplTxTypes[number] # XummTransactionType: str = xumm_tx_types[int] # XrplTransactionType: str = xrpl_tx_types[int] XummTransactionType: str = None XrplTransactionType: str = None -# export interface XummJsonTransaction extends Record { -# TransactionType: XummTransactionType | XrplTransactionType -# } - class XummJsonTransaction(XummResource): def refresh_from(cls, **kwargs): @@ -189,28 +178,6 @@ def instruction(cls, instruction: str): cls._instruction = instruction -# export interface XummPayloadMeta { -# exists: boolean -# uuid: string -# multisign: boolean -# submit: boolean -# destination: string -# resolved_destination: string -# resolved: boolean -# signed: boolean -# cancelled: boolean -# expired: boolean -# pushed: boolean -# app_opened: boolean -# opened_by_deeplink: boolean | null -# immutable?: boolean -# forceAccount?: boolean -# return_url_app: string | null -# return_url_web: string | null -# is_xapp: boolean -# } - - class XummPayloadMeta(XummResource): """ Attributes: @@ -993,10 +960,6 @@ def custom_meta(self, custom_meta: XummCustomMeta): # self._txblob = txblob -# export interface XummPostPayloadBodyJson extends XummPayloadBodyBase { -# txjson: XummJsonTransaction -# } - class XummPostPayloadBodyJson(XummPayloadBodyBase): def __init__(cls, txjson: XummJsonTransaction = None): @@ -1198,42 +1161,6 @@ def pushed(cls, pushed: bool): cls._pushed = pushed -# export interface XummGetPayloadResponse { -# meta: XummPayloadMeta -# application: { -# name: string -# description: string -# disabled: 0 | 1 -# uuidv4: string -# icon_url: string -# issued_user_token: string | null -# } -# payload: { -# tx_type: XummTransactionType | XrplTransactionType -# tx_destination: string -# tx_destination_tag: number | null -# request_json: XummJsonTransaction -# origintype: string | null -# signmethod: string | null -# created_at: string -# expires_at: string -# expires_in_seconds: number -# computed?: Record -# } -# response: { -# hex: string | null -# txid: string | null -# resolved_at: string | null -# dispatched_nodetype: string | null -# dispatched_to: string | null -# dispatched_result: string | null -# multisign_account: string | null -# account: string | null -# approved_with?: XummTransactionApprovalType -# } -# custom_meta: XummCustomMeta -# } - class XummGetPayloadResponse(XummResource): """ @@ -1513,46 +1440,3 @@ def custom_meta(cls, custom_meta: XummCustomMeta): raise ValueError("Invalid value for `custom_meta`, must not be `None`") # noqa: E501 cls._custom_meta = custom_meta - -# export interface XummWebhookBody { -# meta: { -# url: string -# application_uuidv4: string -# payload_uuidv4: string -# } -# custom_meta: XummCustomMeta -# payloadResponse: { -# payload_uuidv4: string -# reference_call_uuidv4: string -# signed: boolean -# user_token: boolean -# return_url: { -# app: string | null -# web: string | null -# } -# } -# userToken: { -# user_token: string -# token_issued: number -# token_expiration: number -# } | null -# } - -# export interface XummWebsocketBody { -# payload_uuidv4: string -# reference_call_uuidv4: string -# signed: boolean -# user_token: boolean -# return_url: { -# app: string | null -# web: string | null -# } -# custom_meta: XummCustomMeta -# } - -# export interface XummApiError { -# error: { -# reference: string -# code: number -# } -# }