Skip to content

Request model error xrpl.models.requests.ledger_entry.Directory #885

@mDuo13

Description

@mDuo13

This model requires a dir_root field, but that field should be optional.

Steps to Reproduce

The following code throws an error:

from xrpl.models.requests import LedgerEntry
from xrpl.models.requests.ledger_entry import Directory

directory_request = LedgerEntry(
    directory=Directory(
        owner="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
        sub_index=0
    ),
    ledger_index="validated"
)

The error is:

xrpl.models.exceptions.XRPLModelException: {'dir_root': 'dir_root is not set'}

Workaround / Expected Result

The following code runs successfully, including making a successful query to Testnet:

from xrpl.clients import JsonRpcClient
from xrpl.models.requests import LedgerEntry

directory_request = LedgerEntry(
    directory={
        "owner": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
        "sub_index": 0
    },
    ledger_index="validated"
)

client = JsonRpcClient("https://s.altnet.rippletest.net:51234/")
response = client.request(directory_request)
print(response.result)

Affected Versions

Tested on xrpl-py 4.2.0 and 4.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions