ParamErrors
Set of errors when converting []const u8 into ParamType.
error{ InvalidEnumTag, InvalidCharacter, LengthMismatch, Overflow } || Allocator.ErrorFixedArray
Representation of the solidity fixed array type.
Properties
struct {
child: *const ParamType
size: usize
}ParamType
Type that represents solidity types in zig.
Properties
union(enum) {
address
string
bool
bytes
tuple
uint: usize
int: usize
fixedBytes: usize
@"enum": usize
fixedArray: FixedArray
dynamicArray: *const ParamType
}FromHumanReadableTokenTag
Converts a human readable token into ParamType.
Signature
pub fn fromHumanReadableTokenTag(tag: TokenTags) ?ParamTypeFreeArrayParamType
User must call this if the union type contains a fixedArray or dynamicArray field. They create pointers so they must be destroyed after.
Signature
pub fn freeArrayParamType(
self: @This(),
alloc: Allocator,
) voidTypeToJsonStringify
Converts the tagname of self into a writer.
Signature
pub fn typeToJsonStringify(
self: @This(),
writer: anytype,
) @TypeOf(writer).Error!voidTypeToString
Converts self into its tagname.
Signature
pub fn typeToString(
self: @This(),
writer: anytype,
) @TypeOf(writer).Error!voidTypeToUnion
Helper function that is used to convert solidity types into zig unions, the function will allocate if a array or a fixed array is used.
Consider using freeArrayParamType to destroy the pointers
or call the destroy method on your allocator manually
Signature
pub fn typeToUnion(
abitype: []const u8,
alloc: Allocator,
) ParamErrors!ParamTypeTypeToUnionWithTag
Signature
pub fn typeToUnionWithTag(
allocator: Allocator,
abitype: []const u8,
token_tag: TokenTags,
) ParamErrors!ParamType