# This file was autogenerated by some hot garbage in the `uniffi` crate.
# Trust me, you don't want to mess with it!

# Common helper code.
#
# Ideally this would live in a separate .py file where it can be unittested etc
# in isolation, and perhaps even published as a re-useable package.
#
# However, it's important that the details of how this helper code works (e.g. the
# way that different builtin types are passed across the FFI) exactly match what's
# expected by the rust code on the other side of the interface. In practice right
# now that means coming from the exact some version of `uniffi` that was used to
# compile the rust component. The easiest way to ensure this is to bundle the Python
# helpers directly inline like we're doing here.

import os
import sys
import ctypes
import enum
import struct
import contextlib
import datetime
import typing
import platform

# Used for default argument values
_DEFAULT = object()


class _UniffiRustBuffer(ctypes.Structure):
    _fields_ = [
        ("capacity", ctypes.c_int32),
        ("len", ctypes.c_int32),
        ("data", ctypes.POINTER(ctypes.c_char)),
    ]

    @staticmethod
    def alloc(size):
        return _rust_call(_UniffiLib.ffi_zklink_sdk_rustbuffer_alloc, size)

    @staticmethod
    def reserve(rbuf, additional):
        return _rust_call(_UniffiLib.ffi_zklink_sdk_rustbuffer_reserve, rbuf, additional)

    def free(self):
        return _rust_call(_UniffiLib.ffi_zklink_sdk_rustbuffer_free, self)

    def __str__(self):
        return "_UniffiRustBuffer(capacity={}, len={}, data={})".format(
            self.capacity,
            self.len,
            self.data[0:self.len]
        )

    @contextlib.contextmanager
    def alloc_with_builder(*args):
        """Context-manger to allocate a buffer using a _UniffiRustBufferBuilder.

        The allocated buffer will be automatically freed if an error occurs, ensuring that
        we don't accidentally leak it.
        """
        builder = _UniffiRustBufferBuilder()
        try:
            yield builder
        except:
            builder.discard()
            raise

    @contextlib.contextmanager
    def consume_with_stream(self):
        """Context-manager to consume a buffer using a _UniffiRustBufferStream.

        The _UniffiRustBuffer will be freed once the context-manager exits, ensuring that we don't
        leak it even if an error occurs.
        """
        try:
            s = _UniffiRustBufferStream.from_rust_buffer(self)
            yield s
            if s.remaining() != 0:
                raise RuntimeError("junk data left in buffer at end of consume_with_stream")
        finally:
            self.free()

    @contextlib.contextmanager
    def read_with_stream(self):
        """Context-manager to read a buffer using a _UniffiRustBufferStream.

        This is like consume_with_stream, but doesn't free the buffer afterwards.
        It should only be used with borrowed `_UniffiRustBuffer` data.
        """
        s = _UniffiRustBufferStream.from_rust_buffer(self)
        yield s
        if s.remaining() != 0:
            raise RuntimeError("junk data left in buffer at end of read_with_stream")

class _UniffiForeignBytes(ctypes.Structure):
    _fields_ = [
        ("len", ctypes.c_int32),
        ("data", ctypes.POINTER(ctypes.c_char)),
    ]

    def __str__(self):
        return "_UniffiForeignBytes(len={}, data={})".format(self.len, self.data[0:self.len])


class _UniffiRustBufferStream:
    """
    Helper for structured reading of bytes from a _UniffiRustBuffer
    """

    def __init__(self, data, len):
        self.data = data
        self.len = len
        self.offset = 0

    @classmethod
    def from_rust_buffer(cls, buf):
        return cls(buf.data, buf.len)

    def remaining(self):
        return self.len - self.offset

    def _unpack_from(self, size, format):
        if self.offset + size > self.len:
            raise InternalError("read past end of rust buffer")
        value = struct.unpack(format, self.data[self.offset:self.offset+size])[0]
        self.offset += size
        return value

    def read(self, size):
        if self.offset + size > self.len:
            raise InternalError("read past end of rust buffer")
        data = self.data[self.offset:self.offset+size]
        self.offset += size
        return data

    def read_i8(self):
        return self._unpack_from(1, ">b")

    def read_u8(self):
        return self._unpack_from(1, ">B")

    def read_i16(self):
        return self._unpack_from(2, ">h")

    def read_u16(self):
        return self._unpack_from(2, ">H")

    def read_i32(self):
        return self._unpack_from(4, ">i")

    def read_u32(self):
        return self._unpack_from(4, ">I")

    def read_i64(self):
        return self._unpack_from(8, ">q")

    def read_u64(self):
        return self._unpack_from(8, ">Q")

    def read_float(self):
        v = self._unpack_from(4, ">f")
        return v

    def read_double(self):
        return self._unpack_from(8, ">d")

    def read_c_size_t(self):
        return self._unpack_from(ctypes.sizeof(ctypes.c_size_t) , "@N")

class _UniffiRustBufferBuilder:
    """
    Helper for structured writing of bytes into a _UniffiRustBuffer.
    """

    def __init__(self):
        self.rbuf = _UniffiRustBuffer.alloc(16)
        self.rbuf.len = 0

    def finalize(self):
        rbuf = self.rbuf
        self.rbuf = None
        return rbuf

    def discard(self):
        if self.rbuf is not None:
            rbuf = self.finalize()
            rbuf.free()

    @contextlib.contextmanager
    def _reserve(self, num_bytes):
        if self.rbuf.len + num_bytes > self.rbuf.capacity:
            self.rbuf = _UniffiRustBuffer.reserve(self.rbuf, num_bytes)
        yield None
        self.rbuf.len += num_bytes

    def _pack_into(self, size, format, value):
        with self._reserve(size):
            # XXX TODO: I feel like I should be able to use `struct.pack_into` here but can't figure it out.
            for i, byte in enumerate(struct.pack(format, value)):
                self.rbuf.data[self.rbuf.len + i] = byte

    def write(self, value):
        with self._reserve(len(value)):
            for i, byte in enumerate(value):
                self.rbuf.data[self.rbuf.len + i] = byte

    def write_i8(self, v):
        self._pack_into(1, ">b", v)

    def write_u8(self, v):
        self._pack_into(1, ">B", v)

    def write_i16(self, v):
        self._pack_into(2, ">h", v)

    def write_u16(self, v):
        self._pack_into(2, ">H", v)

    def write_i32(self, v):
        self._pack_into(4, ">i", v)

    def write_u32(self, v):
        self._pack_into(4, ">I", v)

    def write_i64(self, v):
        self._pack_into(8, ">q", v)

    def write_u64(self, v):
        self._pack_into(8, ">Q", v)

    def write_float(self, v):
        self._pack_into(4, ">f", v)

    def write_double(self, v):
        self._pack_into(8, ">d", v)

    def write_c_size_t(self, v):
        self._pack_into(ctypes.sizeof(ctypes.c_size_t) , "@N", v)
# A handful of classes and functions to support the generated data structures.
# This would be a good candidate for isolating in its own ffi-support lib.

class InternalError(Exception):
    pass

class _UniffiRustCallStatus(ctypes.Structure):
    """
    Error runtime.
    """
    _fields_ = [
        ("code", ctypes.c_int8),
        ("error_buf", _UniffiRustBuffer),
    ]

    # These match the values from the uniffi::rustcalls module
    CALL_SUCCESS = 0
    CALL_ERROR = 1
    CALL_PANIC = 2

    def __str__(self):
        if self.code == _UniffiRustCallStatus.CALL_SUCCESS:
            return "_UniffiRustCallStatus(CALL_SUCCESS)"
        elif self.code == _UniffiRustCallStatus.CALL_ERROR:
            return "_UniffiRustCallStatus(CALL_ERROR)"
        elif self.code == _UniffiRustCallStatus.CALL_PANIC:
            return "_UniffiRustCallStatus(CALL_PANIC)"
        else:
            return "_UniffiRustCallStatus(<invalid code>)"

def _rust_call(fn, *args):
    # Call a rust function
    return _rust_call_with_error(None, fn, *args)

def _rust_call_with_error(error_ffi_converter, fn, *args):
    # Call a rust function and handle any errors
    #
    # This function is used for rust calls that return Result<> and therefore can set the CALL_ERROR status code.
    # error_ffi_converter must be set to the _UniffiConverter for the error class that corresponds to the result.
    call_status = _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer(0, 0, None))

    args_with_error = args + (ctypes.byref(call_status),)
    result = fn(*args_with_error)
    _uniffi_check_call_status(error_ffi_converter, call_status)
    return result

def _uniffi_check_call_status(error_ffi_converter, call_status):
    if call_status.code == _UniffiRustCallStatus.CALL_SUCCESS:
        pass
    elif call_status.code == _UniffiRustCallStatus.CALL_ERROR:
        if error_ffi_converter is None:
            call_status.error_buf.free()
            raise InternalError("_rust_call_with_error: CALL_ERROR, but error_ffi_converter is None")
        else:
            raise error_ffi_converter.lift(call_status.error_buf)
    elif call_status.code == _UniffiRustCallStatus.CALL_PANIC:
        # When the rust code sees a panic, it tries to construct a _UniffiRustBuffer
        # with the message.  But if that code panics, then it just sends back
        # an empty buffer.
        if call_status.error_buf.len > 0:
            msg = _UniffiConverterString.lift(call_status.error_buf)
        else:
            msg = "Unknown rust panic"
        raise InternalError(msg)
    else:
        raise InternalError("Invalid _UniffiRustCallStatus code: {}".format(
            call_status.code))

# A function pointer for a callback as defined by UniFFI.
# Rust definition `fn(handle: u64, method: u32, args: _UniffiRustBuffer, buf_ptr: *mut _UniffiRustBuffer) -> int`
_UNIFFI_FOREIGN_CALLBACK_T = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_ulonglong, ctypes.c_ulong, ctypes.POINTER(ctypes.c_char), ctypes.c_int, ctypes.POINTER(_UniffiRustBuffer))

# UniFFI future continuation
_UNIFFI_FUTURE_CONTINUATION_T = ctypes.CFUNCTYPE(None, ctypes.c_size_t, ctypes.c_int8)

class _UniffiPointerManagerCPython:
    """
    Manage giving out pointers to Python objects on CPython

    This class is used to generate opaque pointers that reference Python objects to pass to Rust.
    It assumes a CPython platform.  See _UniffiPointerManagerGeneral for the alternative.
    """

    def new_pointer(self, obj):
        """
        Get a pointer for an object as a ctypes.c_size_t instance

        Each call to new_pointer() must be balanced with exactly one call to release_pointer()

        This returns a ctypes.c_size_t.  This is always the same size as a pointer and can be
        interchanged with pointers for FFI function arguments and return values.
        """
        # IncRef the object since we're going to pass a pointer to Rust
        ctypes.pythonapi.Py_IncRef(ctypes.py_object(obj))
        # id() is the object address on CPython
        # (https://docs.python.org/3/library/functions.html#id)
        return id(obj)

    def release_pointer(self, address):
        py_obj = ctypes.cast(address, ctypes.py_object)
        obj = py_obj.value
        ctypes.pythonapi.Py_DecRef(py_obj)
        return obj

    def lookup(self, address):
        return ctypes.cast(address, ctypes.py_object).value

class _UniffiPointerManagerGeneral:
    """
    Manage giving out pointers to Python objects on non-CPython platforms

    This has the same API as _UniffiPointerManagerCPython, but doesn't assume we're running on
    CPython and is slightly slower.

    Instead of using real pointers, it maps integer values to objects and returns the keys as
    c_size_t values.
    """

    def __init__(self):
        self._map = {}
        self._lock = threading.Lock()
        self._current_handle = 0

    def new_pointer(self, obj):
        with self._lock:
            handle = self._current_handle
            self._current_handle += 1
            self._map[handle] = obj
        return handle

    def release_pointer(self, handle):
        with self._lock:
            return self._map.pop(handle)

    def lookup(self, handle):
        with self._lock:
            return self._map[handle]

# Pick an pointer manager implementation based on the platform
if platform.python_implementation() == 'CPython':
    _UniffiPointerManager = _UniffiPointerManagerCPython # type: ignore
else:
    _UniffiPointerManager = _UniffiPointerManagerGeneral # type: ignore
# Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI.
class _UniffiConverterPrimitive:
    @classmethod
    def check(cls, value):
        return value

    @classmethod
    def lift(cls, value):
        return value

    @classmethod
    def lower(cls, value):
        return cls.lowerUnchecked(cls.check(value))

    @classmethod
    def lowerUnchecked(cls, value):
        return value

    @classmethod
    def write(cls, value, buf):
        cls.write_unchecked(cls.check(value), buf)

class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive):
    @classmethod
    def check(cls, value):
        try:
            value = value.__index__()
        except Exception:
            raise TypeError("'{}' object cannot be interpreted as an integer".format(type(value).__name__))
        if not isinstance(value, int):
            raise TypeError("__index__ returned non-int (type {})".format(type(value).__name__))
        if not cls.VALUE_MIN <= value < cls.VALUE_MAX:
            raise ValueError("{} requires {} <= value < {}".format(cls.CLASS_NAME, cls.VALUE_MIN, cls.VALUE_MAX))
        return super().check(value)

class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive):
    @classmethod
    def check(cls, value):
        try:
            value = value.__float__()
        except Exception:
            raise TypeError("must be real number, not {}".format(type(value).__name__))
        if not isinstance(value, float):
            raise TypeError("__float__ returned non-float (type {})".format(type(value).__name__))
        return super().check(value)

# Helper class for wrapper types that will always go through a _UniffiRustBuffer.
# Classes should inherit from this and implement the `read` and `write` static methods.
class _UniffiConverterRustBuffer:
    @classmethod
    def lift(cls, rbuf):
        with rbuf.consume_with_stream() as stream:
            return cls.read(stream)

    @classmethod
    def lower(cls, value):
        with _UniffiRustBuffer.alloc_with_builder() as builder:
            cls.write(value, builder)
            return builder.finalize()

# Contains loading, initialization code, and the FFI Function declarations.
# Define some ctypes FFI types that we use in the library

"""
ctypes type for the foreign executor callback.  This is a built-in interface for scheduling
tasks

Args:
  executor: opaque c_size_t value representing the eventloop
  delay: delay in ms
  task: function pointer to the task callback
  task_data: void pointer to the task callback data

Normally we should call task(task_data) after the detail.
However, when task is NULL this indicates that Rust has dropped the ForeignExecutor and we should
decrease the EventLoop refcount.
"""
_UNIFFI_FOREIGN_EXECUTOR_CALLBACK_T = ctypes.CFUNCTYPE(ctypes.c_int8, ctypes.c_size_t, ctypes.c_uint32, ctypes.c_void_p, ctypes.c_void_p)

"""
Function pointer for a Rust task, which a callback function that takes a opaque pointer
"""
_UNIFFI_RUST_TASK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int8)

def _uniffi_future_callback_t(return_type):
    """
    Factory function to create callback function types for async functions
    """
    return ctypes.CFUNCTYPE(None, ctypes.c_size_t, return_type, _UniffiRustCallStatus)

def _uniffi_load_indirect():
    """
    This is how we find and load the dynamic library provided by the component.
    For now we just look it up by name.
    """
    if sys.platform == "darwin":
        libname = "lib{}.dylib"
    elif sys.platform.startswith("win"):
        # As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
        # We could use `os.add_dll_directory` to configure the search path, but
        # it doesn't feel right to mess with application-wide settings. Let's
        # assume that the `.dll` is next to the `.py` file and load by full path.
        libname = os.path.join(
            os.path.dirname(__file__),
            "{}.dll",
        )
    else:
        # Anything else must be an ELF platform - Linux, *BSD, Solaris/illumos
        libname = "lib{}.so"

    libname = libname.format("zklink_sdk")
    path = os.path.join(os.path.dirname(__file__), libname)
    lib = ctypes.cdll.LoadLibrary(path)
    return lib

def _uniffi_check_contract_api_version(lib):
    # Get the bindings contract version from our ComponentInterface
    bindings_contract_version = 24
    # Get the scaffolding contract version by calling the into the dylib
    scaffolding_contract_version = lib.ffi_zklink_sdk_uniffi_contract_version()
    if bindings_contract_version != scaffolding_contract_version:
        raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")

