Skip to content

Commit abd94f3

Browse files
authored
Merge branch 'main' into xls_80d
2 parents 39ec51e + 70bf96f commit abd94f3

39 files changed

+910
-144
lines changed

.darglint

Lines changed: 0 additions & 4 deletions
This file was deleted.

.flake8

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ ignore = D205,D212,D415,E203,W503
1111
# https://black.readthedocs.io/en/stable/the_black_code_style.html#line-length
1212
max-line-length = 88
1313

14+
# This is for pydocstyle - to allow docstrings in __init__ functions
15+
# This rule was used for easier migration from darglint
16+
# TODO: remove this rule
17+
allow-init-docstring=True
18+
1419
per-file-ignores =
1520
# For tests, disable type annotation and docstring linting.
16-
tests/*: ANN D DAR
21+
tests/*: ANN D DOC
1722

1823
# Select other tools to enable.
1924

@@ -25,7 +30,7 @@ per-file-ignores =
2530

2631
# D enables docstrings warnings from pydocstyle.
2732

28-
# DAR enables docstring style linting via darglint.
33+
# DOC enables docstring style linting via pydoclint.
2934

3035
# F are errors reported by pyflakes, a tool which parses source files
3136
# and finds invalid Python code.
@@ -35,4 +40,4 @@ per-file-ignores =
3540

3641
# W and E are warnings and errors reported by pycodestyle, which checks
3742
# your Python code against some of the style conventions in PEP 8.
38-
select = ABS,ANN,DAR,BLK,D,E,F,I,W
43+
select = ABS,ANN,DOC,BLK,D,E,F,I,W

.github/workflows/unit_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949

5050
- name: Lint
5151
run: |
52-
poetry run flake8 xrpl tests snippets --darglint-ignore-regex="^_(.*)"
52+
poetry run poe lint
5353
5454
- name: Type-check
5555
run: |

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
types: [python]
2222
- id: flake8
2323
name: flake8
24-
entry: poetry run flake8 --darglint-ignore-regex="^_(.*)"
24+
entry: poetry run flake8
2525
language: system
2626
types: [python]
2727
- id: mypy

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@
2727
"source.organizeImports": "always"
2828
}
2929
},
30-
"isort.args": ["--profile", "black"]
30+
"isort.args": [
31+
"--profile",
32+
"black"
33+
],
34+
"python.testing.pytestEnabled": false,
35+
"python.testing.unittestEnabled": true
3136
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111
- Add support for the `PermissionedDomains` feature
12+
- Support `AMMClawback` amendment (XLS-73d).
13+
- Support for the `simulate` RPC ([XLS-69](https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0069d-simulate))
14+
15+
### Fixed
16+
- `Sign`, `SignFor`, and `SignAndSubmit` methods now properly handle WebSocket clients
1217

1318
## [4.0.0] - 2024-12-23
1419

@@ -46,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4651
- Add `nfts_by_issuer` clio-only API definition
4752
- Included `ctid` field in the `tx` request.
4853
- `from_xrpl` method accepts input dictionary keys exclusively in the proper XRPL format.
54+
- Support for DynamicNFT amendment (XLS-46)
4955

5056
### Fixed
5157
- Added support for `XChainModifyBridge` flag maps (fixing an issue with `NFTokenCreateOffer` flag names)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ To run linting and other checks, `xrpl-py` uses [`pre-commit`](https://pre-commi
6666
To run the linter:
6767

6868
```bash
69-
poetry run flake8 xrpl tests --darglint-ignore-regex="^_(.*)"
69+
poetry run poe lint
7070
```
7171

7272
### Running Tests

poetry.lock

Lines changed: 54 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ base58 = "^2.1.0"
2828
ECPy = "^1.2.5"
2929
typing-extensions = "^4.2.0"
3030
httpx = ">=0.18.1,<0.29.0"
31-
websockets = ">=11,<14"
31+
websockets = ">=11"
3232
Deprecated = "^1.2.13"
3333
types-Deprecated = "^1.2.9"
3434
pycryptodome = "^3.16.0"
@@ -43,7 +43,10 @@ isort = "^5.11.5"
4343
flake8-isort = "^6.0.0"
4444
flake8-annotations = "^3.1.1"
4545
flake8-absolute-import = "^1.0"
46-
darglint = "^1.5.8"
46+
pydoclint = [
47+
{ version = "<=0.5.12", python = "<3.9" },
48+
{ version = "^0.5.13", python = ">=3.9" }
49+
]
4750
sphinx-rtd-theme = "^3.0.2"
4851
aiounittest = "^1.4.0"
4952
coverage = "^7.2.7"
@@ -74,6 +77,7 @@ precision = 2
7477
[tool.poe.tasks]
7578
test_unit = "coverage run -m unittest discover tests/unit"
7679
test_integration = "coverage run -m unittest discover tests/integration"
80+
lint = "poetry run flake8 xrpl tests snippets"
7781

7882
[tool.poe.tasks.test]
7983
cmd = "python3 -m unittest ${FILE_PATHS}"

tests/integration/it_utils.py

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def test_async_and_sync(
218218
websockets_only=False,
219219
num_retries=1,
220220
use_testnet=False,
221+
async_only=False,
221222
):
222223
def decorator(test_function):
223224
lines = _get_non_decorator_code(test_function)
@@ -235,15 +236,18 @@ def decorator(test_function):
235236
first_line = lines[0]
236237
sync_code += first_line.replace(" async def ", "").replace(":", "")
237238

238-
sync_modules_to_import = {}
239-
if modules is not None:
240-
for module_str in modules:
241-
function = module_str.split(".")[-1]
242-
location = module_str[: -1 * len(function) - 1]
243-
module = getattr(importlib.import_module(location), function)
244-
sync_modules_to_import[function] = module
245-
246-
all_modules = {**original_globals, **globals(), **sync_modules_to_import}
239+
if not async_only:
240+
sync_modules_to_import = {}
241+
if modules is not None:
242+
for module_str in modules:
243+
function = module_str.split(".")[-1]
244+
location = module_str[: -1 * len(function) - 1]
245+
module = getattr(importlib.import_module(location), function)
246+
sync_modules_to_import[function] = module
247+
248+
all_modules = {**original_globals, **globals(), **sync_modules_to_import}
249+
else:
250+
all_modules = {**original_globals, **globals()}
247251
# NOTE: passing `globals()` into `exec` is really bad practice and not safe at
248252
# all, but in this case it's fine because it's only running test code
249253

@@ -290,14 +294,16 @@ def modified_test(self):
290294
asyncio.run(
291295
_run_async_test(self, _get_client(True, True, use_testnet), 1)
292296
)
293-
with self.subTest(version="sync", client="json"):
294-
_run_sync_test(self, _get_client(False, True, use_testnet), 2)
297+
if not async_only:
298+
with self.subTest(version="sync", client="json"):
299+
_run_sync_test(self, _get_client(False, True, use_testnet), 2)
295300
with self.subTest(version="async", client="websocket"):
296301
asyncio.run(
297302
_run_async_test(self, _get_client(True, False, use_testnet), 3)
298303
)
299-
with self.subTest(version="sync", client="websocket"):
300-
_run_sync_test(self, _get_client(False, False, use_testnet), 4)
304+
if not async_only:
305+
with self.subTest(version="sync", client="websocket"):
306+
_run_sync_test(self, _get_client(False, False, use_testnet), 4)
301307

302308
return modified_test
303309

@@ -315,6 +321,7 @@ def _get_non_decorator_code(function):
315321

316322
def create_amm_pool(
317323
client: SyncClient = JSON_RPC_CLIENT,
324+
enable_amm_clawback: bool = False,
318325
) -> Dict[str, Any]:
319326
issuer_wallet = Wallet.create()
320327
fund_wallet(issuer_wallet)
@@ -331,6 +338,16 @@ def create_amm_pool(
331338
issuer_wallet,
332339
)
333340

341+
# The below flag is required for AMMClawback tests
342+
if enable_amm_clawback:
343+
sign_and_reliable_submission(
344+
AccountSet(
345+
account=issuer_wallet.classic_address,
346+
set_flag=AccountSetAsfFlag.ASF_ALLOW_TRUSTLINE_CLAWBACK,
347+
),
348+
issuer_wallet,
349+
)
350+
334351
sign_and_reliable_submission(
335352
TrustSet(
336353
account=lp_wallet.classic_address,
@@ -382,11 +399,13 @@ def create_amm_pool(
382399
"asset": asset,
383400
"asset2": asset2,
384401
"issuer_wallet": issuer_wallet,
402+
"lp_wallet": lp_wallet,
385403
}
386404

387405

388406
async def create_amm_pool_async(
389407
client: AsyncClient = ASYNC_JSON_RPC_CLIENT,
408+
enable_amm_clawback: bool = False,
390409
) -> Dict[str, Any]:
391410
issuer_wallet = Wallet.create()
392411
await fund_wallet_async(issuer_wallet)
@@ -403,6 +422,16 @@ async def create_amm_pool_async(
403422
issuer_wallet,
404423
)
405424

425+
# The below flag is required for AMMClawback tests
426+
if enable_amm_clawback:
427+
await sign_and_reliable_submission_async(
428+
AccountSet(
429+
account=issuer_wallet.classic_address,
430+
set_flag=AccountSetAsfFlag.ASF_ALLOW_TRUSTLINE_CLAWBACK,
431+
),
432+
issuer_wallet,
433+
)
434+
406435
await sign_and_reliable_submission_async(
407436
TrustSet(
408437
account=lp_wallet.classic_address,
@@ -454,6 +483,7 @@ async def create_amm_pool_async(
454483
"asset": asset,
455484
"asset2": asset2,
456485
"issuer_wallet": issuer_wallet,
486+
"lp_wallet": lp_wallet,
457487
}
458488

459489

0 commit comments

Comments
 (0)