Skip to content

Commit

Permalink
Merge branch 'main' into removeBridgeSnip
Browse files Browse the repository at this point in the history
  • Loading branch information
ckeshava authored Sep 19, 2024
2 parents e77fc9d + 17aad31 commit f2412ed
Show file tree
Hide file tree
Showing 179 changed files with 1,666 additions and 1,162 deletions.
4 changes: 4 additions & 0 deletions .ci-config/rippled.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ validators.txt
# Note: The version of rippled you use this config with must have an implementation for the amendments you attempt to enable or it will crash.
# If you need the version of rippled to be more up to date, you may need to make a comment on this repo: https://github.com/WietseWind/docker-rippled

# network_id is required otherwise it's read as None
[network_id]
63456

[features]
# Devnet amendments as of June 28th, 2023
NegativeUNL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snippet_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

env:
PYTHON_VERSION: "3.7"
PYTHON_VERSION: "3.8"

steps:
- name: Checkout code
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [[Unreleased]]
- Add support for the DeliverMax field in Payment transactions

### BREAKING CHANGE:
- Remove Python 3.7 support to fix dependency installation and use 3.8 as new default.

## [3.0.0] - 2024-07-16

### BREAKING CHANGE
- Use rippled API v2 as default in requests

### Added
- Support for the DeliverMax field in Payment transactions
- Support for the `feature` RPC

### Fixed
- Allow empty strings for the purpose of removing fields in DIDSet transaction

### Removed
- Remove deprecated `full`, `accounts`, and `type` parameters from ledger request model

## [2.6.0] - 2024-06-03

### Added
- Support for the Price Oracles amendment (XLS-47).
- Add `nfts_by_issuer` clio-only API definition
- Included `ctid` field in the `tx` request.
- `from_xrpl` method accepts input dictionary keys exclusively in the proper XRPL format.