def _uniffi_check_api_checksums(lib):
    if lib.uniffi_zklink_sdk_checksum_func_create_signed_change_pubkey() != 63374:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_func_eth_signature_of_change_pubkey() != 32759:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_func_get_public_key_hash() != 58294:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_func_verify_musig() != 61749:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_func_zklink_main_net_url() != 63488:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_func_zklink_test_net_url() != 4933:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_create_signed_tx() != 63490:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_get_bytes() != 44684:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_get_signature() != 16515:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_is_signature_valid() != 2829:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_is_valid() != 32196:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_json_str() != 3439:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_to_zklink_tx() != 64239:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_autodeleveraging_tx_hash() != 35167:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_get_bytes() != 1938:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_get_signature() != 51549:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_is_onchain() != 10977:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_is_signature_valid() != 25271:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_is_valid() != 31315:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_json_str() != 43695:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_to_zklink_tx() != 42088:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_changepubkey_tx_hash() != 26881:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contract_create_signed_contract() != 3720:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contract_get_bytes() != 6953:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contract_get_signature() != 60348:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contract_is_long() != 52375:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contract_is_short() != 24664:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contract_is_signature_valid() != 33071:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_create_signed_tx() != 44741:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_get_bytes() != 12250:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_get_signature() != 41128:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_is_signature_valid() != 33576:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_is_valid() != 55586:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_json_str() != 42918:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_to_zklink_tx() != 43065:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_contractmatching_tx_hash() != 3288:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_deposit_get_bytes() != 46958:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_deposit_json_str() != 17811:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_deposit_tx_hash() != 37358:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ethsigner_get_address() != 11362:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ethsigner_sign_message() != 14536:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_create_signed_tx() != 17267:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_get_bytes() != 15553:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_get_signature() != 48117:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_is_signature_valid() != 6534:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_is_valid() != 46100:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_json_str() != 4050:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_to_zklink_tx() != 32455:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_forcedexit_tx_hash() != 45462:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_fullexit_get_bytes() != 52461:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_fullexit_is_valid() != 57198:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_fullexit_json_str() != 24199:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_fullexit_to_zklink_tx() != 51607:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_fullexit_tx_hash() != 48511:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_create_signed_tx() != 38824:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_get_bytes() != 63867:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_get_signature() != 29468:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_is_signature_valid() != 50669:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_is_valid() != 4189:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_json_str() != 55097:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_to_zklink_tx() != 27295:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_funding_tx_hash() != 26610:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_create_signed_tx() != 18143:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_get_bytes() != 1134:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_get_signature() != 31505:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_is_signature_valid() != 8478:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_is_valid() != 2828:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_json_str() != 62587:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_to_zklink_tx() != 30414:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_liquidation_tx_hash() != 34918:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_create_signed_order() != 18530:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_get_bytes() != 51161:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_get_eth_sign_msg() != 11725:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_get_signature() != 46876:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_is_signature_valid() != 6764:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_is_valid() != 56951:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_order_json_str() != 20284:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_create_signed_tx() != 27728:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_get_bytes() != 13177:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_get_signature() != 35878:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_is_signature_valid() != 54946:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_is_valid() != 51995:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_json_str() != 33830:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_to_zklink_tx() != 23870:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_ordermatching_tx_hash() != 3162:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_auto_deleveraging() != 3485:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_create2data_auth() != 39808:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_eth_ecdsa_auth() != 63567:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_onchain_auth_data() != 26921:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_contract_matching() != 27932:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_forced_exit() != 37862:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_funding() != 31213:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_liquidation() != 56257:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_order_matching() != 19982:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_transfer() != 51577:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_signer_sign_withdraw() != 56851:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_starksigner_sign_message() != 27027:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_create_signed_tx() != 17446:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_eth_signature() != 18454:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_get_bytes() != 56287:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_get_eth_sign_msg() != 46393:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_get_signature() != 55226:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_is_signature_valid() != 31540:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_is_valid() != 46475:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_json_str() != 28252:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_to_zklink_tx() != 64899:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_transfer_tx_hash() != 16259:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_updateglobalvar_get_bytes() != 40576:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_updateglobalvar_is_valid() != 7961:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_updateglobalvar_json_str() != 48653:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_updateglobalvar_to_zklink_tx() != 40091:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_updateglobalvar_tx_hash() != 4261:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_create_signed_tx() != 15886:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_eth_signature() != 28825:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_get_bytes() != 15999:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_get_eth_sign_msg() != 27813:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_get_signature() != 56920:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_is_signature_valid() != 9636:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_is_valid() != 32004:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_json_str() != 3719:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_to_zklink_tx() != 26934:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_withdraw_tx_hash() != 25800:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_zklinksigner_public_key() != 11211:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_method_zklinksigner_sign_musig() != 46475:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_autodeleveraging_new() != 10122:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_changepubkey_new() != 10607:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_contract_new() != 32968:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_contractmatching_new() != 210:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_deposit_new() != 2732:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_ethsigner_new() != 58738:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_forcedexit_new() != 30328:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_fullexit_new() != 27234:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_funding_new() != 62515:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_liquidation_new() != 56634:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_order_new() != 13958:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_ordermatching_new() != 5934:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_signer_new() != 24354:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_starksigner_new() != 61581:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_starksigner_new_from_hex_str() != 57960:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_transfer_new() != 31981:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_typeddata_new() != 46773:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_updateglobalvar_new() != 31819:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_withdraw_new() != 47491:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new() != 62411:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_bytes() != 17619:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_hex_eth_signer() != 60210:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_hex_stark_signer() != 21809:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
    if lib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_seed() != 47514:
        raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")

# A ctypes library to expose the extern-C FFI definitions.
# This is an implementation detail which will be called internally by the public API.

_UniffiLib = _uniffi_load_indirect()
_UniffiLib.uniffi_zklink_sdk_fn_free_autodeleveraging.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_autodeleveraging.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_autodeleveraging_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_autodeleveraging_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_changepubkey.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_changepubkey.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_changepubkey_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_changepubkey_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_onchain.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_onchain.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_contract.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_contract.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_contract_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_contract_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_create_signed_contract.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_create_signed_contract.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_long.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_long.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_short.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_short.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_free_contractmatching.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_contractmatching.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_contractmatching_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_contractmatching_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_deposit.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_deposit.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_deposit_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_deposit_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_ethsigner.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_ethsigner.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_ethsigner_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_ethsigner_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_ethsigner_get_address.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ethsigner_get_address.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_ethsigner_sign_message.argtypes = (
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ethsigner_sign_message.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_forcedexit.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_forcedexit.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_forcedexit_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_forcedexit_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_fullexit.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_fullexit.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_fullexit_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_fullexit_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_funding.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_funding.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_funding_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_funding_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_funding_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_liquidation.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_liquidation.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_liquidation_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_liquidation_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_order.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_order.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_order_new.argtypes = (
    ctypes.c_uint32,
    ctypes.c_uint8,
    ctypes.c_uint32,
    ctypes.c_uint32,
    ctypes.c_uint32,
    ctypes.c_uint32,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.c_int8,
    ctypes.c_int8,
    ctypes.c_uint8,
    ctypes.c_uint8,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_order_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_order_create_signed_order.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_create_signed_order.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_eth_sign_msg.argtypes = (
    ctypes.c_void_p,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.c_uint8,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_eth_sign_msg.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_order_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_order_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_order_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_order_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_ordermatching.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_ordermatching.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_ordermatching_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_ordermatching_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_signer.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_signer.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_signer_new.argtypes = (
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_signer_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_auto_deleveraging.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_auto_deleveraging.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_create2data_auth.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_create2data_auth.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_eth_ecdsa_auth.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_eth_ecdsa_auth.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_onchain_auth_data.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_onchain_auth_data.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_contract_matching.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_contract_matching.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_forced_exit.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_forced_exit.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_funding.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_funding.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_liquidation.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_liquidation.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_order_matching.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_order_matching.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_transfer.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_transfer.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_withdraw.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_withdraw.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_starksigner.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_starksigner.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_starksigner_new.argtypes = (
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_starksigner_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_constructor_starksigner_new_from_hex_str.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_starksigner_new_from_hex_str.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_starksigner_sign_message.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_starksigner_sign_message.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_transfer.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_transfer.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_transfer_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_transfer_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_eth_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_eth_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_eth_sign_msg.argtypes = (
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_eth_sign_msg.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_typeddata.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_typeddata.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_typeddata_new.argtypes = (
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_typeddata_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_free_updateglobalvar.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_updateglobalvar.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_updateglobalvar_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_updateglobalvar_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_withdraw.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_withdraw.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_withdraw_new.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_withdraw_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_create_signed_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_create_signed_tx.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_eth_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_eth_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_bytes.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_bytes.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_eth_sign_msg.argtypes = (
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_eth_sign_msg.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_signature.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_signature.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_is_signature_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_is_signature_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_is_valid.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_is_valid.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_json_str.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_json_str.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_to_zklink_tx.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_to_zklink_tx.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_tx_hash.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_tx_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_free_zklinksigner.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_free_zklinksigner.restype = None
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new.argtypes = (
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_bytes.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_bytes.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_hex_eth_signer.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_hex_eth_signer.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_hex_stark_signer.argtypes = (
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_hex_stark_signer.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_seed.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_seed.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_method_zklinksigner_public_key.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_zklinksigner_public_key.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_method_zklinksigner_sign_musig.argtypes = (
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_method_zklinksigner_sign_musig.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_func_create_signed_change_pubkey.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_func_create_signed_change_pubkey.restype = ctypes.c_void_p
_UniffiLib.uniffi_zklink_sdk_fn_func_eth_signature_of_change_pubkey.argtypes = (
    ctypes.c_void_p,
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_func_eth_signature_of_change_pubkey.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_func_get_public_key_hash.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_func_get_public_key_hash.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_func_verify_musig.argtypes = (
    _UniffiRustBuffer,
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_func_verify_musig.restype = ctypes.c_int8
_UniffiLib.uniffi_zklink_sdk_fn_func_zklink_main_net_url.argtypes = (
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_func_zklink_main_net_url.restype = _UniffiRustBuffer
_UniffiLib.uniffi_zklink_sdk_fn_func_zklink_test_net_url.argtypes = (
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_zklink_sdk_fn_func_zklink_test_net_url.restype = _UniffiRustBuffer
_UniffiLib.ffi_zklink_sdk_rustbuffer_alloc.argtypes = (
    ctypes.c_int32,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rustbuffer_alloc.restype = _UniffiRustBuffer
_UniffiLib.ffi_zklink_sdk_rustbuffer_from_bytes.argtypes = (
    _UniffiForeignBytes,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rustbuffer_from_bytes.restype = _UniffiRustBuffer
_UniffiLib.ffi_zklink_sdk_rustbuffer_free.argtypes = (
    _UniffiRustBuffer,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rustbuffer_free.restype = None
_UniffiLib.ffi_zklink_sdk_rustbuffer_reserve.argtypes = (
    _UniffiRustBuffer,
    ctypes.c_int32,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rustbuffer_reserve.restype = _UniffiRustBuffer
_UniffiLib.ffi_zklink_sdk_rust_future_continuation_callback_set.argtypes = (
    _UNIFFI_FUTURE_CONTINUATION_T,
)
_UniffiLib.ffi_zklink_sdk_rust_future_continuation_callback_set.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u8.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u8.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u8.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u8.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_u8.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_u8.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u8.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u8.restype = ctypes.c_uint8
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i8.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i8.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i8.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i8.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_i8.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_i8.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i8.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i8.restype = ctypes.c_int8
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u16.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u16.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u16.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u16.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_u16.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_u16.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u16.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u16.restype = ctypes.c_uint16
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i16.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i16.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i16.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i16.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_i16.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_i16.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i16.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i16.restype = ctypes.c_int16
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u32.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u32.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_u32.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_u32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u32.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u32.restype = ctypes.c_uint32
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i32.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i32.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_i32.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_i32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i32.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i32.restype = ctypes.c_int32
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u64.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_u64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u64.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_u64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_u64.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_u64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u64.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_u64.restype = ctypes.c_uint64
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i64.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_i64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i64.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_i64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_i64.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_i64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i64.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_i64.restype = ctypes.c_int64
_UniffiLib.ffi_zklink_sdk_rust_future_poll_f32.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_f32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_f32.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_f32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_f32.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_f32.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_f32.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_f32.restype = ctypes.c_float
_UniffiLib.ffi_zklink_sdk_rust_future_poll_f64.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_f64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_f64.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_f64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_f64.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_f64.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_f64.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_f64.restype = ctypes.c_double
_UniffiLib.ffi_zklink_sdk_rust_future_poll_pointer.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_pointer.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_pointer.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_pointer.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_pointer.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_pointer.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_pointer.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_pointer.restype = ctypes.c_void_p
_UniffiLib.ffi_zklink_sdk_rust_future_poll_rust_buffer.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_rust_buffer.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_rust_buffer.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_rust_buffer.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_rust_buffer.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_rust_buffer.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_rust_buffer.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer
_UniffiLib.ffi_zklink_sdk_rust_future_poll_void.argtypes = (
    ctypes.c_void_p,
    ctypes.c_size_t,
)
_UniffiLib.ffi_zklink_sdk_rust_future_poll_void.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_void.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_cancel_void.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_free_void.argtypes = (
    ctypes.c_void_p,
)
_UniffiLib.ffi_zklink_sdk_rust_future_free_void.restype = None
_UniffiLib.ffi_zklink_sdk_rust_future_complete_void.argtypes = (
    ctypes.c_void_p,
    ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.ffi_zklink_sdk_rust_future_complete_void.restype = None
_UniffiLib.uniffi_zklink_sdk_checksum_func_create_signed_change_pubkey.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_func_create_signed_change_pubkey.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_func_eth_signature_of_change_pubkey.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_func_eth_signature_of_change_pubkey.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_func_get_public_key_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_func_get_public_key_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_func_verify_musig.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_func_verify_musig.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_func_zklink_main_net_url.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_func_zklink_main_net_url.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_func_zklink_test_net_url.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_func_zklink_test_net_url.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_autodeleveraging_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_is_onchain.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_is_onchain.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_changepubkey_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_create_signed_contract.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_create_signed_contract.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_is_long.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_is_long.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_is_short.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_is_short.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contract_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_contractmatching_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_deposit_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_deposit_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_deposit_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_deposit_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_deposit_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_deposit_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ethsigner_get_address.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ethsigner_get_address.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ethsigner_sign_message.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ethsigner_sign_message.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_forcedexit_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_fullexit_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_funding_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_liquidation_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_create_signed_order.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_create_signed_order.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_get_eth_sign_msg.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_get_eth_sign_msg.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_order_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_ordermatching_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_auto_deleveraging.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_auto_deleveraging.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_create2data_auth.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_create2data_auth.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_eth_ecdsa_auth.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_eth_ecdsa_auth.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_onchain_auth_data.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_change_pubkey_with_onchain_auth_data.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_contract_matching.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_contract_matching.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_forced_exit.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_forced_exit.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_funding.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_funding.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_liquidation.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_liquidation.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_order_matching.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_order_matching.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_transfer.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_transfer.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_withdraw.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_signer_sign_withdraw.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_starksigner_sign_message.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_starksigner_sign_message.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_eth_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_eth_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_get_eth_sign_msg.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_get_eth_sign_msg.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_transfer_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_updateglobalvar_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_create_signed_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_create_signed_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_eth_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_eth_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_get_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_get_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_get_eth_sign_msg.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_get_eth_sign_msg.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_get_signature.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_get_signature.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_is_signature_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_is_signature_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_is_valid.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_is_valid.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_json_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_json_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_to_zklink_tx.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_to_zklink_tx.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_tx_hash.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_withdraw_tx_hash.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_zklinksigner_public_key.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_zklinksigner_public_key.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_method_zklinksigner_sign_musig.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_method_zklinksigner_sign_musig.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_autodeleveraging_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_autodeleveraging_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_changepubkey_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_changepubkey_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_contract_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_contract_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_contractmatching_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_contractmatching_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_deposit_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_deposit_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_ethsigner_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_ethsigner_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_forcedexit_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_forcedexit_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_fullexit_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_fullexit_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_funding_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_funding_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_liquidation_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_liquidation_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_order_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_order_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_ordermatching_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_ordermatching_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_signer_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_signer_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_starksigner_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_starksigner_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_starksigner_new_from_hex_str.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_starksigner_new_from_hex_str.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_transfer_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_transfer_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_typeddata_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_typeddata_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_updateglobalvar_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_updateglobalvar_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_withdraw_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_withdraw_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_bytes.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_bytes.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_hex_eth_signer.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_hex_eth_signer.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_hex_stark_signer.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_hex_stark_signer.restype = ctypes.c_uint16
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_seed.argtypes = (
)
_UniffiLib.uniffi_zklink_sdk_checksum_constructor_zklinksigner_new_from_seed.restype = ctypes.c_uint16
_UniffiLib.ffi_zklink_sdk_uniffi_contract_version.argtypes = (
)
_UniffiLib.ffi_zklink_sdk_uniffi_contract_version.restype = ctypes.c_uint32
_uniffi_check_contract_api_version(_UniffiLib)
_uniffi_check_api_checksums(_UniffiLib)

# Async support

# Public interface members begin here.


class _UniffiConverterUInt8(_UniffiConverterPrimitiveInt):
    CLASS_NAME = "u8"
    VALUE_MIN = 0
    VALUE_MAX = 2**8

    @staticmethod
    def read(buf):
        return buf.read_u8()

    @staticmethod
    def write_unchecked(value, buf):
        buf.write_u8(value)

class _UniffiConverterUInt16(_UniffiConverterPrimitiveInt):
    CLASS_NAME = "u16"
    VALUE_MIN = 0
    VALUE_MAX = 2**16

    @staticmethod
    def read(buf):
        return buf.read_u16()

    @staticmethod
    def write_unchecked(value, buf):
        buf.write_u16(value)

class _UniffiConverterInt16(_UniffiConverterPrimitiveInt):
    CLASS_NAME = "i16"
    VALUE_MIN = -2**15
    VALUE_MAX = 2**15

    @staticmethod
    def read(buf):
        return buf.read_i16()

    @staticmethod
    def write_unchecked(value, buf):
        buf.write_i16(value)

class _UniffiConverterUInt32(_UniffiConverterPrimitiveInt):
    CLASS_NAME = "u32"
    VALUE_MIN = 0
    VALUE_MAX = 2**32

    @staticmethod
    def read(buf):
        return buf.read_u32()

    @staticmethod
    def write_unchecked(value, buf):
        buf.write_u32(value)

class _UniffiConverterUInt64(_UniffiConverterPrimitiveInt):
    CLASS_NAME = "u64"
    VALUE_MIN = 0
    VALUE_MAX = 2**64

    @staticmethod
    def read(buf):
        return buf.read_u64()

    @staticmethod
    def write_unchecked(value, buf):
        buf.write_u64(value)

class _UniffiConverterBool(_UniffiConverterPrimitive):
    @classmethod
    def check(cls, value):
        return not not value

    @classmethod
    def read(cls, buf):
        return cls.lift(buf.read_u8())

    @classmethod
    def write_unchecked(cls, value, buf):
        buf.write_u8(value)

    @staticmethod
    def lift(value):
        return value != 0

class _UniffiConverterString:
    @staticmethod
    def check(value):
        if not isinstance(value, str):
            raise TypeError("argument must be str, not {}".format(type(value).__name__))
        return value

    @staticmethod
    def read(buf):
        size = buf.read_i32()
        if size < 0:
            raise InternalError("Unexpected negative string length")
        utf8_bytes = buf.read(size)
        return utf8_bytes.decode("utf-8")

    @staticmethod
    def write(value, buf):
        value = _UniffiConverterString.check(value)
        utf8_bytes = value.encode("utf-8")
        buf.write_i32(len(utf8_bytes))
        buf.write(utf8_bytes)

    @staticmethod
    def lift(buf):
        with buf.consume_with_stream() as stream:
            return stream.read(stream.remaining()).decode("utf-8")

    @staticmethod
    def lower(value):
        value = _UniffiConverterString.check(value)
        with _UniffiRustBuffer.alloc_with_builder() as builder:
            builder.write(value.encode("utf-8"))
            return builder.finalize()



class AutoDeleveraging:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "AutoDeleveragingBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_autodeleveraging_new,
        _UniffiConverterTypeAutoDeleveragingBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_autodeleveraging, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "AutoDeleveraging":
        
        return _UniffiConverterTypeAutoDeleveraging.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_autodeleveraging_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeAutoDeleveraging:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, AutoDeleveraging):
            raise TypeError("Expected AutoDeleveraging instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return AutoDeleveraging._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class ChangePubKey:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "ChangePubKeyBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_changepubkey_new,
        _UniffiConverterTypeChangePubKeyBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_changepubkey, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_get_signature,self._pointer,)
        )






    def is_onchain(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_onchain,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_changepubkey_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeChangePubKey:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, ChangePubKey):
            raise TypeError("Expected ChangePubKey instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return ChangePubKey._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Contract:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "ContractBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_contract_new,
        _UniffiConverterTypeContractBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_contract, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_contract(self, zklink_signer: "ZkLinkSigner") -> "Contract":
        
        return _UniffiConverterTypeContract.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_contract_create_signed_contract,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(zklink_signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contract_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contract_get_signature,self._pointer,)
        )






    def is_long(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_long,self._pointer,)
        )






    def is_short(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_short,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contract_is_signature_valid,self._pointer,)
        )






class _UniffiConverterTypeContract:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Contract):
            raise TypeError("Expected Contract instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Contract._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class ContractMatching:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "ContractMatchingBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_contractmatching_new,
        _UniffiConverterTypeContractMatchingBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_contractmatching, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "ContractMatching":
        
        return _UniffiConverterTypeContractMatching.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_contractmatching_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeContractMatching:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, ContractMatching):
            raise TypeError("Expected ContractMatching instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return ContractMatching._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Deposit:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "DepositBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_deposit_new,
        _UniffiConverterTypeDepositBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_deposit, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_get_bytes,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_json_str,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_deposit_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeDeposit:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Deposit):
            raise TypeError("Expected Deposit instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Deposit._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class EthSigner:
    _pointer: ctypes.c_void_p
    def __init__(self, private_key: "str"):
        
        self._pointer = _rust_call_with_error(_UniffiConverterTypeEthSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_ethsigner_new,
        _UniffiConverterString.lower(private_key))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_ethsigner, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def get_address(self, ) -> "Address":
        return _UniffiConverterTypeAddress.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ethsigner_get_address,self._pointer,)
        )






    def sign_message(self, message: "typing.List[int]") -> "PackedEthSignature":
        
        return _UniffiConverterTypePackedEthSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeEthSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_ethsigner_sign_message,self._pointer,
        _UniffiConverterSequenceUInt8.lower(message))
        )






class _UniffiConverterTypeEthSigner:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, EthSigner):
            raise TypeError("Expected EthSigner instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return EthSigner._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class ForcedExit:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "ForcedExitBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_forcedexit_new,
        _UniffiConverterTypeForcedExitBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_forcedexit, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "ForcedExit":
        
        return _UniffiConverterTypeForcedExit.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_forcedexit_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeForcedExit:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, ForcedExit):
            raise TypeError("Expected ForcedExit instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return ForcedExit._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class FullExit:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "FullExitBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_fullexit_new,
        _UniffiConverterTypeFullExitBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_fullexit, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_get_bytes,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_fullexit_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeFullExit:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, FullExit):
            raise TypeError("Expected FullExit instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return FullExit._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Funding:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "FundingBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_funding_new,
        _UniffiConverterTypeFundingBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_funding, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "Funding":
        
        return _UniffiConverterTypeFunding.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_funding_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_funding_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeFunding:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Funding):
            raise TypeError("Expected Funding instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Funding._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Liquidation:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "LiquidationBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_liquidation_new,
        _UniffiConverterTypeLiquidationBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_liquidation, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "Liquidation":
        
        return _UniffiConverterTypeLiquidation.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_liquidation_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeLiquidation:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Liquidation):
            raise TypeError("Expected Liquidation instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Liquidation._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Order:
    _pointer: ctypes.c_void_p
    def __init__(self, account_id: "AccountId",sub_account_id: "SubAccountId",slot_id: "SlotId",nonce: "Nonce",base_token_id: "TokenId",quote_token_id: "TokenId",amount: "BigUint",price: "BigUint",is_sell: "bool",has_subsidy: "bool",maker_fee_rate: "int",taker_fee_rate: "int",signature: "typing.Optional[ZkLinkSignature]"):
        
        
        
        
        
        
        
        
        
        
        
        
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_order_new,
        _UniffiConverterTypeAccountId.lower(account_id),
        _UniffiConverterTypeSubAccountId.lower(sub_account_id),
        _UniffiConverterTypeSlotId.lower(slot_id),
        _UniffiConverterTypeNonce.lower(nonce),
        _UniffiConverterTypeTokenId.lower(base_token_id),
        _UniffiConverterTypeTokenId.lower(quote_token_id),
        _UniffiConverterTypeBigUint.lower(amount),
        _UniffiConverterTypeBigUint.lower(price),
        _UniffiConverterBool.lower(is_sell),
        _UniffiConverterBool.lower(has_subsidy),
        _UniffiConverterUInt8.lower(maker_fee_rate),
        _UniffiConverterUInt8.lower(taker_fee_rate),
        _UniffiConverterOptionalTypeZkLinkSignature.lower(signature))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_order, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_order(self, zklink_signer: "ZkLinkSigner") -> "Order":
        
        return _UniffiConverterTypeOrder.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_order_create_signed_order,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(zklink_signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_bytes,self._pointer,)
        )






    def get_eth_sign_msg(self, quote_token: "str",based_token: "str",decimals: "int") -> "str":
        
        
        
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_eth_sign_msg,self._pointer,
        _UniffiConverterString.lower(quote_token),
        _UniffiConverterString.lower(based_token),
        _UniffiConverterUInt8.lower(decimals))
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_order_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_order_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_order_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_order_json_str,self._pointer,)
        )






class _UniffiConverterTypeOrder:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Order):
            raise TypeError("Expected Order instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Order._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class OrderMatching:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "OrderMatchingBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_ordermatching_new,
        _UniffiConverterTypeOrderMatchingBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_ordermatching, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "OrderMatching":
        
        return _UniffiConverterTypeOrderMatching.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_get_bytes,self._pointer,)
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_ordermatching_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeOrderMatching:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, OrderMatching):
            raise TypeError("Expected OrderMatching instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return OrderMatching._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Signer:
    _pointer: ctypes.c_void_p
    def __init__(self, private_key: "str",l1_type: "L1SignerType"):
        
        
        self._pointer = _rust_call_with_error(_UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_signer_new,
        _UniffiConverterString.lower(private_key),
        _UniffiConverterTypeL1SignerType.lower(l1_type))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_signer, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def sign_auto_deleveraging(self, tx: "AutoDeleveraging") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_auto_deleveraging,self._pointer,
        _UniffiConverterTypeAutoDeleveraging.lower(tx))
        )






    def sign_change_pubkey_with_create2data_auth(self, tx: "ChangePubKey",crate2data: "Create2Data") -> "TxSignature":
        
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_create2data_auth,self._pointer,
        _UniffiConverterTypeChangePubKey.lower(tx),
        _UniffiConverterTypeCreate2Data.lower(crate2data))
        )






    def sign_change_pubkey_with_eth_ecdsa_auth(self, tx: "ChangePubKey") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_eth_ecdsa_auth,self._pointer,
        _UniffiConverterTypeChangePubKey.lower(tx))
        )






    def sign_change_pubkey_with_onchain_auth_data(self, tx: "ChangePubKey") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_change_pubkey_with_onchain_auth_data,self._pointer,
        _UniffiConverterTypeChangePubKey.lower(tx))
        )






    def sign_contract_matching(self, tx: "ContractMatching") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_contract_matching,self._pointer,
        _UniffiConverterTypeContractMatching.lower(tx))
        )






    def sign_forced_exit(self, tx: "ForcedExit") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_forced_exit,self._pointer,
        _UniffiConverterTypeForcedExit.lower(tx))
        )






    def sign_funding(self, tx: "Funding") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_funding,self._pointer,
        _UniffiConverterTypeFunding.lower(tx))
        )






    def sign_liquidation(self, tx: "Liquidation") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_liquidation,self._pointer,
        _UniffiConverterTypeLiquidation.lower(tx))
        )






    def sign_order_matching(self, tx: "OrderMatching") -> "TxSignature":
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_order_matching,self._pointer,
        _UniffiConverterTypeOrderMatching.lower(tx))
        )






    def sign_transfer(self, tx: "Transfer",token_sybmol: "str",chain_id: "typing.Optional[str]",addr: "typing.Optional[str]") -> "TxSignature":
        
        
        
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_transfer,self._pointer,
        _UniffiConverterTypeTransfer.lower(tx),
        _UniffiConverterString.lower(token_sybmol),
        _UniffiConverterOptionalString.lower(chain_id),
        _UniffiConverterOptionalString.lower(addr))
        )






    def sign_withdraw(self, tx: "Withdraw",l2_source_token_symbol: "str",chain_id: "typing.Optional[str]",addr: "typing.Optional[str]") -> "TxSignature":
        
        
        
        
        return _UniffiConverterTypeTxSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_method_signer_sign_withdraw,self._pointer,
        _UniffiConverterTypeWithdraw.lower(tx),
        _UniffiConverterString.lower(l2_source_token_symbol),
        _UniffiConverterOptionalString.lower(chain_id),
        _UniffiConverterOptionalString.lower(addr))
        )






