Skip to content

Module: types

ArAddress = NewType('ArAddress', str) module-attribute

Type alias for Arweave addresses, represented as strings.

ArTransactionId = NewType('ArTransactionId', str) module-attribute

Type alias for Arweave transaction IDs, represented as strings.

Tags = Dict[str, str] module-attribute

Type alias for a dictionary of tags, where both keys and values are strings.

ArRepoId

Bases: BaseModel

A class representing a repository identifier on Arweave.

Attributes:

Name Type Description
owner ArAddress

The owner of the repository.

name str

The name of the repository.

Source code in src/ritual_arweave/types.py
class ArRepoId(BaseModel):
    """
    A class representing a repository identifier on Arweave.

    Attributes:
        owner (ArAddress): The owner of the repository.
        name (str): The name of the repository.
    """

    owner: ArAddress
    name: str

    @classmethod
    def from_str(cls, _id: str) -> ArRepoId:
        """
        Create a ArRepoId instance from a string.

        Args:
            _id (str): A string in the format 'owner/name'.

        Returns:
            ArRepoId: An instance of ArRepoId with the owner and name extracted from the
            input string.
        """
        owner, name = _id.split("/")
        return cls(owner=ArAddress(owner), name=name)

from_str(_id) classmethod

Create a ArRepoId instance from a string.

Parameters:

Name Type Description Default
_id str

A string in the format 'owner/name'.

required

Returns:

Name Type Description
ArRepoId ArRepoId

An instance of ArRepoId with the owner and name extracted from the

ArRepoId

input string.

Source code in src/ritual_arweave/types.py
@classmethod
def from_str(cls, _id: str) -> ArRepoId:
    """
    Create a ArRepoId instance from a string.

    Args:
        _id (str): A string in the format 'owner/name'.

    Returns:
        ArRepoId: An instance of ArRepoId with the owner and name extracted from the
        input string.
    """
    owner, name = _id.split("/")
    return cls(owner=ArAddress(owner), name=name)

LargeFileManifest

Bases: BaseModel

A class to represent a manifest file for a large file uploaded in sections.

Attributes:

Name Type Description
files Dict[str, str]

A dictionary of file names and their transaction IDs.

size int

The total size of the file.

Source code in src/ritual_arweave/types.py
class LargeFileManifest(BaseModel):
    """
    A class to represent a manifest file for a large file uploaded in sections.

    Attributes:
        files (Dict[str, str]): A dictionary of file names and their transaction IDs.
        size (int): The total size of the file.
    """

    size: int
    files: Dict[str, str]