Skip to content

Commit

Permalink
addressed Omar's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ckeshava committed Dec 20, 2024
1 parent e168dcb commit 387f72b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions xrpl/models/transactions/credential_accept.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ class CredentialAccept(Transaction):
it has been transferred/accepted.
"""

transaction_type: TransactionType = field(
default=TransactionType.CREDENTIAL_ACCEPT,
init=False,
)

account: str = REQUIRED # type: ignore
"""
The subject of the credential.
Expand All @@ -43,6 +38,11 @@ class CredentialAccept(Transaction):
A hex-encoded value to identify the type of credential from the issuer.
"""

transaction_type: TransactionType = field(
default=TransactionType.CREDENTIAL_ACCEPT,
init=False,
)

def _get_errors(self: Self) -> Dict[str, str]:
errors = super()._get_errors()
if (
Expand Down
10 changes: 5 additions & 5 deletions xrpl/models/transactions/credential_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
class CredentialCreate(Transaction):
"""This transaction creates a Credential object. It must be sent by the issuer."""

transaction_type: TransactionType = field(
default=TransactionType.CREDENTIAL_CREATE,
init=False,
)

account: str = REQUIRED # type: ignore
"""
The issuer of the credential.
Expand All @@ -54,6 +49,11 @@ class CredentialCreate(Transaction):
Credential document).
"""

transaction_type: TransactionType = field(
default=TransactionType.CREDENTIAL_CREATE,
init=False,
)

def _get_errors(self: Self) -> Dict[str, str]:
errors = super()._get_errors()

Expand Down
8 changes: 4 additions & 4 deletions xrpl/models/transactions/credential_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
class CredentialDelete(Transaction):
"""This transaction deletes a Credential object."""

transaction_type: TransactionType = field(
default=TransactionType.CREDENTIAL_DELETE, init=False
)

account: str = REQUIRED # type: ignore
"""The transaction submitter."""

Expand All @@ -37,6 +33,10 @@ class CredentialDelete(Transaction):
credential_type: str = REQUIRED # type: ignore
"""A hex-encoded value to identify the type of credential from the issuer."""

transaction_type: TransactionType = field(
default=TransactionType.CREDENTIAL_DELETE, init=False
)

def _get_errors(self: Self) -> Dict[str, str]:
errors = super()._get_errors()

Expand Down
4 changes: 2 additions & 2 deletions xrpl/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

HEX_REGEX: Final[Pattern[str]] = re.compile("[a-fA-F0-9]*")

MAX_CREDENTIAL_ARRAY_LENGTH = 8

# Credentials are represented in hex. Whilst they are allowed a maximum length of 64
# bytes, every byte requires 2 hex characters for representation
_MAX_CREDENTIAL_LENGTH: Final[int] = 128

MAX_CREDENTIAL_ARRAY_LENGTH = 8


def get_credential_type_error(credential_type: str) -> Optional[str]:
"""
Expand Down

0 comments on commit 387f72b

Please sign in to comment.