class _UniffiConverterTypeSigner:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Signer):
            raise TypeError("Expected Signer instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Signer._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class StarkSigner:
    _pointer: ctypes.c_void_p
    def __init__(self, ):
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_starksigner_new,)

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_starksigner, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst

    @classmethod
    def new_from_hex_str(cls, hex_str: "str"):
        
        # Call the (fallible) function before creating any half-baked object instances.
        pointer = _rust_call_with_error(_UniffiConverterTypeStarkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_starksigner_new_from_hex_str,
        _UniffiConverterString.lower(hex_str))
        return cls._make_instance_(pointer)



    def sign_message(self, typed_data: "TypedData",addr: "str") -> "StarkEip712Signature":
        
        
        return _UniffiConverterTypeStarkEip712Signature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeStarkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_starksigner_sign_message,self._pointer,
        _UniffiConverterTypeTypedData.lower(typed_data),
        _UniffiConverterString.lower(addr))
        )






class _UniffiConverterTypeStarkSigner:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, StarkSigner):
            raise TypeError("Expected StarkSigner instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return StarkSigner._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Transfer:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "TransferBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_transfer_new,
        _UniffiConverterTypeTransferBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_transfer, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "Transfer":
        
        return _UniffiConverterTypeTransfer.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def eth_signature(self, eth_signer: "EthSigner",token_symbol: "str") -> "TxLayer1Signature":
        
        
        return _UniffiConverterTypeTxLayer1Signature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_eth_signature,self._pointer,
        _UniffiConverterTypeEthSigner.lower(eth_signer),
        _UniffiConverterString.lower(token_symbol))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_bytes,self._pointer,)
        )






    def get_eth_sign_msg(self, token_symbol: "str") -> "str":
        
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_eth_sign_msg,self._pointer,
        _UniffiConverterString.lower(token_symbol))
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_transfer_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeTransfer:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Transfer):
            raise TypeError("Expected Transfer instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Transfer._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class TypedData:
    _pointer: ctypes.c_void_p
    def __init__(self, message: "TypedDataMessage",chain_id: "str"):
        
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_typeddata_new,
        _UniffiConverterTypeTypedDataMessage.lower(message),
        _UniffiConverterString.lower(chain_id))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_typeddata, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


class _UniffiConverterTypeTypedData:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, TypedData):
            raise TypeError("Expected TypedData instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return TypedData._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class UpdateGlobalVar:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "UpdateGlobalVarBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_updateglobalvar_new,
        _UniffiConverterTypeUpdateGlobalVarBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_updateglobalvar, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_get_bytes,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_updateglobalvar_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeUpdateGlobalVar:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, UpdateGlobalVar):
            raise TypeError("Expected UpdateGlobalVar instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return UpdateGlobalVar._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class Withdraw:
    _pointer: ctypes.c_void_p
    def __init__(self, builder: "WithdrawBuilder"):
        
        self._pointer = _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_constructor_withdraw_new,
        _UniffiConverterTypeWithdrawBuilder.lower(builder))

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_withdraw, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst


    def create_signed_tx(self, signer: "ZkLinkSigner") -> "Withdraw":
        
        return _UniffiConverterTypeWithdraw.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_create_signed_tx,self._pointer,
        _UniffiConverterTypeZkLinkSigner.lower(signer))
        )






    def eth_signature(self, eth_signer: "EthSigner",l2_source_token_symbol: "str") -> "PackedEthSignature":
        
        
        return _UniffiConverterTypePackedEthSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_eth_signature,self._pointer,
        _UniffiConverterTypeEthSigner.lower(eth_signer),
        _UniffiConverterString.lower(l2_source_token_symbol))
        )






    def get_bytes(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_bytes,self._pointer,)
        )






    def get_eth_sign_msg(self, token_symbol: "str") -> "str":
        
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_eth_sign_msg,self._pointer,
        _UniffiConverterString.lower(token_symbol))
        )






    def get_signature(self, ) -> "ZkLinkSignature":
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_get_signature,self._pointer,)
        )






    def is_signature_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_is_signature_valid,self._pointer,)
        )






    def is_valid(self, ) -> "bool":
        return _UniffiConverterBool.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_is_valid,self._pointer,)
        )






    def json_str(self, ) -> "str":
        return _UniffiConverterString.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_json_str,self._pointer,)
        )






    def to_zklink_tx(self, ) -> "ZkLinkTx":
        return _UniffiConverterTypeZkLinkTx.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_to_zklink_tx,self._pointer,)
        )






    def tx_hash(self, ) -> "typing.List[int]":
        return _UniffiConverterSequenceUInt8.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_withdraw_tx_hash,self._pointer,)
        )






class _UniffiConverterTypeWithdraw:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, Withdraw):
            raise TypeError("Expected Withdraw instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return Withdraw._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer



class ZkLinkSigner:
    _pointer: ctypes.c_void_p
    def __init__(self, ):
        self._pointer = _rust_call_with_error(_UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new,)

    def __del__(self):
        # In case of partial initialization of instances.
        pointer = getattr(self, "_pointer", None)
        if pointer is not None:
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_free_zklinksigner, pointer)

    # Used by alternative constructors or any methods which return this type.
    @classmethod
    def _make_instance_(cls, pointer):
        # Lightly yucky way to bypass the usual __init__ logic
        # and just create a new instance with the required pointer.
        inst = cls.__new__(cls)
        inst._pointer = pointer
        return inst

    @classmethod
    def new_from_bytes(cls, slice: "typing.List[int]"):
        
        # Call the (fallible) function before creating any half-baked object instances.
        pointer = _rust_call_with_error(_UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_bytes,
        _UniffiConverterSequenceUInt8.lower(slice))
        return cls._make_instance_(pointer)


    @classmethod
    def new_from_hex_eth_signer(cls, eth_hex_private_key: "str"):
        
        # Call the (fallible) function before creating any half-baked object instances.
        pointer = _rust_call_with_error(_UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_hex_eth_signer,
        _UniffiConverterString.lower(eth_hex_private_key))
        return cls._make_instance_(pointer)


    @classmethod
    def new_from_hex_stark_signer(cls, hex_private_key: "str",addr: "str",chain_id: "str"):
        
        
        
        # Call the (fallible) function before creating any half-baked object instances.
        pointer = _rust_call_with_error(_UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_hex_stark_signer,
        _UniffiConverterString.lower(hex_private_key),
        _UniffiConverterString.lower(addr),
        _UniffiConverterString.lower(chain_id))
        return cls._make_instance_(pointer)


    @classmethod
    def new_from_seed(cls, seed: "typing.List[int]"):
        
        # Call the (fallible) function before creating any half-baked object instances.
        pointer = _rust_call_with_error(_UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_constructor_zklinksigner_new_from_seed,
        _UniffiConverterSequenceUInt8.lower(seed))
        return cls._make_instance_(pointer)



    def public_key(self, ) -> "PackedPublicKey":
        return _UniffiConverterTypePackedPublicKey.lift(
            _rust_call(_UniffiLib.uniffi_zklink_sdk_fn_method_zklinksigner_public_key,self._pointer,)
        )






    def sign_musig(self, msg: "typing.List[int]") -> "ZkLinkSignature":
        
        return _UniffiConverterTypeZkLinkSignature.lift(
            _rust_call_with_error(
    _UniffiConverterTypeZkSignerError,_UniffiLib.uniffi_zklink_sdk_fn_method_zklinksigner_sign_musig,self._pointer,
        _UniffiConverterSequenceUInt8.lower(msg))
        )






class _UniffiConverterTypeZkLinkSigner:
    @classmethod
    def read(cls, buf):
        ptr = buf.read_u64()
        if ptr == 0:
            raise InternalError("Raw pointer value was null")
        return cls.lift(ptr)

    @classmethod
    def write(cls, value, buf):
        if not isinstance(value, ZkLinkSigner):
            raise TypeError("Expected ZkLinkSigner instance, {} found".format(type(value).__name__))
        buf.write_u64(cls.lower(value))

    @staticmethod
    def lift(value):
        return ZkLinkSigner._make_instance_(value)

    @staticmethod
    def lower(value):
        return value._pointer


class AutoDeleveragingBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";sub_account_nonce: "Nonce";contract_prices: "typing.List[ContractPrice]";margin_prices: "typing.List[SpotPriceInfo]";adl_account_id: "AccountId";pair_id: "PairId";adl_size: "BigUint";adl_price: "BigUint";fee: "BigUint";fee_token: "TokenId";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", sub_account_nonce: "Nonce", contract_prices: "typing.List[ContractPrice]", margin_prices: "typing.List[SpotPriceInfo]", adl_account_id: "AccountId", pair_id: "PairId", adl_size: "BigUint", adl_price: "BigUint", fee: "BigUint", fee_token: "TokenId"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.sub_account_nonce = sub_account_nonce
        self.contract_prices = contract_prices
        self.margin_prices = margin_prices
        self.adl_account_id = adl_account_id
        self.pair_id = pair_id
        self.adl_size = adl_size
        self.adl_price = adl_price
        self.fee = fee
        self.fee_token = fee_token

    def __str__(self):
        return "AutoDeleveragingBuilder(account_id={}, sub_account_id={}, sub_account_nonce={}, contract_prices={}, margin_prices={}, adl_account_id={}, pair_id={}, adl_size={}, adl_price={}, fee={}, fee_token={})".format(self.account_id, self.sub_account_id, self.sub_account_nonce, self.contract_prices, self.margin_prices, self.adl_account_id, self.pair_id, self.adl_size, self.adl_price, self.fee, self.fee_token)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.sub_account_nonce != other.sub_account_nonce:
            return False
        if self.contract_prices != other.contract_prices:
            return False
        if self.margin_prices != other.margin_prices:
            return False
        if self.adl_account_id != other.adl_account_id:
            return False
        if self.pair_id != other.pair_id:
            return False
        if self.adl_size != other.adl_size:
            return False
        if self.adl_price != other.adl_price:
            return False
        if self.fee != other.fee:
            return False
        if self.fee_token != other.fee_token:
            return False
        return True

