Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pyteal/ast/abi/string.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Union, TypeVar, Sequence
from typing import Union, TypeVar, Sequence, cast
from collections.abc import Sequence as CollectionSequence

from pyteal.ast.abi.uint import Byte
from pyteal.ast.abi.type import ComputedValue, BaseType
from pyteal.ast.abi.array_dynamic import DynamicArray, DynamicArrayTypeSpec
from pyteal.ast.abi.uint import ByteTypeSpec, Uint16TypeSpec
Expand Down Expand Up @@ -39,7 +40,7 @@ def __eq__(self, other: object) -> bool:
StringTypeSpec.__module__ = "pyteal"


class String(DynamicArray):
class String(DynamicArray[Byte]):
def __init__(self) -> None:
super().__init__(StringTypeSpec())

Expand All @@ -54,9 +55,9 @@ def get(self) -> Expr:
def set(
self,
value: Union[
Sequence[T],
DynamicArray[T],
ComputedValue[DynamicArray[T]],
Sequence[Byte],
DynamicArray[Byte],
ComputedValue[DynamicArray[Byte]],
"String",
str,
bytes,
Expand Down Expand Up @@ -86,7 +87,7 @@ def set(
case Expr():
return self.stored_value.store(encoded_string(value))
case CollectionSequence():
return super().set(value)
return super().set(cast(Sequence[Byte], value))

raise TealInputError(
f"Got {type(value)}, expected DynamicArray, ComputedValue, String, str, bytes, Expr"
Expand Down