### Fixed
- Added support for `XChainModifyBridge` flag maps (fixing an issue with `NFTokenCreateOffer` flag names)
- Fixed `XChainModifyBridge` validation to allow just clearing of `MinAccountCreateAmount`
- Added support for IDE auto-completion of model constructors
- Currency codes with special characters not being allowed by IssuedCurrency objects.
- Construction of Wallet throws an "Invalid Seed" error, if the secret is not decode-able.
- Rectify the incorrect usage of a transaction flag name: Update `TF_NO_DIRECT_RIPPLE` to `TF_NO_RIPPLE_DIRECT`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The `xrpl-py` library is available on [PyPI](https://pypi.org/). Install with `p
pip3 install xrpl-py
```

The library supports [Python 3.7](https://www.python.org/downloads/) and later.
The library supports [Python 3.8](https://www.python.org/downloads/) and later.

[![Supported Versions](https://img.shields.io/pypi/pyversions/xrpl-py.svg)](https://pypi.org/project/xrpl-py)

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See the `project README <https://github.com/XRPLF/xrpl-py/blob/main/README.md>`_

Install
--------------
First, ensure that you have `Python 3.7 <https://www.python.org/downloads/>`_ or later.
First, ensure that you have `Python 3.8 <https://www.python.org/downloads/>`_ or later.

Then, download the package via ``pip``:

Expand Down
784 changes: 381 additions & 403 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "xrpl-py"
version = "2.6.0"
version = "3.0.0"
description = "A complete Python library for interacting with the XRP ledger"
readme = "README.md"
repository = "https://github.com/XRPLF/xrpl-py"
Expand Down Expand Up @@ -30,7 +30,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
base58 = "^2.1.0"
ECPy = "^1.2.5"
typing-extensions = "^4.2.0"
Expand Down
10 changes: 5 additions & 5 deletions snippets/multisign.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example of how we can multisign a transaction"""

from xrpl.clients import JsonRpcClient
from xrpl.models import AccountSet, SignerEntry, SignerListSet
from xrpl.transaction import autofill, multisign, sign, submit_and_wait
Expand Down Expand Up @@ -57,11 +58,10 @@
if multisigned_tx_response.result["validated"]:
print("The multisigned transaction was accepted by the ledger:")
print(multisigned_tx_response)
if multisigned_tx_response.result["Signers"]:
print(
"The transaction had "
f"{len(multisigned_tx_response.result['Signers'])} signatures"
)
signers_in_response = multisigned_tx_response.result["tx_json"].get("Signers")

if signers_in_response:
print("The transaction had " f"{len(signers_in_response)} signatures")
else:
print(
"The multisigned transaction was rejected by rippled."
Expand Down
3 changes: 2 additions & 1 deletion snippets/send_escrow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example of how we can set up an escrow"""

from datetime import datetime
from time import sleep

Expand Down Expand Up @@ -55,7 +56,7 @@
finish_tx = EscrowFinish(
account=wallet1.address,
owner=wallet1.address,
offer_sequence=create_escrow_response.result["Sequence"],
offer_sequence=create_escrow_response.result["tx_json"]["Sequence"],
)

submit_and_wait(finish_tx, client, wallet1)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/clients/test_json_rpc_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the json_rpc_client."""

from __future__ import annotations

from unittest import TestCase
Expand All @@ -10,7 +11,7 @@
class TestJsonRpcClient(TestCase):
"""Test json_rpc_client."""

def test_json_rpc_client_valid_url(self: TestJsonRpcClient) -> None:
def test_json_rpc_client_valid_url(self) -> None:
# Valid URL
JSON_RPC_URL = "https://s.altnet.rippletest.net:51234"
client = JsonRpcClient(JSON_RPC_URL)
Expand Down
42 changes: 42 additions & 0 deletions tests/integration/reqs/test_account_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,45 @@ async def test_basic_functionality(self, client):
)
)
self.assertTrue(response.is_successful())

@test_async_and_sync(globals())
async def test_api_v2(self, client):
response = await client.request(
AccountTx(account=WALLET.address, api_version=2)
)

# use the below proxies to ensure that the correct API response is returned
# API v2 returns tx_json field
self.assertIn("tx_json", response.result["transactions"][0])

# API v2 does not return a tx field
self.assertNotIn("tx", response.result["transactions"][0])
self.assertTrue(response.is_successful())

@test_async_and_sync(globals())
async def test_api_v1(self, client):
response = await client.request(
AccountTx(account=WALLET.address, api_version=1)
)

# use the below proxies to ensure that the correct API response is returned
# API v1 does not contain a tx_json field
self.assertNotIn("tx_json", response.result["transactions"][0])

# API v1 returns a tx field
self.assertIn("tx", response.result["transactions"][0])
self.assertTrue(response.is_successful())

@test_async_and_sync(globals())
async def test_no_explicit_api_version(self, client):
response_without_version = await client.request(
AccountTx(account=WALLET.address)
)

response_with_version = await client.request(
AccountTx(account=WALLET.address, api_version=2)
)

# if api_version is not explicitly specified, xrpl-py inserts api_version:2
# inside the Requests
self.assertEqual(response_with_version.result, response_without_version.result)
29 changes: 29 additions & 0 deletions tests/integration/reqs/test_feature.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from tests.integration.integration_test_case import IntegrationTestCase
from tests.integration.it_utils import test_async_and_sync
from xrpl.models.requests import Feature

AMM_AMENDMENT = "8CC0774A3BF66D1D22E76BBDA8E8A232E6B6313834301B3B23E8601196AE6455"


class TestFeature(IntegrationTestCase):
@test_async_and_sync(globals())
async def test_basic_functionality(self, client):
response = await client.request(Feature())
features = response.result["features"]

self.assertIn(AMM_AMENDMENT, features)
feature_info = features[AMM_AMENDMENT]
self.assertEqual(feature_info["name"], "AMM")
self.assertTrue(isinstance(feature_info["enabled"], bool))
self.assertEqual(feature_info["supported"], True)

@test_async_and_sync(globals())
async def test_single_feature(self, client):
response = await client.request(Feature(feature=AMM_AMENDMENT))
features = response.result

self.assertIn(AMM_AMENDMENT, features)
feature_info = features[AMM_AMENDMENT]
self.assertEqual(feature_info["name"], "AMM")
self.assertTrue(isinstance(feature_info["enabled"], bool))
self.assertEqual(feature_info["supported"], True)
24 changes: 16 additions & 8 deletions tests/integration/reqs/test_generic_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@


class TestGenericRequest(IntegrationTestCase):
# Note: Support for the tx_history command has been removed since rippled API v2
@test_async_and_sync(globals())
async def test_constructor(self, client):
response = await client.request(
GenericRequest(
method="tx_history",
start=0,
)
GenericRequest(method="tx_history", start=0, api_version=1)
)
self.assertTrue(response.is_successful())

Expand All @@ -23,6 +21,7 @@ async def test_json_formatting(self, client):
"params": {
"start": 0,
},
"api_version": 1,
}
)
)
Expand All @@ -32,10 +31,19 @@ async def test_json_formatting(self, client):
async def test_websocket_formatting(self, client):
response = await client.request(
GenericRequest.from_dict(
{
"command": "tx_history",
"start": 0,
}
{"command": "tx_history", "start": 0, "api_version": 1}
)
)
self.assertTrue(response.is_successful())

def test_from_dict_json_without_api_version_input(self):
with self.assertRaises(KeyError):
# tx_history is invalid in the default API version 2
GenericRequest.from_dict(
{
"method": "tx_history",
"params": {
"start": 0,
},
}
)
4 changes: 2 additions & 2 deletions tests/integration/sugar/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def test_get_latest_transaction(self, client):

response = await get_latest_transaction(WALLET.address, client)
self.assertEqual(len(response.result["transactions"]), 1)
transaction = response.result["transactions"][0]["tx"]
transaction = response.result["transactions"][0]["tx_json"]
self.assertEqual(transaction["TransactionType"], "Payment")
self.assertEqual(transaction["Amount"], amount)
self.assertEqual(transaction["DeliverMax"], amount)
self.assertEqual(transaction["Account"], WALLET.address)
24 changes: 0 additions & 24 deletions tests/integration/sugar/test_network_id.py

This file was deleted.

Loading

0 comments on commit f2412ed

Please sign in to comment.