class _UniffiConverterTypeAutoDeleveragingBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return AutoDeleveragingBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            sub_account_nonce=_UniffiConverterTypeNonce.read(buf),
            contract_prices=_UniffiConverterSequenceTypeContractPrice.read(buf),
            margin_prices=_UniffiConverterSequenceTypeSpotPriceInfo.read(buf),
            adl_account_id=_UniffiConverterTypeAccountId.read(buf),
            pair_id=_UniffiConverterTypePairId.read(buf),
            adl_size=_UniffiConverterTypeBigUint.read(buf),
            adl_price=_UniffiConverterTypeBigUint.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            fee_token=_UniffiConverterTypeTokenId.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeNonce.write(value.sub_account_nonce, buf)
        _UniffiConverterSequenceTypeContractPrice.write(value.contract_prices, buf)
        _UniffiConverterSequenceTypeSpotPriceInfo.write(value.margin_prices, buf)
        _UniffiConverterTypeAccountId.write(value.adl_account_id, buf)
        _UniffiConverterTypePairId.write(value.pair_id, buf)
        _UniffiConverterTypeBigUint.write(value.adl_size, buf)
        _UniffiConverterTypeBigUint.write(value.adl_price, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeTokenId.write(value.fee_token, buf)


class ChangePubKeyBuilder:
    chain_id: "ChainId";account_id: "AccountId";sub_account_id: "SubAccountId";new_pubkey_hash: "PubKeyHash";fee_token: "TokenId";fee: "BigUint";nonce: "Nonce";eth_signature: "typing.Optional[PackedEthSignature]";timestamp: "TimeStamp";

    @typing.no_type_check
    def __init__(self, chain_id: "ChainId", account_id: "AccountId", sub_account_id: "SubAccountId", new_pubkey_hash: "PubKeyHash", fee_token: "TokenId", fee: "BigUint", nonce: "Nonce", eth_signature: "typing.Optional[PackedEthSignature]", timestamp: "TimeStamp"):
        self.chain_id = chain_id
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.new_pubkey_hash = new_pubkey_hash
        self.fee_token = fee_token
        self.fee = fee
        self.nonce = nonce
        self.eth_signature = eth_signature
        self.timestamp = timestamp

    def __str__(self):
        return "ChangePubKeyBuilder(chain_id={}, account_id={}, sub_account_id={}, new_pubkey_hash={}, fee_token={}, fee={}, nonce={}, eth_signature={}, timestamp={})".format(self.chain_id, self.account_id, self.sub_account_id, self.new_pubkey_hash, self.fee_token, self.fee, self.nonce, self.eth_signature, self.timestamp)

    def __eq__(self, other):
        if self.chain_id != other.chain_id:
            return False
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.new_pubkey_hash != other.new_pubkey_hash:
            return False
        if self.fee_token != other.fee_token:
            return False
        if self.fee != other.fee:
            return False
        if self.nonce != other.nonce:
            return False
        if self.eth_signature != other.eth_signature:
            return False
        if self.timestamp != other.timestamp:
            return False
        return True

class _UniffiConverterTypeChangePubKeyBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return ChangePubKeyBuilder(
            chain_id=_UniffiConverterTypeChainId.read(buf),
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            new_pubkey_hash=_UniffiConverterTypePubKeyHash.read(buf),
            fee_token=_UniffiConverterTypeTokenId.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            nonce=_UniffiConverterTypeNonce.read(buf),
            eth_signature=_UniffiConverterOptionalTypePackedEthSignature.read(buf),
            timestamp=_UniffiConverterTypeTimeStamp.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeChainId.write(value.chain_id, buf)
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypePubKeyHash.write(value.new_pubkey_hash, buf)
        _UniffiConverterTypeTokenId.write(value.fee_token, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeNonce.write(value.nonce, buf)
        _UniffiConverterOptionalTypePackedEthSignature.write(value.eth_signature, buf)
        _UniffiConverterTypeTimeStamp.write(value.timestamp, buf)


class ContractBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";slot_id: "SlotId";nonce: "Nonce";pair_id: "PairId";size: "BigUint";price: "BigUint";direction: "bool";taker_fee_rate: "int";maker_fee_rate: "int";has_subsidy: "bool";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", slot_id: "SlotId", nonce: "Nonce", pair_id: "PairId", size: "BigUint", price: "BigUint", direction: "bool", taker_fee_rate: "int", maker_fee_rate: "int", has_subsidy: "bool"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.slot_id = slot_id
        self.nonce = nonce
        self.pair_id = pair_id
        self.size = size
        self.price = price
        self.direction = direction
        self.taker_fee_rate = taker_fee_rate
        self.maker_fee_rate = maker_fee_rate
        self.has_subsidy = has_subsidy

    def __str__(self):
        return "ContractBuilder(account_id={}, sub_account_id={}, slot_id={}, nonce={}, pair_id={}, size={}, price={}, direction={}, taker_fee_rate={}, maker_fee_rate={}, has_subsidy={})".format(self.account_id, self.sub_account_id, self.slot_id, self.nonce, self.pair_id, self.size, self.price, self.direction, self.taker_fee_rate, self.maker_fee_rate, self.has_subsidy)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.slot_id != other.slot_id:
            return False
        if self.nonce != other.nonce:
            return False
        if self.pair_id != other.pair_id:
            return False
        if self.size != other.size:
            return False
        if self.price != other.price:
            return False
        if self.direction != other.direction:
            return False
        if self.taker_fee_rate != other.taker_fee_rate:
            return False
        if self.maker_fee_rate != other.maker_fee_rate:
            return False
        if self.has_subsidy != other.has_subsidy:
            return False
        return True

class _UniffiConverterTypeContractBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return ContractBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            slot_id=_UniffiConverterTypeSlotId.read(buf),
            nonce=_UniffiConverterTypeNonce.read(buf),
            pair_id=_UniffiConverterTypePairId.read(buf),
            size=_UniffiConverterTypeBigUint.read(buf),
            price=_UniffiConverterTypeBigUint.read(buf),
            direction=_UniffiConverterBool.read(buf),
            taker_fee_rate=_UniffiConverterUInt8.read(buf),
            maker_fee_rate=_UniffiConverterUInt8.read(buf),
            has_subsidy=_UniffiConverterBool.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeSlotId.write(value.slot_id, buf)
        _UniffiConverterTypeNonce.write(value.nonce, buf)
        _UniffiConverterTypePairId.write(value.pair_id, buf)
        _UniffiConverterTypeBigUint.write(value.size, buf)
        _UniffiConverterTypeBigUint.write(value.price, buf)
        _UniffiConverterBool.write(value.direction, buf)
        _UniffiConverterUInt8.write(value.taker_fee_rate, buf)
        _UniffiConverterUInt8.write(value.maker_fee_rate, buf)
        _UniffiConverterBool.write(value.has_subsidy, buf)


class ContractMatchingBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";taker: "Contract";maker: "typing.List[Contract]";fee: "BigUint";fee_token: "TokenId";contract_prices: "typing.List[ContractPrice]";margin_prices: "typing.List[SpotPriceInfo]";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", taker: "Contract", maker: "typing.List[Contract]", fee: "BigUint", fee_token: "TokenId", contract_prices: "typing.List[ContractPrice]", margin_prices: "typing.List[SpotPriceInfo]"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.taker = taker
        self.maker = maker
        self.fee = fee
        self.fee_token = fee_token
        self.contract_prices = contract_prices
        self.margin_prices = margin_prices

    def __str__(self):
        return "ContractMatchingBuilder(account_id={}, sub_account_id={}, taker={}, maker={}, fee={}, fee_token={}, contract_prices={}, margin_prices={})".format(self.account_id, self.sub_account_id, self.taker, self.maker, self.fee, self.fee_token, self.contract_prices, self.margin_prices)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.taker != other.taker:
            return False
        if self.maker != other.maker:
            return False
        if self.fee != other.fee:
            return False
        if self.fee_token != other.fee_token:
            return False
        if self.contract_prices != other.contract_prices:
            return False
        if self.margin_prices != other.margin_prices:
            return False
        return True

class _UniffiConverterTypeContractMatchingBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return ContractMatchingBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            taker=_UniffiConverterTypeContract.read(buf),
            maker=_UniffiConverterSequenceTypeContract.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            fee_token=_UniffiConverterTypeTokenId.read(buf),
            contract_prices=_UniffiConverterSequenceTypeContractPrice.read(buf),
            margin_prices=_UniffiConverterSequenceTypeSpotPriceInfo.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeContract.write(value.taker, buf)
        _UniffiConverterSequenceTypeContract.write(value.maker, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeTokenId.write(value.fee_token, buf)
        _UniffiConverterSequenceTypeContractPrice.write(value.contract_prices, buf)
        _UniffiConverterSequenceTypeSpotPriceInfo.write(value.margin_prices, buf)


class ContractPrice:
    pair_id: "PairId";market_price: "BigUint";

    @typing.no_type_check
    def __init__(self, pair_id: "PairId", market_price: "BigUint"):
        self.pair_id = pair_id
        self.market_price = market_price

    def __str__(self):
        return "ContractPrice(pair_id={}, market_price={})".format(self.pair_id, self.market_price)

    def __eq__(self, other):
        if self.pair_id != other.pair_id:
            return False
        if self.market_price != other.market_price:
            return False
        return True

class _UniffiConverterTypeContractPrice(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return ContractPrice(
            pair_id=_UniffiConverterTypePairId.read(buf),
            market_price=_UniffiConverterTypeBigUint.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypePairId.write(value.pair_id, buf)
        _UniffiConverterTypeBigUint.write(value.market_price, buf)


class Create2Data:
    creator_address: "ZkLinkAddress";salt_arg: "H256";code_hash: "H256";

    @typing.no_type_check
    def __init__(self, creator_address: "ZkLinkAddress", salt_arg: "H256", code_hash: "H256"):
        self.creator_address = creator_address
        self.salt_arg = salt_arg
        self.code_hash = code_hash

    def __str__(self):
        return "Create2Data(creator_address={}, salt_arg={}, code_hash={})".format(self.creator_address, self.salt_arg, self.code_hash)

    def __eq__(self, other):
        if self.creator_address != other.creator_address:
            return False
        if self.salt_arg != other.salt_arg:
            return False
        if self.code_hash != other.code_hash:
            return False
        return True

class _UniffiConverterTypeCreate2Data(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return Create2Data(
            creator_address=_UniffiConverterTypeZkLinkAddress.read(buf),
            salt_arg=_UniffiConverterTypeH256.read(buf),
            code_hash=_UniffiConverterTypeH256.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeZkLinkAddress.write(value.creator_address, buf)
        _UniffiConverterTypeH256.write(value.salt_arg, buf)
        _UniffiConverterTypeH256.write(value.code_hash, buf)


class DepositBuilder:
    from_address: "ZkLinkAddress";to_address: "ZkLinkAddress";from_chain_id: "ChainId";sub_account_id: "SubAccountId";l2_target_token: "TokenId";l1_source_token: "TokenId";amount: "BigUint";serial_id: "int";l2_hash: "H256";eth_hash: "typing.Optional[H256]";

    @typing.no_type_check
    def __init__(self, from_address: "ZkLinkAddress", to_address: "ZkLinkAddress", from_chain_id: "ChainId", sub_account_id: "SubAccountId", l2_target_token: "TokenId", l1_source_token: "TokenId", amount: "BigUint", serial_id: "int", l2_hash: "H256", eth_hash: "typing.Optional[H256]"):
        self.from_address = from_address
        self.to_address = to_address
        self.from_chain_id = from_chain_id
        self.sub_account_id = sub_account_id
        self.l2_target_token = l2_target_token
        self.l1_source_token = l1_source_token
        self.amount = amount
        self.serial_id = serial_id
        self.l2_hash = l2_hash
        self.eth_hash = eth_hash

    def __str__(self):
        return "DepositBuilder(from_address={}, to_address={}, from_chain_id={}, sub_account_id={}, l2_target_token={}, l1_source_token={}, amount={}, serial_id={}, l2_hash={}, eth_hash={})".format(self.from_address, self.to_address, self.from_chain_id, self.sub_account_id, self.l2_target_token, self.l1_source_token, self.amount, self.serial_id, self.l2_hash, self.eth_hash)

    def __eq__(self, other):
        if self.from_address != other.from_address:
            return False
        if self.to_address != other.to_address:
            return False
        if self.from_chain_id != other.from_chain_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.l2_target_token != other.l2_target_token:
            return False
        if self.l1_source_token != other.l1_source_token:
            return False
        if self.amount != other.amount:
            return False
        if self.serial_id != other.serial_id:
            return False
        if self.l2_hash != other.l2_hash:
            return False
        if self.eth_hash != other.eth_hash:
            return False
        return True

class _UniffiConverterTypeDepositBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return DepositBuilder(
            from_address=_UniffiConverterTypeZkLinkAddress.read(buf),
            to_address=_UniffiConverterTypeZkLinkAddress.read(buf),
            from_chain_id=_UniffiConverterTypeChainId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            l2_target_token=_UniffiConverterTypeTokenId.read(buf),
            l1_source_token=_UniffiConverterTypeTokenId.read(buf),
            amount=_UniffiConverterTypeBigUint.read(buf),
            serial_id=_UniffiConverterUInt64.read(buf),
            l2_hash=_UniffiConverterTypeH256.read(buf),
            eth_hash=_UniffiConverterOptionalTypeH256.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeZkLinkAddress.write(value.from_address, buf)
        _UniffiConverterTypeZkLinkAddress.write(value.to_address, buf)
        _UniffiConverterTypeChainId.write(value.from_chain_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeTokenId.write(value.l2_target_token, buf)
        _UniffiConverterTypeTokenId.write(value.l1_source_token, buf)
        _UniffiConverterTypeBigUint.write(value.amount, buf)
        _UniffiConverterUInt64.write(value.serial_id, buf)
        _UniffiConverterTypeH256.write(value.l2_hash, buf)
        _UniffiConverterOptionalTypeH256.write(value.eth_hash, buf)


class ForcedExitBuilder:
    to_chain_id: "ChainId";initiator_account_id: "AccountId";initiator_sub_account_id: "SubAccountId";target: "ZkLinkAddress";target_sub_account_id: "SubAccountId";l2_source_token: "TokenId";l1_target_token: "TokenId";initiator_nonce: "Nonce";exit_amount: "BigUint";withdraw_to_l1: "bool";timestamp: "TimeStamp";

    @typing.no_type_check
    def __init__(self, to_chain_id: "ChainId", initiator_account_id: "AccountId", initiator_sub_account_id: "SubAccountId", target: "ZkLinkAddress", target_sub_account_id: "SubAccountId", l2_source_token: "TokenId", l1_target_token: "TokenId", initiator_nonce: "Nonce", exit_amount: "BigUint", withdraw_to_l1: "bool", timestamp: "TimeStamp"):
        self.to_chain_id = to_chain_id
        self.initiator_account_id = initiator_account_id
        self.initiator_sub_account_id = initiator_sub_account_id
        self.target = target
        self.target_sub_account_id = target_sub_account_id
        self.l2_source_token = l2_source_token
        self.l1_target_token = l1_target_token
        self.initiator_nonce = initiator_nonce
        self.exit_amount = exit_amount
        self.withdraw_to_l1 = withdraw_to_l1
        self.timestamp = timestamp

    def __str__(self):
        return "ForcedExitBuilder(to_chain_id={}, initiator_account_id={}, initiator_sub_account_id={}, target={}, target_sub_account_id={}, l2_source_token={}, l1_target_token={}, initiator_nonce={}, exit_amount={}, withdraw_to_l1={}, timestamp={})".format(self.to_chain_id, self.initiator_account_id, self.initiator_sub_account_id, self.target, self.target_sub_account_id, self.l2_source_token, self.l1_target_token, self.initiator_nonce, self.exit_amount, self.withdraw_to_l1, self.timestamp)

    def __eq__(self, other):
        if self.to_chain_id != other.to_chain_id:
            return False
        if self.initiator_account_id != other.initiator_account_id:
            return False
        if self.initiator_sub_account_id != other.initiator_sub_account_id:
            return False
        if self.target != other.target:
            return False
        if self.target_sub_account_id != other.target_sub_account_id:
            return False
        if self.l2_source_token != other.l2_source_token:
            return False
        if self.l1_target_token != other.l1_target_token:
            return False
        if self.initiator_nonce != other.initiator_nonce:
            return False
        if self.exit_amount != other.exit_amount:
            return False
        if self.withdraw_to_l1 != other.withdraw_to_l1:
            return False
        if self.timestamp != other.timestamp:
            return False
        return True

class _UniffiConverterTypeForcedExitBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return ForcedExitBuilder(
            to_chain_id=_UniffiConverterTypeChainId.read(buf),
            initiator_account_id=_UniffiConverterTypeAccountId.read(buf),
            initiator_sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            target=_UniffiConverterTypeZkLinkAddress.read(buf),
            target_sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            l2_source_token=_UniffiConverterTypeTokenId.read(buf),
            l1_target_token=_UniffiConverterTypeTokenId.read(buf),
            initiator_nonce=_UniffiConverterTypeNonce.read(buf),
            exit_amount=_UniffiConverterTypeBigUint.read(buf),
            withdraw_to_l1=_UniffiConverterBool.read(buf),
            timestamp=_UniffiConverterTypeTimeStamp.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeChainId.write(value.to_chain_id, buf)
        _UniffiConverterTypeAccountId.write(value.initiator_account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.initiator_sub_account_id, buf)
        _UniffiConverterTypeZkLinkAddress.write(value.target, buf)
        _UniffiConverterTypeSubAccountId.write(value.target_sub_account_id, buf)
        _UniffiConverterTypeTokenId.write(value.l2_source_token, buf)
        _UniffiConverterTypeTokenId.write(value.l1_target_token, buf)
        _UniffiConverterTypeNonce.write(value.initiator_nonce, buf)
        _UniffiConverterTypeBigUint.write(value.exit_amount, buf)
        _UniffiConverterBool.write(value.withdraw_to_l1, buf)
        _UniffiConverterTypeTimeStamp.write(value.timestamp, buf)


class FullExitBuilder:
    to_chain_id: "ChainId";account_id: "AccountId";sub_account_id: "SubAccountId";exit_address: "ZkLinkAddress";l2_source_token: "TokenId";l1_target_token: "TokenId";contract_prices: "typing.List[ContractPrice]";margin_prices: "typing.List[SpotPriceInfo]";serial_id: "int";l2_hash: "H256";

    @typing.no_type_check
    def __init__(self, to_chain_id: "ChainId", account_id: "AccountId", sub_account_id: "SubAccountId", exit_address: "ZkLinkAddress", l2_source_token: "TokenId", l1_target_token: "TokenId", contract_prices: "typing.List[ContractPrice]", margin_prices: "typing.List[SpotPriceInfo]", serial_id: "int", l2_hash: "H256"):
        self.to_chain_id = to_chain_id
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.exit_address = exit_address
        self.l2_source_token = l2_source_token
        self.l1_target_token = l1_target_token
        self.contract_prices = contract_prices
        self.margin_prices = margin_prices
        self.serial_id = serial_id
        self.l2_hash = l2_hash

    def __str__(self):
        return "FullExitBuilder(to_chain_id={}, account_id={}, sub_account_id={}, exit_address={}, l2_source_token={}, l1_target_token={}, contract_prices={}, margin_prices={}, serial_id={}, l2_hash={})".format(self.to_chain_id, self.account_id, self.sub_account_id, self.exit_address, self.l2_source_token, self.l1_target_token, self.contract_prices, self.margin_prices, self.serial_id, self.l2_hash)

    def __eq__(self, other):
        if self.to_chain_id != other.to_chain_id:
            return False
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.exit_address != other.exit_address:
            return False
        if self.l2_source_token != other.l2_source_token:
            return False
        if self.l1_target_token != other.l1_target_token:
            return False
        if self.contract_prices != other.contract_prices:
            return False
        if self.margin_prices != other.margin_prices:
            return False
        if self.serial_id != other.serial_id:
            return False
        if self.l2_hash != other.l2_hash:
            return False
        return True

class _UniffiConverterTypeFullExitBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return FullExitBuilder(
            to_chain_id=_UniffiConverterTypeChainId.read(buf),
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            exit_address=_UniffiConverterTypeZkLinkAddress.read(buf),
            l2_source_token=_UniffiConverterTypeTokenId.read(buf),
            l1_target_token=_UniffiConverterTypeTokenId.read(buf),
            contract_prices=_UniffiConverterSequenceTypeContractPrice.read(buf),
            margin_prices=_UniffiConverterSequenceTypeSpotPriceInfo.read(buf),
            serial_id=_UniffiConverterUInt64.read(buf),
            l2_hash=_UniffiConverterTypeH256.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeChainId.write(value.to_chain_id, buf)
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeZkLinkAddress.write(value.exit_address, buf)
        _UniffiConverterTypeTokenId.write(value.l2_source_token, buf)
        _UniffiConverterTypeTokenId.write(value.l1_target_token, buf)
        _UniffiConverterSequenceTypeContractPrice.write(value.contract_prices, buf)
        _UniffiConverterSequenceTypeSpotPriceInfo.write(value.margin_prices, buf)
        _UniffiConverterUInt64.write(value.serial_id, buf)
        _UniffiConverterTypeH256.write(value.l2_hash, buf)


class FundingBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";sub_account_nonce: "Nonce";funding_account_ids: "typing.List[AccountId]";fee: "BigUint";fee_token: "TokenId";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", sub_account_nonce: "Nonce", funding_account_ids: "typing.List[AccountId]", fee: "BigUint", fee_token: "TokenId"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.sub_account_nonce = sub_account_nonce
        self.funding_account_ids = funding_account_ids
        self.fee = fee
        self.fee_token = fee_token

    def __str__(self):
        return "FundingBuilder(account_id={}, sub_account_id={}, sub_account_nonce={}, funding_account_ids={}, fee={}, fee_token={})".format(self.account_id, self.sub_account_id, self.sub_account_nonce, self.funding_account_ids, self.fee, self.fee_token)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.sub_account_nonce != other.sub_account_nonce:
            return False
        if self.funding_account_ids != other.funding_account_ids:
            return False
        if self.fee != other.fee:
            return False
        if self.fee_token != other.fee_token:
            return False
        return True

class _UniffiConverterTypeFundingBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return FundingBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            sub_account_nonce=_UniffiConverterTypeNonce.read(buf),
            funding_account_ids=_UniffiConverterSequenceTypeAccountId.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            fee_token=_UniffiConverterTypeTokenId.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeNonce.write(value.sub_account_nonce, buf)
        _UniffiConverterSequenceTypeAccountId.write(value.funding_account_ids, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeTokenId.write(value.fee_token, buf)


class FundingInfo:
    pair_id: "PairId";price: "BigUint";funding_rate: "int";

    @typing.no_type_check
    def __init__(self, pair_id: "PairId", price: "BigUint", funding_rate: "int"):
        self.pair_id = pair_id
        self.price = price
        self.funding_rate = funding_rate

    def __str__(self):
        return "FundingInfo(pair_id={}, price={}, funding_rate={})".format(self.pair_id, self.price, self.funding_rate)

    def __eq__(self, other):
        if self.pair_id != other.pair_id:
            return False
        if self.price != other.price:
            return False
        if self.funding_rate != other.funding_rate:
            return False
        return True

class _UniffiConverterTypeFundingInfo(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return FundingInfo(
            pair_id=_UniffiConverterTypePairId.read(buf),
            price=_UniffiConverterTypeBigUint.read(buf),
            funding_rate=_UniffiConverterInt16.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypePairId.write(value.pair_id, buf)
        _UniffiConverterTypeBigUint.write(value.price, buf)
        _UniffiConverterInt16.write(value.funding_rate, buf)


class LiquidationBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";sub_account_nonce: "Nonce";contract_prices: "typing.List[ContractPrice]";margin_prices: "typing.List[SpotPriceInfo]";liquidation_account_id: "AccountId";fee: "BigUint";fee_token: "TokenId";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", sub_account_nonce: "Nonce", contract_prices: "typing.List[ContractPrice]", margin_prices: "typing.List[SpotPriceInfo]", liquidation_account_id: "AccountId", fee: "BigUint", fee_token: "TokenId"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.sub_account_nonce = sub_account_nonce
        self.contract_prices = contract_prices
        self.margin_prices = margin_prices
        self.liquidation_account_id = liquidation_account_id
        self.fee = fee
        self.fee_token = fee_token

    def __str__(self):
        return "LiquidationBuilder(account_id={}, sub_account_id={}, sub_account_nonce={}, contract_prices={}, margin_prices={}, liquidation_account_id={}, fee={}, fee_token={})".format(self.account_id, self.sub_account_id, self.sub_account_nonce, self.contract_prices, self.margin_prices, self.liquidation_account_id, self.fee, self.fee_token)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.sub_account_nonce != other.sub_account_nonce:
            return False
        if self.contract_prices != other.contract_prices:
            return False
        if self.margin_prices != other.margin_prices:
            return False
        if self.liquidation_account_id != other.liquidation_account_id:
            return False
        if self.fee != other.fee:
            return False
        if self.fee_token != other.fee_token:
            return False
        return True

class _UniffiConverterTypeLiquidationBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return LiquidationBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            sub_account_nonce=_UniffiConverterTypeNonce.read(buf),
            contract_prices=_UniffiConverterSequenceTypeContractPrice.read(buf),
            margin_prices=_UniffiConverterSequenceTypeSpotPriceInfo.read(buf),
            liquidation_account_id=_UniffiConverterTypeAccountId.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            fee_token=_UniffiConverterTypeTokenId.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeNonce.write(value.sub_account_nonce, buf)
        _UniffiConverterSequenceTypeContractPrice.write(value.contract_prices, buf)
        _UniffiConverterSequenceTypeSpotPriceInfo.write(value.margin_prices, buf)
        _UniffiConverterTypeAccountId.write(value.liquidation_account_id, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeTokenId.write(value.fee_token, buf)


class Message:
    data: "str";

    @typing.no_type_check
    def __init__(self, data: "str"):
        self.data = data

    def __str__(self):
        return "Message(data={})".format(self.data)

    def __eq__(self, other):
        if self.data != other.data:
            return False
        return True

class _UniffiConverterTypeMessage(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return Message(
            data=_UniffiConverterString.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value.data, buf)


class OraclePrices:
    contract_prices: "typing.List[ContractPrice]";margin_prices: "typing.List[SpotPriceInfo]";

    @typing.no_type_check
    def __init__(self, contract_prices: "typing.List[ContractPrice]", margin_prices: "typing.List[SpotPriceInfo]"):
        self.contract_prices = contract_prices
        self.margin_prices = margin_prices

    def __str__(self):
        return "OraclePrices(contract_prices={}, margin_prices={})".format(self.contract_prices, self.margin_prices)

    def __eq__(self, other):
        if self.contract_prices != other.contract_prices:
            return False
        if self.margin_prices != other.margin_prices:
            return False
        return True

class _UniffiConverterTypeOraclePrices(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return OraclePrices(
            contract_prices=_UniffiConverterSequenceTypeContractPrice.read(buf),
            margin_prices=_UniffiConverterSequenceTypeSpotPriceInfo.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterSequenceTypeContractPrice.write(value.contract_prices, buf)
        _UniffiConverterSequenceTypeSpotPriceInfo.write(value.margin_prices, buf)


class OrderMatchingBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";taker: "Order";maker: "Order";fee: "BigUint";fee_token: "TokenId";contract_prices: "typing.List[ContractPrice]";margin_prices: "typing.List[SpotPriceInfo]";expect_base_amount: "BigUint";expect_quote_amount: "BigUint";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", taker: "Order", maker: "Order", fee: "BigUint", fee_token: "TokenId", contract_prices: "typing.List[ContractPrice]", margin_prices: "typing.List[SpotPriceInfo]", expect_base_amount: "BigUint", expect_quote_amount: "BigUint"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.taker = taker
        self.maker = maker
        self.fee = fee
        self.fee_token = fee_token
        self.contract_prices = contract_prices
        self.margin_prices = margin_prices
        self.expect_base_amount = expect_base_amount
        self.expect_quote_amount = expect_quote_amount

    def __str__(self):
        return "OrderMatchingBuilder(account_id={}, sub_account_id={}, taker={}, maker={}, fee={}, fee_token={}, contract_prices={}, margin_prices={}, expect_base_amount={}, expect_quote_amount={})".format(self.account_id, self.sub_account_id, self.taker, self.maker, self.fee, self.fee_token, self.contract_prices, self.margin_prices, self.expect_base_amount, self.expect_quote_amount)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.taker != other.taker:
            return False
        if self.maker != other.maker:
            return False
        if self.fee != other.fee:
            return False
        if self.fee_token != other.fee_token:
            return False
        if self.contract_prices != other.contract_prices:
            return False
        if self.margin_prices != other.margin_prices:
            return False
        if self.expect_base_amount != other.expect_base_amount:
            return False
        if self.expect_quote_amount != other.expect_quote_amount:
            return False
        return True

class _UniffiConverterTypeOrderMatchingBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return OrderMatchingBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            taker=_UniffiConverterTypeOrder.read(buf),
            maker=_UniffiConverterTypeOrder.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            fee_token=_UniffiConverterTypeTokenId.read(buf),
            contract_prices=_UniffiConverterSequenceTypeContractPrice.read(buf),
            margin_prices=_UniffiConverterSequenceTypeSpotPriceInfo.read(buf),
            expect_base_amount=_UniffiConverterTypeBigUint.read(buf),
            expect_quote_amount=_UniffiConverterTypeBigUint.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeOrder.write(value.taker, buf)
        _UniffiConverterTypeOrder.write(value.maker, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeTokenId.write(value.fee_token, buf)
        _UniffiConverterSequenceTypeContractPrice.write(value.contract_prices, buf)
        _UniffiConverterSequenceTypeSpotPriceInfo.write(value.margin_prices, buf)
        _UniffiConverterTypeBigUint.write(value.expect_base_amount, buf)
        _UniffiConverterTypeBigUint.write(value.expect_quote_amount, buf)


class SpotPriceInfo:
    token_id: "TokenId";price: "BigUint";

    @typing.no_type_check
    def __init__(self, token_id: "TokenId", price: "BigUint"):
        self.token_id = token_id
        self.price = price

    def __str__(self):
        return "SpotPriceInfo(token_id={}, price={})".format(self.token_id, self.price)

    def __eq__(self, other):
        if self.token_id != other.token_id:
            return False
        if self.price != other.price:
            return False
        return True

class _UniffiConverterTypeSpotPriceInfo(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return SpotPriceInfo(
            token_id=_UniffiConverterTypeTokenId.read(buf),
            price=_UniffiConverterTypeBigUint.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeTokenId.write(value.token_id, buf)
        _UniffiConverterTypeBigUint.write(value.price, buf)


class TransferBuilder:
    account_id: "AccountId";to_address: "ZkLinkAddress";from_sub_account_id: "SubAccountId";to_sub_account_id: "SubAccountId";token: "TokenId";amount: "BigUint";fee: "BigUint";nonce: "Nonce";timestamp: "TimeStamp";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", to_address: "ZkLinkAddress", from_sub_account_id: "SubAccountId", to_sub_account_id: "SubAccountId", token: "TokenId", amount: "BigUint", fee: "BigUint", nonce: "Nonce", timestamp: "TimeStamp"):
        self.account_id = account_id
        self.to_address = to_address
        self.from_sub_account_id = from_sub_account_id
        self.to_sub_account_id = to_sub_account_id
        self.token = token
        self.amount = amount
        self.fee = fee
        self.nonce = nonce
        self.timestamp = timestamp

    def __str__(self):
        return "TransferBuilder(account_id={}, to_address={}, from_sub_account_id={}, to_sub_account_id={}, token={}, amount={}, fee={}, nonce={}, timestamp={})".format(self.account_id, self.to_address, self.from_sub_account_id, self.to_sub_account_id, self.token, self.amount, self.fee, self.nonce, self.timestamp)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.to_address != other.to_address:
            return False
        if self.from_sub_account_id != other.from_sub_account_id:
            return False
        if self.to_sub_account_id != other.to_sub_account_id:
            return False
        if self.token != other.token:
            return False
        if self.amount != other.amount:
            return False
        if self.fee != other.fee:
            return False
        if self.nonce != other.nonce:
            return False
        if self.timestamp != other.timestamp:
            return False
        return True

class _UniffiConverterTypeTransferBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return TransferBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            to_address=_UniffiConverterTypeZkLinkAddress.read(buf),
            from_sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            to_sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            token=_UniffiConverterTypeTokenId.read(buf),
            amount=_UniffiConverterTypeBigUint.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            nonce=_UniffiConverterTypeNonce.read(buf),
            timestamp=_UniffiConverterTypeTimeStamp.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeZkLinkAddress.write(value.to_address, buf)
        _UniffiConverterTypeSubAccountId.write(value.from_sub_account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.to_sub_account_id, buf)
        _UniffiConverterTypeTokenId.write(value.token, buf)
        _UniffiConverterTypeBigUint.write(value.amount, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeNonce.write(value.nonce, buf)
        _UniffiConverterTypeTimeStamp.write(value.timestamp, buf)


class TxMessage:
    transaction: "str";amount: "str";fee: "str";token: "str";to: "str";nonce: "str";

    @typing.no_type_check
    def __init__(self, transaction: "str", amount: "str", fee: "str", token: "str", to: "str", nonce: "str"):
        self.transaction = transaction
        self.amount = amount
        self.fee = fee
        self.token = token
        self.to = to
        self.nonce = nonce

    def __str__(self):
        return "TxMessage(transaction={}, amount={}, fee={}, token={}, to={}, nonce={})".format(self.transaction, self.amount, self.fee, self.token, self.to, self.nonce)

    def __eq__(self, other):
        if self.transaction != other.transaction:
            return False
        if self.amount != other.amount:
            return False
        if self.fee != other.fee:
            return False
        if self.token != other.token:
            return False
        if self.to != other.to:
            return False
        if self.nonce != other.nonce:
            return False
        return True

class _UniffiConverterTypeTxMessage(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return TxMessage(
            transaction=_UniffiConverterString.read(buf),
            amount=_UniffiConverterString.read(buf),
            fee=_UniffiConverterString.read(buf),
            token=_UniffiConverterString.read(buf),
            to=_UniffiConverterString.read(buf),
            nonce=_UniffiConverterString.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value.transaction, buf)
        _UniffiConverterString.write(value.amount, buf)
        _UniffiConverterString.write(value.fee, buf)
        _UniffiConverterString.write(value.token, buf)
        _UniffiConverterString.write(value.to, buf)
        _UniffiConverterString.write(value.nonce, buf)


class TxSignature:
    tx: "ZkLinkTx";layer1_signature: "typing.Optional[TxLayer1Signature]";

    @typing.no_type_check
    def __init__(self, tx: "ZkLinkTx", layer1_signature: "typing.Optional[TxLayer1Signature]"):
        self.tx = tx
        self.layer1_signature = layer1_signature

    def __str__(self):
        return "TxSignature(tx={}, layer1_signature={})".format(self.tx, self.layer1_signature)

    def __eq__(self, other):
        if self.tx != other.tx:
            return False
        if self.layer1_signature != other.layer1_signature:
            return False
        return True

class _UniffiConverterTypeTxSignature(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return TxSignature(
            tx=_UniffiConverterTypeZkLinkTx.read(buf),
            layer1_signature=_UniffiConverterOptionalTypeTxLayer1Signature.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeZkLinkTx.write(value.tx, buf)
        _UniffiConverterOptionalTypeTxLayer1Signature.write(value.layer1_signature, buf)


class UpdateGlobalVarBuilder:
    from_chain_id: "ChainId";sub_account_id: "SubAccountId";parameter: "Parameter";serial_id: "int";

    @typing.no_type_check
    def __init__(self, from_chain_id: "ChainId", sub_account_id: "SubAccountId", parameter: "Parameter", serial_id: "int"):
        self.from_chain_id = from_chain_id
        self.sub_account_id = sub_account_id
        self.parameter = parameter
        self.serial_id = serial_id

    def __str__(self):
        return "UpdateGlobalVarBuilder(from_chain_id={}, sub_account_id={}, parameter={}, serial_id={})".format(self.from_chain_id, self.sub_account_id, self.parameter, self.serial_id)

    def __eq__(self, other):
        if self.from_chain_id != other.from_chain_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.parameter != other.parameter:
            return False
        if self.serial_id != other.serial_id:
            return False
        return True

class _UniffiConverterTypeUpdateGlobalVarBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return UpdateGlobalVarBuilder(
            from_chain_id=_UniffiConverterTypeChainId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            parameter=_UniffiConverterTypeParameter.read(buf),
            serial_id=_UniffiConverterUInt64.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeChainId.write(value.from_chain_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeParameter.write(value.parameter, buf)
        _UniffiConverterUInt64.write(value.serial_id, buf)


class WithdrawBuilder:
    account_id: "AccountId";sub_account_id: "SubAccountId";to_chain_id: "ChainId";to_address: "ZkLinkAddress";l2_source_token: "TokenId";l1_target_token: "TokenId";amount: "BigUint";call_data: "typing.Optional[typing.List[int]]";fee: "BigUint";nonce: "Nonce";withdraw_fee_ratio: "int";withdraw_to_l1: "bool";timestamp: "TimeStamp";

    @typing.no_type_check
    def __init__(self, account_id: "AccountId", sub_account_id: "SubAccountId", to_chain_id: "ChainId", to_address: "ZkLinkAddress", l2_source_token: "TokenId", l1_target_token: "TokenId", amount: "BigUint", call_data: "typing.Optional[typing.List[int]]", fee: "BigUint", nonce: "Nonce", withdraw_fee_ratio: "int", withdraw_to_l1: "bool", timestamp: "TimeStamp"):
        self.account_id = account_id
        self.sub_account_id = sub_account_id
        self.to_chain_id = to_chain_id
        self.to_address = to_address
        self.l2_source_token = l2_source_token
        self.l1_target_token = l1_target_token
        self.amount = amount
        self.call_data = call_data
        self.fee = fee
        self.nonce = nonce
        self.withdraw_fee_ratio = withdraw_fee_ratio
        self.withdraw_to_l1 = withdraw_to_l1
        self.timestamp = timestamp

    def __str__(self):
        return "WithdrawBuilder(account_id={}, sub_account_id={}, to_chain_id={}, to_address={}, l2_source_token={}, l1_target_token={}, amount={}, call_data={}, fee={}, nonce={}, withdraw_fee_ratio={}, withdraw_to_l1={}, timestamp={})".format(self.account_id, self.sub_account_id, self.to_chain_id, self.to_address, self.l2_source_token, self.l1_target_token, self.amount, self.call_data, self.fee, self.nonce, self.withdraw_fee_ratio, self.withdraw_to_l1, self.timestamp)

    def __eq__(self, other):
        if self.account_id != other.account_id:
            return False
        if self.sub_account_id != other.sub_account_id:
            return False
        if self.to_chain_id != other.to_chain_id:
            return False
        if self.to_address != other.to_address:
            return False
        if self.l2_source_token != other.l2_source_token:
            return False
        if self.l1_target_token != other.l1_target_token:
            return False
        if self.amount != other.amount:
            return False
        if self.call_data != other.call_data:
            return False
        if self.fee != other.fee:
            return False
        if self.nonce != other.nonce:
            return False
        if self.withdraw_fee_ratio != other.withdraw_fee_ratio:
            return False
        if self.withdraw_to_l1 != other.withdraw_to_l1:
            return False
        if self.timestamp != other.timestamp:
            return False
        return True

class _UniffiConverterTypeWithdrawBuilder(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return WithdrawBuilder(
            account_id=_UniffiConverterTypeAccountId.read(buf),
            sub_account_id=_UniffiConverterTypeSubAccountId.read(buf),
            to_chain_id=_UniffiConverterTypeChainId.read(buf),
            to_address=_UniffiConverterTypeZkLinkAddress.read(buf),
            l2_source_token=_UniffiConverterTypeTokenId.read(buf),
            l1_target_token=_UniffiConverterTypeTokenId.read(buf),
            amount=_UniffiConverterTypeBigUint.read(buf),
            call_data=_UniffiConverterOptionalSequenceUInt8.read(buf),
            fee=_UniffiConverterTypeBigUint.read(buf),
            nonce=_UniffiConverterTypeNonce.read(buf),
            withdraw_fee_ratio=_UniffiConverterUInt16.read(buf),
            withdraw_to_l1=_UniffiConverterBool.read(buf),
            timestamp=_UniffiConverterTypeTimeStamp.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypeAccountId.write(value.account_id, buf)
        _UniffiConverterTypeSubAccountId.write(value.sub_account_id, buf)
        _UniffiConverterTypeChainId.write(value.to_chain_id, buf)
        _UniffiConverterTypeZkLinkAddress.write(value.to_address, buf)
        _UniffiConverterTypeTokenId.write(value.l2_source_token, buf)
        _UniffiConverterTypeTokenId.write(value.l1_target_token, buf)
        _UniffiConverterTypeBigUint.write(value.amount, buf)
        _UniffiConverterOptionalSequenceUInt8.write(value.call_data, buf)
        _UniffiConverterTypeBigUint.write(value.fee, buf)
        _UniffiConverterTypeNonce.write(value.nonce, buf)
        _UniffiConverterUInt16.write(value.withdraw_fee_ratio, buf)
        _UniffiConverterBool.write(value.withdraw_to_l1, buf)
        _UniffiConverterTypeTimeStamp.write(value.timestamp, buf)


class ZkLinkSignature:
    pub_key: "PackedPublicKey";signature: "PackedSignature";

    @typing.no_type_check
    def __init__(self, pub_key: "PackedPublicKey", signature: "PackedSignature"):
        self.pub_key = pub_key
        self.signature = signature

    def __str__(self):
        return "ZkLinkSignature(pub_key={}, signature={})".format(self.pub_key, self.signature)

    def __eq__(self, other):
        if self.pub_key != other.pub_key:
            return False
        if self.signature != other.signature:
            return False
        return True

class _UniffiConverterTypeZkLinkSignature(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        return ZkLinkSignature(
            pub_key=_UniffiConverterTypePackedPublicKey.read(buf),
            signature=_UniffiConverterTypePackedSignature.read(buf),
        )

    @staticmethod
    def write(value, buf):
        _UniffiConverterTypePackedPublicKey.write(value.pub_key, buf)
        _UniffiConverterTypePackedSignature.write(value.signature, buf)





class ChangePubKeyAuthData:
    def __init__(self):
        raise RuntimeError("ChangePubKeyAuthData cannot be instantiated directly")

    # Each enum variant is a nested class of the enum itself.
    class ONCHAIN:
        

        @typing.no_type_check
        def __init__(self,):
            
            pass
            

        def __str__(self):
            return "ChangePubKeyAuthData.ONCHAIN()".format()

        def __eq__(self, other):
            if not other.is_onchain():
                return False
            return True
    class ETH_ECDSA:
        eth_signature: "PackedEthSignature";

        @typing.no_type_check
        def __init__(self,eth_signature: "PackedEthSignature"):
            
            self.eth_signature = eth_signature
            

        def __str__(self):
            return "ChangePubKeyAuthData.ETH_ECDSA(eth_signature={})".format(self.eth_signature)

        def __eq__(self, other):
            if not other.is_eth_ecdsa():
                return False
            if self.eth_signature != other.eth_signature:
                return False
            return True
    class ETH_CREATE2:
        data: "Create2Data";

        @typing.no_type_check
        def __init__(self,data: "Create2Data"):
            
            self.data = data
            

        def __str__(self):
            return "ChangePubKeyAuthData.ETH_CREATE2(data={})".format(self.data)

        def __eq__(self, other):
            if not other.is_eth_create2():
                return False
            if self.data != other.data:
                return False
            return True
    

    # For each variant, we have an `is_NAME` method for easily checking
    # whether an instance is that variant.
    def is_onchain(self) -> bool:
        return isinstance(self, ChangePubKeyAuthData.ONCHAIN)
    def is_eth_ecdsa(self) -> bool:
        return isinstance(self, ChangePubKeyAuthData.ETH_ECDSA)
    def is_eth_create2(self) -> bool:
        return isinstance(self, ChangePubKeyAuthData.ETH_CREATE2)
    

# Now, a little trick - we make each nested variant class be a subclass of the main
# enum class, so that method calls and instance checks etc will work intuitively.
# We might be able to do this a little more neatly with a metaclass, but this'll do.
ChangePubKeyAuthData.ONCHAIN = type("ChangePubKeyAuthData.ONCHAIN", (ChangePubKeyAuthData.ONCHAIN, ChangePubKeyAuthData,), {})  # type: ignore
ChangePubKeyAuthData.ETH_ECDSA = type("ChangePubKeyAuthData.ETH_ECDSA", (ChangePubKeyAuthData.ETH_ECDSA, ChangePubKeyAuthData,), {})  # type: ignore
ChangePubKeyAuthData.ETH_CREATE2 = type("ChangePubKeyAuthData.ETH_CREATE2", (ChangePubKeyAuthData.ETH_CREATE2, ChangePubKeyAuthData,), {})  # type: ignore




class _UniffiConverterTypeChangePubKeyAuthData(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return ChangePubKeyAuthData.ONCHAIN(
            )
        if variant == 2:
            return ChangePubKeyAuthData.ETH_ECDSA(
                _UniffiConverterTypePackedEthSignature.read(buf),
            )
        if variant == 3:
            return ChangePubKeyAuthData.ETH_CREATE2(
                _UniffiConverterTypeCreate2Data.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    def write(value, buf):
        if value.is_onchain():
            buf.write_i32(1)
        if value.is_eth_ecdsa():
            buf.write_i32(2)
            _UniffiConverterTypePackedEthSignature.write(value.eth_signature, buf)
        if value.is_eth_create2():
            buf.write_i32(3)
            _UniffiConverterTypeCreate2Data.write(value.data, buf)







class ChangePubKeyAuthRequest:
    def __init__(self):
        raise RuntimeError("ChangePubKeyAuthRequest cannot be instantiated directly")

    # Each enum variant is a nested class of the enum itself.
    class ONCHAIN:
        

        @typing.no_type_check
        def __init__(self,):
            
            pass
            

        def __str__(self):
            return "ChangePubKeyAuthRequest.ONCHAIN()".format()

        def __eq__(self, other):
            if not other.is_onchain():
                return False
            return True
    class ETH_ECDSA:
        

        @typing.no_type_check
        def __init__(self,):
            
            pass
            

        def __str__(self):
            return "ChangePubKeyAuthRequest.ETH_ECDSA()".format()

        def __eq__(self, other):
            if not other.is_eth_ecdsa():
                return False
            return True
    class ETH_CREATE2:
        data: "Create2Data";

        @typing.no_type_check
        def __init__(self,data: "Create2Data"):
            
            self.data = data
            

        def __str__(self):
            return "ChangePubKeyAuthRequest.ETH_CREATE2(data={})".format(self.data)

        def __eq__(self, other):
            if not other.is_eth_create2():
                return False
            if self.data != other.data:
                return False
            return True
    

    # For each variant, we have an `is_NAME` method for easily checking
    # whether an instance is that variant.
    def is_onchain(self) -> bool:
        return isinstance(self, ChangePubKeyAuthRequest.ONCHAIN)
    def is_eth_ecdsa(self) -> bool:
        return isinstance(self, ChangePubKeyAuthRequest.ETH_ECDSA)
    def is_eth_create2(self) -> bool:
        return isinstance(self, ChangePubKeyAuthRequest.ETH_CREATE2)
    

# Now, a little trick - we make each nested variant class be a subclass of the main
# enum class, so that method calls and instance checks etc will work intuitively.
# We might be able to do this a little more neatly with a metaclass, but this'll do.
ChangePubKeyAuthRequest.ONCHAIN = type("ChangePubKeyAuthRequest.ONCHAIN", (ChangePubKeyAuthRequest.ONCHAIN, ChangePubKeyAuthRequest,), {})  # type: ignore
ChangePubKeyAuthRequest.ETH_ECDSA = type("ChangePubKeyAuthRequest.ETH_ECDSA", (ChangePubKeyAuthRequest.ETH_ECDSA, ChangePubKeyAuthRequest,), {})  # type: ignore
ChangePubKeyAuthRequest.ETH_CREATE2 = type("ChangePubKeyAuthRequest.ETH_CREATE2", (ChangePubKeyAuthRequest.ETH_CREATE2, ChangePubKeyAuthRequest,), {})  # type: ignore




class _UniffiConverterTypeChangePubKeyAuthRequest(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return ChangePubKeyAuthRequest.ONCHAIN(
            )
        if variant == 2:
            return ChangePubKeyAuthRequest.ETH_ECDSA(
            )
        if variant == 3:
            return ChangePubKeyAuthRequest.ETH_CREATE2(
                _UniffiConverterTypeCreate2Data.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    def write(value, buf):
        if value.is_onchain():
            buf.write_i32(1)
        if value.is_eth_ecdsa():
            buf.write_i32(2)
        if value.is_eth_create2():
            buf.write_i32(3)
            _UniffiConverterTypeCreate2Data.write(value.data, buf)




# EthSignerError
# We want to define each variant as a nested class that's also a subclass,
# which is tricky in Python.  To accomplish this we're going to create each
# class separately, then manually add the child classes to the base class's
# __dict__.  All of this happens in dummy class to avoid polluting the module
# namespace.
class EthSignerError(Exception):
    pass

_UniffiTempEthSignerError = EthSignerError

class EthSignerError:  # type: ignore
    class InvalidEthSigner(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.InvalidEthSigner({})".format(repr(str(self)))
    _UniffiTempEthSignerError.InvalidEthSigner = InvalidEthSigner # type: ignore
    class MissingEthPrivateKey(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.MissingEthPrivateKey({})".format(repr(str(self)))
    _UniffiTempEthSignerError.MissingEthPrivateKey = MissingEthPrivateKey # type: ignore
    class MissingEthSigner(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.MissingEthSigner({})".format(repr(str(self)))
    _UniffiTempEthSignerError.MissingEthSigner = MissingEthSigner # type: ignore
    class SigningFailed(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.SigningFailed({})".format(repr(str(self)))
    _UniffiTempEthSignerError.SigningFailed = SigningFailed # type: ignore
    class UnlockingFailed(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.UnlockingFailed({})".format(repr(str(self)))
    _UniffiTempEthSignerError.UnlockingFailed = UnlockingFailed # type: ignore
    class InvalidRawTx(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.InvalidRawTx({})".format(repr(str(self)))
    _UniffiTempEthSignerError.InvalidRawTx = InvalidRawTx # type: ignore
    class Eip712Failed(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.Eip712Failed({})".format(repr(str(self)))
    _UniffiTempEthSignerError.Eip712Failed = Eip712Failed # type: ignore
    class NoSigningKey(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.NoSigningKey({})".format(repr(str(self)))
    _UniffiTempEthSignerError.NoSigningKey = NoSigningKey # type: ignore
    class DefineAddress(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.DefineAddress({})".format(repr(str(self)))
    _UniffiTempEthSignerError.DefineAddress = DefineAddress # type: ignore
    class RecoverAddress(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.RecoverAddress({})".format(repr(str(self)))
    _UniffiTempEthSignerError.RecoverAddress = RecoverAddress # type: ignore
    class LengthMismatched(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.LengthMismatched({})".format(repr(str(self)))
    _UniffiTempEthSignerError.LengthMismatched = LengthMismatched # type: ignore
    class CryptoError(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.CryptoError({})".format(repr(str(self)))
    _UniffiTempEthSignerError.CryptoError = CryptoError # type: ignore
    class InvalidSignatureStr(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.InvalidSignatureStr({})".format(repr(str(self)))
    _UniffiTempEthSignerError.InvalidSignatureStr = InvalidSignatureStr # type: ignore
    class CustomError(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.CustomError({})".format(repr(str(self)))
    _UniffiTempEthSignerError.CustomError = CustomError # type: ignore
    class RpcSignError(_UniffiTempEthSignerError):
        def __repr__(self):
            return "EthSignerError.RpcSignError({})".format(repr(str(self)))
    _UniffiTempEthSignerError.RpcSignError = RpcSignError # type: ignore

EthSignerError = _UniffiTempEthSignerError # type: ignore
del _UniffiTempEthSignerError


class _UniffiConverterTypeEthSignerError(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return EthSignerError.InvalidEthSigner(
                _UniffiConverterString.read(buf),
            )
        if variant == 2:
            return EthSignerError.MissingEthPrivateKey(
                _UniffiConverterString.read(buf),
            )
        if variant == 3:
            return EthSignerError.MissingEthSigner(
                _UniffiConverterString.read(buf),
            )
        if variant == 4:
            return EthSignerError.SigningFailed(
                _UniffiConverterString.read(buf),
            )
        if variant == 5:
            return EthSignerError.UnlockingFailed(
                _UniffiConverterString.read(buf),
            )
        if variant == 6:
            return EthSignerError.InvalidRawTx(
                _UniffiConverterString.read(buf),
            )
        if variant == 7:
            return EthSignerError.Eip712Failed(
                _UniffiConverterString.read(buf),
            )
        if variant == 8:
            return EthSignerError.NoSigningKey(
                _UniffiConverterString.read(buf),
            )
        if variant == 9:
            return EthSignerError.DefineAddress(
                _UniffiConverterString.read(buf),
            )
        if variant == 10:
            return EthSignerError.RecoverAddress(
                _UniffiConverterString.read(buf),
            )
        if variant == 11:
            return EthSignerError.LengthMismatched(
                _UniffiConverterString.read(buf),
            )
        if variant == 12:
            return EthSignerError.CryptoError(
                _UniffiConverterString.read(buf),
            )
        if variant == 13:
            return EthSignerError.InvalidSignatureStr(
                _UniffiConverterString.read(buf),
            )
        if variant == 14:
            return EthSignerError.CustomError(
                _UniffiConverterString.read(buf),
            )
        if variant == 15:
            return EthSignerError.RpcSignError(
                _UniffiConverterString.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    @staticmethod
    def write(value, buf):
        if isinstance(value, EthSignerError.InvalidEthSigner):
            buf.write_i32(1)
        if isinstance(value, EthSignerError.MissingEthPrivateKey):
            buf.write_i32(2)
        if isinstance(value, EthSignerError.MissingEthSigner):
            buf.write_i32(3)
        if isinstance(value, EthSignerError.SigningFailed):
            buf.write_i32(4)
        if isinstance(value, EthSignerError.UnlockingFailed):
            buf.write_i32(5)
        if isinstance(value, EthSignerError.InvalidRawTx):
            buf.write_i32(6)
        if isinstance(value, EthSignerError.Eip712Failed):
            buf.write_i32(7)
        if isinstance(value, EthSignerError.NoSigningKey):
            buf.write_i32(8)
        if isinstance(value, EthSignerError.DefineAddress):
            buf.write_i32(9)
        if isinstance(value, EthSignerError.RecoverAddress):
            buf.write_i32(10)
        if isinstance(value, EthSignerError.LengthMismatched):
            buf.write_i32(11)
        if isinstance(value, EthSignerError.CryptoError):
            buf.write_i32(12)
        if isinstance(value, EthSignerError.InvalidSignatureStr):
            buf.write_i32(13)
        if isinstance(value, EthSignerError.CustomError):
            buf.write_i32(14)
        if isinstance(value, EthSignerError.RpcSignError):
            buf.write_i32(15)





class L1SignerType:
    def __init__(self):
        raise RuntimeError("L1SignerType cannot be instantiated directly")

    # Each enum variant is a nested class of the enum itself.
    class ETH:
        

        @typing.no_type_check
        def __init__(self,):
            
            pass
            

        def __str__(self):
            return "L1SignerType.ETH()".format()

        def __eq__(self, other):
            if not other.is_eth():
                return False
            return True
    class STARKNET:
        chain_id: "str";address: "str";

        @typing.no_type_check
        def __init__(self,chain_id: "str", address: "str"):
            
            self.chain_id = chain_id
            self.address = address
            

        def __str__(self):
            return "L1SignerType.STARKNET(chain_id={}, address={})".format(self.chain_id, self.address)

        def __eq__(self, other):
            if not other.is_starknet():
                return False
            if self.chain_id != other.chain_id:
                return False
            if self.address != other.address:
                return False
            return True
    

    # For each variant, we have an `is_NAME` method for easily checking
    # whether an instance is that variant.
    def is_eth(self) -> bool:
        return isinstance(self, L1SignerType.ETH)
    def is_starknet(self) -> bool:
        return isinstance(self, L1SignerType.STARKNET)
    

# Now, a little trick - we make each nested variant class be a subclass of the main
# enum class, so that method calls and instance checks etc will work intuitively.
# We might be able to do this a little more neatly with a metaclass, but this'll do.
L1SignerType.ETH = type("L1SignerType.ETH", (L1SignerType.ETH, L1SignerType,), {})  # type: ignore
L1SignerType.STARKNET = type("L1SignerType.STARKNET", (L1SignerType.STARKNET, L1SignerType,), {})  # type: ignore




class _UniffiConverterTypeL1SignerType(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return L1SignerType.ETH(
            )
        if variant == 2:
            return L1SignerType.STARKNET(
                _UniffiConverterString.read(buf),
                _UniffiConverterString.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    def write(value, buf):
        if value.is_eth():
            buf.write_i32(1)
        if value.is_starknet():
            buf.write_i32(2)
            _UniffiConverterString.write(value.chain_id, buf)
            _UniffiConverterString.write(value.address, buf)







class L1Type(enum.Enum):
    ETH = 1
    STARKNET = 2
    


class _UniffiConverterTypeL1Type(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return L1Type.ETH
        if variant == 2:
            return L1Type.STARKNET
        raise InternalError("Raw enum value doesn't match any cases")

    def write(value, buf):
        if value == L1Type.ETH:
            buf.write_i32(1)
        if value == L1Type.STARKNET:
            buf.write_i32(2)







class Parameter:
    def __init__(self):
        raise RuntimeError("Parameter cannot be instantiated directly")

    # Each enum variant is a nested class of the enum itself.
    class FEE_ACCOUNT:
        account_id: "AccountId";

        @typing.no_type_check
        def __init__(self,account_id: "AccountId"):
            
            self.account_id = account_id
            

        def __str__(self):
            return "Parameter.FEE_ACCOUNT(account_id={})".format(self.account_id)

        def __eq__(self, other):
            if not other.is_fee_account():
                return False
            if self.account_id != other.account_id:
                return False
            return True
    class INSURANCE_FUND_ACCOUNT:
        account_id: "AccountId";

        @typing.no_type_check
        def __init__(self,account_id: "AccountId"):
            
            self.account_id = account_id
            

        def __str__(self):
            return "Parameter.INSURANCE_FUND_ACCOUNT(account_id={})".format(self.account_id)

        def __eq__(self, other):
            if not other.is_insurance_fund_account():
                return False
            if self.account_id != other.account_id:
                return False
            return True
    class MARGIN_INFO:
        margin_id: "MarginId";token_id: "TokenId";ratio: "int";

        @typing.no_type_check
        def __init__(self,margin_id: "MarginId", token_id: "TokenId", ratio: "int"):
            
            self.margin_id = margin_id
            self.token_id = token_id
            self.ratio = ratio
            

        def __str__(self):
            return "Parameter.MARGIN_INFO(margin_id={}, token_id={}, ratio={})".format(self.margin_id, self.token_id, self.ratio)

        def __eq__(self, other):
            if not other.is_margin_info():
                return False
            if self.margin_id != other.margin_id:
                return False
            if self.token_id != other.token_id:
                return False
            if self.ratio != other.ratio:
                return False
            return True
    class FUNDING_INFOS:
        infos: "typing.List[FundingInfo]";

        @typing.no_type_check
        def __init__(self,infos: "typing.List[FundingInfo]"):
            
            self.infos = infos
            

        def __str__(self):
            return "Parameter.FUNDING_INFOS(infos={})".format(self.infos)

        def __eq__(self, other):
            if not other.is_funding_infos():
                return False
            if self.infos != other.infos:
                return False
            return True
    class CONTRACT_INFO:
        pair_id: "PairId";symbol: "str";initial_margin_rate: "int";maintenance_margin_rate: "int";

        @typing.no_type_check
        def __init__(self,pair_id: "PairId", symbol: "str", initial_margin_rate: "int", maintenance_margin_rate: "int"):
            
            self.pair_id = pair_id
            self.symbol = symbol
            self.initial_margin_rate = initial_margin_rate
            self.maintenance_margin_rate = maintenance_margin_rate
            

        def __str__(self):
            return "Parameter.CONTRACT_INFO(pair_id={}, symbol={}, initial_margin_rate={}, maintenance_margin_rate={})".format(self.pair_id, self.symbol, self.initial_margin_rate, self.maintenance_margin_rate)

        def __eq__(self, other):
            if not other.is_contract_info():
                return False
            if self.pair_id != other.pair_id:
                return False
            if self.symbol != other.symbol:
                return False
            if self.initial_margin_rate != other.initial_margin_rate:
                return False
            if self.maintenance_margin_rate != other.maintenance_margin_rate:
                return False
            return True
    

    # For each variant, we have an `is_NAME` method for easily checking
    # whether an instance is that variant.
    def is_fee_account(self) -> bool:
        return isinstance(self, Parameter.FEE_ACCOUNT)
    def is_insurance_fund_account(self) -> bool:
        return isinstance(self, Parameter.INSURANCE_FUND_ACCOUNT)
    def is_margin_info(self) -> bool:
        return isinstance(self, Parameter.MARGIN_INFO)
    def is_funding_infos(self) -> bool:
        return isinstance(self, Parameter.FUNDING_INFOS)
    def is_contract_info(self) -> bool:
        return isinstance(self, Parameter.CONTRACT_INFO)
    

# Now, a little trick - we make each nested variant class be a subclass of the main
# enum class, so that method calls and instance checks etc will work intuitively.
# We might be able to do this a little more neatly with a metaclass, but this'll do.
Parameter.FEE_ACCOUNT = type("Parameter.FEE_ACCOUNT", (Parameter.FEE_ACCOUNT, Parameter,), {})  # type: ignore
Parameter.INSURANCE_FUND_ACCOUNT = type("Parameter.INSURANCE_FUND_ACCOUNT", (Parameter.INSURANCE_FUND_ACCOUNT, Parameter,), {})  # type: ignore
Parameter.MARGIN_INFO = type("Parameter.MARGIN_INFO", (Parameter.MARGIN_INFO, Parameter,), {})  # type: ignore
Parameter.FUNDING_INFOS = type("Parameter.FUNDING_INFOS", (Parameter.FUNDING_INFOS, Parameter,), {})  # type: ignore
Parameter.CONTRACT_INFO = type("Parameter.CONTRACT_INFO", (Parameter.CONTRACT_INFO, Parameter,), {})  # type: ignore




class _UniffiConverterTypeParameter(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return Parameter.FEE_ACCOUNT(
                _UniffiConverterTypeAccountId.read(buf),
            )
        if variant == 2:
            return Parameter.INSURANCE_FUND_ACCOUNT(
                _UniffiConverterTypeAccountId.read(buf),
            )
        if variant == 3:
            return Parameter.MARGIN_INFO(
                _UniffiConverterTypeMarginId.read(buf),
                _UniffiConverterTypeTokenId.read(buf),
                _UniffiConverterUInt8.read(buf),
            )
        if variant == 4:
            return Parameter.FUNDING_INFOS(
                _UniffiConverterSequenceTypeFundingInfo.read(buf),
            )
        if variant == 5:
            return Parameter.CONTRACT_INFO(
                _UniffiConverterTypePairId.read(buf),
                _UniffiConverterString.read(buf),
                _UniffiConverterUInt16.read(buf),
                _UniffiConverterUInt16.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    def write(value, buf):
        if value.is_fee_account():
            buf.write_i32(1)
            _UniffiConverterTypeAccountId.write(value.account_id, buf)
        if value.is_insurance_fund_account():
            buf.write_i32(2)
            _UniffiConverterTypeAccountId.write(value.account_id, buf)
        if value.is_margin_info():
            buf.write_i32(3)
            _UniffiConverterTypeMarginId.write(value.margin_id, buf)
            _UniffiConverterTypeTokenId.write(value.token_id, buf)
            _UniffiConverterUInt8.write(value.ratio, buf)
        if value.is_funding_infos():
            buf.write_i32(4)
            _UniffiConverterSequenceTypeFundingInfo.write(value.infos, buf)
        if value.is_contract_info():
            buf.write_i32(5)
            _UniffiConverterTypePairId.write(value.pair_id, buf)
            _UniffiConverterString.write(value.symbol, buf)
            _UniffiConverterUInt16.write(value.initial_margin_rate, buf)
            _UniffiConverterUInt16.write(value.maintenance_margin_rate, buf)




# SignError
# We want to define each variant as a nested class that's also a subclass,
# which is tricky in Python.  To accomplish this we're going to create each
# class separately, then manually add the child classes to the base class's
# __dict__.  All of this happens in dummy class to avoid polluting the module
# namespace.
class SignError(Exception):
    pass

_UniffiTempSignError = SignError

class SignError:  # type: ignore
    class EthSigningError(_UniffiTempSignError):
        def __repr__(self):
            return "SignError.EthSigningError({})".format(repr(str(self)))
    _UniffiTempSignError.EthSigningError = EthSigningError # type: ignore
    class ZkSigningError(_UniffiTempSignError):
        def __repr__(self):
            return "SignError.ZkSigningError({})".format(repr(str(self)))
    _UniffiTempSignError.ZkSigningError = ZkSigningError # type: ignore
    class StarkSigningError(_UniffiTempSignError):
        def __repr__(self):
            return "SignError.StarkSigningError({})".format(repr(str(self)))
    _UniffiTempSignError.StarkSigningError = StarkSigningError # type: ignore
    class IncorrectTx(_UniffiTempSignError):
        def __repr__(self):
            return "SignError.IncorrectTx({})".format(repr(str(self)))
    _UniffiTempSignError.IncorrectTx = IncorrectTx # type: ignore

SignError = _UniffiTempSignError # type: ignore
del _UniffiTempSignError


class _UniffiConverterTypeSignError(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return SignError.EthSigningError(
                _UniffiConverterString.read(buf),
            )
        if variant == 2:
            return SignError.ZkSigningError(
                _UniffiConverterString.read(buf),
            )
        if variant == 3:
            return SignError.StarkSigningError(
                _UniffiConverterString.read(buf),
            )
        if variant == 4:
            return SignError.IncorrectTx(
                _UniffiConverterString.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    @staticmethod
    def write(value, buf):
        if isinstance(value, SignError.EthSigningError):
            buf.write_i32(1)
        if isinstance(value, SignError.ZkSigningError):
            buf.write_i32(2)
        if isinstance(value, SignError.StarkSigningError):
            buf.write_i32(3)
        if isinstance(value, SignError.IncorrectTx):
            buf.write_i32(4)


# StarkSignerError
# We want to define each variant as a nested class that's also a subclass,
# which is tricky in Python.  To accomplish this we're going to create each
# class separately, then manually add the child classes to the base class's
# __dict__.  All of this happens in dummy class to avoid polluting the module
# namespace.
class StarkSignerError(Exception):
    pass

_UniffiTempStarkSignerError = StarkSignerError

class StarkSignerError:  # type: ignore
    class InvalidStarknetSigner(_UniffiTempStarkSignerError):
        def __repr__(self):
            return "StarkSignerError.InvalidStarknetSigner({})".format(repr(str(self)))
    _UniffiTempStarkSignerError.InvalidStarknetSigner = InvalidStarknetSigner # type: ignore
    class InvalidSignature(_UniffiTempStarkSignerError):
        def __repr__(self):
            return "StarkSignerError.InvalidSignature({})".format(repr(str(self)))
    _UniffiTempStarkSignerError.InvalidSignature = InvalidSignature # type: ignore
    class InvalidPrivKey(_UniffiTempStarkSignerError):
        def __repr__(self):
            return "StarkSignerError.InvalidPrivKey({})".format(repr(str(self)))
    _UniffiTempStarkSignerError.InvalidPrivKey = InvalidPrivKey # type: ignore
    class SignError(_UniffiTempStarkSignerError):
        def __repr__(self):
            return "StarkSignerError.SignError({})".format(repr(str(self)))
    _UniffiTempStarkSignerError.SignError = SignError # type: ignore
    class RpcSignError(_UniffiTempStarkSignerError):
        def __repr__(self):
            return "StarkSignerError.RpcSignError({})".format(repr(str(self)))
    _UniffiTempStarkSignerError.RpcSignError = RpcSignError # type: ignore

StarkSignerError = _UniffiTempStarkSignerError # type: ignore
del _UniffiTempStarkSignerError


class _UniffiConverterTypeStarkSignerError(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return StarkSignerError.InvalidStarknetSigner(
                _UniffiConverterString.read(buf),
            )
        if variant == 2:
            return StarkSignerError.InvalidSignature(
                _UniffiConverterString.read(buf),
            )
        if variant == 3:
            return StarkSignerError.InvalidPrivKey(
                _UniffiConverterString.read(buf),
            )
        if variant == 4:
            return StarkSignerError.SignError(
                _UniffiConverterString.read(buf),
            )
        if variant == 5:
            return StarkSignerError.RpcSignError(
                _UniffiConverterString.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    @staticmethod
    def write(value, buf):
        if isinstance(value, StarkSignerError.InvalidStarknetSigner):
            buf.write_i32(1)
        if isinstance(value, StarkSignerError.InvalidSignature):
            buf.write_i32(2)
        if isinstance(value, StarkSignerError.InvalidPrivKey):
            buf.write_i32(3)
        if isinstance(value, StarkSignerError.SignError):
            buf.write_i32(4)
        if isinstance(value, StarkSignerError.RpcSignError):
            buf.write_i32(5)


# TypeError
# We want to define each variant as a nested class that's also a subclass,
# which is tricky in Python.  To accomplish this we're going to create each
# class separately, then manually add the child classes to the base class's
# __dict__.  All of this happens in dummy class to avoid polluting the module
# namespace.
class TypeError(Exception):
    pass

_UniffiTempTypeError = TypeError

class TypeError:  # type: ignore
    class InvalidAddress(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.InvalidAddress({})".format(repr(str(self)))
    _UniffiTempTypeError.InvalidAddress = InvalidAddress # type: ignore
    class InvalidTxHash(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.InvalidTxHash({})".format(repr(str(self)))
    _UniffiTempTypeError.InvalidTxHash = InvalidTxHash # type: ignore
    class NotStartWithZerox(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.NotStartWithZerox({})".format(repr(str(self)))
    _UniffiTempTypeError.NotStartWithZerox = NotStartWithZerox # type: ignore
    class SizeMismatch(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.SizeMismatch({})".format(repr(str(self)))
    _UniffiTempTypeError.SizeMismatch = SizeMismatch # type: ignore
    class DecodeFromHexErr(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.DecodeFromHexErr({})".format(repr(str(self)))
    _UniffiTempTypeError.DecodeFromHexErr = DecodeFromHexErr # type: ignore
    class TooBigInteger(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.TooBigInteger({})".format(repr(str(self)))
    _UniffiTempTypeError.TooBigInteger = TooBigInteger # type: ignore
    class InvalidBigIntStr(_UniffiTempTypeError):
        def __repr__(self):
            return "TypeError.InvalidBigIntStr({})".format(repr(str(self)))
    _UniffiTempTypeError.InvalidBigIntStr = InvalidBigIntStr # type: ignore

TypeError = _UniffiTempTypeError # type: ignore
del _UniffiTempTypeError


class _UniffiConverterTypeTypeError(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return TypeError.InvalidAddress(
                _UniffiConverterString.read(buf),
            )
        if variant == 2:
            return TypeError.InvalidTxHash(
                _UniffiConverterString.read(buf),
            )
        if variant == 3:
            return TypeError.NotStartWithZerox(
                _UniffiConverterString.read(buf),
            )
        if variant == 4:
            return TypeError.SizeMismatch(
                _UniffiConverterString.read(buf),
            )
        if variant == 5:
            return TypeError.DecodeFromHexErr(
                _UniffiConverterString.read(buf),
            )
        if variant == 6:
            return TypeError.TooBigInteger(
                _UniffiConverterString.read(buf),
            )
        if variant == 7:
            return TypeError.InvalidBigIntStr(
                _UniffiConverterString.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    @staticmethod
    def write(value, buf):
        if isinstance(value, TypeError.InvalidAddress):
            buf.write_i32(1)
        if isinstance(value, TypeError.InvalidTxHash):
            buf.write_i32(2)
        if isinstance(value, TypeError.NotStartWithZerox):
            buf.write_i32(3)
        if isinstance(value, TypeError.SizeMismatch):
            buf.write_i32(4)
        if isinstance(value, TypeError.DecodeFromHexErr):
            buf.write_i32(5)
        if isinstance(value, TypeError.TooBigInteger):
            buf.write_i32(6)
        if isinstance(value, TypeError.InvalidBigIntStr):
            buf.write_i32(7)





class TypedDataMessage:
    def __init__(self):
        raise RuntimeError("TypedDataMessage cannot be instantiated directly")

    # Each enum variant is a nested class of the enum itself.
    class CREATE_L2_KEY:
        message: "Message";

        @typing.no_type_check
        def __init__(self,message: "Message"):
            
            self.message = message
            

        def __str__(self):
            return "TypedDataMessage.CREATE_L2_KEY(message={})".format(self.message)

        def __eq__(self, other):
            if not other.is_create_l2_key():
                return False
            if self.message != other.message:
                return False
            return True
    class TRANSACTION:
        message: "TxMessage";

        @typing.no_type_check
        def __init__(self,message: "TxMessage"):
            
            self.message = message
            

        def __str__(self):
            return "TypedDataMessage.TRANSACTION(message={})".format(self.message)

        def __eq__(self, other):
            if not other.is_transaction():
                return False
            if self.message != other.message:
                return False
            return True
    

    # For each variant, we have an `is_NAME` method for easily checking
    # whether an instance is that variant.
    def is_create_l2_key(self) -> bool:
        return isinstance(self, TypedDataMessage.CREATE_L2_KEY)
    def is_transaction(self) -> bool:
        return isinstance(self, TypedDataMessage.TRANSACTION)
    

# Now, a little trick - we make each nested variant class be a subclass of the main
# enum class, so that method calls and instance checks etc will work intuitively.
# We might be able to do this a little more neatly with a metaclass, but this'll do.
TypedDataMessage.CREATE_L2_KEY = type("TypedDataMessage.CREATE_L2_KEY", (TypedDataMessage.CREATE_L2_KEY, TypedDataMessage,), {})  # type: ignore
TypedDataMessage.TRANSACTION = type("TypedDataMessage.TRANSACTION", (TypedDataMessage.TRANSACTION, TypedDataMessage,), {})  # type: ignore




class _UniffiConverterTypeTypedDataMessage(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return TypedDataMessage.CREATE_L2_KEY(
                _UniffiConverterTypeMessage.read(buf),
            )
        if variant == 2:
            return TypedDataMessage.TRANSACTION(
                _UniffiConverterTypeTxMessage.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    def write(value, buf):
        if value.is_create_l2_key():
            buf.write_i32(1)
            _UniffiConverterTypeMessage.write(value.message, buf)
        if value.is_transaction():
            buf.write_i32(2)
            _UniffiConverterTypeTxMessage.write(value.message, buf)




# ZkSignerError
# We want to define each variant as a nested class that's also a subclass,
# which is tricky in Python.  To accomplish this we're going to create each
# class separately, then manually add the child classes to the base class's
# __dict__.  All of this happens in dummy class to avoid polluting the module
# namespace.
class ZkSignerError(Exception):
    pass

_UniffiTempZkSignerError = ZkSignerError

class ZkSignerError:  # type: ignore
    class CustomError(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.CustomError({})".format(repr(str(self)))
    _UniffiTempZkSignerError.CustomError = CustomError # type: ignore
    class InvalidSignature(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.InvalidSignature({})".format(repr(str(self)))
    _UniffiTempZkSignerError.InvalidSignature = InvalidSignature # type: ignore
    class InvalidPrivKey(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.InvalidPrivKey({})".format(repr(str(self)))
    _UniffiTempZkSignerError.InvalidPrivKey = InvalidPrivKey # type: ignore
    class InvalidSeed(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.InvalidSeed({})".format(repr(str(self)))
    _UniffiTempZkSignerError.InvalidSeed = InvalidSeed # type: ignore
    class InvalidPubkey(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.InvalidPubkey({})".format(repr(str(self)))
    _UniffiTempZkSignerError.InvalidPubkey = InvalidPubkey # type: ignore
    class InvalidPubkeyHash(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.InvalidPubkeyHash({})".format(repr(str(self)))
    _UniffiTempZkSignerError.InvalidPubkeyHash = InvalidPubkeyHash # type: ignore
    class EthSignerError(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.EthSignerError({})".format(repr(str(self)))
    _UniffiTempZkSignerError.EthSignerError = EthSignerError # type: ignore
    class StarkSignerError(_UniffiTempZkSignerError):
        def __repr__(self):
            return "ZkSignerError.StarkSignerError({})".format(repr(str(self)))
    _UniffiTempZkSignerError.StarkSignerError = StarkSignerError # type: ignore

ZkSignerError = _UniffiTempZkSignerError # type: ignore
del _UniffiTempZkSignerError


class _UniffiConverterTypeZkSignerError(_UniffiConverterRustBuffer):
    @staticmethod
    def read(buf):
        variant = buf.read_i32()
        if variant == 1:
            return ZkSignerError.CustomError(
                _UniffiConverterString.read(buf),
            )
        if variant == 2:
            return ZkSignerError.InvalidSignature(
                _UniffiConverterString.read(buf),
            )
        if variant == 3:
            return ZkSignerError.InvalidPrivKey(
                _UniffiConverterString.read(buf),
            )
        if variant == 4:
            return ZkSignerError.InvalidSeed(
                _UniffiConverterString.read(buf),
            )
        if variant == 5:
            return ZkSignerError.InvalidPubkey(
                _UniffiConverterString.read(buf),
            )
        if variant == 6:
            return ZkSignerError.InvalidPubkeyHash(
                _UniffiConverterString.read(buf),
            )
        if variant == 7:
            return ZkSignerError.EthSignerError(
                _UniffiConverterString.read(buf),
            )
        if variant == 8:
            return ZkSignerError.StarkSignerError(
                _UniffiConverterString.read(buf),
            )
        raise InternalError("Raw enum value doesn't match any cases")

    @staticmethod
    def write(value, buf):
        if isinstance(value, ZkSignerError.CustomError):
            buf.write_i32(1)
        if isinstance(value, ZkSignerError.InvalidSignature):
            buf.write_i32(2)
        if isinstance(value, ZkSignerError.InvalidPrivKey):
            buf.write_i32(3)
        if isinstance(value, ZkSignerError.InvalidSeed):
            buf.write_i32(4)
        if isinstance(value, ZkSignerError.InvalidPubkey):
            buf.write_i32(5)
        if isinstance(value, ZkSignerError.InvalidPubkeyHash):
            buf.write_i32(6)
        if isinstance(value, ZkSignerError.EthSignerError):
            buf.write_i32(7)
        if isinstance(value, ZkSignerError.StarkSignerError):
            buf.write_i32(8)



class _UniffiConverterOptionalString(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        if value is None:
            buf.write_u8(0)
            return

        buf.write_u8(1)
        _UniffiConverterString.write(value, buf)

    @classmethod
    def read(cls, buf):
        flag = buf.read_u8()
        if flag == 0:
            return None
        elif flag == 1:
            return _UniffiConverterString.read(buf)
        else:
            raise InternalError("Unexpected flag byte for optional type")



class _UniffiConverterOptionalTypeZkLinkSignature(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        if value is None:
            buf.write_u8(0)
            return

        buf.write_u8(1)
        _UniffiConverterTypeZkLinkSignature.write(value, buf)

    @classmethod
    def read(cls, buf):
        flag = buf.read_u8()
        if flag == 0:
            return None
        elif flag == 1:
            return _UniffiConverterTypeZkLinkSignature.read(buf)
        else:
            raise InternalError("Unexpected flag byte for optional type")



class _UniffiConverterOptionalSequenceUInt8(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        if value is None:
            buf.write_u8(0)
            return

        buf.write_u8(1)
        _UniffiConverterSequenceUInt8.write(value, buf)

    @classmethod
    def read(cls, buf):
        flag = buf.read_u8()
        if flag == 0:
            return None
        elif flag == 1:
            return _UniffiConverterSequenceUInt8.read(buf)
        else:
            raise InternalError("Unexpected flag byte for optional type")



class _UniffiConverterOptionalTypeH256(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        if value is None:
            buf.write_u8(0)
            return

        buf.write_u8(1)
        _UniffiConverterTypeH256.write(value, buf)

    @classmethod
    def read(cls, buf):
        flag = buf.read_u8()
        if flag == 0:
            return None
        elif flag == 1:
            return _UniffiConverterTypeH256.read(buf)
        else:
            raise InternalError("Unexpected flag byte for optional type")



class _UniffiConverterOptionalTypePackedEthSignature(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        if value is None:
            buf.write_u8(0)
            return

        buf.write_u8(1)
        _UniffiConverterTypePackedEthSignature.write(value, buf)

    @classmethod
    def read(cls, buf):
        flag = buf.read_u8()
        if flag == 0:
            return None
        elif flag == 1:
            return _UniffiConverterTypePackedEthSignature.read(buf)
        else:
            raise InternalError("Unexpected flag byte for optional type")



class _UniffiConverterOptionalTypeTxLayer1Signature(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        if value is None:
            buf.write_u8(0)
            return

        buf.write_u8(1)
        _UniffiConverterTypeTxLayer1Signature.write(value, buf)

    @classmethod
    def read(cls, buf):
        flag = buf.read_u8()
        if flag == 0:
            return None
        elif flag == 1:
            return _UniffiConverterTypeTxLayer1Signature.read(buf)
        else:
            raise InternalError("Unexpected flag byte for optional type")



class _UniffiConverterSequenceUInt8(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        items = len(value)
        buf.write_i32(items)
        for item in value:
            _UniffiConverterUInt8.write(item, buf)

    @classmethod
    def read(cls, buf):
        count = buf.read_i32()
        if count < 0:
            raise InternalError("Unexpected negative sequence length")

        return [
            _UniffiConverterUInt8.read(buf) for i in range(count)
        ]



class _UniffiConverterSequenceTypeContract(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        items = len(value)
        buf.write_i32(items)
        for item in value:
            _UniffiConverterTypeContract.write(item, buf)

    @classmethod
    def read(cls, buf):
        count = buf.read_i32()
        if count < 0:
            raise InternalError("Unexpected negative sequence length")

        return [
            _UniffiConverterTypeContract.read(buf) for i in range(count)
        ]



class _UniffiConverterSequenceTypeContractPrice(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        items = len(value)
        buf.write_i32(items)
        for item in value:
            _UniffiConverterTypeContractPrice.write(item, buf)

    @classmethod
    def read(cls, buf):
        count = buf.read_i32()
        if count < 0:
            raise InternalError("Unexpected negative sequence length")

        return [
            _UniffiConverterTypeContractPrice.read(buf) for i in range(count)
        ]



class _UniffiConverterSequenceTypeFundingInfo(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        items = len(value)
        buf.write_i32(items)
        for item in value:
            _UniffiConverterTypeFundingInfo.write(item, buf)

    @classmethod
    def read(cls, buf):
        count = buf.read_i32()
        if count < 0:
            raise InternalError("Unexpected negative sequence length")

        return [
            _UniffiConverterTypeFundingInfo.read(buf) for i in range(count)
        ]



class _UniffiConverterSequenceTypeSpotPriceInfo(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        items = len(value)
        buf.write_i32(items)
        for item in value:
            _UniffiConverterTypeSpotPriceInfo.write(item, buf)

    @classmethod
    def read(cls, buf):
        count = buf.read_i32()
        if count < 0:
            raise InternalError("Unexpected negative sequence length")

        return [
            _UniffiConverterTypeSpotPriceInfo.read(buf) for i in range(count)
        ]



class _UniffiConverterSequenceTypeAccountId(_UniffiConverterRustBuffer):
    @classmethod
    def write(cls, value, buf):
        items = len(value)
        buf.write_i32(items)
        for item in value:
            _UniffiConverterTypeAccountId.write(item, buf)

    @classmethod
    def read(cls, buf):
        count = buf.read_i32()
        if count < 0:
            raise InternalError("Unexpected negative sequence length")

        return [
            _UniffiConverterTypeAccountId.read(buf) for i in range(count)
        ]


# Type alias
AccountId = int

class _UniffiConverterTypeAccountId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt32.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt32.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt32.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt32.lower(value)


# Type alias
Address = str

class _UniffiConverterTypeAddress:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
BigUint = str

class _UniffiConverterTypeBigUint:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
BlockNumber = int

class _UniffiConverterTypeBlockNumber:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt32.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt32.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt32.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt32.lower(value)


# Type alias
ChainId = int

class _UniffiConverterTypeChainId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt8.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt8.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt8.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt8.lower(value)


# Type alias
EthBlockId = int

class _UniffiConverterTypeEthBlockId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt64.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt64.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt64.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt64.lower(value)


# Type alias
H256 = str

class _UniffiConverterTypeH256:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
MarginId = int

class _UniffiConverterTypeMarginId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt8.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt8.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt8.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt8.lower(value)


# Type alias
Nonce = int

class _UniffiConverterTypeNonce:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt32.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt32.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt32.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt32.lower(value)


# Type alias
PackedEthSignature = str

class _UniffiConverterTypePackedEthSignature:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
PackedPublicKey = str

class _UniffiConverterTypePackedPublicKey:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
PackedSignature = str

class _UniffiConverterTypePackedSignature:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
PairId = int

class _UniffiConverterTypePairId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt16.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt16.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt16.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt16.lower(value)


# Type alias
PriorityOpId = int

class _UniffiConverterTypePriorityOpId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt64.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt64.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt64.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt64.lower(value)


# Type alias
PubKeyHash = str

class _UniffiConverterTypePubKeyHash:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
SlotId = int

class _UniffiConverterTypeSlotId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt32.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt32.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt32.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt32.lower(value)


# Type alias
StarkEip712Signature = str

class _UniffiConverterTypeStarkEip712Signature:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
SubAccountId = int

class _UniffiConverterTypeSubAccountId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt8.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt8.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt8.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt8.lower(value)


# Type alias
TimeStamp = int

class _UniffiConverterTypeTimeStamp:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt32.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt32.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt32.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt32.lower(value)


# Type alias
TokenId = int

class _UniffiConverterTypeTokenId:
    @staticmethod
    def write(value, buf):
        _UniffiConverterUInt32.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterUInt32.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterUInt32.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterUInt32.lower(value)


# Type alias
TxHash = str

class _UniffiConverterTypeTxHash:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
TxLayer1Signature = str

class _UniffiConverterTypeTxLayer1Signature:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
ZkLinkAddress = str

class _UniffiConverterTypeZkLinkAddress:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)


# Type alias
ZkLinkTx = str

class _UniffiConverterTypeZkLinkTx:
    @staticmethod
    def write(value, buf):
        _UniffiConverterString.write(value, buf)

    @staticmethod
    def read(buf):
        return _UniffiConverterString.read(buf)

    @staticmethod
    def lift(value):
        return _UniffiConverterString.lift(value)

    @staticmethod
    def lower(value):
        return _UniffiConverterString.lower(value)

def create_signed_change_pubkey(zklink_signer: "ZkLinkSigner",tx: "ChangePubKey",eth_auth_data: "ChangePubKeyAuthData") -> "ChangePubKey":
    
    
    
    return _UniffiConverterTypeChangePubKey.lift(_rust_call_with_error(_UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_func_create_signed_change_pubkey,
        _UniffiConverterTypeZkLinkSigner.lower(zklink_signer),
        _UniffiConverterTypeChangePubKey.lower(tx),
        _UniffiConverterTypeChangePubKeyAuthData.lower(eth_auth_data)))


def eth_signature_of_change_pubkey(tx: "ChangePubKey",eth_signer: "EthSigner") -> "PackedEthSignature":
    
    
    return _UniffiConverterTypePackedEthSignature.lift(_rust_call_with_error(_UniffiConverterTypeSignError,_UniffiLib.uniffi_zklink_sdk_fn_func_eth_signature_of_change_pubkey,
        _UniffiConverterTypeChangePubKey.lower(tx),
        _UniffiConverterTypeEthSigner.lower(eth_signer)))


def get_public_key_hash(public_key: "PackedPublicKey") -> "PubKeyHash":
    
    return _UniffiConverterTypePubKeyHash.lift(_rust_call(_UniffiLib.uniffi_zklink_sdk_fn_func_get_public_key_hash,
        _UniffiConverterTypePackedPublicKey.lower(public_key)))


def verify_musig(signature: "ZkLinkSignature",msg: "typing.List[int]") -> "bool":
    
    
    return _UniffiConverterBool.lift(_rust_call(_UniffiLib.uniffi_zklink_sdk_fn_func_verify_musig,
        _UniffiConverterTypeZkLinkSignature.lower(signature),
        _UniffiConverterSequenceUInt8.lower(msg)))


def zklink_main_net_url() -> "str":
    return _UniffiConverterString.lift(_rust_call(_UniffiLib.uniffi_zklink_sdk_fn_func_zklink_main_net_url,))


def zklink_test_net_url() -> "str":
    return _UniffiConverterString.lift(_rust_call(_UniffiLib.uniffi_zklink_sdk_fn_func_zklink_test_net_url,))


__all__ = [
    "InternalError",
    "ChangePubKeyAuthData",
    "ChangePubKeyAuthRequest",
    "EthSignerError",
    "L1SignerType",
    "L1Type",
    "Parameter",
    "SignError",
    "StarkSignerError",
    "TypeError",
    "TypedDataMessage",
    "ZkSignerError",
    "AutoDeleveragingBuilder",
    "ChangePubKeyBuilder",
    "ContractBuilder",
    "ContractMatchingBuilder",
    "ContractPrice",
    "Create2Data",
    "DepositBuilder",
    "ForcedExitBuilder",
    "FullExitBuilder",
    "FundingBuilder",
    "FundingInfo",
    "LiquidationBuilder",
    "Message",
    "OraclePrices",
    "OrderMatchingBuilder",
    "SpotPriceInfo",
    "TransferBuilder",
    "TxMessage",
    "TxSignature",
    "UpdateGlobalVarBuilder",
    "WithdrawBuilder",
    "ZkLinkSignature",
    "create_signed_change_pubkey",
    "eth_signature_of_change_pubkey",
    "get_public_key_hash",
    "verify_musig",
    "zklink_main_net_url",
    "zklink_test_net_url",
    "AutoDeleveraging",
    "ChangePubKey",
    "Contract",
    "ContractMatching",
    "Deposit",
    "EthSigner",
    "ForcedExit",
    "FullExit",
    "Funding",
    "Liquidation",
    "Order",
    "OrderMatching",
    "Signer",
    "StarkSigner",
    "Transfer",
    "TypedData",
    "UpdateGlobalVar",
    "Withdraw",
    "ZkLinkSigner",
]

